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

Method addBag

tools/aapt/ResourceTable.cpp:1885–1928  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1883}
1884
1885status_t ResourceTable::addBag(const SourcePos& sourcePos,
1886 const String16& package,
1887 const String16& type,
1888 const String16& name,
1889 const String16& bagParent,
1890 const String16& bagKey,
1891 const String16& value,
1892 const Vector<StringPool::entry_style_span>* style,
1893 const ResTable_config* params,
1894 bool replace, bool isId, const int32_t format)
1895{
1896 // Check for adding entries in other packages... for now we do
1897 // nothing. We need to do the right thing here to support skinning.
1898 uint32_t rid = mAssets->getIncludedResources()
1899 .identifierForName(name.string(), name.size(),
1900 type.string(), type.size(),
1901 package.string(), package.size());
1902 if (rid != 0) {
1903 return NO_ERROR;
1904 }
1905
1906#if 0
1907 if (name == String16("left")) {
1908 printf("Adding bag left: file=%s, line=%d, type=%s\n",
1909 sourcePos.file.striing(), sourcePos.line, String8(type).string());
1910 }
1911#endif
1912 sp<Entry> e = getEntry(package, type, name, sourcePos, replace, params);
1913 if (e == NULL) {
1914 return UNKNOWN_ERROR;
1915 }
1916
1917 // If a parent is explicitly specified, set it.
1918 if (bagParent.size() > 0) {
1919 e->setParent(bagParent);
1920 }
1921
1922 const bool first = e->getBag().indexOfKey(bagKey) < 0;
1923 status_t err = e->addToBag(sourcePos, bagKey, value, style, replace, isId, format);
1924 if (err == NO_ERROR && first) {
1925 mNumLocal++;
1926 }
1927 return err;
1928}
1929
1930bool ResourceTable::hasBagOrEntry(const String16& package,
1931 const String16& type,

Callers 4

createIfNeededMethod · 0.80
compileAttributeFunction · 0.80
parseAndAddBagFunction · 0.80
generateAttributesMethod · 0.80

Calls 7

identifierForNameMethod · 0.80
stringMethod · 0.80
addToBagMethod · 0.80
String16Class · 0.70
sizeMethod · 0.65
setParentMethod · 0.45
indexOfKeyMethod · 0.45

Tested by

no test coverage detected