RRO: prevent duplicate system overlays

System overlays, ie overlays with targetPackage="android", were loaded
twice, which caused all sorts of issues. Ensure they are only loaded
once, which will be during Zygote initialization.

Bug: 17765434
Change-Id: Ia5064045c77f713c58fb78adc3942f6af1abdc93
This commit is contained in:
Mårten Kongstad
2014-11-07 10:57:15 +01:00
committed by Zoran Jovanovic
parent 96198ebae8
commit cb7b63d928
2 changed files with 8 additions and 0 deletions

View File

@@ -236,9 +236,11 @@ public:
private:
struct asset_path
{
asset_path() : path(""), type(kFileTypeRegular), idmap(""), isSystemOverlay(false) {}
String8 path;
FileType type;
String8 idmap;
bool isSystemOverlay;
};
Asset* openInPathLocked(const char* fileName, AccessMode mode,

View File

@@ -605,6 +605,11 @@ FileType AssetManager::getFileType(const char* fileName)
}
bool AssetManager::appendPathToResTable(const asset_path& ap) const {
// skip those ap's that correspond to system overlays
if (ap.isSystemOverlay) {
return true;
}
Asset* ass = NULL;
ResTable* sharedRes = NULL;
bool shared = true;
@@ -790,6 +795,7 @@ void AssetManager::addSystemOverlays(const char* pathOverlaysList,
oap.path = String8(buf, space - buf);
oap.type = kFileTypeRegular;
oap.idmap = String8(space + 1, newline - space - 1);
oap.isSystemOverlay = true;
Asset* oass = const_cast<AssetManager*>(this)->
openNonAssetInPathLocked("resources.arsc",