summaryrefslogtreecommitdiffstats
path: root/libs/androidfw
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2014-09-19 18:59:17 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-19 18:59:17 +0000
commita7d1a111c7176fdf853e53e74f6c7c7843c3c81c (patch)
treeaf22ff3e1c37bce425c329ab7e9b8a9e16b078f2 /libs/androidfw
parent89502b999c95c61ac7bfee8dc65eb84f04545995 (diff)
parent67ab8fa5bc54706e26526582d807b3c9e5f08079 (diff)
downloadframeworks_base-a7d1a111c7176fdf853e53e74f6c7c7843c3c81c.zip
frameworks_base-a7d1a111c7176fdf853e53e74f6c7c7843c3c81c.tar.gz
frameworks_base-a7d1a111c7176fdf853e53e74f6c7c7843c3c81c.tar.bz2
am e7e9ad6d: am 863b1a90: am 19f9d54f: Merge "Fix backwards compat problem with AAPT public attrs" into lmp-dev
* commit 'e7e9ad6d172bcc463e726564a3a5c36025d61a70': Fix backwards compat problem with AAPT public attrs
Diffstat (limited to 'libs/androidfw')
-rw-r--r--libs/androidfw/ResourceTypes.cpp38
-rwxr-xr-xlibs/androidfw/tests/data/basic/build4
2 files changed, 41 insertions, 1 deletions
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 690b1d6..8cef137 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -5393,6 +5393,44 @@ const char16_t* StringPoolRef::string16(size_t* outLen) const {
return NULL;
}
+bool ResTable::getResourceFlags(uint32_t resID, uint32_t* outFlags) const {
+ if (mError != NO_ERROR) {
+ return false;
+ }
+
+ const ssize_t p = getResourcePackageIndex(resID);
+ const int t = Res_GETTYPE(resID);
+ const int e = Res_GETENTRY(resID);
+
+ if (p < 0) {
+ if (Res_GETPACKAGE(resID)+1 == 0) {
+ ALOGW("No package identifier when getting flags for resource number 0x%08x", resID);
+ } else {
+ ALOGW("No known package when getting flags for resource number 0x%08x", resID);
+ }
+ return false;
+ }
+ if (t < 0) {
+ ALOGW("No type identifier when getting flags for resource number 0x%08x", resID);
+ return false;
+ }
+
+ const PackageGroup* const grp = mPackageGroups[p];
+ if (grp == NULL) {
+ ALOGW("Bad identifier when getting flags for resource number 0x%08x", resID);
+ return false;
+ }
+
+ Entry entry;
+ status_t err = getEntry(grp, t, e, NULL, &entry);
+ if (err != NO_ERROR) {
+ return false;
+ }
+
+ *outFlags = entry.specFlags;
+ return true;
+}
+
status_t ResTable::getEntry(
const PackageGroup* packageGroup, int typeIndex, int entryIndex,
const ResTable_config* config,
diff --git a/libs/androidfw/tests/data/basic/build b/libs/androidfw/tests/data/basic/build
index fa4a9fe..036e468 100755
--- a/libs/androidfw/tests/data/basic/build
+++ b/libs/androidfw/tests/data/basic/build
@@ -1,6 +1,8 @@
#!/bin/bash
-aapt package -M AndroidManifest.xml -S res --split fr,de -F bundle.apk -f && \
+PATH_TO_FRAMEWORK_RES=$(gettop)/prebuilts/sdk/current/android.jar
+
+aapt package -M AndroidManifest.xml -S res -I $PATH_TO_FRAMEWORK_RES --split fr,de -F bundle.apk -f && \
unzip bundle.apk resources.arsc && \
mv resources.arsc basic.arsc && \
xxd -i basic.arsc > basic_arsc.h && \