summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-06-09 16:06:07 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-06-09 16:06:07 -0700
commit199512446d07e15797d1ae8b21b92ae61a372352 (patch)
tree0c82e60cb9d297caa5d2f66016ca7ded75d71b0d
parentfd8454ebbfe30d824088bb85b5cbeb88794f5ce2 (diff)
parent3bbe6fb6b23becfa745e6b49ba450845d0f12336 (diff)
downloadframeworks_native-199512446d07e15797d1ae8b21b92ae61a372352.zip
frameworks_native-199512446d07e15797d1ae8b21b92ae61a372352.tar.gz
frameworks_native-199512446d07e15797d1ae8b21b92ae61a372352.tar.bz2
am a8d7ea06: am 220cd77d: Merge "Enforce public resource restriction on bag parents." into honeycomb-mr2
* commit 'a8d7ea067cf22baeee2ff0a33e5a8c5a35936942': Enforce public resource restriction on bag parents.
-rw-r--r--include/utils/ResourceTypes.h3
-rw-r--r--libs/utils/ResourceTypes.cpp32
2 files changed, 32 insertions, 3 deletions
diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h
index 8a92cd6..612ff93 100644
--- a/include/utils/ResourceTypes.h
+++ b/include/utils/ResourceTypes.h
@@ -1988,7 +1988,8 @@ public:
String16* outName,
const String16* defType = NULL,
const String16* defPackage = NULL,
- const char** outErrorMsg = NULL);
+ const char** outErrorMsg = NULL,
+ bool* outPublicOnly = NULL);
static bool stringToInt(const char16_t* s, size_t len, Res_value* outValue);
static bool stringToFloat(const char16_t* s, size_t len, Res_value* outValue);
diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp
index 4a6a3db..cb6c246 100644
--- a/libs/utils/ResourceTypes.cpp
+++ b/libs/utils/ResourceTypes.cpp
@@ -2663,6 +2663,9 @@ uint32_t ResTable::identifierForName(const char16_t* name, size_t nameLen,
goto nope;
}
}
+ if (outTypeSpecFlags) {
+ *outTypeSpecFlags = ResTable_typeSpec::SPEC_PUBLIC;
+ }
return m->id;
nope:
;
@@ -2677,6 +2680,9 @@ nope:
index);
return 0;
}
+ if (outTypeSpecFlags) {
+ *outTypeSpecFlags = ResTable_typeSpec::SPEC_PUBLIC;
+ }
return Res_MAKEARRAY(index);
}
}
@@ -2687,6 +2693,8 @@ nope:
return 0;
}
+ bool fakePublic = false;
+
// Figure out the package and type we are looking in...
const char16_t* packageEnd = NULL;
@@ -2698,7 +2706,13 @@ nope:
else if (*p == '/') typeEnd = p;
p++;
}
- if (*name == '@') name++;
+ if (*name == '@') {
+ name++;
+ if (*name == '*') {
+ fakePublic = true;
+ name++;
+ }
+ }
if (name >= nameEnd) {
return 0;
}
@@ -2803,6 +2817,9 @@ nope:
if (dtohl(entry->key.index) == (size_t)ei) {
if (outTypeSpecFlags) {
*outTypeSpecFlags = typeConfigs->typeSpecFlags[i];
+ if (fakePublic) {
+ *outTypeSpecFlags |= ResTable_typeSpec::SPEC_PUBLIC;
+ }
}
return Res_MAKEID(group->id-1, ti, i);
}
@@ -2819,7 +2836,8 @@ bool ResTable::expandResourceRef(const uint16_t* refStr, size_t refLen,
String16* outName,
const String16* defType,
const String16* defPackage,
- const char** outErrorMsg)
+ const char** outErrorMsg,
+ bool* outPublicOnly)
{
const char16_t* packageEnd = NULL;
const char16_t* typeEnd = NULL;
@@ -2836,6 +2854,16 @@ bool ResTable::expandResourceRef(const uint16_t* refStr, size_t refLen,
p = refStr;
if (*p == '@') p++;
+ if (outPublicOnly != NULL) {
+ *outPublicOnly = true;
+ }
+ if (*p == '*') {
+ p++;
+ if (outPublicOnly != NULL) {
+ *outPublicOnly = false;
+ }
+ }
+
if (packageEnd) {
*outPackage = String16(p, packageEnd-p);
p = packageEnd+1;