diff options
author | Henry Daitx <daitx@google.com> | 2018-12-12 10:40:57 +0000 |
---|---|---|
committer | Henry Daitx <daitx@google.com> | 2018-12-14 15:25:15 +0000 |
commit | ee01c80afe54ece71e2da5eb86de1e7c655488f6 (patch) | |
tree | dc9fa7fd784815ddfb2d1af9d517910c098cc86b /adb/client/fastdeploy.cpp | |
parent | 73d03dc8047edd1b3a39ebff6770826deec6c956 (diff) |
Change --fastdeploy behaviour
--fastdeploy does not require -r anymore, and reverts to a normal install
if the application is not already on the device.
Bug: 120828611
Test: mm -j72
Test: adb install --fastdeploy --force-agent --local-agent /mnt/raid/boat-attack-apk/boat-attack-swappy.apk
Change-Id: Ice2a71493a34ee7d0debabcce6a9aebb0af79e62
Diffstat (limited to 'adb/client/fastdeploy.cpp')
-rw-r--r-- | adb/client/fastdeploy.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/adb/client/fastdeploy.cpp b/adb/client/fastdeploy.cpp index e82f15a7d..f4e8664a8 100644 --- a/adb/client/fastdeploy.cpp +++ b/adb/client/fastdeploy.cpp @@ -16,6 +16,7 @@ #include "fastdeploy.h" +#include <string.h> #include <algorithm> #include <array> #include <memory> @@ -31,7 +32,7 @@ #include "adb_utils.h" -static constexpr long kRequiredAgentVersion = 0x00000001; +static constexpr long kRequiredAgentVersion = 0x00000002; static constexpr const char* kDeviceAgentPath = "/data/local/tmp/"; @@ -313,9 +314,16 @@ void install_patch(const char* apkPath, const char* patchPath, int argc, const c std::vector<unsigned char> applyErrorBuffer; std::string argsString; + bool rSwitchPresent = false; for (int i = 0; i < argc; i++) { argsString.append(argv[i]); argsString.append(" "); + if (!strcmp(argv[i], "-r")) { + rSwitchPresent = true; + } + } + if (!rSwitchPresent) { + argsString.append("-r"); } std::string applyPatchCommand = @@ -326,3 +334,9 @@ void install_patch(const char* apkPath, const char* patchPath, int argc, const c error_exit("Executing %s returned %d", applyPatchCommand.c_str(), returnCode); } } + +bool find_package(const char* apkPath) { + const std::string findCommand = + "/data/local/tmp/deployagent find " + get_packagename_from_apk(apkPath); + return !send_shell_command(findCommand); +} |