From a90930528d4be87b3132bf758afeb6aa7a7524b9 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Thu, 26 Mar 2020 17:15:01 -0700 Subject: Invalidate idmap when target updates When the target package update, check if the idmap file must change. If so, propagate the idmap changes to the targets overlay paths, and invalidate cached overlay ApkAssets in ResourcesManager. Bug: 147794117 Bug: 150877400 Test: OverlayRemountedTest Test: libandroidfw_tests Change-Id: I6115c30bae3672b188a5ff270720a0eea15b43b5 --- libs/androidfw/ApkAssets.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libs/androidfw/ApkAssets.cpp') diff --git a/libs/androidfw/ApkAssets.cpp b/libs/androidfw/ApkAssets.cpp index 918e7af12d31..05f4d6b63a4c 100644 --- a/libs/androidfw/ApkAssets.cpp +++ b/libs/androidfw/ApkAssets.cpp @@ -385,7 +385,7 @@ std::unique_ptr ApkAssets::LoadOverlay(const std::string& idmap const StringPiece idmap_data( reinterpret_cast(idmap_asset->getBuffer(true /*wordAligned*/)), static_cast(idmap_asset->getLength())); - std::unique_ptr loaded_idmap = LoadedIdmap::Load(idmap_data); + std::unique_ptr loaded_idmap = LoadedIdmap::Load(idmap_path, idmap_data); if (loaded_idmap == nullptr) { LOG(ERROR) << "failed to load IDMAP " << idmap_path; return {}; @@ -538,8 +538,9 @@ bool ApkAssets::IsUpToDate() const { // Loaders are invalidated by the app, not the system, so assume they are up to date. return true; } + return (!loaded_idmap_ || loaded_idmap_->IsUpToDate()) && + last_mod_time_ == getFileModDate(path_.c_str()); - return last_mod_time_ == getFileModDate(path_.c_str()); } } // namespace android -- cgit v1.2.3-59-g8ed1b