summaryrefslogtreecommitdiff
path: root/libs/androidfw/AssetManager2.cpp
diff options
context:
space:
mode:
author Ryan Mitchell <rtmitchell@google.com> 2020-04-02 09:54:23 -0700
committer Ryan Mitchell <rtmitchell@google.com> 2020-04-09 11:01:54 -0700
commit192400cf334e0e8befe336861a6d214c6a88c993 (patch)
treee5702b6ffbf4bd02012766ebada03e3ceec8f460 /libs/androidfw/AssetManager2.cpp
parent2d8d9812e9925ed017c5ce10208b3d807258a2cc (diff)
Fail install when resources.arsc is compressed
If an application targets R+, prevent the application from being installed if the app has a compressed resources.arsc or if the resources.arsc is not aligned on a 4-byte boundary. Resources tables that cannot be memory mapped have to be read into a buffer in RAM and exert unnecessary memory pressure on the system. Bug: 132742131 Test: manual (adding CTS tests) Change-Id: Ieef764c87643863de24531fac12cc520fe6d90d0
Diffstat (limited to 'libs/androidfw/AssetManager2.cpp')
-rw-r--r--libs/androidfw/AssetManager2.cpp5
1 files changed, 5 insertions, 0 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;