summaryrefslogtreecommitdiff
path: root/libs/androidfw/ApkAssets.cpp
diff options
context:
space:
mode:
author Yurii Zubrytskyi <zyy@google.com> 2025-01-07 09:24:39 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-01-07 09:24:39 -0800
commit62b7a14d7992937afa2e7769d85878709dd7c6e4 (patch)
tree42a9360e54062c22089d3d013dd3fd6caba8ddb4 /libs/androidfw/ApkAssets.cpp
parenta473c3658ea4258e5a57fa789000fcc6d5ddbcd5 (diff)
parent53d89b210d6d657481921a67cb2cedfcd68bebc3 (diff)
Merge changes I5fa70d33,Ibc5ac60a,I2f048fee,I0f801bef into main
* changes: [res] Dump resources timings in dumpsys [res] Don't create extra asset provider when not needed [res] Optimize few functions for dtoh() as a noop [res] Optimize isUpToDate() for ApkAssets
Diffstat (limited to 'libs/androidfw/ApkAssets.cpp')
-rw-r--r--libs/androidfw/ApkAssets.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/libs/androidfw/ApkAssets.cpp b/libs/androidfw/ApkAssets.cpp
index dbb891455ddd..e693fcfd3918 100644
--- a/libs/androidfw/ApkAssets.cpp
+++ b/libs/androidfw/ApkAssets.cpp
@@ -162,10 +162,13 @@ const std::string& ApkAssets::GetDebugName() const {
return assets_provider_->GetDebugName();
}
-bool ApkAssets::IsUpToDate() const {
+UpToDate ApkAssets::IsUpToDate() const {
// Loaders are invalidated by the app, not the system, so assume they are up to date.
- return IsLoader() || ((!loaded_idmap_ || loaded_idmap_->IsUpToDate())
- && assets_provider_->IsUpToDate());
+ if (IsLoader()) {
+ return UpToDate::Always;
+ }
+ const auto idmap_res = loaded_idmap_ ? loaded_idmap_->IsUpToDate() : UpToDate::Always;
+ return combine(idmap_res, [this] { return assets_provider_->IsUpToDate(); });
}
} // namespace android