diff options
author | 2015-12-18 14:22:14 -0800 | |
---|---|---|
committer | 2016-01-04 13:53:54 -0800 | |
commit | 1c686f2ce6cbfa3fdb598f452aa31d38f3eb2320 (patch) | |
tree | 231683457601efdf2050ebc9ae863b99c3f056ed /include/androidfw/AssetManager.h | |
parent | c1f9e7c4875e791e108c79382508aab8d171f25f (diff) |
Avoid matching system locales in locale negotiation
Also:
1. Add AssetManager method for finding non-system locales: This is
used in per-app locale negotiation. (Normally,
AssetManager#getLocales() returns both system and non-system
locales.)
2. Match pseudolocales correctly in locale negotiation.
Bug: 25800576
Bug: 26236938
Change-Id: I116caf3a91c290deb4ad68b291c65b7035b18dd4
Diffstat (limited to 'include/androidfw/AssetManager.h')
-rw-r--r-- | include/androidfw/AssetManager.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/include/androidfw/AssetManager.h b/include/androidfw/AssetManager.h index 3d4e47d84c65..914ac3d52421 100644 --- a/include/androidfw/AssetManager.h +++ b/include/androidfw/AssetManager.h @@ -100,16 +100,17 @@ public: * then on success, *cookie is set to the value corresponding to the * newly-added asset source. */ - bool addAssetPath(const String8& path, int32_t* cookie, bool appAsLib=false); + bool addAssetPath(const String8& path, int32_t* cookie, + bool appAsLib=false, bool isSystemAsset=false); bool addOverlayPath(const String8& path, int32_t* cookie); - /* + /* * Convenience for adding the standard system assets. Uses the * ANDROID_ROOT environment variable to find them. */ bool addDefaultAssets(); - /* + /* * Iterate over the asset paths in this manager. (Previously * added via addAssetPath() and addDefaultAssets().) On first call, * 'cookie' must be 0, resulting in the first cookie being returned. @@ -118,7 +119,7 @@ public: */ int32_t nextAssetPath(const int32_t cookie) const; - /* + /* * Return an asset path in the manager. 'which' must be between 0 and * countAssetPaths(). */ @@ -221,11 +222,11 @@ public: * the current data. */ bool isUpToDate(); - + /** * Get the known locales for this asset manager object. */ - void getLocales(Vector<String8>* locales) const; + void getLocales(Vector<String8>* locales, bool includeSystemLocales=true) const; /** * Generate idmap data to translate resources IDs between a package and a @@ -237,11 +238,13 @@ public: private: struct asset_path { - asset_path() : path(""), type(kFileTypeRegular), idmap(""), isSystemOverlay(false) {} + asset_path() : path(""), type(kFileTypeRegular), idmap(""), + isSystemOverlay(false), isSystemAsset(false) {} String8 path; FileType type; String8 idmap; bool isSystemOverlay; + bool isSystemAsset; }; Asset* openInPathLocked(const char* fileName, AccessMode mode, |