diff options
Diffstat (limited to 'devel/android-tools-adb/files')
5 files changed, 173 insertions, 10 deletions
diff --git a/devel/android-tools-adb/files/Makefile b/devel/android-tools-adb/files/Makefile index 52883461eb10..88d30f997211 100644 --- a/devel/android-tools-adb/files/Makefile +++ b/devel/android-tools-adb/files/Makefile @@ -96,6 +96,8 @@ CPPFLAGS+= -DPLATFORM_TOOLS_VERSION="\"${VERSION:U0.0.0}\"" CPPFLAGS+= -DADB_HOST=1 CPPFLAGS+= -Doff64_t=off_t CPPFLAGS+= -Dlseek64=lseek +CPPFLAGS+= -Dpread64=pread +CPPFLAGS+= -Dpwrite64=pwrite CPPFLAGS+= -I${.CURDIR} CPPFLAGS+= -I${.CURDIR}/client CPPFLAGS+= -I${.CURDIR}/../include diff --git a/devel/android-tools-adb/files/extra-patch-revert-d3d650628c8c b/devel/android-tools-adb/files/extra-patch-revert-d3d650628c8c new file mode 100644 index 000000000000..b843ecbe7f4e --- /dev/null +++ b/devel/android-tools-adb/files/extra-patch-revert-d3d650628c8c @@ -0,0 +1,56 @@ +In file included from adb_utils.cpp:19: +adb/adb_utils.h:19:10: fatal error: 'charconv' file not found +#include <charconv> + ^~~~~~~~~~ + +--- adb/adb_utils.h.orig 2019-10-18 00:22:21 UTC ++++ adb/adb_utils.h +@@ -16,7 +16,6 @@ + + #pragma once + +-#include <charconv> + #include <condition_variable> + #include <mutex> + #include <string> +@@ -113,17 +112,33 @@ inline std::string_view StripTrailingNulls(std::string + // Base-10 stroll on a string_view. + template <typename T> + inline bool ParseUint(T* result, std::string_view str, std::string_view* remaining = nullptr) { +- T value; +- const auto res = std::from_chars(str.begin(), str.end(), value); +- if (res.ec != std::errc{}) { ++ if (str.empty() || !isdigit(str[0])) { + return false; + } +- if (res.ptr != str.end() && !remaining) { +- return false; ++ ++ T value = 0; ++ std::string_view::iterator it; ++ constexpr T max = std::numeric_limits<T>::max(); ++ for (it = str.begin(); it != str.end() && isdigit(*it); ++it) { ++ if (value > max / 10) { ++ return false; ++ } ++ ++ value *= 10; ++ ++ T digit = *it - '0'; ++ if (value > max - digit) { ++ return false; ++ } ++ ++ value += digit; + } ++ *result = value; + if (remaining) { +- *remaining = std::string_view(res.ptr, str.end() - res.ptr); ++ *remaining = str.substr(it - str.begin()); ++ } else { ++ return it == str.end(); + } +- *result = value; ++ + return true; + } diff --git a/devel/android-tools-adb/files/patch-adb_client_adb__install.cpp b/devel/android-tools-adb/files/patch-adb_client_adb__install.cpp index 675ec42dba69..5cd17d521128 100644 --- a/devel/android-tools-adb/files/patch-adb_client_adb__install.cpp +++ b/devel/android-tools-adb/files/patch-adb_client_adb__install.cpp @@ -1,11 +1,105 @@ ---- adb/client/adb_install.cpp.orig 2019-08-13 02:10:58 UTC +--- adb/client/adb_install.cpp.orig 2019-10-18 00:22:21 UTC +++ adb/client/adb_install.cpp -@@ -214,7 +214,7 @@ static int install_app_streamed(int argc, const char** - return 1; +@@ -35,9 +35,11 @@ + #include "adb_utils.h" + #include "client/file_sync_client.h" + #include "commandline.h" ++#if defined(ENABLE_FASTDEPLOY) + #include "fastdeploy.h" + + static constexpr int kFastDeployMinApi = 24; ++#endif + + namespace { + +@@ -167,6 +169,7 @@ static int install_app_streamed(int argc, const char** + } + + if (use_fastdeploy) { ++#if defined(ENABLE_FASTDEPLOY) + auto metadata = extract_metadata(file); + if (metadata.has_value()) { + // pass all but 1st (command) and last (apk path) parameters through to pm for +@@ -175,6 +178,9 @@ static int install_app_streamed(int argc, const char** + auto patchFd = install_patch(pm_args.size(), pm_args.data()); + return stream_patch(file, std::move(metadata.value()), std::move(patchFd)); } ++#else ++ error_exit("fastdeploy is disabled"); ++#endif + } + + struct stat sb; +@@ -189,7 +195,7 @@ static int install_app_streamed(int argc, const char** + return 1; + } -#ifdef __linux__ +#if !defined(__APPLE__) && !defined(_WIN32) - posix_fadvise(local_fd.get(), 0, 0, POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE); + posix_fadvise(local_fd.get(), 0, 0, POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE); #endif +@@ -263,6 +269,7 @@ static int install_app_legacy(int argc, const char** a + argv[last_apk] = apk_dest.c_str(); /* destination name, not source location */ + + if (use_fastdeploy) { ++#if defined(ENABLE_FASTDEPLOY) + auto metadata = extract_metadata(apk_file[0]); + if (metadata.has_value()) { + auto patchFd = apply_patch_on_device(apk_dest.c_str()); +@@ -273,6 +280,9 @@ static int install_app_legacy(int argc, const char** a + + return status; + } ++#else ++ error_exit("fastdeploy is disabled"); ++#endif + } + + if (do_sync_push(apk_file, apk_dest.c_str(), false)) { +@@ -288,7 +298,9 @@ int install_app(int argc, const char** argv) { + InstallMode installMode = INSTALL_DEFAULT; + bool use_fastdeploy = false; + bool is_reinstall = false; ++#if defined(ENABLE_FASTDEPLOY) + FastDeploy_AgentUpdateStrategy agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion; ++#endif + + for (int i = 1; i < argc; i++) { + if (!strcmp(argv[i], "--streaming")) { +@@ -309,13 +321,19 @@ int install_app(int argc, const char** argv) { + use_fastdeploy = false; + } else if (!strcmp(argv[i], "--force-agent")) { + processedArgIndicies.push_back(i); ++#if defined(ENABLE_FASTDEPLOY) + agent_update_strategy = FastDeploy_AgentUpdateAlways; ++#endif + } else if (!strcmp(argv[i], "--date-check-agent")) { + processedArgIndicies.push_back(i); ++#if defined(ENABLE_FASTDEPLOY) + agent_update_strategy = FastDeploy_AgentUpdateNewerTimeStamp; ++#endif + } else if (!strcmp(argv[i], "--version-check-agent")) { + processedArgIndicies.push_back(i); ++#if defined(ENABLE_FASTDEPLOY) + agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion; ++#endif + } + } + +@@ -327,6 +345,7 @@ int install_app(int argc, const char** argv) { + error_exit("Attempting to use streaming install on unsupported device"); + } + ++#if defined(ENABLE_FASTDEPLOY) + if (use_fastdeploy && get_device_api_level() < kFastDeployMinApi) { + printf("Fast Deploy is only compatible with devices of API version %d or higher, " + "ignoring.\n", +@@ -334,6 +353,7 @@ int install_app(int argc, const char** argv) { + use_fastdeploy = false; + } + fastdeploy_set_agent_update_strategy(agent_update_strategy); ++#endif + + std::vector<const char*> passthrough_argv; + for (int i = 0; i < argc; i++) { diff --git a/devel/android-tools-adb/files/patch-adb_client_auth.cpp b/devel/android-tools-adb/files/patch-adb_client_auth.cpp index c6bfa634962e..b4dd1e8dabbd 100644 --- a/devel/android-tools-adb/files/patch-adb_client_auth.cpp +++ b/devel/android-tools-adb/files/patch-adb_client_auth.cpp @@ -1,16 +1,17 @@ ---- adb/client/auth.cpp.orig 2019-07-17 19:54:09 UTC +--- adb/client/auth.cpp.orig 2019-10-18 00:22:21 UTC +++ adb/client/auth.cpp -@@ -34,7 +34,9 @@ +@@ -34,7 +34,10 @@ #include <android-base/stringprintf.h> #include <android-base/strings.h> #include <crypto_utils/android_pubkey.h> +#if defined(OPENSSL_IS_BORINGSSL) #include <openssl/base64.h> +#endif ++#include <openssl/err.h> #include <openssl/evp.h> #include <openssl/objects.h> #include <openssl/pem.h> -@@ -52,6 +54,30 @@ static std::mutex& g_keys_mutex = *new std::mutex; +@@ -52,6 +55,30 @@ static std::mutex& g_keys_mutex = *new std::mutex; static std::map<std::string, std::shared_ptr<RSA>>& g_keys = *new std::map<std::string, std::shared_ptr<RSA>>; static std::map<int, std::string>& g_monitored_paths = *new std::map<int, std::string>; diff --git a/devel/android-tools-adb/files/patch-adb_client_commandline.cpp b/devel/android-tools-adb/files/patch-adb_client_commandline.cpp index 7118af6063d0..a572e6aef20a 100644 --- a/devel/android-tools-adb/files/patch-adb_client_commandline.cpp +++ b/devel/android-tools-adb/files/patch-adb_client_commandline.cpp @@ -1,6 +1,16 @@ ---- adb/client/commandline.cpp.orig 2019-07-17 19:54:09 UTC +--- adb/client/commandline.cpp.orig 2019-10-18 00:22:21 UTC +++ adb/client/commandline.cpp -@@ -1016,7 +1016,11 @@ static int ppp(int argc, const char** argv) { +@@ -59,7 +59,9 @@ + #include "bugreport.h" + #include "client/file_sync_client.h" + #include "commandline.h" ++#if defined(ENABLE_FASTDEPLOY) + #include "fastdeploy.h" ++#endif + #include "services.h" + #include "shell_protocol.h" + #include "sysdeps/chrono.h" +@@ -1012,7 +1014,11 @@ static int ppp(int argc, const char** argv) { // copy args const char** ppp_args = (const char**)alloca(sizeof(char*) * argc + 1); @@ -12,7 +22,7 @@ for (i = 2 ; i < argc ; i++) { //argv[2] and beyond become ppp_args[1] and beyond ppp_args[i - 1] = argv[i]; -@@ -1028,8 +1032,13 @@ static int ppp(int argc, const char** argv) { +@@ -1024,8 +1030,13 @@ static int ppp(int argc, const char** argv) { adb_close(STDERR_FILENO); adb_close(fd); |