summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2015-01-23 12:30:23 -0800
committerClark Scheff <clark@cyngn.com>2015-10-27 10:39:00 -0700
commit79d41a9f470603d49097ef8da6d9c9766e0a22c4 (patch)
tree4ccac3994663d7b50ff894d9aff2bf2b38728a78 /libs
parent18b301874e2a658eb01f97defd70da038521f450 (diff)
downloadframeworks_base-79d41a9f470603d49097ef8da6d9c9766e0a22c4.zip
frameworks_base-79d41a9f470603d49097ef8da6d9c9766e0a22c4.tar.gz
frameworks_base-79d41a9f470603d49097ef8da6d9c9766e0a22c4.tar.bz2
Themes: Don't add common assets if files cannot be accessed
If resApkPath does not exist, asset manaager will load the resources from the theme's apk which end up overriding resources in the 0x7f package id. This causes apps, such as SystemUI, to crash endlessly. The correct behavior is to not add common overlay assets if the files that are being passed in as paths cannot be accessed. The same behavior is already used in AssetManager::addOverlayPath() Change-Id: If5e90baeda5f07973f268060dcb6d73dae657603
Diffstat (limited to 'libs')
-rw-r--r--libs/androidfw/AssetManager.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index 370aaa2..f4ac254 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -330,6 +330,16 @@ bool AssetManager::addCommonOverlayPath(const String8& themePackagePath, int32_t
}
}
+ if (access(themePackagePath.string(), R_OK) != 0) {
+ ALOGW("failed to access file %s: %s\n", themePackagePath.string(), strerror(errno));
+ return false;
+ }
+
+ if (access(resApkPath.string(), R_OK) != 0) {
+ ALOGW("failed to access file %s: %s\n", resApkPath.string(), strerror(errno));
+ return false;
+ }
+
asset_path oap;
oap.path = themePackagePath;
oap.type = ::getFileType(themePackagePath.string());