Loading include/utils/ResourceTypes.h +2 −1 Original line number Diff line number Diff line Loading @@ -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); Loading libs/utils/ResourceTypes.cpp +30 −2 Original line number Diff line number Diff line Loading @@ -2499,6 +2499,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: ; Loading @@ -2513,6 +2516,9 @@ nope: index); return 0; } if (outTypeSpecFlags) { *outTypeSpecFlags = ResTable_typeSpec::SPEC_PUBLIC; } return Res_MAKEARRAY(index); } } Loading @@ -2523,6 +2529,8 @@ nope: return 0; } bool fakePublic = false; // Figure out the package and type we are looking in... const char16_t* packageEnd = NULL; Loading @@ -2534,7 +2542,13 @@ nope: else if (*p == '/') typeEnd = p; p++; } if (*name == '@') name++; if (*name == '@') { name++; if (*name == '*') { fakePublic = true; name++; } } if (name >= nameEnd) { return 0; } Loading Loading @@ -2639,6 +2653,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); } Loading @@ -2655,7 +2672,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; Loading @@ -2672,6 +2690,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; Loading Loading
include/utils/ResourceTypes.h +2 −1 Original line number Diff line number Diff line Loading @@ -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); Loading
libs/utils/ResourceTypes.cpp +30 −2 Original line number Diff line number Diff line Loading @@ -2499,6 +2499,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: ; Loading @@ -2513,6 +2516,9 @@ nope: index); return 0; } if (outTypeSpecFlags) { *outTypeSpecFlags = ResTable_typeSpec::SPEC_PUBLIC; } return Res_MAKEARRAY(index); } } Loading @@ -2523,6 +2529,8 @@ nope: return 0; } bool fakePublic = false; // Figure out the package and type we are looking in... const char16_t* packageEnd = NULL; Loading @@ -2534,7 +2542,13 @@ nope: else if (*p == '/') typeEnd = p; p++; } if (*name == '@') name++; if (*name == '@') { name++; if (*name == '*') { fakePublic = true; name++; } } if (name >= nameEnd) { return 0; } Loading Loading @@ -2639,6 +2653,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); } Loading @@ -2655,7 +2672,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; Loading @@ -2672,6 +2690,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; Loading