Merge "YuvImage: jpeg_set_quality() should be called after jpeg_set_defaults()."
diff --git a/cmds/servicemanager/Android.mk b/cmds/servicemanager/Android.mk
index 392e727..fe5929b 100644
--- a/cmds/servicemanager/Android.mk
+++ b/cmds/servicemanager/Android.mk
@@ -10,10 +10,8 @@
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_SRC_FILES := service_manager.c binder.c
LOCAL_MODULE := servicemanager
-ifeq ($(LVMX),true)
- ifeq ($(TARGET_ARCH),arm)
+ifeq ($(BOARD_USE_LVMX),true)
LOCAL_CFLAGS += -DLVMX
- endif
endif
include $(BUILD_EXECUTABLE)
endif
diff --git a/core/java/android/webkit/LoadListener.java b/core/java/android/webkit/LoadListener.java
index 115499f..7da99ca 100644
--- a/core/java/android/webkit/LoadListener.java
+++ b/core/java/android/webkit/LoadListener.java
@@ -1057,7 +1057,7 @@
mCacheLoader != null) ? HTTP_OK : mStatusCode;
// pass content-type content-length and content-encoding
final int nativeResponse = nativeCreateResponse(
- mUrl, statusCode, mStatusText,
+ originalUrl(), statusCode, mStatusText,
mMimeType, mContentLength, mEncoding);
if (mHeaders != null) {
mHeaders.getHeaders(new Headers.HeaderCallback() {
@@ -1256,9 +1256,6 @@
return;
}
- if (mOriginalUrl == null) {
- mOriginalUrl = mUrl;
- }
// Cache the redirect response
if (getErrorID() == OK) {
@@ -1273,6 +1270,8 @@
WebViewWorker.MSG_REMOVE_CACHE, this).sendToTarget();
}
+ // Saving a copy of the unstripped url for the response
+ mOriginalUrl = redirectTo;
// This will strip the anchor
setUrl(redirectTo);
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index 39edcad..016f016 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -377,11 +377,17 @@
return;
}
mPreChange = postChange;
- // This was simply a delete or a cut, so just delete the selection.
- if (before > 0 && 0 == count) {
- mWebView.deleteSelection(start, start + before);
- // For this and all changes to the text, update our cache
- updateCachedTextfield();
+ if (0 == count) {
+ if (before > 0) {
+ // This was simply a delete or a cut, so just delete the
+ // selection.
+ mWebView.deleteSelection(start, start + before);
+ // For this and all changes to the text, update our cache
+ updateCachedTextfield();
+ }
+ // before should never be negative, so whether it was a cut
+ // (handled above), or before is 0, in which case nothing has
+ // changed, we should return.
return;
}
// Find the last character being replaced. If it can be represented by
diff --git a/libs/audioflinger/Android.mk b/libs/audioflinger/Android.mk
index 29e4a57..870c0b8 100644
--- a/libs/audioflinger/Android.mk
+++ b/libs/audioflinger/Android.mk
@@ -119,14 +119,12 @@
endif
endif
-ifeq ($(LVMX),true)
- ifeq ($(TARGET_ARCH),arm)
+ifeq ($(BOARD_USE_LVMX),true)
LOCAL_CFLAGS += -DLVMX
LOCAL_C_INCLUDES += vendor/nxp
LOCAL_STATIC_LIBRARIES += liblifevibes
LOCAL_SHARED_LIBRARIES += liblvmxservice
# LOCAL_SHARED_LIBRARIES += liblvmxipc
- endif
endif
include $(BUILD_SHARED_LIBRARY)
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 83937fa..1b4ba81 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -436,11 +436,16 @@
if (!parseProviderList(url, initialValues)) return null;
}
+ SettingsCache cache = SettingsCache.forTable(args.table);
+ String value = initialValues.getAsString(Settings.NameValueTable.VALUE);
+ if (SettingsCache.isRedundantSetValue(cache, name, value)) {
+ return Uri.withAppendedPath(url, name);
+ }
+
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
final long rowId = db.insert(args.table, null, initialValues);
if (rowId <= 0) return null;
- SettingsCache cache = SettingsCache.forTable(args.table);
SettingsCache.populate(cache, initialValues); // before we notify
if (LOCAL_LOGV) Log.v(TAG, args.table + " <- " + initialValues);
@@ -669,5 +674,21 @@
}
}
+ /**
+ * For suppressing duplicate/redundant settings inserts early,
+ * checking our cache first (but without faulting it in),
+ * before going to sqlite with the mutation.
+ */
+ public static boolean isRedundantSetValue(SettingsCache cache, String name, String value) {
+ if (cache == null) return false;
+ synchronized (cache) {
+ Bundle bundle = cache.get(name);
+ if (bundle == null) return false;
+ String oldValue = bundle.getPairValue();
+ if (oldValue == null && value == null) return true;
+ if ((oldValue == null) != (value == null)) return false;
+ return oldValue.equals(value);
+ }
+ }
}
}
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index ab5e937..85665e0 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -13,6 +13,7 @@
#include <stdarg.h>
#define NOISY(x) //x
+#define NOISY_REF(x) //x
status_t compileXmlFile(const sp<AaptAssets>& assets,
const sp<AaptFile>& target,
@@ -1933,7 +1934,7 @@
// information we have already processed that string!
outValue->size = sizeof(Res_value);
outValue->res0 = 0;
- outValue->dataType = outValue->TYPE_STRING;
+ outValue->dataType = Res_value::TYPE_STRING;
outValue->data = 0;
finalStr = str;
}
@@ -1942,7 +1943,7 @@
return false;
}
- if (outValue->dataType == outValue->TYPE_STRING) {
+ if (outValue->dataType == Res_value::TYPE_STRING) {
// Should do better merging styles.
if (pool) {
if (style != NULL && style->size() > 0) {
@@ -2530,6 +2531,7 @@
// Iterate through all data, collecting all values (strings,
// references, etc).
StringPool valueStrings = StringPool(false, bundle->getUTF8());
+ ResourceConfigReferences configRefs;
for (pi=0; pi<N; pi++) {
sp<Package> p = mOrderedPackages.itemAt(pi);
if (p->getTypes().size() == 0) {
@@ -2570,6 +2572,13 @@
if (err != NO_ERROR) {
return err;
}
+ if (e->getType() == Entry::TYPE_ITEM) {
+ const Item* item = e->getItem();
+ if (item != NULL) {
+ uint32_t poolIndex = item->parsedValue.data;
+ configRefs.add(poolIndex, config);
+ }
+ }
}
}
}
@@ -2578,6 +2587,70 @@
p->setKeyStrings(keyStrings.createStringBlock());
}
+ NOISY_REF(configRefs.dump();)
+
+ // Trim all entries in config tables that are not roots for that string.
+ // i.e., rely on the resource system to grab the string from the more
+ // generic pool during runtime to save space.
+ for (pi=0; pi<N; pi++) {
+ sp<Package> p = mOrderedPackages.itemAt(pi);
+ if (p->getTypes().size() == 0) {
+ // Empty, skip!
+ continue;
+ }
+ const size_t TN = p->getOrderedTypes().size();
+ for (size_t ti=0; ti<TN; ti++) {
+ sp<Type> t = p->getOrderedTypes().itemAt(ti);
+ if (t == NULL) {
+ continue;
+ }
+ size_t CN = t->getOrderedConfigs().size();
+ for (size_t ci=0; ci<CN; ci++) {
+ sp<ConfigList> c = t->getOrderedConfigs().itemAt(ci);
+ if (c == NULL) {
+ continue;
+ }
+ DefaultKeyedVector<ConfigDescription, sp<Entry> > newEntries;
+ size_t EN = c->getEntries().size();
+ for (size_t ei=0; ei<EN; ++ei) {
+ ConfigDescription config = c->getEntries().keyAt(ei);
+ if (!filter.match(config)) {
+ continue;
+ }
+ sp<Entry> e = c->getEntries().valueAt(ei);
+ if (e == NULL) {
+ continue;
+ }
+ if (e->getType() == Entry::TYPE_ITEM) {
+ const Item* item = e->getItem();
+ if (item != NULL) {
+ uint32_t poolIndex = item->parsedValue.data;
+ if (!configRefs.isRoot(poolIndex, config)) {
+ NOISY_REF(
+ printf(" ConfigRef %d: removing ", poolIndex);
+ DEBUG_LANG(config)
+ printf("\n");
+ )
+ c->removeEntryAt(ei);
+ t->removeUniqueConfig(config);
+ --ei; --EN;
+ }
+ }
+ }
+ }
+ if (EN == 0) {
+ // We removed all the entries from a config, so remove the
+ // config itself.
+ NOISY_REF(
+ printf(" ConfigRef REMOVED ENTIRE CONFIG\n");
+ )
+ t->removeOrderedConfigAt(ci);
+ --ci; --CN;
+ }
+ }
+ }
+ }
+
ssize_t strAmt = 0;
// Now build the array of package chunks.
@@ -3732,3 +3805,95 @@
}
return res;
}
+
+#define DEBUG_LANG(x) printf("lang=%c%c cnt=%c%c ", \
+ (x).language[0] ? (x).language[0] : '-', \
+ (x).language[1] ? (x).language[1] : '-', \
+ (x).country[0] ? (x).country[0] : '-', \
+ (x).country[1] ? (x).country[1] : '-');
+
+status_t ResourceConfigReferences::add(uint32_t id, const ResTable_config& config)
+{
+ ssize_t index = mRoots.indexOfKey(id);
+ if (index < 0) {
+ index = mRoots.add(id, Vector<const ResTable_config*>());
+ }
+ Vector<const ResTable_config*>& configRoots = mRoots.editValueFor(id);
+
+ if (!configRoots.isEmpty()) {
+ ssize_t NR = configRoots.size();
+ for (int ri=0; ri<NR; ++ri) {
+ const ResTable_config* current = configRoots[ri];
+
+ if (config.match(*current)) {
+ // We already have something more generic than our incoming string.
+ NOISY_REF(
+ printf(" ConfigRef %d: ignoring ", id);
+ DEBUG_LANG(config)
+ printf("\n");
+ )
+ return NO_ERROR;
+ } else if (current->match(config)) {
+ // more generic
+ NOISY_REF(
+ printf(" ConfigRef %d: remove ", id);
+ DEBUG_LANG(current)
+ printf("\n");
+ )
+ configRoots.removeItemsAt(ri);
+ --ri; --NR;
+ }
+ }
+ }
+ NOISY_REF(
+ printf(" ConfigRef %d: add ", id);
+ DEBUG_LANG(config)
+ printf("\n");
+ )
+ ResTable_config *configCopy = (ResTable_config*)malloc(sizeof(ResTable_config));
+ memcpy(configCopy, &config, sizeof(ResTable_config));
+ configRoots.add(configCopy);
+
+ return NO_ERROR;
+}
+
+void ResourceConfigReferences::dump()
+{
+ printf("ResourceConfigReferences\n");
+ const ssize_t NR = mRoots.size();
+ for (int ri=0; ri<NR; ++ri) {
+ const Vector<const ResTable_config*>& configRoots = mRoots.valueAt(ri);
+ printf(" String %d\n", mRoots.keyAt(ri));
+ const ssize_t NC = configRoots.size();
+ for (int ci=0; ci<NC; ++ci) {
+ printf(" ");
+ DEBUG_LANG(*configRoots[ci])
+ printf("\n");
+ }
+ }
+}
+
+bool ResourceConfigReferences::isRoot(uint32_t id, const ResTable_config& config)
+{
+ const Vector<const ResTable_config*>& configRoots = mRoots.editValueFor(id);
+ const ssize_t NR = configRoots.size();
+ for (int ri = 0; ri<NR; ++ri) {
+ if (configRoots[ri]->match(config)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+ResourceConfigReferences::~ResourceConfigReferences()
+{
+ const ssize_t NR = mRoots.size();
+ for (int ri=0; ri<NR; ++ri) {
+ Vector<const ResTable_config*> configRoots = mRoots.editValueAt(ri);
+ const ssize_t NC = configRoots.size();
+ for (int ci=0; ci<NC; ++ci) {
+ ResTable_config* config = const_cast<ResTable_config*>(configRoots[ci]);
+ free(config);
+ }
+ }
+}
diff --git a/tools/aapt/ResourceTable.h b/tools/aapt/ResourceTable.h
index 186c7ca..cc2a429 100644
--- a/tools/aapt/ResourceTable.h
+++ b/tools/aapt/ResourceTable.h
@@ -376,6 +376,10 @@
void addEntry(const ResTable_config& config, const sp<Entry>& entry) {
mEntries.add(config, entry);
}
+
+ void removeEntryAt(int32_t index) {
+ mEntries.removeItemsAt(index);
+ }
const DefaultKeyedVector<ConfigDescription, sp<Entry> >& getEntries() const { return mEntries; }
private:
@@ -448,6 +452,9 @@
const DefaultKeyedVector<String16, sp<ConfigList> >& getConfigs() const { return mConfigs; }
const Vector<sp<ConfigList> >& getOrderedConfigs() const { return mOrderedConfigs; }
+ void removeUniqueConfig(ConfigDescription& config) { mUniqueConfigs.remove(config); }
+ void removeOrderedConfigAt(uint32_t index) { mOrderedConfigs.removeItemsAt(index); }
+
const SortedVector<String16>& getCanAddEntries() const { return mCanAddEntries; }
const SourcePos& getPos() const { return mPos; }
@@ -558,5 +565,17 @@
bool mContainsPseudo;
};
+class ResourceConfigReferences
+{
+public:
+ ResourceConfigReferences() : mRoots() {}
+ ~ResourceConfigReferences();
+ status_t add(uint32_t id, const ResTable_config& config);
+ bool isRoot(uint32_t id, const ResTable_config& config);
+ void dump();
+
+private:
+ KeyedVector<uint32_t, Vector<const ResTable_config*> > mRoots;
+};
#endif