merge in ics-mr0-release history after reset to ics-mr0
diff --git a/res/drawable-hdpi/row_activated_bookmark_widget_holo.9.png b/res/drawable-hdpi/row_activated_bookmark_widget_holo.9.png
deleted file mode 100644
index 54e5825..0000000
--- a/res/drawable-hdpi/row_activated_bookmark_widget_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/row_activated_bookmark_widget_holo.9.png b/res/drawable-mdpi/row_activated_bookmark_widget_holo.9.png
deleted file mode 100644
index 69b6d40..0000000
--- a/res/drawable-mdpi/row_activated_bookmark_widget_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/row_activated_bookmark_widget_holo.9.png b/res/drawable-xhdpi/row_activated_bookmark_widget_holo.9.png
deleted file mode 100644
index 8df6517..0000000
--- a/res/drawable-xhdpi/row_activated_bookmark_widget_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/suggest_item_selector.xml b/res/drawable/suggest_item_selector.xml
deleted file mode 100644
index 301584f..0000000
--- a/res/drawable/suggest_item_selector.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
- <item android:state_pressed="true"
- android:drawable="@drawable/row_activated_bookmark_widget_holo" />
- <item android:state_pressed="false" android:drawable="@drawable/clear" />
-</selector>
diff --git a/res/layout/suggestion_item.xml b/res/layout/suggestion_item.xml
index 2def735..0adea1b 100644
--- a/res/layout/suggestion_item.xml
+++ b/res/layout/suggestion_item.xml
@@ -32,7 +32,7 @@
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal"
- android:background="@drawable/suggest_item_selector"
+ android:background="?android:attr/selectableItemBackground"
android:padding="0dp">
<ImageView
android:layout_width="wrap_content"
@@ -74,7 +74,7 @@
android:id="@+id/icon2"
android:scaleType="center"
android:src="@drawable/ic_querybuilder"
- android:background="@drawable/suggest_item_selector"
+ android:background="?android:attr/selectableItemBackground"
android:paddingRight="@dimen/suggest_item_padding"
android:paddingLeft="@dimen/suggest_item_padding"
/>
diff --git a/res/xml/debug_preferences.xml b/res/xml/debug_preferences.xml
index ed78fcb..029bc4f 100644
--- a/res/xml/debug_preferences.xml
+++ b/res/xml/debug_preferences.xml
@@ -25,7 +25,8 @@
<CheckBoxPreference
android:key="enable_hardware_accel_skia"
android:defaultValue="false"
- android:title="@string/pref_development_hardware_accel_skia" />
+ android:title="@string/pref_development_hardware_accel_skia"
+ android:enabled="false" />
<ListPreference
android:key="user_agent"
diff --git a/src/com/android/browser/homepages/RequestHandler.java b/src/com/android/browser/homepages/RequestHandler.java
index e0a0eac..defda61 100644
--- a/src/com/android/browser/homepages/RequestHandler.java
+++ b/src/com/android/browser/homepages/RequestHandler.java
@@ -16,6 +16,16 @@
*/
package com.android.browser.homepages;
+import android.content.Context;
+import android.content.UriMatcher;
+import android.content.res.Resources;
+import android.database.Cursor;
+import android.net.Uri;
+import android.provider.Browser;
+import android.text.TextUtils;
+import android.util.Base64;
+import android.util.Log;
+
import com.android.browser.R;
import java.io.IOException;
@@ -24,15 +34,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import android.content.Context;
-import android.content.UriMatcher;
-import android.content.res.Resources;
-import android.database.Cursor;
-import android.net.Uri;
-import android.provider.Browser;
-import android.util.Base64;
-import android.util.Log;
-
public class RequestHandler extends Thread {
private static final String TAG = "RequestHandler";
@@ -79,6 +80,10 @@
}
}
+ byte[] htmlEncode(String s) {
+ return TextUtils.htmlEncode(s).getBytes();
+ }
+
void writeTemplatedIndex() throws IOException {
Template t = Template.getCachedTemplate(mContext, R.raw.most_visited);
Cursor cursor = mContext.getContentResolver().query(Browser.BOOKMARKS_URI,
@@ -90,9 +95,9 @@
public void writeValue(OutputStream stream, String key) throws IOException {
Cursor cursor = getCursor();
if (key.equals("url")) {
- stream.write(cursor.getString(0).getBytes());
+ stream.write(htmlEncode(cursor.getString(0)));
} else if (key.equals("title")) {
- stream.write(cursor.getString(1).getBytes());
+ stream.write(htmlEncode(cursor.getString(1)));
} else if (key.equals("thumbnail")) {
stream.write("data:image/png;base64,".getBytes());
byte[] thumb = cursor.getBlob(2);
diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java
index 9aa2502..06c8e16 100644
--- a/src/com/android/browser/provider/BrowserProvider2.java
+++ b/src/com/android/browser/provider/BrowserProvider2.java
@@ -379,6 +379,7 @@
// This is so provider tests can intercept widget updating
ContentObserver mWidgetObserver = null;
boolean mUpdateWidgets = false;
+ boolean mSyncToNetwork = true;
final class DatabaseHelper extends SQLiteOpenHelper {
static final String DATABASE_NAME = "browser2.db";
@@ -804,6 +805,7 @@
}
mUpdateWidgets = false;
}
+ mSyncToNetwork = true;
}
@Override
@@ -1319,7 +1321,9 @@
}
if (deleted > 0) {
postNotifyUri(uri);
- postNotifyUri(LEGACY_AUTHORITY_URI);
+ if (shouldNotifyLegacy(uri)) {
+ postNotifyUri(LEGACY_AUTHORITY_URI);
+ }
}
return deleted;
}
@@ -1466,7 +1470,9 @@
if (id >= 0) {
postNotifyUri(uri);
- postNotifyUri(LEGACY_AUTHORITY_URI);
+ if (shouldNotifyLegacy(uri)) {
+ postNotifyUri(LEGACY_AUTHORITY_URI);
+ }
return ContentUris.withAppendedId(uri, id);
} else {
return null;
@@ -1678,15 +1684,26 @@
db.insertOrThrow(TABLE_IMAGES, Images.FAVICON, values);
count = 1;
}
+ // Only favicon is exposed in the public API. If we updated
+ // the thumbnail or touch icon don't bother notifying the
+ // legacy authority since it can't read it anyway.
+ boolean updatedLegacy = false;
if (getUrlCount(db, TABLE_BOOKMARKS, url) > 0) {
postNotifyUri(Bookmarks.CONTENT_URI);
+ updatedLegacy = values.containsKey(Images.FAVICON);
refreshWidgets();
}
if (getUrlCount(db, TABLE_HISTORY, url) > 0) {
postNotifyUri(History.CONTENT_URI);
+ updatedLegacy = values.containsKey(Images.FAVICON);
}
- postNotifyUri(LEGACY_AUTHORITY_URI);
- pruneImages();
+ if (pruneImages() > 0 || updatedLegacy) {
+ postNotifyUri(LEGACY_AUTHORITY_URI);
+ }
+ // Even though we may be calling notifyUri on Bookmarks, don't
+ // sync to network as images aren't synced. Otherwise this
+ // unnecessarily triggers a bookmark sync.
+ mSyncToNetwork = false;
return count;
}
@@ -1714,7 +1731,9 @@
pruneImages();
if (modified > 0) {
postNotifyUri(uri);
- postNotifyUri(LEGACY_AUTHORITY_URI);
+ if (shouldNotifyLegacy(uri)) {
+ postNotifyUri(LEGACY_AUTHORITY_URI);
+ }
}
return modified;
}
@@ -2028,9 +2047,31 @@
return imageValues;
}
- void pruneImages() {
+ int pruneImages() {
final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
- db.delete(TABLE_IMAGES, IMAGE_PRUNE, null);
+ return db.delete(TABLE_IMAGES, IMAGE_PRUNE, null);
+ }
+
+ boolean shouldNotifyLegacy(Uri uri) {
+ if (uri.getPathSegments().contains("history")
+ || uri.getPathSegments().contains("bookmarks")
+ || uri.getPathSegments().contains("searches")) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected boolean syncToNetwork(Uri uri) {
+ if (BrowserContract.AUTHORITY.equals(uri.getAuthority())
+ && uri.getPathSegments().contains("bookmarks")) {
+ return mSyncToNetwork;
+ }
+ if (LEGACY_AUTHORITY.equals(uri.getAuthority())) {
+ // Allow for 3rd party sync adapters
+ return true;
+ }
+ return false;
}
static class SuggestionsCursor extends AbstractCursor {
diff --git a/src/com/android/browser/provider/SQLiteContentProvider.java b/src/com/android/browser/provider/SQLiteContentProvider.java
index 13acd3d..75e298e 100644
--- a/src/com/android/browser/provider/SQLiteContentProvider.java
+++ b/src/com/android/browser/provider/SQLiteContentProvider.java
@@ -239,7 +239,12 @@
}
ContentResolver resolver = getContext().getContentResolver();
for (Uri uri : changed) {
- resolver.notifyChange(uri, null, !callerIsSyncAdapter);
+ boolean syncToNetwork = !callerIsSyncAdapter && syncToNetwork(uri);
+ resolver.notifyChange(uri, null, syncToNetwork);
}
}
+
+ protected boolean syncToNetwork(Uri uri) {
+ return false;
+ }
}