diff options
author | Ryan Mitchell <rtmitchell@google.com> | 2020-04-13 15:14:05 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-04-13 15:14:05 +0000 |
commit | 5a57f52b6b2a6ea577c9aee53e328b720ff688f5 (patch) | |
tree | 5ed17157e9ef4f569b0893f691f8813b3bce6322 /libs/androidfw | |
parent | 0953e8d398855248825abff1a8558c402a865b0c (diff) | |
parent | b8a61d13c2fd447abe5ce9cd635ea3a49c08ebe9 (diff) |
Merge "Fail install when resources.arsc is compressed" into rvc-dev am: b8a61d13c2
Change-Id: Ib01a8e7b83525cf420dae44758fcc214669d887d
Diffstat (limited to 'libs/androidfw')
-rw-r--r-- | libs/androidfw/AssetManager2.cpp | 5 | ||||
-rw-r--r-- | libs/androidfw/include/androidfw/ApkAssets.h | 17 | ||||
-rw-r--r-- | libs/androidfw/include/androidfw/AssetManager2.h | 3 |
3 files changed, 19 insertions, 6 deletions
diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp index eaf452b5fa71..b9765ea7212c 100644 --- a/libs/androidfw/AssetManager2.cpp +++ b/libs/androidfw/AssetManager2.cpp @@ -331,6 +331,11 @@ bool AssetManager2::GetOverlayablesToString(const android::StringPiece& package_ return true; } +bool AssetManager2::ContainsAllocatedTable() const { + return std::find_if(apk_assets_.begin(), apk_assets_.end(), + std::mem_fn(&ApkAssets::IsTableAllocated)) != apk_assets_.end(); +} + void AssetManager2::SetConfiguration(const ResTable_config& configuration) { const int diff = configuration_.diff(configuration); configuration_ = configuration; diff --git a/libs/androidfw/include/androidfw/ApkAssets.h b/libs/androidfw/include/androidfw/ApkAssets.h index 879b050b65bd..e57490aab2d8 100644 --- a/libs/androidfw/include/androidfw/ApkAssets.h +++ b/libs/androidfw/include/androidfw/ApkAssets.h @@ -119,31 +119,36 @@ class ApkAssets { package_property_t flags = 0U, std::unique_ptr<const AssetsProvider> override_asset = nullptr); - inline const std::string& GetPath() const { + const std::string& GetPath() const { return path_; } - inline const AssetsProvider* GetAssetsProvider() const { + const AssetsProvider* GetAssetsProvider() const { return assets_provider_.get(); } // This is never nullptr. - inline const LoadedArsc* GetLoadedArsc() const { + const LoadedArsc* GetLoadedArsc() const { return loaded_arsc_.get(); } - inline const LoadedIdmap* GetLoadedIdmap() const { + const LoadedIdmap* GetLoadedIdmap() const { return loaded_idmap_.get(); } - inline bool IsLoader() const { + bool IsLoader() const { return (property_flags_ & PROPERTY_LOADER) != 0; } - inline bool IsOverlay() const { + bool IsOverlay() const { return loaded_idmap_ != nullptr; } + // Returns whether the resources.arsc is allocated in RAM (not mmapped). + bool IsTableAllocated() const { + return resources_asset_ && resources_asset_->isAllocated(); + } + bool IsUpToDate() const; // Creates an Asset from a file on disk. diff --git a/libs/androidfw/include/androidfw/AssetManager2.h b/libs/androidfw/include/androidfw/AssetManager2.h index e21abade99a4..30ef25c6a516 100644 --- a/libs/androidfw/include/androidfw/AssetManager2.h +++ b/libs/androidfw/include/androidfw/AssetManager2.h @@ -134,6 +134,9 @@ class AssetManager2 { const std::unordered_map<std::string, std::string>* GetOverlayableMapForPackage(uint32_t package_id) const; + // Returns whether the resources.arsc of any loaded apk assets is allocated in RAM (not mmapped). + bool ContainsAllocatedTable() const; + // Sets/resets the configuration for this AssetManager. This will cause all // caches that are related to the configuration change to be invalidated. void SetConfiguration(const ResTable_config& configuration); |