MCPcopy Create free account
hub / github.com/CyanogenMod/android_frameworks_base / getNamespaceResourcePackage

Function getNamespaceResourcePackage

tools/aapt/XMLNode.cpp:53–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51static const String16 RESOURCES_TOOLS_NAMESPACE("http://schemas.android.com/tools");
52
53String16 getNamespaceResourcePackage(String16 appPackage, String16 namespaceUri, bool* outIsPublic)
54{
55 //printf("%s starts with %s?\n", String8(namespaceUri).string(),
56 // String8(RESOURCES_PREFIX).string());
57 size_t prefixSize;
58 bool isPublic = true;
59 if(namespaceUri.startsWith(RESOURCES_PREFIX_AUTO_PACKAGE)) {
60 NOISY(printf("Using default application package: %s -> %s\n", String8(namespaceUri).string(), String8(appPackage).string()));
61 isPublic = true;
62 return appPackage;
63 } else if (namespaceUri.startsWith(RESOURCES_PREFIX)) {
64 prefixSize = RESOURCES_PREFIX.size();
65 } else if (namespaceUri.startsWith(RESOURCES_PRV_PREFIX)) {
66 isPublic = false;
67 prefixSize = RESOURCES_PRV_PREFIX.size();
68 } else {
69 if (outIsPublic) *outIsPublic = isPublic; // = true
70 return String16();
71 }
72
73 //printf("YES!\n");
74 //printf("namespace: %s\n", String8(String16(namespaceUri, namespaceUri.size()-prefixSize, prefixSize)).string());
75 if (outIsPublic) *outIsPublic = isPublic;
76 return String16(namespaceUri, namespaceUri.size()-prefixSize, prefixSize);
77}
78
79status_t hasSubstitutionErrors(const char* fileName,
80 ResXMLTree* inXml,

Callers 1

assignResourceIdsMethod · 0.85

Calls 3

stringMethod · 0.80
String16Class · 0.70
sizeMethod · 0.65

Tested by

no test coverage detected