Skip to content

Commit

Permalink
Update to platform-tools-31.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nmeum committed Jun 2, 2021
1 parent 62955f3 commit c036c4d
Show file tree
Hide file tree
Showing 32 changed files with 328 additions and 344 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@
[submodule "vendor/logging"]
path = vendor/logging
url = https://android.googlesource.com/platform/system/logging.git
[submodule "vendor/incremental_delivery"]
path = vendor/incremental_delivery
url = https://android.googlesource.com/platform/system/incremental_delivery
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ set(ANDROID_MKE2FS_NAME "mke2fs.android")

# Version of android-tools and the version of boringssl being used.
# See: https://android.googlesource.com/platform/external/boringssl/+/platform-tools-${ANDROID_VERSION}/BORINGSSL_REVISION
set(ANDROID_VERSION 31.0.0p1)
set(BORINGSSL_VERSION c1e156ae16fa8b61af9b5d2b74e59d3f86e141be)
set(ANDROID_VERSION 31.0.2)
set(BORINGSSL_VERSION ae2bb641735447496bed334c495e4868b981fe32)

# Vendor string used in version outputs.
set(ANDROID_VENDOR android-tools)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ The following libraries are required by android-tools:
5. [brotli][brotli]
6. [zstd][zstd]
7. [lz4][lz4]
8. [fmt][fmt]

Additionally the following software is required at compile-time:

Expand Down Expand Up @@ -108,4 +109,5 @@ have been copied from Anatol's ruby script.
[brotli]: https://github.com/google/brotli
[zstd]: https://facebook.github.io/zstd/
[lz4]: https://github.com/lz4/lz4
[fmt]: https://github.com/fmtlib/fmt
[anatol.pomozov]: https://github.com/anatol
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
From 43bd4fbbd8ccd4d36dd12d046bb8a311a73507a4 Mon Sep 17 00:00:00 2001
From: John Zimmermann <[email protected]>
Date: Thu, 18 Mar 2021 12:42:29 +0100
From 9c4b6d7b8bc5cd512dd9329f8e7e51d321d494fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <[email protected]>
Date: Fri, 28 May 2021 11:26:01 +0200
Subject: [PATCH] Don't use the internal glibc header sys/cdefs.h

