Modified fastdeploy dependencies to ensure that fast deploy is build as part of 'sdk' target
deploypatchgenerator is now a dependency of adb
deployagent is now a java_binary target and uses the built in 'wrapper' parameter to bundle deployagent.sh
fastdeploy.cpp code in adb modified to reference deployagent rather than deployagent.sh (required to work with built in wrapper functionality).
removed near-redundant fastdeploy_init and TFastDeployConfig singleton as per:
https://android-review.googlesource.com/c/platform/system/core/+/740521/12/adb/client/fastdeploy.cpp#36
relocated kFastDeployMinApi to more appropriate location
Test: rm -rf $ANDROID_ROOT/out
Test: make sdk -j40
Test: find out/ -iname deploypatchgenerator
Test: observe that deploypatchgenerator.jar has been built as a dependency of the sdk target
Test: mm
Test: adb install -r -f --force-agent --local-agent ~/example_apks/example.apk
Test: adb install -r -f --no-streaming --force-agent --local-agent ~/example_apks/example.apk
Change-Id: I4e52d32f87774b44845bf6b5be0bae331a0b2324
diff --git a/adb/client/fastdeploy.cpp b/adb/client/fastdeploy.cpp
index c0d793c..2914836 100644
--- a/adb/client/fastdeploy.cpp
+++ b/adb/client/fastdeploy.cpp
@@ -30,20 +30,13 @@
static constexpr const char* kDeviceAgentPath = "/data/local/tmp/";
-struct TFastDeployConfig {
- bool use_localagent;
-};
-
-static TFastDeployConfig& get_fastdeploy_config() {
- TFastDeployConfig& instance = *new TFastDeployConfig;
- return instance;
-}
+static bool use_localagent = false;
long get_agent_version() {
std::vector<char> versionOutputBuffer;
std::vector<char> versionErrorBuffer;
- int statusCode = capture_shell_command("/data/local/tmp/deployagent.sh version",
+ int statusCode = capture_shell_command("/data/local/tmp/deployagent version",
&versionOutputBuffer, &versionErrorBuffer);
long version = -1;
@@ -68,8 +61,8 @@
return api_level;
}
-void fastdeploy_init(bool use_localagent) {
- get_fastdeploy_config().use_localagent = use_localagent;
+void fastdeploy_set_local_agent(bool set_use_localagent) {
+ use_localagent = set_use_localagent;
}
// local_path - must start with a '/' and be relative to $ANDROID_PRODUCT_OUT
@@ -80,7 +73,7 @@
return false;
}
- if (get_fastdeploy_config().use_localagent) {
+ if (use_localagent) {
const char* product_out = getenv("ANDROID_PRODUCT_OUT");
if (product_out == nullptr) {
return false;
@@ -105,8 +98,7 @@
}
std::string agent_sh_path;
- if (get_agent_component_host_path("/system/bin/deployagent.sh", "/deployagent.sh",
- &agent_sh_path)) {
+ if (get_agent_component_host_path("/system/bin/deployagent", "/deployagent", &agent_sh_path)) {
srcs.push_back(agent_sh_path.c_str());
} else {
return false;
@@ -115,7 +107,7 @@
if (do_sync_push(srcs, kDeviceAgentPath, checkTimeStamps)) {
// on windows the shell script might have lost execute permission
// so need to set this explicitly
- const char* kChmodCommandPattern = "chmod 777 %sdeployagent.sh";
+ const char* kChmodCommandPattern = "chmod 777 %sdeployagent";
std::string chmodCommand =
android::base::StringPrintf(kChmodCommandPattern, kDeviceAgentPath);
int ret = send_shell_command(chmodCommand);
@@ -158,7 +150,7 @@
}
static std::string get_aapt2_path() {
- if (get_fastdeploy_config().use_localagent) {
+ if (use_localagent) {
// This should never happen on a Windows machine
const char* host_out = getenv("ANDROID_HOST_OUT");
if (host_out == nullptr) {
@@ -214,7 +206,7 @@
return -1;
}
- const char* kAgentExtractCommandPattern = "/data/local/tmp/deployagent.sh extract %s";
+ const char* kAgentExtractCommandPattern = "/data/local/tmp/deployagent extract %s";
std::string extractCommand =
android::base::StringPrintf(kAgentExtractCommandPattern, packageName.c_str());
@@ -231,7 +223,7 @@
}
static std::string get_patch_generator_command() {
- if (get_fastdeploy_config().use_localagent) {
+ if (use_localagent) {
// This should never happen on a Windows machine
const char* host_out = getenv("ANDROID_HOST_OUT");
if (host_out == nullptr) {
@@ -269,8 +261,7 @@
}
int apply_patch_on_device(const char* apkPath, const char* patchPath, const char* outputPath) {
- const std::string kAgentApplyCommandPattern =
- "/data/local/tmp/deployagent.sh apply %s %s -o %s";
+ const std::string kAgentApplyCommandPattern = "/data/local/tmp/deployagent apply %s %s -o %s";
std::string packageName;
if (get_packagename_from_apk(apkPath, &packageName) == false) {
@@ -294,8 +285,7 @@
}
int install_patch(const char* apkPath, const char* patchPath, int argc, const char** argv) {
- const std::string kAgentApplyCommandPattern =
- "/data/local/tmp/deployagent.sh apply %s %s -pm %s";
+ const std::string kAgentApplyCommandPattern = "/data/local/tmp/deployagent apply %s %s -pm %s";
std::string packageName;
if (get_packagename_from_apk(apkPath, &packageName) == false) {