Lines 1-18
Link Here
|
1 |
--- adb/client/adb_install.cpp.orig 2019-10-18 00:22:21 UTC |
1 |
--- adb/client/adb_install.cpp.orig 2020-04-17 21:40:09 UTC |
2 |
+++ adb/client/adb_install.cpp |
2 |
+++ adb/client/adb_install.cpp |
3 |
@@ -35,9 +35,11 @@ |
3 |
@@ -37,12 +37,16 @@ |
4 |
#include "adb_utils.h" |
4 |
#include "adb_utils.h" |
5 |
#include "client/file_sync_client.h" |
5 |
#include "client/file_sync_client.h" |
6 |
#include "commandline.h" |
6 |
#include "commandline.h" |
7 |
+#if defined(ENABLE_FASTDEPLOY) |
7 |
+#if defined(ENABLE_FASTDEPLOY) |
8 |
#include "fastdeploy.h" |
8 |
#include "fastdeploy.h" |
|
|
9 |
+#endif |
10 |
#include "incremental.h" |
11 |
|
12 |
using namespace std::literals; |
9 |
|
13 |
|
|
|
14 |
+#if defined(ENABLE_FASTDEPLOY) |
10 |
static constexpr int kFastDeployMinApi = 24; |
15 |
static constexpr int kFastDeployMinApi = 24; |
11 |
+#endif |
16 |
+#endif |
12 |
|
17 |
|
13 |
namespace { |
18 |
namespace { |
14 |
|
19 |
|
15 |
@@ -167,6 +169,7 @@ static int install_app_streamed(int argc, const char** |
20 |
@@ -177,6 +181,7 @@ static int install_app_streamed(int argc, const char** |
16 |
} |
21 |
} |
17 |
|
22 |
|
18 |
if (use_fastdeploy) { |
23 |
if (use_fastdeploy) { |
Lines 20-26
Link Here
|
20 |
auto metadata = extract_metadata(file); |
25 |
auto metadata = extract_metadata(file); |
21 |
if (metadata.has_value()) { |
26 |
if (metadata.has_value()) { |
22 |
// pass all but 1st (command) and last (apk path) parameters through to pm for |
27 |
// pass all but 1st (command) and last (apk path) parameters through to pm for |
23 |
@@ -175,6 +178,9 @@ static int install_app_streamed(int argc, const char** |
28 |
@@ -185,6 +190,9 @@ static int install_app_streamed(int argc, const char** |
24 |
auto patchFd = install_patch(pm_args.size(), pm_args.data()); |
29 |
auto patchFd = install_patch(pm_args.size(), pm_args.data()); |
25 |
return stream_patch(file, std::move(metadata.value()), std::move(patchFd)); |
30 |
return stream_patch(file, std::move(metadata.value()), std::move(patchFd)); |
26 |
} |
31 |
} |
Lines 30-36
Link Here
|
30 |
} |
35 |
} |
31 |
|
36 |
|
32 |
struct stat sb; |
37 |
struct stat sb; |
33 |
@@ -189,7 +195,7 @@ static int install_app_streamed(int argc, const char** |
38 |
@@ -199,7 +207,7 @@ static int install_app_streamed(int argc, const char** |
34 |
return 1; |
39 |
return 1; |
35 |
} |
40 |
} |
36 |
|
41 |
|
Lines 39-45
Link Here
|
39 |
posix_fadvise(local_fd.get(), 0, 0, POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE); |
44 |
posix_fadvise(local_fd.get(), 0, 0, POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE); |
40 |
#endif |
45 |
#endif |
41 |
|
46 |
|
42 |
@@ -263,6 +269,7 @@ static int install_app_legacy(int argc, const char** a |
47 |
@@ -277,6 +285,7 @@ static int install_app_legacy(int argc, const char** a |
43 |
argv[last_apk] = apk_dest.c_str(); /* destination name, not source location */ |
48 |
argv[last_apk] = apk_dest.c_str(); /* destination name, not source location */ |
44 |
|
49 |
|
45 |
if (use_fastdeploy) { |
50 |
if (use_fastdeploy) { |
Lines 47-53
Link Here
|
47 |
auto metadata = extract_metadata(apk_file[0]); |
52 |
auto metadata = extract_metadata(apk_file[0]); |
48 |
if (metadata.has_value()) { |
53 |
if (metadata.has_value()) { |
49 |
auto patchFd = apply_patch_on_device(apk_dest.c_str()); |
54 |
auto patchFd = apply_patch_on_device(apk_dest.c_str()); |
50 |
@@ -273,6 +280,9 @@ static int install_app_legacy(int argc, const char** a |
55 |
@@ -287,6 +296,9 @@ static int install_app_legacy(int argc, const char** a |
51 |
|
56 |
|
52 |
return status; |
57 |
return status; |
53 |
} |
58 |
} |
Lines 56-101
Link Here
|
56 |
+#endif |
61 |
+#endif |
57 |
} |
62 |
} |
58 |
|
63 |
|
59 |
if (do_sync_push(apk_file, apk_dest.c_str(), false)) { |
64 |
if (do_sync_push(apk_file, apk_dest.c_str(), false, CompressionType::Any, false)) { |
60 |
@@ -288,7 +298,9 @@ int install_app(int argc, const char** argv) { |
65 |
@@ -431,7 +443,9 @@ int install_app(int argc, const char** argv) { |
61 |
InstallMode installMode = INSTALL_DEFAULT; |
|
|
62 |
bool use_fastdeploy = false; |
63 |
bool is_reinstall = false; |
66 |
bool is_reinstall = false; |
|
|
67 |
bool wait = false; |
68 |
auto incremental_request = CmdlineOption::None; |
64 |
+#if defined(ENABLE_FASTDEPLOY) |
69 |
+#if defined(ENABLE_FASTDEPLOY) |
65 |
FastDeploy_AgentUpdateStrategy agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion; |
70 |
FastDeploy_AgentUpdateStrategy agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion; |
66 |
+#endif |
71 |
+#endif |
67 |
|
72 |
|
68 |
for (int i = 1; i < argc; i++) { |
73 |
for (int i = 1; i < argc; i++) { |
69 |
if (!strcmp(argv[i], "--streaming")) { |
74 |
if (argv[i] == "--streaming"sv) { |
70 |
@@ -309,13 +321,19 @@ int install_app(int argc, const char** argv) { |
75 |
@@ -452,13 +466,19 @@ int install_app(int argc, const char** argv) { |
71 |
use_fastdeploy = false; |
76 |
use_fastdeploy = false; |
72 |
} else if (!strcmp(argv[i], "--force-agent")) { |
77 |
} else if (argv[i] == "--force-agent"sv) { |
73 |
processedArgIndicies.push_back(i); |
78 |
processedArgIndices.push_back(i); |
74 |
+#if defined(ENABLE_FASTDEPLOY) |
79 |
+#if defined(ENABLE_FASTDEPLOY) |
75 |
agent_update_strategy = FastDeploy_AgentUpdateAlways; |
80 |
agent_update_strategy = FastDeploy_AgentUpdateAlways; |
76 |
+#endif |
81 |
+#endif |
77 |
} else if (!strcmp(argv[i], "--date-check-agent")) { |
82 |
} else if (argv[i] == "--date-check-agent"sv) { |
78 |
processedArgIndicies.push_back(i); |
83 |
processedArgIndices.push_back(i); |
79 |
+#if defined(ENABLE_FASTDEPLOY) |
84 |
+#if defined(ENABLE_FASTDEPLOY) |
80 |
agent_update_strategy = FastDeploy_AgentUpdateNewerTimeStamp; |
85 |
agent_update_strategy = FastDeploy_AgentUpdateNewerTimeStamp; |
81 |
+#endif |
86 |
+#endif |
82 |
} else if (!strcmp(argv[i], "--version-check-agent")) { |
87 |
} else if (argv[i] == "--version-check-agent"sv) { |
83 |
processedArgIndicies.push_back(i); |
88 |
processedArgIndices.push_back(i); |
84 |
+#if defined(ENABLE_FASTDEPLOY) |
89 |
+#if defined(ENABLE_FASTDEPLOY) |
85 |
agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion; |
90 |
agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion; |
86 |
+#endif |
91 |
+#endif |
87 |
} |
92 |
} else if (strlen(argv[i]) >= "--incr"sv.size() && "--incremental"sv.starts_with(argv[i])) { |
88 |
} |
93 |
processedArgIndices.push_back(i); |
89 |
|
94 |
incremental_request = CmdlineOption::Enable; |
90 |
@@ -327,6 +345,7 @@ int install_app(int argc, const char** argv) { |
95 |
@@ -479,6 +499,7 @@ int install_app(int argc, const char** argv) { |
91 |
error_exit("Attempting to use streaming install on unsupported device"); |
96 |
error_exit("Attempting to use streaming install on unsupported device"); |
92 |
} |
97 |
} |
93 |
|
98 |
|
94 |
+#if defined(ENABLE_FASTDEPLOY) |
99 |
+#if defined(ENABLE_FASTDEPLOY) |
95 |
if (use_fastdeploy && get_device_api_level() < kFastDeployMinApi) { |
100 |
if (use_fastdeploy && get_device_api_level() < kFastDeployMinApi) { |
96 |
printf("Fast Deploy is only compatible with devices of API version %d or higher, " |
101 |
fprintf(stderr, |
97 |
"ignoring.\n", |
102 |
"Fast Deploy is only compatible with devices of API version %d or higher, " |
98 |
@@ -334,6 +353,7 @@ int install_app(int argc, const char** argv) { |
103 |
@@ -487,6 +508,7 @@ int install_app(int argc, const char** argv) { |
99 |
use_fastdeploy = false; |
104 |
use_fastdeploy = false; |
100 |
} |
105 |
} |
101 |
fastdeploy_set_agent_update_strategy(agent_update_strategy); |
106 |
fastdeploy_set_agent_update_strategy(agent_update_strategy); |