diff options
Diffstat (limited to 'tools')
35 files changed, 952 insertions, 142 deletions
diff --git a/tools/aapt/AaptAssets.h b/tools/aapt/AaptAssets.h index d5345b277caf..c5a397c73390 100644 --- a/tools/aapt/AaptAssets.h +++ b/tools/aapt/AaptAssets.h @@ -53,17 +53,6 @@ enum { AXIS_END = AXIS_VERSION, }; -enum { - SDK_CUPCAKE = 3, - SDK_DONUT = 4, - SDK_ECLAIR = 5, - SDK_ECLAIR_0_1 = 6, - SDK_MR1 = 7, - SDK_FROYO = 8, - SDK_HONEYCOMB_MR2 = 13, - SDK_ICE_CREAM_SANDWICH = 14, -}; - /** * This structure contains a specific variation of a single file out * of all the variations it can have that we can have. diff --git a/tools/aapt/Bundle.h b/tools/aapt/Bundle.h index 2d1060ba23a0..8e3a1c9d11af 100644 --- a/tools/aapt/Bundle.h +++ b/tools/aapt/Bundle.h @@ -14,6 +14,18 @@ #include <utils/String8.h> #include <utils/Vector.h> +enum { + SDK_CUPCAKE = 3, + SDK_DONUT = 4, + SDK_ECLAIR = 5, + SDK_ECLAIR_0_1 = 6, + SDK_MR1 = 7, + SDK_FROYO = 8, + SDK_HONEYCOMB_MR2 = 13, + SDK_ICE_CREAM_SANDWICH = 14, + SDK_ICE_CREAM_SANDWICH_MR1 = 15, +}; + /* * Things we can do. */ @@ -82,7 +94,6 @@ public: void setRequireLocalization(bool val) { mRequireLocalization = val; } bool getPseudolocalize(void) const { return mPseudolocalize; } void setPseudolocalize(bool val) { mPseudolocalize = val; } - bool getWantUTF16(void) const { return mWantUTF16; } void setWantUTF16(bool val) { mWantUTF16 = val; } bool getValues(void) const { return mValues; } void setValues(bool val) { mValues = val; } @@ -103,6 +114,10 @@ public: bool getGenDependencies() { return mGenDependencies; } void setGenDependencies(bool val) { mGenDependencies = val; } + bool getUTF16StringsOption() { + return mWantUTF16 || !isMinSdkAtLeast(SDK_FROYO); + } + /* * Input options. */ diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index 89942de57eaa..607056a6c1f2 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -479,6 +479,11 @@ int doDump(Bundle* bundle) #ifndef HAVE_ANDROID_OS res.print(bundle->getValues()); #endif + + } else if (strcmp("strings", option) == 0) { + const ResStringPool* pool = res.getTableStringBlock(0); + printStringPool(pool); + } else if (strcmp("xmltree", option) == 0) { if (bundle->getFileSpecCount() < 3) { fprintf(stderr, "ERROR: no dump xmltree resource file specified\n"); @@ -1382,7 +1387,7 @@ int doDump(Bundle* bundle) delete dir; } } else if (strcmp("badger", option) == 0) { - printf(CONSOLE_DATA); + printf("%s", CONSOLE_DATA); } else if (strcmp("configurations", option) == 0) { Vector<ResTable_config> configs; res.getConfigurations(&configs); diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index 1ecf7daef123..c0fe5380afa5 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -847,8 +847,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets) * request UTF-16 encoding and the parameters of this package * allow UTF-8 to be used. */ - if (!bundle->getWantUTF16() - && bundle->isMinSdkAtLeast(SDK_FROYO)) { + if (!bundle->getUTF16StringsOption()) { xmlFlags |= XML_COMPILE_UTF8; } diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp index fdb39ca08e9f..f59bba2815a2 100644 --- a/tools/aapt/ResourceTable.cpp +++ b/tools/aapt/ResourceTable.cpp @@ -2047,7 +2047,8 @@ bool ResourceTable::stringToValue(Res_value* outValue, StringPool* pool, uint32_t attrID, const Vector<StringPool::entry_style_span>* style, String16* outStr, void* accessorCookie, - uint32_t attrType) + uint32_t attrType, const String8* configTypeName, + const ConfigDescription* config) { String16 finalStr; @@ -2075,10 +2076,19 @@ bool ResourceTable::stringToValue(Res_value* outValue, StringPool* pool, if (outValue->dataType == outValue->TYPE_STRING) { // Should do better merging styles. if (pool) { + String8 configStr; + if (config != NULL) { + configStr = config->toString(); + } else { + configStr = "(null)"; + } + NOISY(printf("Adding to pool string style #%d config %s: %s\n", + style != NULL ? style->size() : 0, + configStr.string(), String8(finalStr).string())); if (style != NULL && style->size() > 0) { - outValue->data = pool->add(finalStr, *style); + outValue->data = pool->add(finalStr, *style, configTypeName, config); } else { - outValue->data = pool->add(finalStr, true); + outValue->data = pool->add(finalStr, true, configTypeName, config); } } else { // Caller will fill this in later. @@ -2537,16 +2547,19 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest) return err; } + const ConfigDescription nullConfig; + const size_t N = mOrderedPackages.size(); size_t pi; const static String16 mipmap16("mipmap"); - bool useUTF8 = !bundle->getWantUTF16() && bundle->isMinSdkAtLeast(SDK_FROYO); + bool useUTF8 = !bundle->getUTF16StringsOption(); // Iterate through all data, collecting all values (strings, // references, etc). StringPool valueStrings = StringPool(false, useUTF8); + Vector<sp<Entry> > allEntries; for (pi=0; pi<N; pi++) { sp<Package> p = mOrderedPackages.itemAt(pi); if (p->getTypes().size() == 0) { @@ -2567,6 +2580,19 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest) const String16 typeName(t->getName()); typeStrings.add(typeName, false); + // This is a hack to tweak the sorting order of the final strings, + // to put stuff that is generally not language-specific first. + String8 configTypeName(typeName); + if (configTypeName == "drawable" || configTypeName == "layout" + || configTypeName == "color" || configTypeName == "anim" + || configTypeName == "interpolator" || configTypeName == "animator" + || configTypeName == "xml" || configTypeName == "menu" + || configTypeName == "mipmap" || configTypeName == "raw") { + configTypeName = "1complex"; + } else { + configTypeName = "2value"; + } + const bool filterable = (typeName != mipmap16); const size_t N = t->getOrderedConfigs().size(); @@ -2586,10 +2612,21 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest) continue; } e->setNameIndex(keyStrings.add(e->getName(), true)); - status_t err = e->prepareFlatten(&valueStrings, this); + + // If this entry has no values for other configs, + // and is the default config, then it is special. Otherwise + // we want to add it with the config info. + ConfigDescription* valueConfig = NULL; + if (N != 1 || config == nullConfig) { + valueConfig = &config; + } + + status_t err = e->prepareFlatten(&valueStrings, this, + &configTypeName, &config); if (err != NO_ERROR) { return err; } + allEntries.add(e); } } } @@ -2598,6 +2635,17 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest) p->setKeyStrings(keyStrings.createStringBlock()); } + if (bundle->getOutputAPKFile() != NULL) { + // Now we want to sort the value strings for better locality. This will + // cause the positions of the strings to change, so we need to go back + // through out resource entries and update them accordingly. Only need + // to do this if actually writing the output file. + valueStrings.sortByConfig(); + for (pi=0; pi<allEntries.size(); pi++) { + allEntries[pi]->remapStringValue(&valueStrings); + } + } + ssize_t strAmt = 0; // Now build the array of package chunks. @@ -3137,14 +3185,16 @@ status_t ResourceTable::Entry::assignResourceIds(ResourceTable* table, return hasErrors ? UNKNOWN_ERROR : NO_ERROR; } -status_t ResourceTable::Entry::prepareFlatten(StringPool* strings, ResourceTable* table) +status_t ResourceTable::Entry::prepareFlatten(StringPool* strings, ResourceTable* table, + const String8* configTypeName, const ConfigDescription* config) { if (mType == TYPE_ITEM) { Item& it = mItem; AccessorCookie ac(it.sourcePos, String8(mName), String8(it.value)); if (!table->stringToValue(&it.parsedValue, strings, it.value, false, true, 0, - &it.style, NULL, &ac, mItemFormat)) { + &it.style, NULL, &ac, mItemFormat, + configTypeName, config)) { return UNKNOWN_ERROR; } } else if (mType == TYPE_BAG) { @@ -3155,7 +3205,8 @@ status_t ResourceTable::Entry::prepareFlatten(StringPool* strings, ResourceTable AccessorCookie ac(it.sourcePos, String8(key), String8(it.value)); if (!table->stringToValue(&it.parsedValue, strings, it.value, false, true, it.bagKeyId, - &it.style, NULL, &ac, it.format)) { + &it.style, NULL, &ac, it.format, + configTypeName, config)) { return UNKNOWN_ERROR; } } @@ -3167,6 +3218,29 @@ status_t ResourceTable::Entry::prepareFlatten(StringPool* strings, ResourceTable return NO_ERROR; } +status_t ResourceTable::Entry::remapStringValue(StringPool* strings) +{ + if (mType == TYPE_ITEM) { + Item& it = mItem; + if (it.parsedValue.dataType == Res_value::TYPE_STRING) { + it.parsedValue.data = strings->mapOriginalPosToNewPos(it.parsedValue.data); + } + } else if (mType == TYPE_BAG) { + const size_t N = mBag.size(); + for (size_t i=0; i<N; i++) { + Item& it = mBag.editValueAt(i); + if (it.parsedValue.dataType == Res_value::TYPE_STRING) { + it.parsedValue.data = strings->mapOriginalPosToNewPos(it.parsedValue.data); + } + } + } else { + mPos.error("Error: entry %s is not a single item or a bag.\n", + String8(mName).string()); + return UNKNOWN_ERROR; + } + return NO_ERROR; +} + ssize_t ResourceTable::Entry::flatten(Bundle* bundle, const sp<AaptFile>& data, bool isPublic) { size_t amt = 0; diff --git a/tools/aapt/ResourceTable.h b/tools/aapt/ResourceTable.h index 8123bb3d4226..a3e066690fba 100644 --- a/tools/aapt/ResourceTable.h +++ b/tools/aapt/ResourceTable.h @@ -76,6 +76,37 @@ public: class Type; class Entry; + struct ConfigDescription : public ResTable_config { + ConfigDescription() { + memset(this, 0, sizeof(*this)); + size = sizeof(ResTable_config); + } + ConfigDescription(const ResTable_config&o) { + *static_cast<ResTable_config*>(this) = o; + size = sizeof(ResTable_config); + } + ConfigDescription(const ConfigDescription&o) { + *static_cast<ResTable_config*>(this) = o; + } + + ConfigDescription& operator=(const ResTable_config& o) { + *static_cast<ResTable_config*>(this) = o; + size = sizeof(ResTable_config); + return *this; + } + ConfigDescription& operator=(const ConfigDescription& o) { + *static_cast<ResTable_config*>(this) = o; + return *this; + } + + inline bool operator<(const ConfigDescription& o) const { return compare(o) < 0; } + inline bool operator<=(const ConfigDescription& o) const { return compare(o) <= 0; } + inline bool operator==(const ConfigDescription& o) const { return compare(o) == 0; } + inline bool operator!=(const ConfigDescription& o) const { return compare(o) != 0; } + inline bool operator>=(const ConfigDescription& o) const { return compare(o) >= 0; } + inline bool operator>(const ConfigDescription& o) const { return compare(o) > 0; } + }; + ResourceTable(Bundle* bundle, const String16& assetsPackage); status_t addIncludedResources(Bundle* bundle, const sp<AaptAssets>& assets); @@ -183,7 +214,9 @@ public: uint32_t attrID, const Vector<StringPool::entry_style_span>* style = NULL, String16* outStr = NULL, void* accessorCookie = NULL, - uint32_t attrType = ResTable_map::TYPE_ANY); + uint32_t attrType = ResTable_map::TYPE_ANY, + const String8* configTypeName = NULL, + const ConfigDescription* config = NULL); status_t assignResourceIds(); status_t addSymbols(const sp<AaptSymbols>& outSymbols = NULL); @@ -305,7 +338,10 @@ public: status_t assignResourceIds(ResourceTable* table, const String16& package); - status_t prepareFlatten(StringPool* strings, ResourceTable* table); + status_t prepareFlatten(StringPool* strings, ResourceTable* table, + const String8* configTypeName, const ConfigDescription* config); + + status_t remapStringValue(StringPool* strings); ssize_t flatten(Bundle*, const sp<AaptFile>& data, bool isPublic); @@ -322,37 +358,6 @@ public: uint32_t mParentId; SourcePos mPos; }; - - struct ConfigDescription : public ResTable_config { - ConfigDescription() { - memset(this, 0, sizeof(*this)); - size = sizeof(ResTable_config); - } - ConfigDescription(const ResTable_config&o) { - *static_cast<ResTable_config*>(this) = o; - size = sizeof(ResTable_config); - } - ConfigDescription(const ConfigDescription&o) { - *static_cast<ResTable_config*>(this) = o; - } - - ConfigDescription& operator=(const ResTable_config& o) { - *static_cast<ResTable_config*>(this) = o; - size = sizeof(ResTable_config); - return *this; - } - ConfigDescription& operator=(const ConfigDescription& o) { - *static_cast<ResTable_config*>(this) = o; - return *this; - } - - inline bool operator<(const ConfigDescription& o) const { return compare(o) < 0; } - inline bool operator<=(const ConfigDescription& o) const { return compare(o) <= 0; } - inline bool operator==(const ConfigDescription& o) const { return compare(o) == 0; } - inline bool operator!=(const ConfigDescription& o) const { return compare(o) != 0; } - inline bool operator>=(const ConfigDescription& o) const { return compare(o) >= 0; } - inline bool operator>(const ConfigDescription& o) const { return compare(o) > 0; } - }; class ConfigList : public RefBase { public: diff --git a/tools/aapt/StringPool.cpp b/tools/aapt/StringPool.cpp index 9a0a1c46251b..fe88e37c159f 100644 --- a/tools/aapt/StringPool.cpp +++ b/tools/aapt/StringPool.cpp @@ -5,8 +5,10 @@ // #include "StringPool.h" +#include "ResourceTable.h" #include <utils/ByteOrder.h> +#include <utils/SortedVector.h> #if HAVE_PRINTF_ZD # define ZD "%zd" @@ -30,16 +32,70 @@ void strcpy16_htod(uint16_t* dst, const uint16_t* src) void printStringPool(const ResStringPool* pool) { + SortedVector<const void*> uniqueStrings; + const size_t N = pool->size(); + for (size_t i=0; i<N; i++) { + size_t len; + if (pool->isUTF8()) { + uniqueStrings.add(pool->string8At(i, &len)); + } else { + uniqueStrings.add(pool->stringAt(i, &len)); + } + } + + printf("String pool of " ZD " unique %s %s strings, " ZD " entries and " + ZD " styles using " ZD " bytes:\n", + (ZD_TYPE)uniqueStrings.size(), pool->isUTF8() ? "UTF-8" : "UTF-16", + pool->isSorted() ? "sorted" : "non-sorted", + (ZD_TYPE)N, (ZD_TYPE)pool->styleCount(), (ZD_TYPE)pool->bytes()); + const size_t NS = pool->size(); for (size_t s=0; s<NS; s++) { - size_t len; - const char *str = (const char*)pool->string8At(s, &len); - if (str == NULL) { - str = String8(pool->stringAt(s, &len)).string(); + String8 str = pool->string8ObjectAt(s); + printf("String #" ZD ": %s\n", (ZD_TYPE) s, str.string()); + } +} + +String8 StringPool::entry::makeConfigsString() const { + String8 configStr(configTypeName); + if (configStr.size() > 0) configStr.append(" "); + if (configs.size() > 0) { + for (size_t j=0; j<configs.size(); j++) { + if (j > 0) configStr.append(", "); + configStr.append(configs[j].toString()); } + } else { + configStr = "(none)"; + } + return configStr; +} - printf("String #" ZD ": %s\n", (ZD_TYPE) s, str); +int StringPool::entry::compare(const entry& o) const { + // Strings with styles go first, to reduce the size of the + // styles array. + if (hasStyles) { + return o.hasStyles ? 0 : -1; + } + if (o.hasStyles) { + return 1; + } + int comp = configTypeName.compare(o.configTypeName); + if (comp != 0) { + return comp; } + const size_t LHN = configs.size(); + const size_t RHN = o.configs.size(); + size_t i=0; + while (i < LHN && i < RHN) { + comp = configs[i].compareLogical(o.configs[i]); + if (comp != 0) { + return comp; + } + i++; + } + if (LHN < RHN) return -1; + else if (LHN > RHN) return 1; + return 0; } StringPool::StringPool(bool sorted, bool utf8) @@ -47,14 +103,16 @@ StringPool::StringPool(bool sorted, bool utf8) { } -ssize_t StringPool::add(const String16& value, bool mergeDuplicates) +ssize_t StringPool::add(const String16& value, bool mergeDuplicates, + const String8* configTypeName, const ResTable_config* config) { - return add(String16(), value, mergeDuplicates); + return add(String16(), value, mergeDuplicates, configTypeName, config); } -ssize_t StringPool::add(const String16& value, const Vector<entry_style_span>& spans) +ssize_t StringPool::add(const String16& value, const Vector<entry_style_span>& spans, + const String8* configTypeName, const ResTable_config* config) { - ssize_t res = add(String16(), value, false); + ssize_t res = add(String16(), value, false, configTypeName, config); if (res >= 0) { addStyleSpans(res, spans); } @@ -62,7 +120,7 @@ ssize_t StringPool::add(const String16& value, const Vector<entry_style_span>& s } ssize_t StringPool::add(const String16& ident, const String16& value, - bool mergeDuplicates) + bool mergeDuplicates, const String8* configTypeName, const ResTable_config* config) { if (ident.size() > 0) { ssize_t idx = mIdents.valueFor(ident); @@ -84,20 +142,43 @@ ssize_t StringPool::add(const String16& ident, const String16& value, } } + if (configTypeName != NULL) { + entry& ent = mEntries.editItemAt(eidx); + NOISY(printf("*** adding config type name %s, was %s\n", + configTypeName->string(), ent.configTypeName.string())); + if (ent.configTypeName.size() <= 0) { + ent.configTypeName = *configTypeName; + } else if (ent.configTypeName != *configTypeName) { + ent.configTypeName = " "; + } + } + + if (config != NULL) { + // Add this to the set of configs associated with the string. + entry& ent = mEntries.editItemAt(eidx); + size_t addPos; + for (addPos=0; addPos<ent.configs.size(); addPos++) { + int cmp = ent.configs.itemAt(addPos).compareLogical(*config); + if (cmp >= 0) { + if (cmp > 0) { + NOISY(printf("*** inserting config: %s\n", config->toString().string())); + ent.configs.insertAt(*config, addPos); + } + break; + } + } + if (addPos >= ent.configs.size()) { + NOISY(printf("*** adding config: %s\n", config->toString().string())); + ent.configs.add(*config); + } + } + const bool first = vidx < 0; if (first || !mergeDuplicates) { pos = mEntryArray.add(eidx); if (first) { vidx = mValues.add(value, pos); - const size_t N = mEntryArrayToValues.size(); - for (size_t i=0; i<N; i++) { - size_t& e = mEntryArrayToValues.editItemAt(i); - if ((ssize_t)e >= vidx) { - e++; - } - } } - mEntryArrayToValues.add(vidx); if (!mSorted) { entry& ent = mEntries.editItemAt(eidx); ent.indices.add(pos); @@ -147,6 +228,7 @@ status_t StringPool::addStyleSpan(size_t idx, const entry_style_span& span) entry_style& style = mEntryStyleArray.editItemAt(idx); style.spans.add(span); + mEntries.editItemAt(mEntryArray[idx]).hasStyles = true; return NO_ERROR; } @@ -169,6 +251,132 @@ size_t StringPool::countIdentifiers() const return mIdents.size(); } +int StringPool::config_sort(const size_t* lhs, const size_t* rhs, void* state) +{ + StringPool* pool = (StringPool*)state; + const entry& lhe = pool->mEntries[pool->mEntryArray[*lhs]]; + const entry& rhe = pool->mEntries[pool->mEntryArray[*rhs]]; + return lhe.compare(rhe); +} + +void StringPool::sortByConfig() +{ + LOG_ALWAYS_FATAL_IF(mSorted, "Can't sort string pool containing identifiers."); + LOG_ALWAYS_FATAL_IF(mIdents.size() > 0, "Can't sort string pool containing identifiers."); + LOG_ALWAYS_FATAL_IF(mOriginalPosToNewPos.size() > 0, "Can't sort string pool after already sorted."); + + const size_t N = mEntryArray.size(); + + // This is a vector that starts out with a 1:1 mapping to entries + // in the array, which we will sort to come up with the desired order. + // At that point it maps from the new position in the array to the + // original position the entry appeared. + Vector<size_t> newPosToOriginalPos; + for (size_t i=0; i<mEntryArray.size(); i++) { + newPosToOriginalPos.add(i); + } + + // Sort the array. + NOISY(printf("SORTING STRINGS BY CONFIGURATION...\n")); + newPosToOriginalPos.sort(config_sort, this); + NOISY(printf("DONE SORTING STRINGS BY CONFIGURATION.\n")); + + // Create the reverse mapping from the original position in the array + // to the new position where it appears in the sorted array. This is + // so that clients can re-map any positions they had previously stored. + mOriginalPosToNewPos = newPosToOriginalPos; + for (size_t i=0; i<N; i++) { + mOriginalPosToNewPos.editItemAt(newPosToOriginalPos[i]) = i; + } + +#if 0 + SortedVector<entry> entries; + + for (size_t i=0; i<N; i++) { + printf("#%d was %d: %s\n", i, newPosToOriginalPos[i], + mEntries[mEntryArray[newPosToOriginalPos[i]]].makeConfigsString().string()); + entries.add(mEntries[mEntryArray[i]]); + } + + for (size_t i=0; i<entries.size(); i++) { + printf("Sorted config #%d: %s\n", i, + entries[i].makeConfigsString().string()); + } +#endif + + // Now we rebuild the arrays. + Vector<entry> newEntries; + Vector<size_t> newEntryArray; + Vector<entry_style> newEntryStyleArray; + DefaultKeyedVector<size_t, size_t> origOffsetToNewOffset; + + for (size_t i=0; i<N; i++) { + // We are filling in new offset 'i'; oldI is where we can find it + // in the original data structure. + size_t oldI = newPosToOriginalPos[i]; + // This is the actual entry associated with the old offset. + const entry& oldEnt = mEntries[mEntryArray[oldI]]; + // This is the same entry the last time we added it to the + // new entry array, if any. + ssize_t newIndexOfOffset = origOffsetToNewOffset.indexOfKey(oldI); + size_t newOffset; + if (newIndexOfOffset < 0) { + // This is the first time we have seen the entry, so add + // it. + newOffset = newEntries.add(oldEnt); + newEntries.editItemAt(newOffset).indices.clear(); + } else { + // We have seen this entry before, use the existing one + // instead of adding it again. + newOffset = origOffsetToNewOffset.valueAt(newIndexOfOffset); + } + // Update the indices to include this new position. + newEntries.editItemAt(newOffset).indices.add(i); + // And add the offset of the entry to the new entry array. + newEntryArray.add(newOffset); + // Add any old style to the new style array. + if (mEntryStyleArray.size() > 0) { + if (oldI < mEntryStyleArray.size()) { + newEntryStyleArray.add(mEntryStyleArray[oldI]); + } else { + newEntryStyleArray.add(entry_style()); + } + } + } + + // Now trim any entries at the end of the new style array that are + // not needed. + for (ssize_t i=newEntryStyleArray.size()-1; i>=0; i--) { + const entry_style& style = newEntryStyleArray[i]; + if (style.spans.size() > 0) { + // That's it. + break; + } + // This one is not needed; remove. + newEntryStyleArray.removeAt(i); + } + + // All done, install the new data structures and upate mValues with + // the new positions. + mEntries = newEntries; + mEntryArray = newEntryArray; + mEntryStyleArray = newEntryStyleArray; + mValues.clear(); + for (size_t i=0; i<mEntries.size(); i++) { + const entry& ent = mEntries[i]; + mValues.add(ent.value, ent.indices[0]); + } + +#if 0 + printf("FINAL SORTED STRING CONFIGS:\n"); + for (size_t i=0; i<mEntries.size(); i++) { + const entry& ent = mEntries[i]; + printf("#" ZD " %s: %s\n", (ZD_TYPE)i, ent.makeConfigsString().string(), + String8(ent.value).string()); + } +#endif +} + sp<AaptFile> StringPool::createStringBlock() { sp<AaptFile> pool = new AaptFile(String8(), AaptGroupEntry(), diff --git a/tools/aapt/StringPool.h b/tools/aapt/StringPool.h index 727525976cd9..255bdbfc0a7f 100644 --- a/tools/aapt/StringPool.h +++ b/tools/aapt/StringPool.h @@ -40,12 +40,28 @@ class StringPool public: struct entry { entry() : offset(0) { } - entry(const String16& _value) : value(_value), offset(0) { } - entry(const entry& o) : value(o.value), offset(o.offset), indices(o.indices) { } + entry(const String16& _value) : value(_value), offset(0), hasStyles(false) { } + entry(const entry& o) : value(o.value), offset(o.offset), + hasStyles(o.hasStyles), indices(o.indices), + configTypeName(o.configTypeName), configs(o.configs) { } String16 value; size_t offset; + bool hasStyles; Vector<size_t> indices; + String8 configTypeName; + Vector<ResTable_config> configs; + + String8 makeConfigsString() const; + + int compare(const entry& o) const; + + inline bool operator<(const entry& o) const { return compare(o) < 0; } + inline bool operator<=(const entry& o) const { return compare(o) <= 0; } + inline bool operator==(const entry& o) const { return compare(o) == 0; } + inline bool operator!=(const entry& o) const { return compare(o) != 0; } + inline bool operator>=(const entry& o) const { return compare(o) >= 0; } + inline bool operator>(const entry& o) const { return compare(o) > 0; } }; struct entry_style_span { @@ -84,12 +100,15 @@ public: * if this string pool is sorted, the returned index will not be valid * when the pool is finally written. */ - ssize_t add(const String16& value, bool mergeDuplicates = false); + ssize_t add(const String16& value, bool mergeDuplicates = false, + const String8* configTypeName = NULL, const ResTable_config* config = NULL); - ssize_t add(const String16& value, const Vector<entry_style_span>& spans); + ssize_t add(const String16& value, const Vector<entry_style_span>& spans, + const String8* configTypeName = NULL, const ResTable_config* config = NULL); ssize_t add(const String16& ident, const String16& value, - bool mergeDuplicates = false); + bool mergeDuplicates = false, + const String8* configTypeName = NULL, const ResTable_config* config = NULL); status_t addStyleSpan(size_t idx, const String16& name, uint32_t start, uint32_t end); @@ -102,6 +121,18 @@ public: size_t countIdentifiers() const; + // Sort the contents of the string block by the configuration associated + // with each item. After doing this you can use mapOriginalPosToNewPos() + // to find out the new position given the position originall returned by + // add(). + void sortByConfig(); + + // For use after sortByConfig() to map from the original position of + // a string to its new sorted position. + size_t mapOriginalPosToNewPos(size_t originalPos) const { + return mOriginalPosToNewPos.itemAt(originalPos); + } + sp<AaptFile> createStringBlock(); status_t writeStringBlock(const sp<AaptFile>& pool); @@ -125,27 +156,41 @@ public: const Vector<size_t>* offsetsForString(const String16& val) const; private: + static int config_sort(const size_t* lhs, const size_t* rhs, void* state); + const bool mSorted; const bool mUTF8; - // Raw array of unique strings, in some arbitrary order. + + // The following data structures represent the actual structures + // that will be generated for the final string pool. + + // Raw array of unique strings, in some arbitrary order. This is the + // actual strings that appear in the final string pool, in the order + // that they will be written. Vector<entry> mEntries; // Array of indices into mEntries, in the order they were // added to the pool. This can be different than mEntries // if the same string was added multiple times (it will appear // once in mEntries, with multiple occurrences in this array). + // This is the lookup array that will be written for finding + // the string for each offset/position in the string pool. Vector<size_t> mEntryArray; // Optional style span information associated with each index of // mEntryArray. Vector<entry_style> mEntryStyleArray; - // Mapping from indices in mEntryArray to indices in mValues. - Vector<size_t> mEntryArrayToValues; + + // The following data structures are used for book-keeping as the + // string pool is constructed. + // Unique set of all the strings added to the pool, mapped to // the first index of mEntryArray where the value was added. DefaultKeyedVector<String16, ssize_t> mValues; // Unique set of all (optional) identifiers of strings in the // pool, mapping to indices in mEntries. DefaultKeyedVector<String16, ssize_t> mIdents; - + // This array maps from the original position a string was placed at + // in mEntryArray to its new position after being sorted with sortByConfig(). + Vector<size_t> mOriginalPosToNewPos; }; #endif diff --git a/tools/layoutlib/bridge/.settings/README.txt b/tools/layoutlib/bridge/.settings/README.txt new file mode 100644 index 000000000000..9120b20710a3 --- /dev/null +++ b/tools/layoutlib/bridge/.settings/README.txt @@ -0,0 +1,2 @@ +Copy this in eclipse project as a .settings folder at the root. +This ensure proper compilation compliance and warning/error levels.
\ No newline at end of file diff --git a/tools/layoutlib/bridge/.settings/org.eclipse.jdt.core.prefs b/tools/layoutlib/bridge/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000000..5381a0e16c7d --- /dev/null +++ b/tools/layoutlib/bridge/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,93 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.nonnull=com.android.annotations.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=com.android.annotations.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullisdefault=disabled +org.eclipse.jdt.core.compiler.annotation.nullable=com.android.annotations.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=error +org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentialNullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/tools/layoutlib/bridge/src/android/animation/AnimationThread.java b/tools/layoutlib/bridge/src/android/animation/AnimationThread.java index af83c61b2241..b46134ad4aa1 100644 --- a/tools/layoutlib/bridge/src/android/animation/AnimationThread.java +++ b/tools/layoutlib/bridge/src/android/animation/AnimationThread.java @@ -23,11 +23,10 @@ import com.android.ide.common.rendering.api.Result.Status; import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.impl.RenderSessionImpl; -import android.animation.ValueAnimator; import android.os.Handler; import android.os.Handler_Delegate; -import android.os.Message; import android.os.Handler_Delegate.IHandlerCallback; +import android.os.Message; import java.util.PriorityQueue; import java.util.Queue; @@ -57,6 +56,7 @@ public abstract class AnimationThread extends Thread { mUptimeMillis = uptimeMillis; } + @Override public int compareTo(MessageBundle bundle) { if (mUptimeMillis < bundle.mUptimeMillis) { return -1; @@ -85,6 +85,7 @@ public abstract class AnimationThread extends Thread { Bridge.prepareThread(); try { Handler_Delegate.setCallback(new IHandlerCallback() { + @Override public void sendMessageAtTime(Handler handler, Message msg, long uptimeMillis) { if (msg.what == ValueAnimator.ANIMATION_START /*|| FIXME: The ANIMATION_FRAME message no longer exists. Instead, diff --git a/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java index 9a8cf0462131..65a75b0ab25d 100644 --- a/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java @@ -105,6 +105,7 @@ public class BitmapShader_Delegate extends Shader_Delegate { mTileModeY = tileModeY; } + @Override public java.awt.PaintContext createContext( java.awt.image.ColorModel colorModel, java.awt.Rectangle deviceBounds, @@ -148,13 +149,16 @@ public class BitmapShader_Delegate extends Shader_Delegate { mColorModel = colorModel; } + @Override public void dispose() { } + @Override public java.awt.image.ColorModel getColorModel() { return mColorModel; } + @Override public java.awt.image.Raster getRaster(int x, int y, int w, int h) { java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(w, h, java.awt.image.BufferedImage.TYPE_INT_ARGB); @@ -240,6 +244,7 @@ public class BitmapShader_Delegate extends Shader_Delegate { } + @Override public int getTransparency() { return java.awt.Paint.TRANSLUCENT; } diff --git a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java index f7978366967d..16f15757f072 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java @@ -291,6 +291,7 @@ public final class Canvas_Delegate { Paint paint) { draw(thisCanvas.mNativeCanvas, paint.mNativePaint, false /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { + @Override public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) { for (int i = 0 ; i < count ; i += 4) { graphics.drawLine((int)pts[i + offset], (int)pts[i + offset + 1], @@ -619,6 +620,7 @@ public final class Canvas_Delegate { final int h = canvasDelegate.mBitmap.getImage().getHeight(); draw(nativeCanvas, new GcSnapshot.Drawable() { + @Override public void draw(Graphics2D graphics, Paint_Delegate paint) { // reset its transform just in case graphics.setTransform(new AffineTransform()); @@ -651,6 +653,7 @@ public final class Canvas_Delegate { draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { + @Override public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) { graphics.drawLine((int)startX, (int)startY, (int)stopX, (int)stopY); } @@ -669,6 +672,7 @@ public final class Canvas_Delegate { draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { + @Override public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) { int style = paintDelegate.getStyle(); @@ -693,6 +697,7 @@ public final class Canvas_Delegate { if (oval.right > oval.left && oval.bottom > oval.top) { draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { + @Override public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) { int style = paintDelegate.getStyle(); @@ -728,6 +733,7 @@ public final class Canvas_Delegate { if (oval.right > oval.left && oval.bottom > oval.top) { draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { + @Override public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) { int style = paintDelegate.getStyle(); @@ -757,6 +763,7 @@ public final class Canvas_Delegate { draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { + @Override public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) { int style = paintDelegate.getStyle(); @@ -789,6 +796,7 @@ public final class Canvas_Delegate { draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { + @Override public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) { Shape shape = pathDelegate.getJavaShape(); int style = paintDelegate.getStyle(); @@ -892,6 +900,7 @@ public final class Canvas_Delegate { draw(nativeCanvas, nativePaintOrZero, true /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { + @Override public void draw(Graphics2D graphics, Paint_Delegate paint) { if (paint != null && paint.isFilterBitmap()) { graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, @@ -931,6 +940,7 @@ public final class Canvas_Delegate { final AffineTransform mtx = matrixDelegate.getAffineTransform(); canvasDelegate.getSnapshot().draw(new GcSnapshot.Drawable() { + @Override public void draw(Graphics2D graphics, Paint_Delegate paint) { if (paint != null && paint.isFilterBitmap()) { graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, @@ -970,6 +980,7 @@ public final class Canvas_Delegate { final float startX, final float startY, int flags, int paint) { draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { + @Override public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) { // WARNING: the logic in this method is similar to Paint_Delegate.measureText. // Any change to this method should be reflected in Paint.measureText @@ -1279,6 +1290,7 @@ public final class Canvas_Delegate { draw(nativeCanvas, nativePaintOrZero, true /*compositeOnly*/, sBoolOut[0], new GcSnapshot.Drawable() { + @Override public void draw(Graphics2D graphics, Paint_Delegate paint) { if (paint != null && paint.isFilterBitmap()) { graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, diff --git a/tools/layoutlib/bridge/src/android/graphics/Gradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Gradient_Delegate.java index 38c092d8572b..7475c22bf58c 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Gradient_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Gradient_Delegate.java @@ -87,6 +87,7 @@ public abstract class Gradient_Delegate extends Shader_Delegate { mTileMode = tileMode; } + @Override public int getTransparency() { return java.awt.Paint.TRANSLUCENT; } diff --git a/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java index a2ba758a7e0c..f117fca52cc1 100644 --- a/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java @@ -132,6 +132,7 @@ public final class LinearGradient_Delegate extends Gradient_Delegate { mDSize2 = mDx * mDx + mDy * mDy; } + @Override public java.awt.PaintContext createContext( java.awt.image.ColorModel colorModel, java.awt.Rectangle deviceBounds, @@ -176,13 +177,16 @@ public final class LinearGradient_Delegate extends Gradient_Delegate { mColorModel = colorModel; } + @Override public void dispose() { } + @Override public java.awt.image.ColorModel getColorModel() { return mColorModel; } + @Override public java.awt.image.Raster getRaster(int x, int y, int w, int h) { java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(w, h, java.awt.image.BufferedImage.TYPE_INT_ARGB); diff --git a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java index 5e882ce44390..be27b54bb828 100644 --- a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java @@ -215,6 +215,7 @@ public final class NinePatch_Delegate { Paint_Delegate paint_delegate = Paint_Delegate.getDelegate(paint_instance_or_null); canvas_delegate.getSnapshot().draw(new GcSnapshot.Drawable() { + @Override public void draw(Graphics2D graphics, Paint_Delegate paint) { chunkObject.draw(bitmap_delegate.getImage(), graphics, left, top, right - left, bottom - top, destDensity, srcDensity); diff --git a/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java index 9bf78b4c7249..3fe45fae2a3d 100644 --- a/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java @@ -118,6 +118,7 @@ public class RadialGradient_Delegate extends Gradient_Delegate { mRadius = radius; } + @Override public java.awt.PaintContext createContext( java.awt.image.ColorModel colorModel, java.awt.Rectangle deviceBounds, @@ -162,13 +163,16 @@ public class RadialGradient_Delegate extends Gradient_Delegate { mColorModel = colorModel; } + @Override public void dispose() { } + @Override public java.awt.image.ColorModel getColorModel() { return mColorModel; } + @Override public java.awt.image.Raster getRaster(int x, int y, int w, int h) { java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(w, h, java.awt.image.BufferedImage.TYPE_INT_ARGB); diff --git a/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java index 966e06e4a8b2..13ae12e5a9fa 100644 --- a/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java @@ -110,6 +110,7 @@ public class SweepGradient_Delegate extends Gradient_Delegate { mCy = cy; } + @Override public java.awt.PaintContext createContext( java.awt.image.ColorModel colorModel, java.awt.Rectangle deviceBounds, @@ -154,13 +155,16 @@ public class SweepGradient_Delegate extends Gradient_Delegate { mColorModel = colorModel; } + @Override public void dispose() { } + @Override public java.awt.image.ColorModel getColorModel() { return mColorModel; } + @Override public java.awt.image.Raster getRaster(int x, int y, int w, int h) { java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(w, h, java.awt.image.BufferedImage.TYPE_INT_ARGB); diff --git a/tools/layoutlib/bridge/src/android/view/SurfaceView.java b/tools/layoutlib/bridge/src/android/view/SurfaceView.java index ce32da94badc..6aa4b3b2eb26 100644 --- a/tools/layoutlib/bridge/src/android/view/SurfaceView.java +++ b/tools/layoutlib/bridge/src/android/view/SurfaceView.java @@ -27,7 +27,7 @@ import android.util.AttributeSet; * Mock version of the SurfaceView. * Only non override public methods from the real SurfaceView have been added in there. * Methods that take an unknown class as parameter or as return object, have been removed for now. - * + * * TODO: generate automatically. * */ @@ -36,7 +36,7 @@ public class SurfaceView extends MockView { public SurfaceView(Context context) { this(context, null); } - + public SurfaceView(Context context, AttributeSet attrs) { this(context, attrs , 0); } @@ -44,53 +44,66 @@ public class SurfaceView extends MockView { public SurfaceView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } - + public SurfaceHolder getHolder() { return mSurfaceHolder; } private SurfaceHolder mSurfaceHolder = new SurfaceHolder() { - + + @Override public boolean isCreating() { return false; } + @Override public void addCallback(Callback callback) { } + @Override public void removeCallback(Callback callback) { } - + + @Override public void setFixedSize(int width, int height) { } + @Override public void setSizeFromLayout() { } + @Override public void setFormat(int format) { } + @Override public void setType(int type) { } + @Override public void setKeepScreenOn(boolean screenOn) { } - + + @Override public Canvas lockCanvas() { return null; } + @Override public Canvas lockCanvas(Rect dirty) { return null; } + @Override public void unlockCanvasAndPost(Canvas canvas) { } + @Override public Surface getSurface() { return null; } + @Override public Rect getSurfaceFrame() { return null; } diff --git a/tools/layoutlib/bridge/src/com/android/internal/textservice/ITextServicesManager_Stub_Delegate.java b/tools/layoutlib/bridge/src/com/android/internal/textservice/ITextServicesManager_Stub_Delegate.java index 9efdcaffe70a..3017292d8337 100644 --- a/tools/layoutlib/bridge/src/com/android/internal/textservice/ITextServicesManager_Stub_Delegate.java +++ b/tools/layoutlib/bridge/src/com/android/internal/textservice/ITextServicesManager_Stub_Delegate.java @@ -43,28 +43,33 @@ public class ITextServicesManager_Stub_Delegate { private static class FakeTextServicesManager implements ITextServicesManager { + @Override public void finishSpellCheckerService(ISpellCheckerSessionListener arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public SpellCheckerInfo getCurrentSpellChecker(String arg0) throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public SpellCheckerSubtype getCurrentSpellCheckerSubtype(String arg0, boolean arg1) throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public SpellCheckerInfo[] getEnabledSpellCheckers() throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public void getSpellCheckerService(String arg0, String arg1, ITextServicesSessionListener arg2, ISpellCheckerSessionListener arg3, Bundle arg4) throws RemoteException { @@ -72,26 +77,31 @@ public class ITextServicesManager_Stub_Delegate { } + @Override public boolean isSpellCheckerEnabled() throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public void setCurrentSpellChecker(String arg0, String arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setCurrentSpellCheckerSubtype(String arg0, int arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setSpellCheckerEnabled(boolean arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public IBinder asBinder() { // TODO Auto-generated method stub return null; diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContentProvider.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContentProvider.java index c64ab657ac05..e28866e58891 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContentProvider.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContentProvider.java @@ -19,7 +19,7 @@ package com.android.layoutlib.bridge.android; import android.content.ContentProviderOperation; import android.content.ContentProviderResult; import android.content.ContentValues; -import android.content.ICancelationSignal; +import android.content.ICancellationSignal; import android.content.IContentProvider; import android.content.OperationApplicationException; import android.content.res.AssetFileDescriptor; @@ -92,7 +92,7 @@ public final class BridgeContentProvider implements IContentProvider { @Override public Cursor query(Uri arg0, String[] arg1, String arg2, String[] arg3, String arg4, - ICancelationSignal arg5) throws RemoteException { + ICancellationSignal arg5) throws RemoteException { // TODO Auto-generated method stub return null; } @@ -124,7 +124,7 @@ public final class BridgeContentProvider implements IContentProvider { } @Override - public ICancelationSignal createCancelationSignal() throws RemoteException { + public ICancellationSignal createCancellationSignal() throws RemoteException { // TODO Auto-generated method stub return null; } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java index 2a52888d2d29..db0694c8707d 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java @@ -37,151 +37,179 @@ import java.util.List; */ public class BridgeIInputMethodManager implements IInputMethodManager { + @Override public void addClient(IInputMethodClient arg0, IInputContext arg1, int arg2, int arg3) throws RemoteException { // TODO Auto-generated method stub } + @Override public void finishInput(IInputMethodClient arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public InputMethodSubtype getCurrentInputMethodSubtype() throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public List<InputMethodInfo> getEnabledInputMethodList() throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(InputMethodInfo arg0, boolean arg1) throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public List<InputMethodInfo> getInputMethodList() throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public InputMethodSubtype getLastInputMethodSubtype() throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public List getShortcutInputMethodsAndSubtypes() throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public void hideMySoftInput(IBinder arg0, int arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public boolean hideSoftInput(IInputMethodClient arg0, int arg1, ResultReceiver arg2) throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public boolean notifySuggestionPicked(SuggestionSpan arg0, String arg1, int arg2) throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public void registerSuggestionSpansForNotification(SuggestionSpan[] arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void removeClient(IInputMethodClient arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setAdditionalInputMethodSubtypes(String arg0, InputMethodSubtype[] arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public boolean setCurrentInputMethodSubtype(InputMethodSubtype arg0) throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public void setImeWindowStatus(IBinder arg0, int arg1, int arg2) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setInputMethod(IBinder arg0, String arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setInputMethodAndSubtype(IBinder arg0, String arg1, InputMethodSubtype arg2) throws RemoteException { // TODO Auto-generated method stub } + @Override public boolean setInputMethodEnabled(String arg0, boolean arg1) throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public void showInputMethodAndSubtypeEnablerFromClient(IInputMethodClient arg0, String arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public void showInputMethodPickerFromClient(IInputMethodClient arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void showMySoftInput(IBinder arg0, int arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public boolean showSoftInput(IInputMethodClient arg0, int arg1, ResultReceiver arg2) throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public InputBindResult startInput(IInputMethodClient arg0, IInputContext arg1, EditorInfo arg2, boolean arg3, boolean arg4) throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public boolean switchToLastInputMethod(IBinder arg0) throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public void updateStatusIcon(IBinder arg0, String arg1, int arg2) throws RemoteException { // TODO Auto-generated method stub } + @Override public void windowGainedFocus(IInputMethodClient arg0, IBinder arg1, boolean arg2, boolean arg3, int arg4, boolean arg5, int arg6) throws RemoteException { // TODO Auto-generated method stub } + @Override public IBinder asBinder() { // TODO Auto-generated method stub return null; diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeLayoutParamsMapAttributes.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeLayoutParamsMapAttributes.java index d2084083981a..f5912e7bdb24 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeLayoutParamsMapAttributes.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeLayoutParamsMapAttributes.java @@ -37,6 +37,7 @@ public class BridgeLayoutParamsMapAttributes implements AttributeSet { mAttributes = attributes; } + @Override public String getAttributeValue(String namespace, String name) { if (BridgeConstants.NS_RESOURCES.equals(namespace)) { return mAttributes.get(name); @@ -49,93 +50,114 @@ public class BridgeLayoutParamsMapAttributes implements AttributeSet { // BridgeContext#obtainStyledAttributes(AttributeSet, int[], int, int) // Should they ever be called, we'll just implement them on a need basis. + @Override public int getAttributeCount() { throw new UnsupportedOperationException(); } + @Override public String getAttributeName(int index) { throw new UnsupportedOperationException(); } + @Override public String getAttributeValue(int index) { throw new UnsupportedOperationException(); } + @Override public String getPositionDescription() { throw new UnsupportedOperationException(); } + @Override public int getAttributeNameResource(int index) { throw new UnsupportedOperationException(); } + @Override public int getAttributeListValue(String namespace, String attribute, String[] options, int defaultValue) { throw new UnsupportedOperationException(); } + @Override public boolean getAttributeBooleanValue(String namespace, String attribute, boolean defaultValue) { throw new UnsupportedOperationException(); } + @Override public int getAttributeResourceValue(String namespace, String attribute, int defaultValue) { throw new UnsupportedOperationException(); } + @Override public int getAttributeIntValue(String namespace, String attribute, int defaultValue) { throw new UnsupportedOperationException(); } + @Override public int getAttributeUnsignedIntValue(String namespace, String attribute, int defaultValue) { throw new UnsupportedOperationException(); } + @Override public float getAttributeFloatValue(String namespace, String attribute, float defaultValue) { throw new UnsupportedOperationException(); } + @Override public int getAttributeListValue(int index, String[] options, int defaultValue) { throw new UnsupportedOperationException(); } + @Override public boolean getAttributeBooleanValue(int index, boolean defaultValue) { throw new UnsupportedOperationException(); } + @Override public int getAttributeResourceValue(int index, int defaultValue) { throw new UnsupportedOperationException(); } + @Override public int getAttributeIntValue(int index, int defaultValue) { throw new UnsupportedOperationException(); } + @Override public int getAttributeUnsignedIntValue(int index, int defaultValue) { throw new UnsupportedOperationException(); } + @Override public float getAttributeFloatValue(int index, float defaultValue) { throw new UnsupportedOperationException(); } + @Override public String getIdAttribute() { throw new UnsupportedOperationException(); } + @Override public String getClassAttribute() { throw new UnsupportedOperationException(); } + @Override public int getIdAttributeResourceValue(int defaultValue) { throw new UnsupportedOperationException(); } + @Override public int getStyleAttribute() { throw new UnsupportedOperationException(); } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java index e13380e7e2dd..79606a48f134 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java @@ -24,72 +24,67 @@ import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.view.DragEvent; import android.view.IWindow; -import android.view.KeyEvent; -import android.view.MotionEvent; /** * Implementation of {@link IWindow} to pass to the AttachInfo. */ public final class BridgeWindow implements IWindow { + @Override public void dispatchAppVisibility(boolean arg0) throws RemoteException { // pass for now. } + @Override public void dispatchGetNewSurface() throws RemoteException { // pass for now. } - - public void dispatchKey(KeyEvent arg0) throws RemoteException { - // pass for now. - } - - public void dispatchPointer(MotionEvent arg0, long arg1, boolean arg2) throws RemoteException { - // pass for now. - } - - public void dispatchTrackball(MotionEvent arg0, long arg1, boolean arg2) - throws RemoteException { - // pass for now. - } - + @Override public void executeCommand(String arg0, String arg1, ParcelFileDescriptor arg2) throws RemoteException { // pass for now. } + @Override public void resized(int arg0, int arg1, Rect arg2, Rect arg3, boolean arg4, Configuration arg5) throws RemoteException { // pass for now. } + @Override public void windowFocusChanged(boolean arg0, boolean arg1) throws RemoteException { // pass for now. } + @Override public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync) { // pass for now. } + @Override public void dispatchWallpaperCommand(String action, int x, int y, int z, Bundle extras, boolean sync) { // pass for now. } + @Override public void closeSystemDialogs(String reason) { // pass for now. } + @Override public void dispatchDragEvent(DragEvent event) { // pass for now. } + @Override public void dispatchSystemUiVisibilityChanged(int seq, int globalUi, int localValue, int localChanges) { // pass for now. } + @Override public IBinder asBinder() { // pass for now. return null; diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java index 516725e02174..bef2c95b4d6a 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java @@ -67,288 +67,345 @@ public class BridgeWindowManager implements IWindowManager { // ---- implementation of IWindowManager that we care about ---- + @Override public int getRotation() throws RemoteException { return mRotation; } + @Override public int getMaximumSizeDimension() throws RemoteException { return 0; } + @Override public void getDisplaySize(Point arg0) throws RemoteException { } + @Override public void getRealDisplaySize(Point arg0) throws RemoteException { } // ---- unused implementation of IWindowManager ---- + @Override public boolean canStatusBarHide() throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public void addAppToken(int arg0, IApplicationToken arg1, int arg2, int arg3, boolean arg4) throws RemoteException { // TODO Auto-generated method stub } + @Override public void addWindowToken(IBinder arg0, int arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public void clearForcedDisplaySize() throws RemoteException { // TODO Auto-generated method stub } + @Override public void closeSystemDialogs(String arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void disableKeyguard(IBinder arg0, String arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public void executeAppTransition() throws RemoteException { // TODO Auto-generated method stub } + @Override public void exitKeyguardSecurely(IOnKeyguardExitResult arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void freezeRotation(int arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public float getAnimationScale(int arg0) throws RemoteException { // TODO Auto-generated method stub return 0; } + @Override public float[] getAnimationScales() throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public int getAppOrientation(IApplicationToken arg0) throws RemoteException { // TODO Auto-generated method stub return 0; } + @Override public int getDPadKeycodeState(int arg0) throws RemoteException { // TODO Auto-generated method stub return 0; } + @Override public int getDPadScancodeState(int arg0) throws RemoteException { // TODO Auto-generated method stub return 0; } + @Override public InputDevice getInputDevice(int arg0) throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public int[] getInputDeviceIds() throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public int getKeycodeState(int arg0) throws RemoteException { // TODO Auto-generated method stub return 0; } + @Override public int getKeycodeStateForDevice(int arg0, int arg1) throws RemoteException { // TODO Auto-generated method stub return 0; } + @Override public int getPendingAppTransition() throws RemoteException { // TODO Auto-generated method stub return 0; } + @Override public int getScancodeState(int arg0) throws RemoteException { // TODO Auto-generated method stub return 0; } + @Override public int getScancodeStateForDevice(int arg0, int arg1) throws RemoteException { // TODO Auto-generated method stub return 0; } + @Override public int getSwitchState(int arg0) throws RemoteException { // TODO Auto-generated method stub return 0; } + @Override public int getSwitchStateForDevice(int arg0, int arg1) throws RemoteException { // TODO Auto-generated method stub return 0; } + @Override public int getTrackballKeycodeState(int arg0) throws RemoteException { // TODO Auto-generated method stub return 0; } + @Override public int getTrackballScancodeState(int arg0) throws RemoteException { // TODO Auto-generated method stub return 0; } + @Override public boolean hasKeys(int[] arg0, boolean[] arg1) throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public boolean inKeyguardRestrictedInputMode() throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public boolean injectInputEventNoWait(InputEvent arg0) throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public boolean injectKeyEvent(KeyEvent arg0, boolean arg1) throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public boolean injectPointerEvent(MotionEvent arg0, boolean arg1) throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public boolean injectTrackballEvent(MotionEvent arg0, boolean arg1) throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public boolean inputMethodClientHasFocus(IInputMethodClient arg0) throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public boolean isKeyguardLocked() throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public boolean isKeyguardSecure() throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public boolean isViewServerRunning() throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public InputChannel monitorInput(String arg0) throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public void moveAppToken(int arg0, IBinder arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public void moveAppTokensToBottom(List<IBinder> arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void moveAppTokensToTop(List<IBinder> arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public IWindowSession openSession(IInputMethodClient arg0, IInputContext arg1) throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public void overridePendingAppTransition(String arg0, int arg1, int arg2) throws RemoteException { // TODO Auto-generated method stub } + @Override public void pauseKeyDispatching(IBinder arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void prepareAppTransition(int arg0, boolean arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public void reenableKeyguard(IBinder arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void removeAppToken(IBinder arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void removeWindowToken(IBinder arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void resumeKeyDispatching(IBinder arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public Bitmap screenshotApplications(IBinder arg0, int arg1, int arg2) throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public void setAnimationScale(int arg0, float arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setAnimationScales(float[] arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setAppGroupId(IBinder arg0, int arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setAppOrientation(IApplicationToken arg0, int arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setAppStartingWindow(IBinder arg0, String arg1, int arg2, CompatibilityInfo arg3, CharSequence arg4, int arg5, int arg6, int arg7, IBinder arg8, boolean arg9) throws RemoteException { @@ -356,122 +413,147 @@ public class BridgeWindowManager implements IWindowManager { } + @Override public void setAppVisibility(IBinder arg0, boolean arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setAppWillBeHidden(IBinder arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setEventDispatching(boolean arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setFocusedApp(IBinder arg0, boolean arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setForcedDisplaySize(int arg0, int arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setInTouchMode(boolean arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setNewConfiguration(Configuration arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setPointerSpeed(int arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void updateRotation(boolean arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void setStrictModeVisualIndicatorPreference(String arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void showStrictModeViolation(boolean arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void startAppFreezingScreen(IBinder arg0, int arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public boolean startViewServer(int arg0) throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public void statusBarVisibilityChanged(int arg0) throws RemoteException { // TODO Auto-generated method stub } + @Override public void stopAppFreezingScreen(IBinder arg0, boolean arg1) throws RemoteException { // TODO Auto-generated method stub } + @Override public boolean stopViewServer() throws RemoteException { // TODO Auto-generated method stub return false; } + @Override public void thawRotation() throws RemoteException { // TODO Auto-generated method stub } + @Override public Configuration updateOrientationFromAppTokens(Configuration arg0, IBinder arg1) throws RemoteException { // TODO Auto-generated method stub return null; } + @Override public int watchRotation(IRotationWatcher arg0) throws RemoteException { // TODO Auto-generated method stub return 0; } + @Override public void waitForWindowDrawn(IBinder token, IRemoteCallback callback) { // TODO Auto-generated method stub } - + + @Override public IBinder asBinder() { // TODO Auto-generated method stub return null; } + @Override public int getPreferredOptionsPanelGravity() throws RemoteException { return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM; } + @Override public void dismissKeyguard() { } + @Override public boolean hasNavigationBar() { return false; // should this return something else? } + @Override public void lockNow() { // TODO Auto-generated method stub } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java index a640a9139be8..d3721ed10f70 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java @@ -26,7 +26,6 @@ import android.os.RemoteException; import android.view.IWindow; import android.view.IWindowSession; import android.view.InputChannel; -import android.view.MotionEvent; import android.view.Surface; import android.view.SurfaceView; import android.view.WindowManager.LayoutParams; @@ -37,6 +36,7 @@ import android.view.WindowManager.LayoutParams; */ public final class BridgeWindowSession implements IWindowSession { + @Override public int add(IWindow arg0, int seq, LayoutParams arg1, int arg2, Rect arg3, InputChannel outInputchannel) throws RemoteException { @@ -44,40 +44,30 @@ public final class BridgeWindowSession implements IWindowSession { return 0; } + @Override public int addWithoutInputChannel(IWindow arg0, int seq, LayoutParams arg1, int arg2, Rect arg3) throws RemoteException { // pass for now. return 0; } + @Override public void finishDrawing(IWindow arg0) throws RemoteException { // pass for now. } - public void finishKey(IWindow arg0) throws RemoteException { - // pass for now. - } - + @Override public boolean getInTouchMode() throws RemoteException { // pass for now. return false; } + @Override public boolean performHapticFeedback(IWindow window, int effectId, boolean always) { // pass for now. return false; } - - public MotionEvent getPendingPointerMove(IWindow arg0) throws RemoteException { - // pass for now. - return null; - } - - public MotionEvent getPendingTrackballMove(IWindow arg0) throws RemoteException { - // pass for now. - return null; - } - + @Override public int relayout(IWindow arg0, int seq, LayoutParams arg1, int arg2, int arg3, int arg4, int arg4_5, Rect arg5, Rect arg6, Rect arg7, Configuration arg7b, Surface arg8) throws RemoteException { @@ -85,35 +75,43 @@ public final class BridgeWindowSession implements IWindowSession { return 0; } + @Override public void performDeferredDestroy(IWindow window) { // pass for now. } + @Override public boolean outOfMemory(IWindow window) throws RemoteException { return false; } + @Override public void getDisplayFrame(IWindow window, Rect outDisplayFrame) { // pass for now. } + @Override public void remove(IWindow arg0) throws RemoteException { // pass for now. } + @Override public void setInTouchMode(boolean arg0) throws RemoteException { // pass for now. } + @Override public void setTransparentRegion(IWindow arg0, Region arg1) throws RemoteException { // pass for now. } + @Override public void setInsets(IWindow window, int touchable, Rect contentInsets, Rect visibleInsets, Region touchableRegion) { // pass for now. } + @Override public IBinder prepareDrag(IWindow window, int flags, int thumbnailWidth, int thumbnailHeight, Surface outSurface) throws RemoteException { @@ -121,6 +119,7 @@ public final class BridgeWindowSession implements IWindowSession { return null; } + @Override public boolean performDrag(IWindow window, IBinder dragToken, float touchX, float touchY, float thumbCenterX, float thumbCenterY, ClipData data) @@ -129,49 +128,47 @@ public final class BridgeWindowSession implements IWindowSession { return false; } + @Override public void reportDropResult(IWindow window, boolean consumed) throws RemoteException { // pass for now } + @Override public void dragRecipientEntered(IWindow window) throws RemoteException { // pass for now } + @Override public void dragRecipientExited(IWindow window) throws RemoteException { // pass for now } + @Override public void setWallpaperPosition(IBinder window, float x, float y, float xStep, float yStep) { // pass for now. } + @Override public void wallpaperOffsetsComplete(IBinder window) { // pass for now. } + @Override public Bundle sendWallpaperCommand(IBinder window, String action, int x, int y, int z, Bundle extras, boolean sync) { // pass for now. return null; } + @Override public void wallpaperCommandComplete(IBinder window, Bundle result) { // pass for now. } - public void closeSystemDialogs(String reason) { - // pass for now. - } - + @Override public IBinder asBinder() { // pass for now. return null; } - - public IBinder prepareDrag(IWindow arg0, boolean arg1, int arg2, int arg3, Surface arg4) - throws RemoteException { - // TODO Auto-generated method stub - return null; - } } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlBlockParser.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlBlockParser.java index f8ed4f70a9f3..ac8712eaa025 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlBlockParser.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlBlockParser.java @@ -95,6 +95,7 @@ public class BridgeXmlBlockParser implements XmlResourceParser { // ------- XmlResourceParser implementation + @Override public void setFeature(String name, boolean state) throws XmlPullParserException { if (FEATURE_PROCESS_NAMESPACES.equals(name) && state) { @@ -106,6 +107,7 @@ public class BridgeXmlBlockParser implements XmlResourceParser { throw new XmlPullParserException("Unsupported feature: " + name); } + @Override public boolean getFeature(String name) { if (FEATURE_PROCESS_NAMESPACES.equals(name)) { return true; @@ -116,82 +118,101 @@ public class BridgeXmlBlockParser implements XmlResourceParser { return false; } + @Override public void setProperty(String name, Object value) throws XmlPullParserException { throw new XmlPullParserException("setProperty() not supported"); } + @Override public Object getProperty(String name) { return null; } + @Override public void setInput(Reader in) throws XmlPullParserException { mParser.setInput(in); } + @Override public void setInput(InputStream inputStream, String inputEncoding) throws XmlPullParserException { mParser.setInput(inputStream, inputEncoding); } + @Override public void defineEntityReplacementText(String entityName, String replacementText) throws XmlPullParserException { throw new XmlPullParserException( "defineEntityReplacementText() not supported"); } + @Override public String getNamespacePrefix(int pos) throws XmlPullParserException { throw new XmlPullParserException("getNamespacePrefix() not supported"); } + @Override public String getInputEncoding() { return null; } + @Override public String getNamespace(String prefix) { throw new RuntimeException("getNamespace() not supported"); } + @Override public int getNamespaceCount(int depth) throws XmlPullParserException { throw new XmlPullParserException("getNamespaceCount() not supported"); } + @Override public String getPositionDescription() { return "Binary XML file line #" + getLineNumber(); } + @Override public String getNamespaceUri(int pos) throws XmlPullParserException { throw new XmlPullParserException("getNamespaceUri() not supported"); } + @Override public int getColumnNumber() { return -1; } + @Override public int getDepth() { return mParser.getDepth(); } + @Override public String getText() { return mParser.getText(); } + @Override public int getLineNumber() { return mParser.getLineNumber(); } + @Override public int getEventType() { return mEventType; } + @Override public boolean isWhitespace() throws XmlPullParserException { // Original comment: whitespace was stripped by aapt. return mParser.isWhitespace(); } + @Override public String getPrefix() { throw new RuntimeException("getPrefix not supported"); } + @Override public char[] getTextCharacters(int[] holderForStartAndLength) { String txt = getText(); char[] chars = null; @@ -204,55 +225,68 @@ public class BridgeXmlBlockParser implements XmlResourceParser { return chars; } + @Override public String getNamespace() { return mParser.getNamespace(); } + @Override public String getName() { return mParser.getName(); } + @Override public String getAttributeNamespace(int index) { return mParser.getAttributeNamespace(index); } + @Override public String getAttributeName(int index) { return mParser.getAttributeName(index); } + @Override public String getAttributePrefix(int index) { throw new RuntimeException("getAttributePrefix not supported"); } + @Override public boolean isEmptyElementTag() { // XXX Need to detect this. return false; } + @Override public int getAttributeCount() { return mParser.getAttributeCount(); } + @Override public String getAttributeValue(int index) { return mParser.getAttributeValue(index); } + @Override public String getAttributeType(int index) { return "CDATA"; } + @Override public boolean isAttributeDefault(int index) { return false; } + @Override public int nextToken() throws XmlPullParserException, IOException { return next(); } + @Override public String getAttributeValue(String namespace, String name) { return mParser.getAttributeValue(namespace, name); } + @Override public int next() throws XmlPullParserException, IOException { if (!mStarted) { mStarted = true; @@ -313,6 +347,7 @@ public class BridgeXmlBlockParser implements XmlResourceParser { return "????"; } + @Override public void require(int type, String namespace, String name) throws XmlPullParserException { if (type != getEventType() @@ -322,6 +357,7 @@ public class BridgeXmlBlockParser implements XmlResourceParser { + getPositionDescription()); } + @Override public String nextText() throws XmlPullParserException, IOException { if (getEventType() != START_TAG) { throw new XmlPullParserException(getPositionDescription() @@ -348,6 +384,7 @@ public class BridgeXmlBlockParser implements XmlResourceParser { } } + @Override public int nextTag() throws XmlPullParserException, IOException { int eventType = next(); if (eventType == TEXT && isWhitespace()) { // skip whitespace @@ -363,76 +400,94 @@ public class BridgeXmlBlockParser implements XmlResourceParser { // AttributeSet implementation + @Override public void close() { // pass } + @Override public boolean getAttributeBooleanValue(int index, boolean defaultValue) { return mAttrib.getAttributeBooleanValue(index, defaultValue); } + @Override public boolean getAttributeBooleanValue(String namespace, String attribute, boolean defaultValue) { return mAttrib.getAttributeBooleanValue(namespace, attribute, defaultValue); } + @Override public float getAttributeFloatValue(int index, float defaultValue) { return mAttrib.getAttributeFloatValue(index, defaultValue); } + @Override public float getAttributeFloatValue(String namespace, String attribute, float defaultValue) { return mAttrib.getAttributeFloatValue(namespace, attribute, defaultValue); } + @Override public int getAttributeIntValue(int index, int defaultValue) { return mAttrib.getAttributeIntValue(index, defaultValue); } + @Override public int getAttributeIntValue(String namespace, String attribute, int defaultValue) { return mAttrib.getAttributeIntValue(namespace, attribute, defaultValue); } + @Override public int getAttributeListValue(int index, String[] options, int defaultValue) { return mAttrib.getAttributeListValue(index, options, defaultValue); } + @Override public int getAttributeListValue(String namespace, String attribute, String[] options, int defaultValue) { return mAttrib.getAttributeListValue(namespace, attribute, options, defaultValue); } + @Override public int getAttributeNameResource(int index) { return mAttrib.getAttributeNameResource(index); } + @Override public int getAttributeResourceValue(int index, int defaultValue) { return mAttrib.getAttributeResourceValue(index, defaultValue); } + @Override public int getAttributeResourceValue(String namespace, String attribute, int defaultValue) { return mAttrib.getAttributeResourceValue(namespace, attribute, defaultValue); } + @Override public int getAttributeUnsignedIntValue(int index, int defaultValue) { return mAttrib.getAttributeUnsignedIntValue(index, defaultValue); } + @Override public int getAttributeUnsignedIntValue(String namespace, String attribute, int defaultValue) { return mAttrib.getAttributeUnsignedIntValue(namespace, attribute, defaultValue); } + @Override public String getClassAttribute() { return mAttrib.getClassAttribute(); } + @Override public String getIdAttribute() { return mAttrib.getIdAttribute(); } + @Override public int getIdAttributeResourceValue(int defaultValue) { return mAttrib.getIdAttributeResourceValue(defaultValue); } + @Override public int getStyleAttribute() { return mAttrib.getStyleAttribute(); } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java index d5400d7f3b65..6840f468bc5c 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java @@ -33,10 +33,10 @@ import com.android.ide.common.rendering.api.RenderSession; import com.android.ide.common.rendering.api.ResourceReference; import com.android.ide.common.rendering.api.ResourceValue; import com.android.ide.common.rendering.api.Result; -import com.android.ide.common.rendering.api.SessionParams; -import com.android.ide.common.rendering.api.ViewInfo; import com.android.ide.common.rendering.api.Result.Status; +import com.android.ide.common.rendering.api.SessionParams; import com.android.ide.common.rendering.api.SessionParams.RenderingMode; +import com.android.ide.common.rendering.api.ViewInfo; import com.android.internal.util.XmlUtils; import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.android.BridgeContext; @@ -69,8 +69,8 @@ import android.util.TypedValue; import android.view.AttachInfo_Accessor; import android.view.BridgeInflater; import android.view.View; -import android.view.ViewGroup; import android.view.View.MeasureSpec; +import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.ViewGroup.MarginLayoutParams; import android.widget.AbsListView; @@ -82,8 +82,8 @@ import android.widget.LinearLayout; import android.widget.ListView; import android.widget.QuickContactBadge; import android.widget.TabHost; -import android.widget.TabWidget; import android.widget.TabHost.TabSpec; +import android.widget.TabWidget; import java.awt.AlphaComposite; import java.awt.Color; @@ -835,6 +835,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { previousTransition.addTransitionListener(new TransitionListener() { private int mChangeDisappearingCount = 0; + @Override public void startTransition(LayoutTransition transition, ViewGroup container, View view, int transitionType) { if (transitionType == LayoutTransition.CHANGE_DISAPPEARING) { @@ -842,6 +843,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { } } + @Override public void endTransition(LayoutTransition transition, ViewGroup container, View view, int transitionType) { if (transitionType == LayoutTransition.CHANGE_DISAPPEARING) { @@ -1227,6 +1229,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { TabSpec spec = tabHost.newTabSpec("tag").setIndicator("Tab Label", tabHost.getResources().getDrawable(android.R.drawable.ic_menu_info_details)) .setContent(new TabHost.TabContentFactory() { + @Override public View createTabContent(String tag) { return new LinearLayout(getContext()); } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeAdapter.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeAdapter.java index c9bb424e909d..22570b9cf865 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeAdapter.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeAdapter.java @@ -74,38 +74,46 @@ public class FakeAdapter extends BaseAdapter implements ListAdapter, SpinnerAdap } } + @Override public boolean isEnabled(int position) { return true; } + @Override public int getCount() { return mItems.size(); } + @Override public Object getItem(int position) { return mItems.get(position); } + @Override public long getItemId(int position) { return position; } + @Override public int getItemViewType(int position) { return mItems.get(position).getType(); } + @Override public View getView(int position, View convertView, ViewGroup parent) { // we don't care about recycling here because we never scroll. AdapterItem item = mItems.get(position); return getView(item, null /*parentGroup*/, convertView, parent); } + @Override public int getViewTypeCount() { return mTypes.size(); } // ---- SpinnerAdapter + @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { // pass return null; diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeExpandableAdapter.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeExpandableAdapter.java index 2c492e3efb16..199e0404a16b 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeExpandableAdapter.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/binding/FakeExpandableAdapter.java @@ -99,23 +99,28 @@ public class FakeExpandableAdapter extends BaseAdapter implements ExpandableList // ---- ExpandableListAdapter + @Override public int getGroupCount() { return mItems.size(); } + @Override public int getChildrenCount(int groupPosition) { AdapterItem item = mItems.get(groupPosition); return item.getChildren().size(); } + @Override public Object getGroup(int groupPosition) { return mItems.get(groupPosition); } + @Override public Object getChild(int groupPosition, int childPosition) { return getChildItem(groupPosition, childPosition); } + @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { // we don't care about recycling here because we never scroll. @@ -123,6 +128,7 @@ public class FakeExpandableAdapter extends BaseAdapter implements ExpandableList return getView(item, null /*parentItem*/, convertView, parent); } + @Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { // we don't care about recycling here because we never scroll. @@ -131,48 +137,59 @@ public class FakeExpandableAdapter extends BaseAdapter implements ExpandableList return getView(item, parentItem, convertView, parent); } + @Override public long getGroupId(int groupPosition) { return groupPosition; } + @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } + @Override public long getCombinedGroupId(long groupId) { return groupId << 16 | 0x0000FFFF; } + @Override public long getCombinedChildId(long groupId, long childId) { return groupId << 16 | childId; } + @Override public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } + @Override public void onGroupCollapsed(int groupPosition) { // pass } + @Override public void onGroupExpanded(int groupPosition) { // pass } // ---- HeterogeneousExpandableList + @Override public int getChildType(int groupPosition, int childPosition) { return getChildItem(groupPosition, childPosition).getType(); } + @Override public int getChildTypeCount() { return mChildrenTypes.size(); } + @Override public int getGroupType(int groupPosition) { return mItems.get(groupPosition).getType(); } + @Override public int getGroupTypeCount() { return mGroupTypes.size(); } diff --git a/tools/layoutlib/create/.settings/README.txt b/tools/layoutlib/create/.settings/README.txt new file mode 100644 index 000000000000..9120b20710a3 --- /dev/null +++ b/tools/layoutlib/create/.settings/README.txt @@ -0,0 +1,2 @@ +Copy this in eclipse project as a .settings folder at the root. +This ensure proper compilation compliance and warning/error levels.
\ No newline at end of file diff --git a/tools/layoutlib/create/.settings/org.eclipse.jdt.core.prefs b/tools/layoutlib/create/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000000..5381a0e16c7d --- /dev/null +++ b/tools/layoutlib/create/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,93 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.nonnull=com.android.annotations.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=com.android.annotations.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullisdefault=disabled +org.eclipse.jdt.core.compiler.annotation.nullable=com.android.annotations.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=error +org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentialNullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java index 70c8a009b291..4b33474c65a8 100644 --- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java +++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java @@ -27,6 +27,7 @@ public final class CreateInfo implements ICreateInfo { * Returns the list of class from layoutlib_create to inject in layoutlib. * The list can be empty but must not be null. */ + @Override public Class<?>[] getInjectedClasses() { return INJECTED_CLASSES; } @@ -35,6 +36,7 @@ public final class CreateInfo implements ICreateInfo { * Returns the list of methods to rewrite as delegates. * The list can be empty but must not be null. */ + @Override public String[] getDelegateMethods() { return DELEGATE_METHODS; } @@ -43,6 +45,7 @@ public final class CreateInfo implements ICreateInfo { * Returns the list of classes on which to delegate all native methods. * The list can be empty but must not be null. */ + @Override public String[] getDelegateClassNatives() { return DELEGATE_CLASS_NATIVES; } @@ -54,6 +57,7 @@ public final class CreateInfo implements ICreateInfo { * <p/> * This usage is deprecated. Please use method 'delegates' instead. */ + @Override public String[] getOverriddenMethods() { return OVERRIDDEN_METHODS; } @@ -63,6 +67,7 @@ public final class CreateInfo implements ICreateInfo { * of class to replace followed by the new FQCN. * The list can be empty but must not be null. */ + @Override public String[] getRenamedClasses() { return RENAMED_CLASSES; } @@ -74,6 +79,7 @@ public final class CreateInfo implements ICreateInfo { * the methods to delete. * The list can be empty but must not be null. */ + @Override public String[] getDeleteReturns() { return DELETE_RETURNS; } diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/MethodAdapter.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/MethodAdapter.java index 627ea17260fc..7d1e4cf49635 100644 --- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/MethodAdapter.java +++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/MethodAdapter.java @@ -28,13 +28,14 @@ public class MethodAdapter implements MethodListener { * A stub method is being invoked. * <p/> * Known limitation: caller arguments are not available. - * + * * @param signature The signature of the method being invoked, composed of the * binary class name followed by the method descriptor (aka argument * types). Example: "com/foo/MyClass/InnerClass/printInt(I)V". * @param isNative True if the method was a native method. * @param caller The calling object. Null for static methods, "this" for instance methods. */ + @Override public void onInvokeV(String signature, boolean isNative, Object caller) { } @@ -43,6 +44,7 @@ public class MethodAdapter implements MethodListener { * @see #onInvokeV(String, boolean, Object) * @return an integer, or a boolean, or a short or a byte. */ + @Override public int onInvokeI(String signature, boolean isNative, Object caller) { onInvokeV(signature, isNative, caller); return 0; @@ -53,6 +55,7 @@ public class MethodAdapter implements MethodListener { * @see #onInvokeV(String, boolean, Object) * @return a long. */ + @Override public long onInvokeL(String signature, boolean isNative, Object caller) { onInvokeV(signature, isNative, caller); return 0; @@ -63,6 +66,7 @@ public class MethodAdapter implements MethodListener { * @see #onInvokeV(String, boolean, Object) * @return a float. */ + @Override public float onInvokeF(String signature, boolean isNative, Object caller) { onInvokeV(signature, isNative, caller); return 0; @@ -73,6 +77,7 @@ public class MethodAdapter implements MethodListener { * @see #onInvokeV(String, boolean, Object) * @return a double. */ + @Override public double onInvokeD(String signature, boolean isNative, Object caller) { onInvokeV(signature, isNative, caller); return 0; @@ -83,6 +88,7 @@ public class MethodAdapter implements MethodListener { * @see #onInvokeV(String, boolean, Object) * @return an object. */ + @Override public Object onInvokeA(String signature, boolean isNative, Object caller) { onInvokeV(signature, isNative, caller); return null; diff --git a/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/AsmGeneratorTest.java b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/AsmGeneratorTest.java index f4ff389d41b2..7b76a5b2f914 100644 --- a/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/AsmGeneratorTest.java +++ b/tools/layoutlib/create/tests/com/android/tools/layoutlib/create/AsmGeneratorTest.java @@ -65,24 +65,29 @@ public class AsmGeneratorTest { public void testClassRenaming() throws IOException, LogAbortException { ICreateInfo ci = new ICreateInfo() { + @Override public Class<?>[] getInjectedClasses() { // classes to inject in the final JAR return new Class<?>[0]; } + @Override public String[] getDelegateMethods() { return new String[0]; } + @Override public String[] getDelegateClassNatives() { return new String[0]; } + @Override public String[] getOverriddenMethods() { // methods to force override return new String[0]; } + @Override public String[] getRenamedClasses() { // classes to rename (so that we can replace them) return new String[] { @@ -91,6 +96,7 @@ public class AsmGeneratorTest { }; } + @Override public String[] getDeleteReturns() { // methods deleted from their return type. return new String[0]; |