Merge "Add better error message for AAPT file conflicts" into lmp-dev
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml
index 327782d..f843d1f 100644
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -506,12 +506,24 @@
<!-- Used in LocalePicker -->
<string-array translatable="false" name="special_locale_codes">
+ <!-- http://b/17150708 - ensure that the list of languages says "Arabic"
+ rather than "Arabic (Egypt)". If you're an OEM supporting multiple
+ Arabic locales, you should remove this entry so that ar_EG is shown
+ as "Arabic (Egypt)" in Settings. -->
+ <item>ar_EG</item>
+
<item>zh_CN</item>
<item>zh_TW</item>
</string-array>
<!-- Used in LocalePicker -->
<string-array translatable="false" name="special_locale_names">
+ <!-- http://b/17150708 - ensure that the list of languages says "Arabic"
+ rather than "Arabic (Egypt)". If you're an OEM supporting multiple
+ Arabic locales, you should remove this entry so that ar_EG is shown
+ as "Arabic (Egypt)" in Settings. -->
+ <item>العربية</item>
+
<item>中文 (简体)</item>
<item>中文 (繁體)</item>
</string-array>
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 54afe99..1005bd7 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -4761,7 +4761,9 @@
result.setType(networkType);
return result;
} else {
- return new NetworkInfo(networkType, 0, "Unknown", "");
+ NetworkInfo result = new NetworkInfo(networkType);
+ result.setDetailedState(NetworkInfo.DetailedState.DISCONNECTED, null, null);
+ return result;
}
}
diff --git a/services/core/java/com/android/server/am/AppErrorDialog.java b/services/core/java/com/android/server/am/AppErrorDialog.java
index 0ba62c5..098b0b6 100644
--- a/services/core/java/com/android/server/am/AppErrorDialog.java
+++ b/services/core/java/com/android/server/am/AppErrorDialog.java
@@ -94,6 +94,9 @@
}
mResult.set(msg.what);
+ // Make sure we don't have time timeout still hanging around.
+ removeMessages(FORCE_QUIT);
+
// If this is a timeout we won't be automatically closed, so go
// ahead and explicitly dismiss ourselves just in case.
dismiss();
diff --git a/tests/CanvasCompare/src/com/android/test/hwuicompare/ErrorCalculator.java b/tests/CanvasCompare/src/com/android/test/hwuicompare/ErrorCalculator.java
index 08d7667..d402699 100644
--- a/tests/CanvasCompare/src/com/android/test/hwuicompare/ErrorCalculator.java
+++ b/tests/CanvasCompare/src/com/android/test/hwuicompare/ErrorCalculator.java
@@ -54,7 +54,7 @@
for (int i = 0; i < rowIndices.length; i++)
rowIndices[i] = i * REGION_SIZE;
- mScript = new ScriptC_errorCalculator(mRS, resources, R.raw.errorcalculator);
+ mScript = new ScriptC_errorCalculator(mRS);
mScript.set_HEIGHT(height);
mScript.set_WIDTH(width);
mScript.set_REGION_SIZE(REGION_SIZE);
diff --git a/tests/RenderScriptTests/FountainFbo/Android.mk b/tests/RenderScriptTests/FountainFbo/Android.mk
index 4535eb1..c0f3323 100644
--- a/tests/RenderScriptTests/FountainFbo/Android.mk
+++ b/tests/RenderScriptTests/FountainFbo/Android.mk
@@ -25,5 +25,6 @@
# LOCAL_SDK_VERSION := current
LOCAL_PACKAGE_NAME := RsFountainFbo
+LOCAL_SDK_VERSION := 14
include $(BUILD_PACKAGE)
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 869a6fc..1d93b89 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -1399,7 +1399,8 @@
sp<ApkSplit>& split = splits.editItemAt(i);
sp<AaptFile> flattenedTable = new AaptFile(String8("resources.arsc"),
AaptGroupEntry(), String8());
- err = table.flatten(bundle, split->getResourceFilter(), flattenedTable);
+ err = table.flatten(bundle, split->getResourceFilter(),
+ flattenedTable, split->isBase());
if (err != NO_ERROR) {
fprintf(stderr, "Failed to generate resource table for split '%s'\n",
split->getPrintableName().string());
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 49d8699..b3c364b 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -2074,10 +2074,11 @@
return mNumLocal > 0;
}
-sp<AaptFile> ResourceTable::flatten(Bundle* bundle, const sp<const ResourceFilter>& filter)
+sp<AaptFile> ResourceTable::flatten(Bundle* bundle, const sp<const ResourceFilter>& filter,
+ const bool isBase)
{
sp<AaptFile> data = new AaptFile(String8(), AaptGroupEntry(), String8());
- status_t err = flatten(bundle, filter, data);
+ status_t err = flatten(bundle, filter, data, isBase);
return err == NO_ERROR ? data : NULL;
}
@@ -2699,7 +2700,9 @@
return err;
}
-status_t ResourceTable::flatten(Bundle* bundle, const sp<const ResourceFilter>& filter, const sp<AaptFile>& dest)
+status_t ResourceTable::flatten(Bundle* bundle, const sp<const ResourceFilter>& filter,
+ const sp<AaptFile>& dest,
+ const bool isBase)
{
const ConfigDescription nullConfig;
@@ -2768,6 +2771,13 @@
configTypeName = "2value";
}
+ // mipmaps don't get filtered, so they will
+ // allways end up in the base. Make sure they
+ // don't end up in a split.
+ if (typeName == mipmap16 && !isBase) {
+ continue;
+ }
+
const bool filterable = (typeName != mipmap16);
const size_t N = t->getOrderedConfigs().size();
@@ -2871,10 +2881,12 @@
return amt;
}
- status_t err = flattenLibraryTable(data, libraryPackages);
- if (err != NO_ERROR) {
- fprintf(stderr, "ERROR: failed to write library table\n");
- return err;
+ if (isBase) {
+ status_t err = flattenLibraryTable(data, libraryPackages);
+ if (err != NO_ERROR) {
+ fprintf(stderr, "ERROR: failed to write library table\n");
+ return err;
+ }
}
// Build the type chunks inside of this package.
@@ -2890,6 +2902,7 @@
continue;
}
const bool filterable = (typeName != mipmap16);
+ const bool skipEntireType = (typeName == mipmap16 && !isBase);
const size_t N = t != NULL ? t->getOrderedConfigs().size() : 0;
@@ -2927,6 +2940,11 @@
if (cl->getPublic()) {
typeSpecFlags[ei] |= htodl(ResTable_typeSpec::SPEC_PUBLIC);
}
+
+ if (skipEntireType) {
+ continue;
+ }
+
const size_t CN = cl->getEntries().size();
for (size_t ci=0; ci<CN; ci++) {
if (filterable && !filter->match(cl->getEntries().keyAt(ci))) {
@@ -2943,6 +2961,10 @@
}
}
+ if (skipEntireType) {
+ continue;
+ }
+
// We need to write one type chunk for each configuration for
// which we have entries in this type.
const size_t NC = t->getUniqueConfigs().size();
diff --git a/tools/aapt/ResourceTable.h b/tools/aapt/ResourceTable.h
index d4f47ef..3721de4 100644
--- a/tools/aapt/ResourceTable.h
+++ b/tools/aapt/ResourceTable.h
@@ -165,7 +165,8 @@
size_t numLocalResources() const;
bool hasResources() const;
- sp<AaptFile> flatten(Bundle* bundle, const sp<const ResourceFilter>& filter);
+ sp<AaptFile> flatten(Bundle* bundle, const sp<const ResourceFilter>& filter,
+ const bool isBase);
static inline uint32_t makeResId(uint32_t packageId,
uint32_t typeId,
@@ -206,7 +207,8 @@
void addLocalization(const String16& name, const String8& locale, const SourcePos& src);
status_t validateLocalizations(void);
- status_t flatten(Bundle* bundle, const sp<const ResourceFilter>& filter, const sp<AaptFile>& dest);
+ status_t flatten(Bundle* bundle, const sp<const ResourceFilter>& filter,
+ const sp<AaptFile>& dest, const bool isBase);
status_t flattenLibraryTable(const sp<AaptFile>& dest, const Vector<sp<Package> >& libs);
void writePublicDefinitions(const String16& package, FILE* fp);
diff --git a/tools/aapt/tests/ResourceFilter_test.cpp b/tools/aapt/tests/ResourceFilter_test.cpp
index 30697bb..b55379e 100644
--- a/tools/aapt/tests/ResourceFilter_test.cpp
+++ b/tools/aapt/tests/ResourceFilter_test.cpp
@@ -126,3 +126,38 @@
EXPECT_TRUE(filter.match(config));
}
+TEST(StrongResourceFilterTest, MatchesDensities) {
+ ConfigDescription config;
+ config.density = 160;
+ config.version = 4;
+ std::set<ConfigDescription> configs;
+ configs.insert(config);
+
+ StrongResourceFilter filter(configs);
+
+ ConfigDescription expectedConfig;
+ expectedConfig.density = 160;
+ expectedConfig.version = 4;
+ ASSERT_TRUE(filter.match(expectedConfig));
+}
+
+TEST(StrongResourceFilterTest, MatchOnlyMdpiAndExcludeAllOthers) {
+ std::set<ConfigDescription> configsToMatch;
+ ConfigDescription config;
+ config.density = 160;
+ config.version = 4;
+ configsToMatch.insert(config);
+
+ std::set<ConfigDescription> configsToNotMatch;
+ config.density = 480;
+ configsToNotMatch.insert(config);
+
+ AndResourceFilter filter;
+ filter.addFilter(new InverseResourceFilter(new StrongResourceFilter(configsToNotMatch)));
+ filter.addFilter(new StrongResourceFilter(configsToMatch));
+
+ ConfigDescription expectedConfig;
+ expectedConfig.density = 160;
+ expectedConfig.version = 4;
+ ASSERT_TRUE(filter.match(expectedConfig));
+}