summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Android Build Coastguard Worker <android-build-coastguard-worker@google.com> 2025-04-22 18:34:39 -0700
committer Android Build Coastguard Worker <android-build-coastguard-worker@google.com> 2025-04-22 18:34:39 -0700
commit94612df606a2778d1050dbc3850201919cbe64b2 (patch)
treef3df321bc544026852f2552b09b665f7ae0ba120
parentc2992ce6c7904e7d65c264d1fcee6e0fc2902ae3 (diff)
parente45d057739584cca2a3219f332bd246fab98d213 (diff)
Merge cherrypicks of ['googleplex-android-review.googlesource.com/33132884', 'googleplex-android-review.googlesource.com/33175634'] into 25Q2-release.
Change-Id: Ib730adef8c222bc80879376e4c7891edf56df2a5
-rw-r--r--libs/androidfw/AssetsProvider.cpp13
-rw-r--r--libs/androidfw/include/androidfw/AssetsProvider.h8
-rw-r--r--libs/androidfw/include/androidfw/misc.h4
-rw-r--r--libs/androidfw/misc.cpp5
-rw-r--r--services/core/java/com/android/server/security/intrusiondetection/NetworkLogSource.java4
5 files changed, 22 insertions, 12 deletions
diff --git a/libs/androidfw/AssetsProvider.cpp b/libs/androidfw/AssetsProvider.cpp
index 808509120462..13456fbadbc7 100644
--- a/libs/androidfw/AssetsProvider.cpp
+++ b/libs/androidfw/AssetsProvider.cpp
@@ -104,7 +104,14 @@ void ZipAssetsProvider::ZipCloser::operator()(ZipArchive* a) const {
}
ZipAssetsProvider::ZipAssetsProvider(ZipArchiveHandle handle, PathOrDebugName&& path,
- package_property_t flags, ModDate last_mod_time)
+ package_property_t flags, time_t last_mod_time)
+ : zip_handle_(handle), name_(std::move(path)), flags_(flags), last_mod_time_(last_mod_time) {
+ LOG(ERROR) << "This function is not supported and will result in "
+ "poor performance and/or crashes. Stop calling it.";
+}
+
+ZipAssetsProvider::ZipAssetsProvider(ZipArchiveHandle handle, PathOrDebugName&& path,
+ ModDate last_mod_time, package_property_t flags)
: zip_handle_(handle), name_(std::move(path)), flags_(flags), last_mod_time_(last_mod_time) {
}
@@ -132,7 +139,7 @@ std::unique_ptr<ZipAssetsProvider> ZipAssetsProvider::Create(std::string path,
}
return std::unique_ptr<ZipAssetsProvider>(
- new ZipAssetsProvider(handle, PathOrDebugName::Path(std::move(path)), flags, mod_date));
+ new ZipAssetsProvider(handle, PathOrDebugName::Path(std::move(path)), mod_date, flags));
}
std::unique_ptr<ZipAssetsProvider> ZipAssetsProvider::Create(base::unique_fd fd,
@@ -166,7 +173,7 @@ std::unique_ptr<ZipAssetsProvider> ZipAssetsProvider::Create(base::unique_fd fd,
}
return std::unique_ptr<ZipAssetsProvider>(new ZipAssetsProvider(
- handle, PathOrDebugName::DebugName(std::move(friendly_name)), flags, mod_date));
+ handle, PathOrDebugName::DebugName(std::move(friendly_name)), mod_date, flags));
}
std::unique_ptr<Asset> ZipAssetsProvider::OpenInternal(const std::string& path,
diff --git a/libs/androidfw/include/androidfw/AssetsProvider.h b/libs/androidfw/include/androidfw/AssetsProvider.h
index 037f684f5b78..10e1fe33332c 100644
--- a/libs/androidfw/include/androidfw/AssetsProvider.h
+++ b/libs/androidfw/include/androidfw/AssetsProvider.h
@@ -110,8 +110,14 @@ struct ZipAssetsProvider : public AssetsProvider {
private:
struct PathOrDebugName;
+
+ // There are applications that decided to dlsym and call this constructor somehow, so we
+ // have to keep it for backwards compatibility.
ZipAssetsProvider(ZipArchive* handle, PathOrDebugName&& path, package_property_t flags,
- ModDate last_mod_time);
+ time_t last_mod_time);
+ // ModTime is time_t on Win32, need to change the parameter order to make it overloadable.
+ ZipAssetsProvider(ZipArchive* handle, PathOrDebugName&& path, ModDate last_mod_time,
+ package_property_t flags);
struct PathOrDebugName {
static PathOrDebugName Path(std::string value) {
diff --git a/libs/androidfw/include/androidfw/misc.h b/libs/androidfw/include/androidfw/misc.h
index d8ca64a174a2..5f9fcc9a8a1f 100644
--- a/libs/androidfw/include/androidfw/misc.h
+++ b/libs/androidfw/include/androidfw/misc.h
@@ -77,4 +77,6 @@ bool isKnownWritablePath(const char* path);
} // namespace android
// Whoever uses getFileModDate() will need this as well
-bool operator==(const timespec& l, const timespec& r);
+inline bool operator==(const timespec& l, const timespec& r) {
+ return l.tv_sec == r.tv_sec && l.tv_nsec == r.tv_nsec;
+}
diff --git a/libs/androidfw/misc.cpp b/libs/androidfw/misc.cpp
index 26eb320805c9..052d9e8dbe68 100644
--- a/libs/androidfw/misc.cpp
+++ b/libs/androidfw/misc.cpp
@@ -31,7 +31,6 @@
#include <array>
#include <cstdio>
#include <cstring>
-#include <tuple>
namespace android {
@@ -143,7 +142,3 @@ bool isKnownWritablePath(const char* path) {
#endif // __linux__
} // namespace android
-
-bool operator==(const timespec& l, const timespec& r) {
- return std::tie(l.tv_sec, l.tv_nsec) == std::tie(r.tv_sec, l.tv_nsec);
-}
diff --git a/services/core/java/com/android/server/security/intrusiondetection/NetworkLogSource.java b/services/core/java/com/android/server/security/intrusiondetection/NetworkLogSource.java
index fe0cf80a48f2..f2edaf1fd623 100644
--- a/services/core/java/com/android/server/security/intrusiondetection/NetworkLogSource.java
+++ b/services/core/java/com/android/server/security/intrusiondetection/NetworkLogSource.java
@@ -83,11 +83,11 @@ public class NetworkLogSource implements DataSource {
}
try {
if (!mIpConnectivityMetrics.removeNetdEventCallback(
- INetdEventCallback.CALLBACK_CALLER_NETWORK_WATCHLIST)) {
+ INetdEventCallback.CALLBACK_CALLER_DEVICE_POLICY)) {
mIsNetworkLoggingEnabled.set(false);
} else {
- Slog.e(TAG, "Failed to enable network logging; invalid callback");
+ Slog.e(TAG, "Failed to disable network logging; invalid callback");
}
} catch (RemoteException e) {
Slog.e(TAG, "Failed to disable network logging; ", e);