https://wiki.musl-libc.org/faq.html#Q:-When-compiling-something-against-musl,-I-get-error-messages-about
---
pairing_auth/include/adb/pairing/pairing_auth.h | 9 ++++++---
.../include/adb/pairing/pairing_connection.h | 9 ++++++---
pairing_connection/include/adb/pairing/pairing_server.h | 9 ++++++---
3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/pairing_auth/include/adb/pairing/pairing_auth.h b/pairing_auth/include/adb/pairing/pairing_auth.h
index 9ef97e26..f6b7b2a9 100644
index ee0412fb..83f40a9f 100644
--- a/pairing_auth/include/adb/pairing/pairing_auth.h
+++ b/pairing_auth/include/adb/pairing/pairing_auth.h
@@ -18,13 +18,14 @@
Expand All @@ -27,19 +28,19 @@ index 9ef97e26..f6b7b2a9 100644
+#ifdef __cplusplus
+extern "C" {
+#endif
#if !defined(__ANDROID__) || __ANDROID_API__ >= 30

/**
@@ -183,4 +184,6 @@ bool pairing_auth_decrypt(PairingAuthCtx* ctx, const uint8_t* inbuf, size_t inle
* PairingAuthCtx is a wrapper around the SPAKE2 protocol + cipher initialization
@@ -181,4 +182,6 @@ size_t pairing_auth_safe_decrypted_size(PairingAuthCtx* ctx, const uint8_t* buf,
bool pairing_auth_decrypt(PairingAuthCtx* ctx, const uint8_t* inbuf, size_t inlen, uint8_t* outbuf,
size_t* outlen) __INTRODUCED_IN(30);

#endif //!__ANDROID__ || __ANDROID_API__ >= 30
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
diff --git a/pairing_connection/include/adb/pairing/pairing_connection.h b/pairing_connection/include/adb/pairing/pairing_connection.h
index 3543b873..ad34dc48 100644
index 98764171..8e63db7b 100644
--- a/pairing_connection/include/adb/pairing/pairing_connection.h
+++ b/pairing_connection/include/adb/pairing/pairing_connection.h
@@ -18,7 +18,6 @@
Expand All @@ -58,19 +59,19 @@ index 3543b873..ad34dc48 100644
+#ifdef __cplusplus
+extern "C" {
+#endif
#if !defined(__ANDROID__) || __ANDROID_API__ >= 30

const uint32_t kMaxPeerInfoSize = 8192;
@@ -127,4 +128,6 @@ PairingConnectionCtx* pairing_connection_server_new(const uint8_t* pswd, size_t
struct PeerInfo {
@@ -125,4 +126,6 @@ PairingConnectionCtx* pairing_connection_server_new(const uint8_t* pswd, size_t
// @param ctx the PairingConnectionCtx instance to destroy. Will abort if null.
void pairing_connection_destroy(PairingConnectionCtx* ctx) __INTRODUCED_IN(30);

#endif //!__ANDROID__ || __ANDROID_API__ >= 30
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
diff --git a/pairing_connection/include/adb/pairing/pairing_server.h b/pairing_connection/include/adb/pairing/pairing_server.h
index 178a174b..0a8d6768 100644
index 9e7b69fc..babff948 100644
--- a/pairing_connection/include/adb/pairing/pairing_server.h
+++ b/pairing_connection/include/adb/pairing/pairing_server.h
@@ -18,7 +18,6 @@
Expand All @@ -89,13 +90,13 @@ index 178a174b..0a8d6768 100644
+#ifdef __cplusplus
+extern "C" {
+#endif
#if !defined(__ANDROID__) || __ANDROID_API__ >= 30

// PairingServerCtx is a wrapper around the #PairingConnectionCtx APIs,
@@ -108,4 +109,6 @@ PairingServerCtx* pairing_server_new_no_cert(const uint8_t* pswd, size_t pswd_le
// which handles multiple client connections.
@@ -106,4 +107,6 @@ PairingServerCtx* pairing_server_new_no_cert(const uint8_t* pswd, size_t pswd_le
// @param ctx the PairingServerCtx instance to destroy.
void pairing_server_destroy(PairingServerCtx* ctx) __INTRODUCED_IN(30);

#endif //!__ANDROID__ || __ANDROID_API__ >= 30
-__END_DECLS
+#ifdef __cplusplus
+}
Expand Down
31 changes: 24 additions & 7 deletions patches/adb/0016-adb-disable-mDNS.patch
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
From 09ef5e32470f990a02ffaa6e75c497c9a8643690 Mon Sep 17 00:00:00 2001
From 8027ec77633890c20b2cec0d35e732ac83a48365 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
<[email protected]>
Date: Sun, 1 Nov 2020 15:09:53 +0700
Date: Sun, 1 Nov 2020 15:51:35 +0700
Subject: [PATCH] adb: disable mDNS

---
adb.cpp | 15 ---------------
client/main.cpp | 2 --
socket_spec.cpp | 25 +------------------------
2 files changed, 1 insertion(+), 39 deletions(-)
3 files changed, 1 insertion(+), 41 deletions(-)

diff --git a/adb.cpp b/adb.cpp
index daae0e10..ebc65337 100644
index e829908a..23360304 100644
--- a/adb.cpp
+++ b/adb.cpp
@@ -1077,21 +1077,6 @@ void adb_set_reject_kill_server(bool value) {
@@ -1102,21 +1102,6 @@ void adb_set_reject_kill_server(bool value) {
}

static bool handle_mdns_request(std::string_view service, int reply_fd) {
Expand All @@ -35,8 +36,24 @@ index daae0e10..ebc65337 100644
return false;
}

diff --git a/client/main.cpp b/client/main.cpp
index c74a5cc5..b402f834 100644
--- a/client/main.cpp
+++ b/client/main.cpp
@@ -68,11 +68,9 @@ void adb_server_cleanup() {
// 1. close_smartsockets, so that we don't get any new clients
// 2. kick_all_transports, to avoid writing only part of a packet to a transport.
// 3. usb_cleanup, to tear down the USB stack.
- // 4. mdns_cleanup, to tear down mdns stack.
close_smartsockets();
kick_all_transports();
usb_cleanup();
- mdns_cleanup();
}

static void intentionally_leak() {
diff --git a/socket_spec.cpp b/socket_spec.cpp
index 5cad70d0..fe079337 100644
index 91ebb360..3cf24e17 100644
--- a/socket_spec.cpp
+++ b/socket_spec.cpp
@@ -195,30 +195,7 @@ bool socket_spec_connect(unique_fd* fd, std::string_view address, int* port, std
Expand All @@ -45,7 +62,7 @@ index 5cad70d0..fe079337 100644
} else {
-#if ADB_HOST
- // Check if the address is an mdns service we can connect to.
- if (auto mdns_info = mdns_get_connect_service_info(address.substr(4));
- if (auto mdns_info = mdns_get_connect_service_info(std::string(address.substr(4)));
- mdns_info != std::nullopt) {
- fd->reset(network_connect(mdns_info->addr, mdns_info->port, SOCK_STREAM, 0, error));
- if (fd->get() != -1) {
Expand Down
12 changes: 6 additions & 6 deletions patches/adb/0017-adb_wifi-remove-mDNS.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From efe70298a9b043861bd8fd2048790e5c253cc60e Mon Sep 17 00:00:00 2001
From b8787287589ae0f3e209b78824f2d7ca3b6d776b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
<[email protected]>
Date: Sun, 1 Nov 2020 19:44:01 +0700
Expand All @@ -9,10 +9,10 @@ Subject: [PATCH] adb_wifi: remove mDNS
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/client/adb_wifi.cpp b/client/adb_wifi.cpp
index 61a9a480..9a3f21a7 100644
index e3e853a7..4a9a2055 100644
--- a/client/adb_wifi.cpp
+++ b/client/adb_wifi.cpp
@@ -179,9 +179,7 @@ bool adb_wifi_is_known_host(const std::string& host) {
@@ -180,9 +180,7 @@ bool adb_wifi_is_known_host(const std::string& host) {

void adb_wifi_pair_device(const std::string& host, const std::string& password,
std::string& response) {
Expand All @@ -23,7 +23,7 @@ index 61a9a480..9a3f21a7 100644
// Check the address for a valid address and port.
std::string parsed_host;
std::string err;
@@ -224,10 +222,7 @@ void adb_wifi_pair_device(const std::string& host, const std::string& password,
@@ -225,10 +223,7 @@ void adb_wifi_pair_device(const std::string& host, const std::string& password,

PairingResultWaiter waiter;
std::unique_lock<std::mutex> lock(waiter.mutex_);
Expand All @@ -35,9 +35,9 @@ index 61a9a480..9a3f21a7 100644
waiter.OnResult, &waiter)) {
response = "Failed: Unable to start pairing client.";
return;
@@ -250,5 +245,4 @@ void adb_wifi_pair_device(const std::string& host, const std::string& password,
@@ -251,5 +246,4 @@ void adb_wifi_pair_device(const std::string& host, const std::string& password,
// Write to adb_known_hosts
write_known_host_to_file(device_guid);
// Try to auto-connect.
- adb_secure_connect_by_service_name(device_guid.c_str());
- adb_secure_connect_by_service_name(device_guid);
}
49 changes: 49 additions & 0 deletions patches/adb/0019-adb_mdns-Don-t-use-_Nonnull.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
From 105d81777289abc390e425fe7afbaa2123a85edb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <[email protected]>
Date: Fri, 28 May 2021 07:08:35 +0200
Subject: [PATCH] adb_mdns: Don't use _Nonnull

Only supported as a function attribute by GCC.
---
adb_mdns.h | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/adb_mdns.h b/adb_mdns.h
index 471ec250..c4fcd006 100644
--- a/adb_mdns.h
+++ b/adb_mdns.h
@@ -40,11 +40,11 @@ constexpr int kADBSecurePairingServiceRefIndex = 1;
constexpr int kADBSecureConnectServiceRefIndex = 2;
constexpr int kNumADBDNSServices = 3;

-extern const char* _Nonnull kADBSecurePairingServiceTxtRecord;
-extern const char* _Nonnull kADBSecureConnectServiceTxtRecord;
+extern const char* kADBSecurePairingServiceTxtRecord;
+extern const char* kADBSecureConnectServiceTxtRecord;

-extern const char* _Nonnull kADBDNSServices[kNumADBDNSServices];
-extern const char* _Nonnull kADBDNSServiceTxtRecords[kNumADBDNSServices];
+extern const char* kADBDNSServices[kNumADBDNSServices];
+extern const char* kADBDNSServiceTxtRecords[kNumADBDNSServices];

#if ADB_HOST
// ADB Secure DNS service interface. Used to query what ADB Secure DNS services have been
@@ -83,12 +83,12 @@ std::optional<MdnsInfo> mdns_get_pairing_service_info(const std::string& name);

// TODO: Remove once openscreen has support for bonjour client APIs.
struct AdbMdnsResponderFuncs {
- std::string (*_Nonnull mdns_check)(void);
- std::string (*_Nonnull mdns_list_discovered_services)(void);
- std::optional<MdnsInfo> (*_Nonnull mdns_get_connect_service_info)(const std::string&);
- std::optional<MdnsInfo> (*_Nonnull mdns_get_pairing_service_info)(const std::string&);
- void (*_Nonnull mdns_cleanup)(void);
- bool (*_Nonnull adb_secure_connect_by_service_name)(const std::string&);
+ std::string (*mdns_check)(void);
+ std::string (*mdns_list_discovered_services)(void);
+ std::optional<MdnsInfo> (*mdns_get_connect_service_info)(const std::string&);
+ std::optional<MdnsInfo> (*mdns_get_pairing_service_info)(const std::string&);
+ void (*mdns_cleanup)(void);
+ bool (*adb_secure_connect_by_service_name)(const std::string&);
}; // AdbBonjourCallbacks

// TODO: Remove once openscreen has support for bonjour client APIs.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From f9634b82a18e4041971cdf8be2917eb5a27962b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <[email protected]>
Date: Sun, 23 May 2021 13:36:29 +0200
Subject: [PATCH] AssetManager2: Align creation of FindEntryResult with
declaration

GCC 10.X complains about this and refuses to compile otherwise.
---
libs/androidfw/AssetManager2.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp
index bec80a7d605e..250032e12e4d 100644
--- a/libs/androidfw/AssetManager2.cpp
+++ b/libs/androidfw/AssetManager2.cpp
@@ -821,11 +821,11 @@ base::expected<FindEntryResult, NullOrIOError> AssetManager2::FindEntryInternal(
.entry = *entry,
.config = *best_config,
.type_flags = type_flags,
+ .dynamic_ref_table = package_group.dynamic_ref_table.get(),
.package_name = &best_package->GetPackageName(),
.type_string_ref = StringPoolRef(best_package->GetTypeStringPool(), best_type->id - 1),
.entry_string_ref = StringPoolRef(best_package->GetKeyStringPool(),
best_entry->key.index),
- .dynamic_ref_table = package_group.dynamic_ref_table.get(),
};
}

32 changes: 0 additions & 32 deletions patches/base/0003-nullptr_t-is-std-namespace.patch

This file was deleted.

39 changes: 0 additions & 39 deletions patches/core/0009-Use-glibc-s-gettid-when-using-glibc-2.30.patch

This file was deleted.

Loading

0 comments on commit c036c4d

Please sign in to comment.