From 8160bf94e462ba7c5ac3b5edc6059353ffbe9d30 Mon Sep 17 00:00:00 2001 From: Ian Hu Date: Fri, 29 Oct 2021 19:19:54 +0800 Subject: [PATCH] android-tools: split fix-ndk.patch to small patch per changed file. --- packages/android-tools/fix-ndk.patch | 638 ------------------ .../vendor_CMakeLists.adb.txt.patch | 12 + .../vendor_CMakeLists.fastboot.txt.patch | 10 + .../vendor_CMakeLists.mke2fs.txt.patch | 12 + ...h_include_adb_pairing_pairing_auth.h.patch | 93 +++ ...ude_adb_pairing_pairing_connection.h.patch | 39 ++ ...include_adb_pairing_pairing_server.h.patch | 46 ++ .../android-tools/vendor_adb_sysdeps.h.patch | 17 + ...ase_libs_androidfw_ResourceTypes.cpp.patch | 13 + ...ndor_boringssl_crypto_CMakeLists.txt.patch | 13 + ...vendor_core_fs_mgr_liblp_utility.cpp.patch | 22 + .../vendor_core_init_reboot.cpp.patch | 13 + ...vendor_core_libcutils_properties.cpp.patch | 13 + ...dor_e2fsprogs_lib_ext2fs_ismounted.c.patch | 13 + .../vendor_f2fs-tools_lib_libf2fs.c.patch | 13 + ...ry_incfs_util_include_util_map_ptr.h.patch | 12 + ...ase_include_android-base_unique_fd.h.patch | 22 + .../vendor_libbase_logging.cpp.patch | 23 + .../vendor_libbase_properties.cpp.patch | 53 ++ .../vendor_libziparchive_zip_archive.cc.patch | 42 ++ ...logging_liblog_include_android_log.h.patch | 112 +++ ...ndor_logging_liblog_logger_write.cpp.patch | 45 ++ 22 files changed, 638 insertions(+), 638 deletions(-) delete mode 100644 packages/android-tools/fix-ndk.patch create mode 100644 packages/android-tools/vendor_CMakeLists.adb.txt.patch create mode 100644 packages/android-tools/vendor_CMakeLists.fastboot.txt.patch create mode 100644 packages/android-tools/vendor_CMakeLists.mke2fs.txt.patch create mode 100644 packages/android-tools/vendor_adb_pairing_auth_include_adb_pairing_pairing_auth.h.patch create mode 100644 packages/android-tools/vendor_adb_pairing_connection_include_adb_pairing_pairing_connection.h.patch create mode 100644 packages/android-tools/vendor_adb_pairing_connection_include_adb_pairing_pairing_server.h.patch create mode 100644 packages/android-tools/vendor_adb_sysdeps.h.patch create mode 100644 packages/android-tools/vendor_base_libs_androidfw_ResourceTypes.cpp.patch create mode 100644 packages/android-tools/vendor_boringssl_crypto_CMakeLists.txt.patch create mode 100644 packages/android-tools/vendor_core_fs_mgr_liblp_utility.cpp.patch create mode 100644 packages/android-tools/vendor_core_init_reboot.cpp.patch create mode 100644 packages/android-tools/vendor_core_libcutils_properties.cpp.patch create mode 100644 packages/android-tools/vendor_e2fsprogs_lib_ext2fs_ismounted.c.patch create mode 100644 packages/android-tools/vendor_f2fs-tools_lib_libf2fs.c.patch create mode 100644 packages/android-tools/vendor_incremental_delivery_incfs_util_include_util_map_ptr.h.patch create mode 100644 packages/android-tools/vendor_libbase_include_android-base_unique_fd.h.patch create mode 100644 packages/android-tools/vendor_libbase_logging.cpp.patch create mode 100644 packages/android-tools/vendor_libbase_properties.cpp.patch create mode 100644 packages/android-tools/vendor_libziparchive_zip_archive.cc.patch create mode 100644 packages/android-tools/vendor_logging_liblog_include_android_log.h.patch create mode 100644 packages/android-tools/vendor_logging_liblog_logger_write.cpp.patch diff --git a/packages/android-tools/fix-ndk.patch b/packages/android-tools/fix-ndk.patch deleted file mode 100644 index db71df2a6..000000000 --- a/packages/android-tools/fix-ndk.patch +++ /dev/null @@ -1,638 +0,0 @@ -diff --git a/vendor/CMakeLists.adb.txt b/vendor/CMakeLists.adb.txt -index 2b6d8f0..ee55949 100644 ---- a/vendor/CMakeLists.adb.txt -+++ b/vendor/CMakeLists.adb.txt -@@ -192,7 +192,6 @@ target_link_libraries(adb - brotlidec - brotlienc - lz4 -- pthread - usb-1.0 - z - zstd) -diff --git a/vendor/CMakeLists.fastboot.txt b/vendor/CMakeLists.fastboot.txt -index 1d43937..189d91b 100644 ---- a/vendor/CMakeLists.fastboot.txt -+++ b/vendor/CMakeLists.fastboot.txt -@@ -135,4 +135,4 @@ target_compile_definitions(fastboot PRIVATE - target_link_libraries(fastboot - libsparse libzip libcutils liblog libfsmgr libutil - libbase libext4 libselinux libsepol libdiagnoseusb crypto -- z pcre2-8 pthread dl) -+ z pcre2-8 dl) -diff --git a/vendor/CMakeLists.mke2fs.txt b/vendor/CMakeLists.mke2fs.txt -index a8f89fd..d1cae40 100644 ---- a/vendor/CMakeLists.mke2fs.txt -+++ b/vendor/CMakeLists.mke2fs.txt -@@ -112,6 +112,6 @@ add_executable("${ANDROID_MKE2FS_NAME}" - e2fsprogs/misc/util.c) - - target_link_libraries("${ANDROID_MKE2FS_NAME}" -- libext2fs libsparse libbase libzip liblog libutil pthread z) -+ libext2fs libsparse libbase libzip liblog libutil z) - target_include_directories("${ANDROID_MKE2FS_NAME}" PRIVATE - e2fsprogs/lib) -diff --git a/vendor/adb/pairing_auth/include/adb/pairing/pairing_auth.h b/vendor/adb/pairing_auth/include/adb/pairing/pairing_auth.h -index 83f40a9..9804b76 100644 ---- a/vendor/adb/pairing_auth/include/adb/pairing/pairing_auth.h -+++ b/vendor/adb/pairing_auth/include/adb/pairing/pairing_auth.h -@@ -53,7 +53,7 @@ typedef struct PairingAuthCtx PairingAuthCtx; - * @return a new PairingAuthCtx server instance. Caller is responsible for - * destroying the context via #pairing_auth_destroy. - */ --PairingAuthCtx* pairing_auth_server_new(const uint8_t* pswd, size_t len) __INTRODUCED_IN(30); -+PairingAuthCtx* pairing_auth_server_new(const uint8_t* pswd, size_t len) __INTRODUCED_IN(24); - - /** - * Creates a new PairingAuthCtx instance as the client. -@@ -64,14 +64,14 @@ PairingAuthCtx* pairing_auth_server_new(const uint8_t* pswd, size_t len) __INTRO - * @return a new PairingAuthCtx client instance. Caller is responsible for - * destroying the context via #pairing_auth_destroy. - */ --PairingAuthCtx* pairing_auth_client_new(const uint8_t* pswd, size_t len) __INTRODUCED_IN(30); -+PairingAuthCtx* pairing_auth_client_new(const uint8_t* pswd, size_t len) __INTRODUCED_IN(24); - - /** - * Destroys the PairingAuthCtx. - * - * @param ctx the PairingAuthCtx instance to destroy. Will abort if null. - */ --void pairing_auth_destroy(PairingAuthCtx* ctx) __INTRODUCED_IN(30); -+void pairing_auth_destroy(PairingAuthCtx* ctx) __INTRODUCED_IN(24); - - /** - * Returns the exact size of the SPAKE2 msg. -@@ -82,7 +82,7 @@ void pairing_auth_destroy(PairingAuthCtx* ctx) __INTRODUCED_IN(30); - * @param ctx the PairingAuthCtx instance. Will abort if null. - * @return the size of the SPAKE2 message in bytes. This is guaranteed to be > 0. - */ --size_t pairing_auth_msg_size(PairingAuthCtx* ctx) __INTRODUCED_IN(30); -+size_t pairing_auth_msg_size(PairingAuthCtx* ctx) __INTRODUCED_IN(24); - - /** - * Writes the SPAKE2 message to exchange with the other party to |out_buf|. -@@ -96,7 +96,7 @@ size_t pairing_auth_msg_size(PairingAuthCtx* ctx) __INTRODUCED_IN(30); - * be have at least #pairing_auth_msg_size size. Will abort if - * out_buf is null. - */ --void pairing_auth_get_spake2_msg(PairingAuthCtx* ctx, uint8_t* out_buf) __INTRODUCED_IN(30); -+void pairing_auth_get_spake2_msg(PairingAuthCtx* ctx, uint8_t* out_buf) __INTRODUCED_IN(24); - - /** - * Processes the peer's |their_msg| and attempts to initialize the cipher for -@@ -117,7 +117,7 @@ void pairing_auth_get_spake2_msg(PairingAuthCtx* ctx, uint8_t* out_buf) __INTROD - * for more details on the SPAKE2 protocol. - */ - bool pairing_auth_init_cipher(PairingAuthCtx* ctx, const uint8_t* their_msg, size_t msg_len) -- __INTRODUCED_IN(30); -+ __INTRODUCED_IN(24); - - /** - * Returns a safe buffer size for encrypting data of a certain size. -@@ -130,7 +130,7 @@ bool pairing_auth_init_cipher(PairingAuthCtx* ctx, const uint8_t* their_msg, siz - * @return the minimum buffer size, in bytes, to hold an encrypted message of size len. See - * #pairing_auth_encrypt for usage. - */ --size_t pairing_auth_safe_encrypted_size(PairingAuthCtx* ctx, size_t len) __INTRODUCED_IN(30); -+size_t pairing_auth_safe_encrypted_size(PairingAuthCtx* ctx, size_t len) __INTRODUCED_IN(24); - - /** - * Encrypts input data and writes the encrypted data into a user-provided buffer. -@@ -147,7 +147,7 @@ size_t pairing_auth_safe_encrypted_size(PairingAuthCtx* ctx, size_t len) __INTRO - * otherwise. - */ - bool pairing_auth_encrypt(PairingAuthCtx* ctx, const uint8_t* inbuf, size_t inlen, uint8_t* outbuf, -- size_t* outlen) __INTRODUCED_IN(30); -+ size_t* outlen) __INTRODUCED_IN(24); - - /** - * Returns a safe buffer size for decrypting data of a certain size. -@@ -162,7 +162,7 @@ bool pairing_auth_encrypt(PairingAuthCtx* ctx, const uint8_t* inbuf, size_t inle - * #pairing_auth_decrypt for usage. - */ - size_t pairing_auth_safe_decrypted_size(PairingAuthCtx* ctx, const uint8_t* buf, size_t len) -- __INTRODUCED_IN(30); -+ __INTRODUCED_IN(24); - - /** - * Decrypts input data and writes the decrypted data into a user-provided buffer. -@@ -180,7 +180,7 @@ size_t pairing_auth_safe_decrypted_size(PairingAuthCtx* ctx, const uint8_t* buf, - * otherwise. - */ - bool pairing_auth_decrypt(PairingAuthCtx* ctx, const uint8_t* inbuf, size_t inlen, uint8_t* outbuf, -- size_t* outlen) __INTRODUCED_IN(30); -+ size_t* outlen) __INTRODUCED_IN(24); - - #ifdef __cplusplus - } -diff --git a/vendor/adb/pairing_connection/include/adb/pairing/pairing_connection.h b/vendor/adb/pairing_connection/include/adb/pairing/pairing_connection.h -index 8e63db7..f158015 100644 ---- a/vendor/adb/pairing_connection/include/adb/pairing/pairing_connection.h -+++ b/vendor/adb/pairing_connection/include/adb/pairing/pairing_connection.h -@@ -79,7 +79,7 @@ typedef void (*pairing_result_cb)(const PeerInfo*, int, void*); - // invoked. Otherwise, cb is guaranteed to be invoked, even if you - // destroy the ctx while in the pairing process. - bool pairing_connection_start(PairingConnectionCtx* ctx, int fd, pairing_result_cb cb, void* opaque) -- __INTRODUCED_IN(30); -+ __INTRODUCED_IN(24); - - // Creates a new PairingConnectionCtx instance as the client. - // -@@ -98,7 +98,7 @@ PairingConnectionCtx* pairing_connection_client_new(const uint8_t* pswd, size_t - const PeerInfo* peer_info, - const uint8_t* x509_cert_pem, size_t x509_size, - const uint8_t* priv_key_pem, size_t priv_size) -- __INTRODUCED_IN(30); -+ __INTRODUCED_IN(24); - - // Creates a new PairingConnectionCtx instance as the server. - // -@@ -117,14 +117,14 @@ PairingConnectionCtx* pairing_connection_server_new(const uint8_t* pswd, size_t - const PeerInfo* peer_info, - const uint8_t* x509_cert_pem, size_t x509_size, - const uint8_t* priv_key_pem, size_t priv_size) -- __INTRODUCED_IN(30); -+ __INTRODUCED_IN(24); - - // Destroys the PairingConnectionCtx instance. - // - // It is safe to destroy the instance at any point in the pairing process. - // - // @param ctx the PairingConnectionCtx instance to destroy. Will abort if null. --void pairing_connection_destroy(PairingConnectionCtx* ctx) __INTRODUCED_IN(30); -+void pairing_connection_destroy(PairingConnectionCtx* ctx) __INTRODUCED_IN(24); - - #ifdef __cplusplus - } -diff --git a/vendor/adb/pairing_connection/include/adb/pairing/pairing_server.h b/vendor/adb/pairing_connection/include/adb/pairing/pairing_server.h -index babff94..93dcf9a 100644 ---- a/vendor/adb/pairing_connection/include/adb/pairing/pairing_server.h -+++ b/vendor/adb/pairing_connection/include/adb/pairing/pairing_server.h -@@ -45,7 +45,7 @@ typedef struct PairingServerCtx PairingServerCtx; - // Callback containing the result of the pairing. If #PeerInfo is null, - // then the pairing failed. Otherwise, pairing succeeded and #PeerInfo - // contains information about the peer. --typedef void (*pairing_server_result_cb)(const PeerInfo*, void*) __INTRODUCED_IN(30); -+typedef void (*pairing_server_result_cb)(const PeerInfo*, void*) __INTRODUCED_IN(24); - - // Starts the pairing server. - // -@@ -61,7 +61,7 @@ typedef void (*pairing_server_result_cb)(const PeerInfo*, void*) __INTRODUCED_IN - // @param opaque the opaque userdata. - // @return the port number the server is listening on. Returns 0 on failure. - uint16_t pairing_server_start(PairingServerCtx* ctx, pairing_server_result_cb cb, void* opaque) -- __INTRODUCED_IN(30); -+ __INTRODUCED_IN(24); - - // Creates a new PairingServerCtx instance. - // -@@ -83,7 +83,7 @@ uint16_t pairing_server_start(PairingServerCtx* ctx, pairing_server_result_cb cb - PairingServerCtx* pairing_server_new(const uint8_t* pswd, size_t pswd_len, - const PeerInfo* peer_info, const uint8_t* x509_cert_pem, - size_t x509_size, const uint8_t* priv_key_pem, -- size_t priv_size, uint16_t port) __INTRODUCED_IN(30); -+ size_t priv_size, uint16_t port) __INTRODUCED_IN(24); - - // Same as #pairing_server_new, except that the x509 certificate and private key - // is generated internally. -@@ -100,12 +100,12 @@ PairingServerCtx* pairing_server_new(const uint8_t* pswd, size_t pswd_len, - // for destroying the context via #pairing_server_destroy. - PairingServerCtx* pairing_server_new_no_cert(const uint8_t* pswd, size_t pswd_len, - const PeerInfo* peer_info, uint16_t port) -- __INTRODUCED_IN(30); -+ __INTRODUCED_IN(24); - - // Destroys the PairingServerCtx instance. - // - // @param ctx the PairingServerCtx instance to destroy. --void pairing_server_destroy(PairingServerCtx* ctx) __INTRODUCED_IN(30); -+void pairing_server_destroy(PairingServerCtx* ctx) __INTRODUCED_IN(24); - - #ifdef __cplusplus - } -diff --git a/vendor/adb/sysdeps.h b/vendor/adb/sysdeps.h -index 316afe7..8d5da69 100644 ---- a/vendor/adb/sysdeps.h -+++ b/vendor/adb/sysdeps.h -@@ -514,7 +514,11 @@ static inline int adb_gethostname(char* name, size_t len) { - } - - static inline int adb_getlogin_r(char* buf, size_t bufsize) { -- return getlogin_r(buf, bufsize); -+ char* logname = getlogin(); -+ if (!logname) return ENXIO; -+ if (strlen(logname) >= bufsize) return ERANGE; -+ strcpy(buf, logname); -+ return 0; - } - - static inline int adb_read(borrowed_fd fd, void* buf, size_t len) { -diff --git a/vendor/base/libs/androidfw/ResourceTypes.cpp b/vendor/base/libs/androidfw/ResourceTypes.cpp -index 2233827..bc5e9e2 100644 ---- a/vendor/base/libs/androidfw/ResourceTypes.cpp -+++ b/vendor/base/libs/androidfw/ResourceTypes.cpp -@@ -42,7 +42,7 @@ - #include - #include - --#ifdef __ANDROID__ -+#if 0 - #include - #endif - -diff --git a/vendor/boringssl/crypto/CMakeLists.txt b/vendor/boringssl/crypto/CMakeLists.txt -index cde92b5..e25871c 100644 ---- a/vendor/boringssl/crypto/CMakeLists.txt -+++ b/vendor/boringssl/crypto/CMakeLists.txt -@@ -167,7 +167,7 @@ perlasm(test/trampoline-x86_64.${ASM_EXT} test/asm/trampoline-x86_64.pl) - - add_custom_command( - OUTPUT err_data.c -- COMMAND ${GO_EXECUTABLE} run err_data_generate.go > ${CMAKE_CURRENT_BINARY_DIR}/err_data.c -+ COMMAND GOOS=linux GOARCH=amd64 ${GO_EXECUTABLE} run err_data_generate.go > ${CMAKE_CURRENT_BINARY_DIR}/err_data.c - DEPENDS - err/err_data_generate.go - err/asn1.errordata -diff --git a/vendor/core/fs_mgr/liblp/utility.cpp b/vendor/core/fs_mgr/liblp/utility.cpp -index d8e171b..31b34a5 100644 ---- a/vendor/core/fs_mgr/liblp/utility.cpp -+++ b/vendor/core/fs_mgr/liblp/utility.cpp -@@ -34,7 +34,7 @@ - #include - #include - --#ifdef __ANDROID__ -+#if 0 - #include - #endif - -@@ -208,7 +208,7 @@ bool SetBlockReadonly(int fd, bool readonly) { - } - - base::unique_fd GetControlFileOrOpen(std::string_view path, int flags) { --#if defined(__ANDROID__) -+#if 0 - int fd = android_get_control_file(path.data()); - if (fd >= 0) { - int newfd = TEMP_FAILURE_RETRY(dup(fd)); -diff --git a/vendor/core/init/reboot.cpp b/vendor/core/init/reboot.cpp -index 464746d..dadf811 100644 ---- a/vendor/core/init/reboot.cpp -+++ b/vendor/core/init/reboot.cpp -@@ -246,7 +246,7 @@ static bool FindPartitionsToUmount(std::vector* block_dev_partitions - if (dump) { - LOG(INFO) << "mount entry " << mentry->mnt_fsname << ":" << mentry->mnt_dir << " opts " - << mentry->mnt_opts << " type " << mentry->mnt_type; -- } else if (MountEntry::IsBlockDevice(*mentry) && hasmntopt(mentry, "rw")) { -+ } else if (MountEntry::IsBlockDevice(*mentry) && 0) { - std::string mount_dir(mentry->mnt_dir); - // These are R/O partitions changed to R/W after adb remount. - // Do not umount them as shutdown critical services may rely on them. -diff --git a/vendor/core/libcutils/properties.cpp b/vendor/core/libcutils/properties.cpp -index 03f0496..11c4786 100644 ---- a/vendor/core/libcutils/properties.cpp -+++ b/vendor/core/libcutils/properties.cpp -@@ -91,7 +91,7 @@ int property_get(const char* key, char* value, const char* default_value) { - return len; - } - --#if __has_include() -+#if 0 - - #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ - #include -diff --git a/vendor/e2fsprogs/lib/ext2fs/ismounted.c b/vendor/e2fsprogs/lib/ext2fs/ismounted.c -index 6cd497d..dcdd4fd 100644 ---- a/vendor/e2fsprogs/lib/ext2fs/ismounted.c -+++ b/vendor/e2fsprogs/lib/ext2fs/ismounted.c -@@ -196,7 +196,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, - #endif /* __GNU__ */ - *mount_flags = EXT2_MF_MOUNTED; - --#ifdef MNTOPT_RO -+#if 0 - /* Check to see if the ro option is set */ - if (hasmntopt(mnt, MNTOPT_RO)) - *mount_flags |= EXT2_MF_READONLY; -diff --git a/vendor/f2fs-tools/lib/libf2fs.c b/vendor/f2fs-tools/lib/libf2fs.c -index 55fa391..cf2716c 100644 ---- a/vendor/f2fs-tools/lib/libf2fs.c -+++ b/vendor/f2fs-tools/lib/libf2fs.c -@@ -714,7 +714,7 @@ static int is_mounted(const char *mpt, const char *device) - - while ((mnt = getmntent(file)) != NULL) { - if (!strcmp(device, mnt->mnt_fsname)) { --#ifdef MNTOPT_RO -+#if 0 - if (hasmntopt(mnt, MNTOPT_RO)) - c.ro = 1; - #endif -diff --git a/vendor/incremental_delivery/incfs/util/include/util/map_ptr.h b/vendor/incremental_delivery/incfs/util/include/util/map_ptr.h -index 6fd38ee..bb62fd4 100644 ---- a/vendor/incremental_delivery/incfs/util/include/util/map_ptr.h -+++ b/vendor/incremental_delivery/incfs/util/include/util/map_ptr.h -@@ -23,6 +23,7 @@ - #include - #include - -+#undef __ANDROID__ - #ifdef __ANDROID__ - #include - #endif -diff --git a/vendor/libbase/include/android-base/unique_fd.h b/vendor/libbase/include/android-base/unique_fd.h -index 9ceb5db..bf6f5cc 100644 ---- a/vendor/libbase/include/android-base/unique_fd.h -+++ b/vendor/libbase/include/android-base/unique_fd.h -@@ -46,7 +46,7 @@ - // unique_fd is also known as ScopedFd/ScopedFD/scoped_fd; mentioned here to help - // you find this class if you're searching for one of those names. - --#if defined(__BIONIC__) -+#if 0 - #include - #endif - -@@ -54,7 +54,7 @@ namespace android { - namespace base { - - struct DefaultCloser { --#if defined(__BIONIC__) -+#if 0 - static void Tag(int fd, void* old_addr, void* new_addr) { - if (android_fdsan_exchange_owner_tag) { - uint64_t old_tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD, -diff --git a/vendor/libbase/logging.cpp b/vendor/libbase/logging.cpp -index 168ca42..e3896f3 100644 ---- a/vendor/libbase/logging.cpp -+++ b/vendor/libbase/logging.cpp -@@ -61,11 +61,17 @@ - namespace android { - namespace base { - -+#if defined(__linux__) -+extern "C" { -+extern char* __progname; -+} -+#endif -+ - // BSD-based systems like Android/macOS have getprogname(). Others need us to provide one. - #if defined(__linux__) || defined(_WIN32) - static const char* getprogname() { - #if defined(__linux__) -- return program_invocation_short_name; -+ return __progname; - #elif defined(_WIN32) - static bool first = true; - static char progname[MAX_PATH] = {}; -diff --git a/vendor/libbase/properties.cpp b/vendor/libbase/properties.cpp -index 8190987..6d48ab8 100644 ---- a/vendor/libbase/properties.cpp -+++ b/vendor/libbase/properties.cpp -@@ -16,7 +16,7 @@ - - #include "android-base/properties.h" - --#if defined(__BIONIC__) -+#if 0 - #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ - #include - #include -@@ -32,11 +32,9 @@ - #include - #include - --#if !defined(__BIONIC__) -- - #define PROP_VALUE_MAX 92 - --static std::map& g_properties = *new std::map; -+static std::map g_properties; - - int __system_property_set(const char* key, const char* value) { - if (key == nullptr || *key == '\0') return -1; -@@ -63,8 +61,6 @@ int __system_property_get(const char* key, char* value) { - return strlen(value); - } - --#endif -- - namespace android { - namespace base { - -@@ -108,7 +104,7 @@ template uint64_t GetUintProperty(const std::string&, uint64_t, uint64_t); - - std::string GetProperty(const std::string& key, const std::string& default_value) { - std::string property_value; --#if defined(__BIONIC__) -+#if 0 - const prop_info* pi = __system_property_find(key.c_str()); - if (pi == nullptr) return default_value; - -@@ -134,7 +130,7 @@ bool SetProperty(const std::string& key, const std::string& value) { - return (__system_property_set(key.c_str(), value.c_str()) == 0); - } - --#if defined(__BIONIC__) -+#if 0 - - struct WaitForPropertyData { - bool done; -diff --git a/vendor/libziparchive/zip_archive.cc b/vendor/libziparchive/zip_archive.cc -index fe1baa1..21d2627 100644 ---- a/vendor/libziparchive/zip_archive.cc -+++ b/vendor/libziparchive/zip_archive.cc -@@ -39,7 +39,9 @@ - #define lseek64 lseek - #endif - --#if defined(__BIONIC__) -+#undef __ANDROID__ -+ -+#if 0 - #include - #endif - -@@ -88,7 +90,7 @@ static constexpr uint64_t kMaxFileLength = 256 * static_cast(1u << 30u - * of the string length into the hash table entry. - */ - --#if defined(__BIONIC__) -+#if 0 - uint64_t GetOwnerTag(const ZipArchive* archive) { - return android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_ZIPARCHIVE, - reinterpret_cast(archive)); -@@ -102,7 +104,7 @@ ZipArchive::ZipArchive(MappedZipFile&& map, bool assume_ownership) - central_directory(), - directory_map(), - num_entries(0) { --#if defined(__BIONIC__) -+#if 0 - if (assume_ownership) { - CHECK(mapped_zip.HasFd()); - android_fdsan_exchange_owner_tag(mapped_zip.GetFileDescriptor(), 0, GetOwnerTag(this)); -@@ -120,7 +122,7 @@ ZipArchive::ZipArchive(const void* address, size_t length) - - ZipArchive::~ZipArchive() { - if (close_file && mapped_zip.GetFileDescriptor() >= 0) { --#if defined(__BIONIC__) -+#if 0 - android_fdsan_close_with_tag(mapped_zip.GetFileDescriptor(), GetOwnerTag(this)); - #else - close(mapped_zip.GetFileDescriptor()); -diff --git a/vendor/logging/liblog/include/android/log.h b/vendor/logging/liblog/include/android/log.h -index 12de595..6742aa9 100644 ---- a/vendor/logging/liblog/include/android/log.h -+++ b/vendor/logging/liblog/include/android/log.h -@@ -229,7 +229,7 @@ typedef void (*__android_aborter_function)(const char* abort_message); - * - * Available since API level 30. - */ --void __android_log_write_log_message(struct __android_log_message* log_message) __INTRODUCED_IN(30); -+void __android_log_write_log_message(struct __android_log_message* log_message) __INTRODUCED_IN(24); - - /** - * Sets a user defined logger function. All log messages sent to liblog will be set to the -@@ -241,7 +241,7 @@ void __android_log_write_log_message(struct __android_log_message* log_message) - * - * Available since API level 30. - */ --void __android_log_set_logger(__android_logger_function logger) __INTRODUCED_IN(30); -+void __android_log_set_logger(__android_logger_function logger) __INTRODUCED_IN(24); - - /** - * Writes the log message to logd. This is an __android_logger_function and can be provided to -@@ -251,7 +251,7 @@ void __android_log_set_logger(__android_logger_function logger) __INTRODUCED_IN( - * - * Available since API level 30. - */ --void __android_log_logd_logger(const struct __android_log_message* log_message) __INTRODUCED_IN(30); -+void __android_log_logd_logger(const struct __android_log_message* log_message) __INTRODUCED_IN(24); - - /** - * Writes the log message to stderr. This is an __android_logger_function and can be provided to -@@ -262,7 +262,7 @@ void __android_log_logd_logger(const struct __android_log_message* log_message) - * Available since API level 30. - */ - void __android_log_stderr_logger(const struct __android_log_message* log_message) -- __INTRODUCED_IN(30); -+ __INTRODUCED_IN(24); - - /** - * Sets a user defined aborter function that is called for __android_log_assert() failures. This -@@ -273,7 +273,7 @@ void __android_log_stderr_logger(const struct __android_log_message* log_message - * - * Available since API level 30. - */ --void __android_log_set_aborter(__android_aborter_function aborter) __INTRODUCED_IN(30); -+void __android_log_set_aborter(__android_aborter_function aborter) __INTRODUCED_IN(24); - - /** - * Calls the stored aborter function. This allows for other logging libraries to use the same -@@ -284,7 +284,7 @@ void __android_log_set_aborter(__android_aborter_function aborter) __INTRODUCED_ - * - * Available since API level 30. - */ --void __android_log_call_aborter(const char* abort_message) __INTRODUCED_IN(30); -+void __android_log_call_aborter(const char* abort_message) __INTRODUCED_IN(24); - - /** - * Sets android_set_abort_message() on device then aborts(). This is the default aborter. -@@ -295,7 +295,7 @@ void __android_log_call_aborter(const char* abort_message) __INTRODUCED_IN(30); - * Available since API level 30. - */ - void __android_log_default_aborter(const char* abort_message) __attribute__((noreturn)) --__INTRODUCED_IN(30); -+__INTRODUCED_IN(24); - - /** - * Use the per-tag properties "log.tag." along with the minimum priority from -@@ -314,7 +314,7 @@ __INTRODUCED_IN(30); - * - * Available since API level 30. - */ --int __android_log_is_loggable(int prio, const char* tag, int default_prio) __INTRODUCED_IN(30); -+int __android_log_is_loggable(int prio, const char* tag, int default_prio) __INTRODUCED_IN(24); - - /** - * Use the per-tag properties "log.tag." along with the minimum priority from -@@ -335,7 +335,7 @@ int __android_log_is_loggable(int prio, const char* tag, int default_prio) __INT - * Available since API level 30. - */ - int __android_log_is_loggable_len(int prio, const char* tag, size_t len, int default_prio) -- __INTRODUCED_IN(30); -+ __INTRODUCED_IN(24); - - /** - * Sets the minimum priority that will be logged for this process. -@@ -346,7 +346,7 @@ int __android_log_is_loggable_len(int prio, const char* tag, size_t len, int def - * - * Available since API level 30. - */ --int32_t __android_log_set_minimum_priority(int32_t priority) __INTRODUCED_IN(30); -+int32_t __android_log_set_minimum_priority(int32_t priority) __INTRODUCED_IN(24); - - /** - * Gets the minimum priority that will be logged for this process. If none has been set by a -@@ -357,7 +357,7 @@ int32_t __android_log_set_minimum_priority(int32_t priority) __INTRODUCED_IN(30) - * - * Available since API level 30. - */ --int32_t __android_log_get_minimum_priority(void) __INTRODUCED_IN(30); -+int32_t __android_log_get_minimum_priority(void) __INTRODUCED_IN(24); - - /** - * Sets the default tag if no tag is provided when writing a log message. Defaults to -@@ -368,7 +368,7 @@ int32_t __android_log_get_minimum_priority(void) __INTRODUCED_IN(30); - * - * Available since API level 30. - */ --void __android_log_set_default_tag(const char* tag) __INTRODUCED_IN(30); -+void __android_log_set_default_tag(const char* tag) __INTRODUCED_IN(24); - - #ifdef __cplusplus - } -diff --git a/vendor/logging/liblog/logger_write.cpp b/vendor/logging/liblog/logger_write.cpp -index a0153f8..8863f29 100644 ---- a/vendor/logging/liblog/logger_write.cpp -+++ b/vendor/logging/liblog/logger_write.cpp -@@ -39,6 +39,8 @@ - #include "logger.h" - #include "uio.h" - -+#undef __ANDROID__ -+ - #ifdef __ANDROID__ - #include "logd_writer.h" - #include "pmsg_writer.h" -@@ -108,31 +110,6 @@ void __android_log_close() { - #endif - } - --#if defined(__linux__) || defined(_WIN32) --static const char* getprogname() { --#if defined(__linux__) -- return program_invocation_short_name; --#elif defined(_WIN32) -- static bool first = true; -- static char progname[MAX_PATH] = {}; -- -- if (first) { -- char path[PATH_MAX + 1]; -- DWORD result = GetModuleFileName(nullptr, path, sizeof(path) - 1); -- if (result == 0 || result == sizeof(path) - 1) return ""; -- path[PATH_MAX - 1] = 0; -- -- char* path_basename = basename(path); -- -- snprintf(progname, sizeof(progname), "%s", path_basename); -- first = false; -- } -- -- return progname; --#endif --} --#endif -- - // It's possible for logging to happen during static initialization before our globals are - // initialized, so we place this std::string in a function such that it is initialized on the first - // call. We use a pointer to avoid exit time destructors. diff --git a/packages/android-tools/vendor_CMakeLists.adb.txt.patch b/packages/android-tools/vendor_CMakeLists.adb.txt.patch new file mode 100644 index 000000000..545e459bc --- /dev/null +++ b/packages/android-tools/vendor_CMakeLists.adb.txt.patch @@ -0,0 +1,12 @@ +diff --git a/vendor/CMakeLists.adb.txt b/vendor/CMakeLists.adb.txt +index 2b6d8f0..ee55949 100644 +--- a/vendor/CMakeLists.adb.txt ++++ b/vendor/CMakeLists.adb.txt +@@ -192,7 +192,6 @@ target_link_libraries(adb + brotlidec + brotlienc + lz4 +- pthread + usb-1.0 + z + zstd) diff --git a/packages/android-tools/vendor_CMakeLists.fastboot.txt.patch b/packages/android-tools/vendor_CMakeLists.fastboot.txt.patch new file mode 100644 index 000000000..a0db7641c --- /dev/null +++ b/packages/android-tools/vendor_CMakeLists.fastboot.txt.patch @@ -0,0 +1,10 @@ +diff --git a/vendor/CMakeLists.fastboot.txt b/vendor/CMakeLists.fastboot.txt +index 1d43937..189d91b 100644 +--- a/vendor/CMakeLists.fastboot.txt ++++ b/vendor/CMakeLists.fastboot.txt +@@ -135,4 +135,4 @@ target_compile_definitions(fastboot PRIVATE + target_link_libraries(fastboot + libsparse libzip libcutils liblog libfsmgr libutil + libbase libext4 libselinux libsepol libdiagnoseusb crypto +- z pcre2-8 pthread dl) ++ z pcre2-8 dl) diff --git a/packages/android-tools/vendor_CMakeLists.mke2fs.txt.patch b/packages/android-tools/vendor_CMakeLists.mke2fs.txt.patch new file mode 100644 index 000000000..faf42e7d7 --- /dev/null +++ b/packages/android-tools/vendor_CMakeLists.mke2fs.txt.patch @@ -0,0 +1,12 @@ +diff --git a/vendor/CMakeLists.mke2fs.txt b/vendor/CMakeLists.mke2fs.txt +index a8f89fd..d1cae40 100644 +--- a/vendor/CMakeLists.mke2fs.txt ++++ b/vendor/CMakeLists.mke2fs.txt +@@ -112,6 +112,6 @@ add_executable("${ANDROID_MKE2FS_NAME}" + e2fsprogs/misc/util.c) + + target_link_libraries("${ANDROID_MKE2FS_NAME}" +- libext2fs libsparse libbase libzip liblog libutil pthread z) ++ libext2fs libsparse libbase libzip liblog libutil z) + target_include_directories("${ANDROID_MKE2FS_NAME}" PRIVATE + e2fsprogs/lib) diff --git a/packages/android-tools/vendor_adb_pairing_auth_include_adb_pairing_pairing_auth.h.patch b/packages/android-tools/vendor_adb_pairing_auth_include_adb_pairing_pairing_auth.h.patch new file mode 100644 index 000000000..0fed8065f --- /dev/null +++ b/packages/android-tools/vendor_adb_pairing_auth_include_adb_pairing_pairing_auth.h.patch @@ -0,0 +1,93 @@ +diff --git a/vendor/adb/pairing_auth/include/adb/pairing/pairing_auth.h b/vendor/adb/pairing_auth/include/adb/pairing/pairing_auth.h +index 83f40a9..9804b76 100644 +--- a/vendor/adb/pairing_auth/include/adb/pairing/pairing_auth.h ++++ b/vendor/adb/pairing_auth/include/adb/pairing/pairing_auth.h +@@ -53,7 +53,7 @@ typedef struct PairingAuthCtx PairingAuthCtx; + * @return a new PairingAuthCtx server instance. Caller is responsible for + * destroying the context via #pairing_auth_destroy. + */ +-PairingAuthCtx* pairing_auth_server_new(const uint8_t* pswd, size_t len) __INTRODUCED_IN(30); ++PairingAuthCtx* pairing_auth_server_new(const uint8_t* pswd, size_t len) __INTRODUCED_IN(24); + + /** + * Creates a new PairingAuthCtx instance as the client. +@@ -64,14 +64,14 @@ PairingAuthCtx* pairing_auth_server_new(const uint8_t* pswd, size_t len) __INTRO + * @return a new PairingAuthCtx client instance. Caller is responsible for + * destroying the context via #pairing_auth_destroy. + */ +-PairingAuthCtx* pairing_auth_client_new(const uint8_t* pswd, size_t len) __INTRODUCED_IN(30); ++PairingAuthCtx* pairing_auth_client_new(const uint8_t* pswd, size_t len) __INTRODUCED_IN(24); + + /** + * Destroys the PairingAuthCtx. + * + * @param ctx the PairingAuthCtx instance to destroy. Will abort if null. + */ +-void pairing_auth_destroy(PairingAuthCtx* ctx) __INTRODUCED_IN(30); ++void pairing_auth_destroy(PairingAuthCtx* ctx) __INTRODUCED_IN(24); + + /** + * Returns the exact size of the SPAKE2 msg. +@@ -82,7 +82,7 @@ void pairing_auth_destroy(PairingAuthCtx* ctx) __INTRODUCED_IN(30); + * @param ctx the PairingAuthCtx instance. Will abort if null. + * @return the size of the SPAKE2 message in bytes. This is guaranteed to be > 0. + */ +-size_t pairing_auth_msg_size(PairingAuthCtx* ctx) __INTRODUCED_IN(30); ++size_t pairing_auth_msg_size(PairingAuthCtx* ctx) __INTRODUCED_IN(24); + + /** + * Writes the SPAKE2 message to exchange with the other party to |out_buf|. +@@ -96,7 +96,7 @@ size_t pairing_auth_msg_size(PairingAuthCtx* ctx) __INTRODUCED_IN(30); + * be have at least #pairing_auth_msg_size size. Will abort if + * out_buf is null. + */ +-void pairing_auth_get_spake2_msg(PairingAuthCtx* ctx, uint8_t* out_buf) __INTRODUCED_IN(30); ++void pairing_auth_get_spake2_msg(PairingAuthCtx* ctx, uint8_t* out_buf) __INTRODUCED_IN(24); + + /** + * Processes the peer's |their_msg| and attempts to initialize the cipher for +@@ -117,7 +117,7 @@ void pairing_auth_get_spake2_msg(PairingAuthCtx* ctx, uint8_t* out_buf) __INTROD + * for more details on the SPAKE2 protocol. + */ + bool pairing_auth_init_cipher(PairingAuthCtx* ctx, const uint8_t* their_msg, size_t msg_len) +- __INTRODUCED_IN(30); ++ __INTRODUCED_IN(24); + + /** + * Returns a safe buffer size for encrypting data of a certain size. +@@ -130,7 +130,7 @@ bool pairing_auth_init_cipher(PairingAuthCtx* ctx, const uint8_t* their_msg, siz + * @return the minimum buffer size, in bytes, to hold an encrypted message of size len. See + * #pairing_auth_encrypt for usage. + */ +-size_t pairing_auth_safe_encrypted_size(PairingAuthCtx* ctx, size_t len) __INTRODUCED_IN(30); ++size_t pairing_auth_safe_encrypted_size(PairingAuthCtx* ctx, size_t len) __INTRODUCED_IN(24); + + /** + * Encrypts input data and writes the encrypted data into a user-provided buffer. +@@ -147,7 +147,7 @@ size_t pairing_auth_safe_encrypted_size(PairingAuthCtx* ctx, size_t len) __INTRO + * otherwise. + */ + bool pairing_auth_encrypt(PairingAuthCtx* ctx, const uint8_t* inbuf, size_t inlen, uint8_t* outbuf, +- size_t* outlen) __INTRODUCED_IN(30); ++ size_t* outlen) __INTRODUCED_IN(24); + + /** + * Returns a safe buffer size for decrypting data of a certain size. +@@ -162,7 +162,7 @@ bool pairing_auth_encrypt(PairingAuthCtx* ctx, const uint8_t* inbuf, size_t inle + * #pairing_auth_decrypt for usage. + */ + size_t pairing_auth_safe_decrypted_size(PairingAuthCtx* ctx, const uint8_t* buf, size_t len) +- __INTRODUCED_IN(30); ++ __INTRODUCED_IN(24); + + /** + * Decrypts input data and writes the decrypted data into a user-provided buffer. +@@ -180,7 +180,7 @@ size_t pairing_auth_safe_decrypted_size(PairingAuthCtx* ctx, const uint8_t* buf, + * otherwise. + */ + bool pairing_auth_decrypt(PairingAuthCtx* ctx, const uint8_t* inbuf, size_t inlen, uint8_t* outbuf, +- size_t* outlen) __INTRODUCED_IN(30); ++ size_t* outlen) __INTRODUCED_IN(24); + + #ifdef __cplusplus + } diff --git a/packages/android-tools/vendor_adb_pairing_connection_include_adb_pairing_pairing_connection.h.patch b/packages/android-tools/vendor_adb_pairing_connection_include_adb_pairing_pairing_connection.h.patch new file mode 100644 index 000000000..978168dc1 --- /dev/null +++ b/packages/android-tools/vendor_adb_pairing_connection_include_adb_pairing_pairing_connection.h.patch @@ -0,0 +1,39 @@ +diff --git a/vendor/adb/pairing_connection/include/adb/pairing/pairing_connection.h b/vendor/adb/pairing_connection/include/adb/pairing/pairing_connection.h +index 8e63db7..f158015 100644 +--- a/vendor/adb/pairing_connection/include/adb/pairing/pairing_connection.h ++++ b/vendor/adb/pairing_connection/include/adb/pairing/pairing_connection.h +@@ -79,7 +79,7 @@ typedef void (*pairing_result_cb)(const PeerInfo*, int, void*); + // invoked. Otherwise, cb is guaranteed to be invoked, even if you + // destroy the ctx while in the pairing process. + bool pairing_connection_start(PairingConnectionCtx* ctx, int fd, pairing_result_cb cb, void* opaque) +- __INTRODUCED_IN(30); ++ __INTRODUCED_IN(24); + + // Creates a new PairingConnectionCtx instance as the client. + // +@@ -98,7 +98,7 @@ PairingConnectionCtx* pairing_connection_client_new(const uint8_t* pswd, size_t + const PeerInfo* peer_info, + const uint8_t* x509_cert_pem, size_t x509_size, + const uint8_t* priv_key_pem, size_t priv_size) +- __INTRODUCED_IN(30); ++ __INTRODUCED_IN(24); + + // Creates a new PairingConnectionCtx instance as the server. + // +@@ -117,14 +117,14 @@ PairingConnectionCtx* pairing_connection_server_new(const uint8_t* pswd, size_t + const PeerInfo* peer_info, + const uint8_t* x509_cert_pem, size_t x509_size, + const uint8_t* priv_key_pem, size_t priv_size) +- __INTRODUCED_IN(30); ++ __INTRODUCED_IN(24); + + // Destroys the PairingConnectionCtx instance. + // + // It is safe to destroy the instance at any point in the pairing process. + // + // @param ctx the PairingConnectionCtx instance to destroy. Will abort if null. +-void pairing_connection_destroy(PairingConnectionCtx* ctx) __INTRODUCED_IN(30); ++void pairing_connection_destroy(PairingConnectionCtx* ctx) __INTRODUCED_IN(24); + + #ifdef __cplusplus + } diff --git a/packages/android-tools/vendor_adb_pairing_connection_include_adb_pairing_pairing_server.h.patch b/packages/android-tools/vendor_adb_pairing_connection_include_adb_pairing_pairing_server.h.patch new file mode 100644 index 000000000..d6d54f381 --- /dev/null +++ b/packages/android-tools/vendor_adb_pairing_connection_include_adb_pairing_pairing_server.h.patch @@ -0,0 +1,46 @@ +diff --git a/vendor/adb/pairing_connection/include/adb/pairing/pairing_server.h b/vendor/adb/pairing_connection/include/adb/pairing/pairing_server.h +index babff94..93dcf9a 100644 +--- a/vendor/adb/pairing_connection/include/adb/pairing/pairing_server.h ++++ b/vendor/adb/pairing_connection/include/adb/pairing/pairing_server.h +@@ -45,7 +45,7 @@ typedef struct PairingServerCtx PairingServerCtx; + // Callback containing the result of the pairing. If #PeerInfo is null, + // then the pairing failed. Otherwise, pairing succeeded and #PeerInfo + // contains information about the peer. +-typedef void (*pairing_server_result_cb)(const PeerInfo*, void*) __INTRODUCED_IN(30); ++typedef void (*pairing_server_result_cb)(const PeerInfo*, void*) __INTRODUCED_IN(24); + + // Starts the pairing server. + // +@@ -61,7 +61,7 @@ typedef void (*pairing_server_result_cb)(const PeerInfo*, void*) __INTRODUCED_IN + // @param opaque the opaque userdata. + // @return the port number the server is listening on. Returns 0 on failure. + uint16_t pairing_server_start(PairingServerCtx* ctx, pairing_server_result_cb cb, void* opaque) +- __INTRODUCED_IN(30); ++ __INTRODUCED_IN(24); + + // Creates a new PairingServerCtx instance. + // +@@ -83,7 +83,7 @@ uint16_t pairing_server_start(PairingServerCtx* ctx, pairing_server_result_cb cb + PairingServerCtx* pairing_server_new(const uint8_t* pswd, size_t pswd_len, + const PeerInfo* peer_info, const uint8_t* x509_cert_pem, + size_t x509_size, const uint8_t* priv_key_pem, +- size_t priv_size, uint16_t port) __INTRODUCED_IN(30); ++ size_t priv_size, uint16_t port) __INTRODUCED_IN(24); + + // Same as #pairing_server_new, except that the x509 certificate and private key + // is generated internally. +@@ -100,12 +100,12 @@ PairingServerCtx* pairing_server_new(const uint8_t* pswd, size_t pswd_len, + // for destroying the context via #pairing_server_destroy. + PairingServerCtx* pairing_server_new_no_cert(const uint8_t* pswd, size_t pswd_len, + const PeerInfo* peer_info, uint16_t port) +- __INTRODUCED_IN(30); ++ __INTRODUCED_IN(24); + + // Destroys the PairingServerCtx instance. + // + // @param ctx the PairingServerCtx instance to destroy. +-void pairing_server_destroy(PairingServerCtx* ctx) __INTRODUCED_IN(30); ++void pairing_server_destroy(PairingServerCtx* ctx) __INTRODUCED_IN(24); + + #ifdef __cplusplus + } diff --git a/packages/android-tools/vendor_adb_sysdeps.h.patch b/packages/android-tools/vendor_adb_sysdeps.h.patch new file mode 100644 index 000000000..9c0b7b7fa --- /dev/null +++ b/packages/android-tools/vendor_adb_sysdeps.h.patch @@ -0,0 +1,17 @@ +diff --git a/vendor/adb/sysdeps.h b/vendor/adb/sysdeps.h +index 316afe7..8d5da69 100644 +--- a/vendor/adb/sysdeps.h ++++ b/vendor/adb/sysdeps.h +@@ -514,7 +514,11 @@ static inline int adb_gethostname(char* name, size_t len) { + } + + static inline int adb_getlogin_r(char* buf, size_t bufsize) { +- return getlogin_r(buf, bufsize); ++ char* logname = getlogin(); ++ if (!logname) return ENXIO; ++ if (strlen(logname) >= bufsize) return ERANGE; ++ strcpy(buf, logname); ++ return 0; + } + + static inline int adb_read(borrowed_fd fd, void* buf, size_t len) { diff --git a/packages/android-tools/vendor_base_libs_androidfw_ResourceTypes.cpp.patch b/packages/android-tools/vendor_base_libs_androidfw_ResourceTypes.cpp.patch new file mode 100644 index 000000000..a0a3ce511 --- /dev/null +++ b/packages/android-tools/vendor_base_libs_androidfw_ResourceTypes.cpp.patch @@ -0,0 +1,13 @@ +diff --git a/vendor/base/libs/androidfw/ResourceTypes.cpp b/vendor/base/libs/androidfw/ResourceTypes.cpp +index 2233827..bc5e9e2 100644 +--- a/vendor/base/libs/androidfw/ResourceTypes.cpp ++++ b/vendor/base/libs/androidfw/ResourceTypes.cpp +@@ -42,7 +42,7 @@ + #include + #include + +-#ifdef __ANDROID__ ++#if 0 + #include + #endif + diff --git a/packages/android-tools/vendor_boringssl_crypto_CMakeLists.txt.patch b/packages/android-tools/vendor_boringssl_crypto_CMakeLists.txt.patch new file mode 100644 index 000000000..fa7c6f0ed --- /dev/null +++ b/packages/android-tools/vendor_boringssl_crypto_CMakeLists.txt.patch @@ -0,0 +1,13 @@ +diff --git a/vendor/boringssl/crypto/CMakeLists.txt b/vendor/boringssl/crypto/CMakeLists.txt +index cde92b5..e25871c 100644 +--- a/vendor/boringssl/crypto/CMakeLists.txt ++++ b/vendor/boringssl/crypto/CMakeLists.txt +@@ -167,7 +167,7 @@ perlasm(test/trampoline-x86_64.${ASM_EXT} test/asm/trampoline-x86_64.pl) + + add_custom_command( + OUTPUT err_data.c +- COMMAND ${GO_EXECUTABLE} run err_data_generate.go > ${CMAKE_CURRENT_BINARY_DIR}/err_data.c ++ COMMAND GOOS=linux GOARCH=amd64 ${GO_EXECUTABLE} run err_data_generate.go > ${CMAKE_CURRENT_BINARY_DIR}/err_data.c + DEPENDS + err/err_data_generate.go + err/asn1.errordata diff --git a/packages/android-tools/vendor_core_fs_mgr_liblp_utility.cpp.patch b/packages/android-tools/vendor_core_fs_mgr_liblp_utility.cpp.patch new file mode 100644 index 000000000..44a34c6b8 --- /dev/null +++ b/packages/android-tools/vendor_core_fs_mgr_liblp_utility.cpp.patch @@ -0,0 +1,22 @@ +diff --git a/vendor/core/fs_mgr/liblp/utility.cpp b/vendor/core/fs_mgr/liblp/utility.cpp +index d8e171b..31b34a5 100644 +--- a/vendor/core/fs_mgr/liblp/utility.cpp ++++ b/vendor/core/fs_mgr/liblp/utility.cpp +@@ -34,7 +34,7 @@ + #include + #include + +-#ifdef __ANDROID__ ++#if 0 + #include + #endif + +@@ -208,7 +208,7 @@ bool SetBlockReadonly(int fd, bool readonly) { + } + + base::unique_fd GetControlFileOrOpen(std::string_view path, int flags) { +-#if defined(__ANDROID__) ++#if 0 + int fd = android_get_control_file(path.data()); + if (fd >= 0) { + int newfd = TEMP_FAILURE_RETRY(dup(fd)); diff --git a/packages/android-tools/vendor_core_init_reboot.cpp.patch b/packages/android-tools/vendor_core_init_reboot.cpp.patch new file mode 100644 index 000000000..2824e3b84 --- /dev/null +++ b/packages/android-tools/vendor_core_init_reboot.cpp.patch @@ -0,0 +1,13 @@ +diff --git a/vendor/core/init/reboot.cpp b/vendor/core/init/reboot.cpp +index 464746d..dadf811 100644 +--- a/vendor/core/init/reboot.cpp ++++ b/vendor/core/init/reboot.cpp +@@ -246,7 +246,7 @@ static bool FindPartitionsToUmount(std::vector* block_dev_partitions + if (dump) { + LOG(INFO) << "mount entry " << mentry->mnt_fsname << ":" << mentry->mnt_dir << " opts " + << mentry->mnt_opts << " type " << mentry->mnt_type; +- } else if (MountEntry::IsBlockDevice(*mentry) && hasmntopt(mentry, "rw")) { ++ } else if (MountEntry::IsBlockDevice(*mentry) && 0) { + std::string mount_dir(mentry->mnt_dir); + // These are R/O partitions changed to R/W after adb remount. + // Do not umount them as shutdown critical services may rely on them. diff --git a/packages/android-tools/vendor_core_libcutils_properties.cpp.patch b/packages/android-tools/vendor_core_libcutils_properties.cpp.patch new file mode 100644 index 000000000..9a7fae3c1 --- /dev/null +++ b/packages/android-tools/vendor_core_libcutils_properties.cpp.patch @@ -0,0 +1,13 @@ +diff --git a/vendor/core/libcutils/properties.cpp b/vendor/core/libcutils/properties.cpp +index 03f0496..11c4786 100644 +--- a/vendor/core/libcutils/properties.cpp ++++ b/vendor/core/libcutils/properties.cpp +@@ -91,7 +91,7 @@ int property_get(const char* key, char* value, const char* default_value) { + return len; + } + +-#if __has_include() ++#if 0 + + #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ + #include diff --git a/packages/android-tools/vendor_e2fsprogs_lib_ext2fs_ismounted.c.patch b/packages/android-tools/vendor_e2fsprogs_lib_ext2fs_ismounted.c.patch new file mode 100644 index 000000000..4ac970f0a --- /dev/null +++ b/packages/android-tools/vendor_e2fsprogs_lib_ext2fs_ismounted.c.patch @@ -0,0 +1,13 @@ +diff --git a/vendor/e2fsprogs/lib/ext2fs/ismounted.c b/vendor/e2fsprogs/lib/ext2fs/ismounted.c +index 6cd497d..dcdd4fd 100644 +--- a/vendor/e2fsprogs/lib/ext2fs/ismounted.c ++++ b/vendor/e2fsprogs/lib/ext2fs/ismounted.c +@@ -196,7 +196,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, + #endif /* __GNU__ */ + *mount_flags = EXT2_MF_MOUNTED; + +-#ifdef MNTOPT_RO ++#if 0 + /* Check to see if the ro option is set */ + if (hasmntopt(mnt, MNTOPT_RO)) + *mount_flags |= EXT2_MF_READONLY; diff --git a/packages/android-tools/vendor_f2fs-tools_lib_libf2fs.c.patch b/packages/android-tools/vendor_f2fs-tools_lib_libf2fs.c.patch new file mode 100644 index 000000000..a8dffc388 --- /dev/null +++ b/packages/android-tools/vendor_f2fs-tools_lib_libf2fs.c.patch @@ -0,0 +1,13 @@ +diff --git a/vendor/f2fs-tools/lib/libf2fs.c b/vendor/f2fs-tools/lib/libf2fs.c +index 55fa391..cf2716c 100644 +--- a/vendor/f2fs-tools/lib/libf2fs.c ++++ b/vendor/f2fs-tools/lib/libf2fs.c +@@ -714,7 +714,7 @@ static int is_mounted(const char *mpt, const char *device) + + while ((mnt = getmntent(file)) != NULL) { + if (!strcmp(device, mnt->mnt_fsname)) { +-#ifdef MNTOPT_RO ++#if 0 + if (hasmntopt(mnt, MNTOPT_RO)) + c.ro = 1; + #endif diff --git a/packages/android-tools/vendor_incremental_delivery_incfs_util_include_util_map_ptr.h.patch b/packages/android-tools/vendor_incremental_delivery_incfs_util_include_util_map_ptr.h.patch new file mode 100644 index 000000000..d00fd46ea --- /dev/null +++ b/packages/android-tools/vendor_incremental_delivery_incfs_util_include_util_map_ptr.h.patch @@ -0,0 +1,12 @@ +diff --git a/vendor/incremental_delivery/incfs/util/include/util/map_ptr.h b/vendor/incremental_delivery/incfs/util/include/util/map_ptr.h +index 6fd38ee..bb62fd4 100644 +--- a/vendor/incremental_delivery/incfs/util/include/util/map_ptr.h ++++ b/vendor/incremental_delivery/incfs/util/include/util/map_ptr.h +@@ -23,6 +23,7 @@ + #include + #include + ++#undef __ANDROID__ + #ifdef __ANDROID__ + #include + #endif diff --git a/packages/android-tools/vendor_libbase_include_android-base_unique_fd.h.patch b/packages/android-tools/vendor_libbase_include_android-base_unique_fd.h.patch new file mode 100644 index 000000000..fe9bf7f18 --- /dev/null +++ b/packages/android-tools/vendor_libbase_include_android-base_unique_fd.h.patch @@ -0,0 +1,22 @@ +diff --git a/vendor/libbase/include/android-base/unique_fd.h b/vendor/libbase/include/android-base/unique_fd.h +index 9ceb5db..bf6f5cc 100644 +--- a/vendor/libbase/include/android-base/unique_fd.h ++++ b/vendor/libbase/include/android-base/unique_fd.h +@@ -46,7 +46,7 @@ + // unique_fd is also known as ScopedFd/ScopedFD/scoped_fd; mentioned here to help + // you find this class if you're searching for one of those names. + +-#if defined(__BIONIC__) ++#if 0 + #include + #endif + +@@ -54,7 +54,7 @@ namespace android { + namespace base { + + struct DefaultCloser { +-#if defined(__BIONIC__) ++#if 0 + static void Tag(int fd, void* old_addr, void* new_addr) { + if (android_fdsan_exchange_owner_tag) { + uint64_t old_tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD, diff --git a/packages/android-tools/vendor_libbase_logging.cpp.patch b/packages/android-tools/vendor_libbase_logging.cpp.patch new file mode 100644 index 000000000..ac3cf5299 --- /dev/null +++ b/packages/android-tools/vendor_libbase_logging.cpp.patch @@ -0,0 +1,23 @@ +diff --git a/vendor/libbase/logging.cpp b/vendor/libbase/logging.cpp +index 168ca42..e3896f3 100644 +--- a/vendor/libbase/logging.cpp ++++ b/vendor/libbase/logging.cpp +@@ -61,11 +61,17 @@ + namespace android { + namespace base { + ++#if defined(__linux__) ++extern "C" { ++extern char* __progname; ++} ++#endif ++ + // BSD-based systems like Android/macOS have getprogname(). Others need us to provide one. + #if defined(__linux__) || defined(_WIN32) + static const char* getprogname() { + #if defined(__linux__) +- return program_invocation_short_name; ++ return __progname; + #elif defined(_WIN32) + static bool first = true; + static char progname[MAX_PATH] = {}; diff --git a/packages/android-tools/vendor_libbase_properties.cpp.patch b/packages/android-tools/vendor_libbase_properties.cpp.patch new file mode 100644 index 000000000..bc15d061b --- /dev/null +++ b/packages/android-tools/vendor_libbase_properties.cpp.patch @@ -0,0 +1,53 @@ +diff --git a/vendor/libbase/properties.cpp b/vendor/libbase/properties.cpp +index 8190987..6d48ab8 100644 +--- a/vendor/libbase/properties.cpp ++++ b/vendor/libbase/properties.cpp +@@ -16,7 +16,7 @@ + + #include "android-base/properties.h" + +-#if defined(__BIONIC__) ++#if 0 + #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ + #include + #include +@@ -32,11 +32,9 @@ + #include + #include + +-#if !defined(__BIONIC__) +- + #define PROP_VALUE_MAX 92 + +-static std::map& g_properties = *new std::map; ++static std::map g_properties; + + int __system_property_set(const char* key, const char* value) { + if (key == nullptr || *key == '\0') return -1; +@@ -63,8 +61,6 @@ int __system_property_get(const char* key, char* value) { + return strlen(value); + } + +-#endif +- + namespace android { + namespace base { + +@@ -108,7 +104,7 @@ template uint64_t GetUintProperty(const std::string&, uint64_t, uint64_t); + + std::string GetProperty(const std::string& key, const std::string& default_value) { + std::string property_value; +-#if defined(__BIONIC__) ++#if 0 + const prop_info* pi = __system_property_find(key.c_str()); + if (pi == nullptr) return default_value; + +@@ -134,7 +130,7 @@ bool SetProperty(const std::string& key, const std::string& value) { + return (__system_property_set(key.c_str(), value.c_str()) == 0); + } + +-#if defined(__BIONIC__) ++#if 0 + + struct WaitForPropertyData { + bool done; diff --git a/packages/android-tools/vendor_libziparchive_zip_archive.cc.patch b/packages/android-tools/vendor_libziparchive_zip_archive.cc.patch new file mode 100644 index 000000000..649ff7890 --- /dev/null +++ b/packages/android-tools/vendor_libziparchive_zip_archive.cc.patch @@ -0,0 +1,42 @@ +diff --git a/vendor/libziparchive/zip_archive.cc b/vendor/libziparchive/zip_archive.cc +index fe1baa1..21d2627 100644 +--- a/vendor/libziparchive/zip_archive.cc ++++ b/vendor/libziparchive/zip_archive.cc +@@ -39,7 +39,9 @@ + #define lseek64 lseek + #endif + +-#if defined(__BIONIC__) ++#undef __ANDROID__ ++ ++#if 0 + #include + #endif + +@@ -88,7 +90,7 @@ static constexpr uint64_t kMaxFileLength = 256 * static_cast(1u << 30u + * of the string length into the hash table entry. + */ + +-#if defined(__BIONIC__) ++#if 0 + uint64_t GetOwnerTag(const ZipArchive* archive) { + return android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_ZIPARCHIVE, + reinterpret_cast(archive)); +@@ -102,7 +104,7 @@ ZipArchive::ZipArchive(MappedZipFile&& map, bool assume_ownership) + central_directory(), + directory_map(), + num_entries(0) { +-#if defined(__BIONIC__) ++#if 0 + if (assume_ownership) { + CHECK(mapped_zip.HasFd()); + android_fdsan_exchange_owner_tag(mapped_zip.GetFileDescriptor(), 0, GetOwnerTag(this)); +@@ -120,7 +122,7 @@ ZipArchive::ZipArchive(const void* address, size_t length) + + ZipArchive::~ZipArchive() { + if (close_file && mapped_zip.GetFileDescriptor() >= 0) { +-#if defined(__BIONIC__) ++#if 0 + android_fdsan_close_with_tag(mapped_zip.GetFileDescriptor(), GetOwnerTag(this)); + #else + close(mapped_zip.GetFileDescriptor()); diff --git a/packages/android-tools/vendor_logging_liblog_include_android_log.h.patch b/packages/android-tools/vendor_logging_liblog_include_android_log.h.patch new file mode 100644 index 000000000..d5ab3fc5d --- /dev/null +++ b/packages/android-tools/vendor_logging_liblog_include_android_log.h.patch @@ -0,0 +1,112 @@ +diff --git a/vendor/logging/liblog/include/android/log.h b/vendor/logging/liblog/include/android/log.h +index 12de595..6742aa9 100644 +--- a/vendor/logging/liblog/include/android/log.h ++++ b/vendor/logging/liblog/include/android/log.h +@@ -229,7 +229,7 @@ typedef void (*__android_aborter_function)(const char* abort_message); + * + * Available since API level 30. + */ +-void __android_log_write_log_message(struct __android_log_message* log_message) __INTRODUCED_IN(30); ++void __android_log_write_log_message(struct __android_log_message* log_message) __INTRODUCED_IN(24); + + /** + * Sets a user defined logger function. All log messages sent to liblog will be set to the +@@ -241,7 +241,7 @@ void __android_log_write_log_message(struct __android_log_message* log_message) + * + * Available since API level 30. + */ +-void __android_log_set_logger(__android_logger_function logger) __INTRODUCED_IN(30); ++void __android_log_set_logger(__android_logger_function logger) __INTRODUCED_IN(24); + + /** + * Writes the log message to logd. This is an __android_logger_function and can be provided to +@@ -251,7 +251,7 @@ void __android_log_set_logger(__android_logger_function logger) __INTRODUCED_IN( + * + * Available since API level 30. + */ +-void __android_log_logd_logger(const struct __android_log_message* log_message) __INTRODUCED_IN(30); ++void __android_log_logd_logger(const struct __android_log_message* log_message) __INTRODUCED_IN(24); + + /** + * Writes the log message to stderr. This is an __android_logger_function and can be provided to +@@ -262,7 +262,7 @@ void __android_log_logd_logger(const struct __android_log_message* log_message) + * Available since API level 30. + */ + void __android_log_stderr_logger(const struct __android_log_message* log_message) +- __INTRODUCED_IN(30); ++ __INTRODUCED_IN(24); + + /** + * Sets a user defined aborter function that is called for __android_log_assert() failures. This +@@ -273,7 +273,7 @@ void __android_log_stderr_logger(const struct __android_log_message* log_message + * + * Available since API level 30. + */ +-void __android_log_set_aborter(__android_aborter_function aborter) __INTRODUCED_IN(30); ++void __android_log_set_aborter(__android_aborter_function aborter) __INTRODUCED_IN(24); + + /** + * Calls the stored aborter function. This allows for other logging libraries to use the same +@@ -284,7 +284,7 @@ void __android_log_set_aborter(__android_aborter_function aborter) __INTRODUCED_ + * + * Available since API level 30. + */ +-void __android_log_call_aborter(const char* abort_message) __INTRODUCED_IN(30); ++void __android_log_call_aborter(const char* abort_message) __INTRODUCED_IN(24); + + /** + * Sets android_set_abort_message() on device then aborts(). This is the default aborter. +@@ -295,7 +295,7 @@ void __android_log_call_aborter(const char* abort_message) __INTRODUCED_IN(30); + * Available since API level 30. + */ + void __android_log_default_aborter(const char* abort_message) __attribute__((noreturn)) +-__INTRODUCED_IN(30); ++__INTRODUCED_IN(24); + + /** + * Use the per-tag properties "log.tag." along with the minimum priority from +@@ -314,7 +314,7 @@ __INTRODUCED_IN(30); + * + * Available since API level 30. + */ +-int __android_log_is_loggable(int prio, const char* tag, int default_prio) __INTRODUCED_IN(30); ++int __android_log_is_loggable(int prio, const char* tag, int default_prio) __INTRODUCED_IN(24); + + /** + * Use the per-tag properties "log.tag." along with the minimum priority from +@@ -335,7 +335,7 @@ int __android_log_is_loggable(int prio, const char* tag, int default_prio) __INT + * Available since API level 30. + */ + int __android_log_is_loggable_len(int prio, const char* tag, size_t len, int default_prio) +- __INTRODUCED_IN(30); ++ __INTRODUCED_IN(24); + + /** + * Sets the minimum priority that will be logged for this process. +@@ -346,7 +346,7 @@ int __android_log_is_loggable_len(int prio, const char* tag, size_t len, int def + * + * Available since API level 30. + */ +-int32_t __android_log_set_minimum_priority(int32_t priority) __INTRODUCED_IN(30); ++int32_t __android_log_set_minimum_priority(int32_t priority) __INTRODUCED_IN(24); + + /** + * Gets the minimum priority that will be logged for this process. If none has been set by a +@@ -357,7 +357,7 @@ int32_t __android_log_set_minimum_priority(int32_t priority) __INTRODUCED_IN(30) + * + * Available since API level 30. + */ +-int32_t __android_log_get_minimum_priority(void) __INTRODUCED_IN(30); ++int32_t __android_log_get_minimum_priority(void) __INTRODUCED_IN(24); + + /** + * Sets the default tag if no tag is provided when writing a log message. Defaults to +@@ -368,7 +368,7 @@ int32_t __android_log_get_minimum_priority(void) __INTRODUCED_IN(30); + * + * Available since API level 30. + */ +-void __android_log_set_default_tag(const char* tag) __INTRODUCED_IN(30); ++void __android_log_set_default_tag(const char* tag) __INTRODUCED_IN(24); + + #ifdef __cplusplus + } diff --git a/packages/android-tools/vendor_logging_liblog_logger_write.cpp.patch b/packages/android-tools/vendor_logging_liblog_logger_write.cpp.patch new file mode 100644 index 000000000..e2af2eed9 --- /dev/null +++ b/packages/android-tools/vendor_logging_liblog_logger_write.cpp.patch @@ -0,0 +1,45 @@ +diff --git a/vendor/logging/liblog/logger_write.cpp b/vendor/logging/liblog/logger_write.cpp +index a0153f8..8863f29 100644 +--- a/vendor/logging/liblog/logger_write.cpp ++++ b/vendor/logging/liblog/logger_write.cpp +@@ -39,6 +39,8 @@ + #include "logger.h" + #include "uio.h" + ++#undef __ANDROID__ ++ + #ifdef __ANDROID__ + #include "logd_writer.h" + #include "pmsg_writer.h" +@@ -108,31 +110,6 @@ void __android_log_close() { + #endif + } + +-#if defined(__linux__) || defined(_WIN32) +-static const char* getprogname() { +-#if defined(__linux__) +- return program_invocation_short_name; +-#elif defined(_WIN32) +- static bool first = true; +- static char progname[MAX_PATH] = {}; +- +- if (first) { +- char path[PATH_MAX + 1]; +- DWORD result = GetModuleFileName(nullptr, path, sizeof(path) - 1); +- if (result == 0 || result == sizeof(path) - 1) return ""; +- path[PATH_MAX - 1] = 0; +- +- char* path_basename = basename(path); +- +- snprintf(progname, sizeof(progname), "%s", path_basename); +- first = false; +- } +- +- return progname; +-#endif +-} +-#endif +- + // It's possible for logging to happen during static initialization before our globals are + // initialized, so we place this std::string in a function such that it is initialized on the first + // call. We use a pointer to avoid exit time destructors.