am 33c8bdb1: am b446443e: Only show manually entered URLs in suggestions.

Merge commit '33c8bdb17d9ef65d5cc790a1059712d8b65dc60b'

* commit '33c8bdb17d9ef65d5cc790a1059712d8b65dc60b':
  Only show manually entered URLs in suggestions.
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 6ca29ce..7c3b3fc 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -646,11 +646,7 @@
                 url = intent.getStringExtra(SearchManager.QUERY);
                 if (url != null) {
                     mLastEnteredUrl = url;
-                    // Don't add Urls, just search terms.
-                    // Urls will get added when the page is loaded.
-                    if (!Patterns.WEB_URL.matcher(url).matches()) {
-                        Browser.updateVisitedHistory(mResolver, url, false);
-                    }
+                    Browser.updateVisitedHistory(mResolver, url, false);
                     // In general, we shouldn't modify URL from Intent.
                     // But currently, we get the user-typed URL from search box as well.
                     url = fixUrl(url);
diff --git a/src/com/android/browser/BrowserProvider.java b/src/com/android/browser/BrowserProvider.java
index cecc8d2..618afc1 100644
--- a/src/com/android/browser/BrowserProvider.java
+++ b/src/com/android/browser/BrowserProvider.java
@@ -73,11 +73,11 @@
         "bookmarks", "searches"
     };
     private static final String[] SUGGEST_PROJECTION = new String[] {
-            "_id", "url", "title", "bookmark"
+            "_id", "url", "title", "bookmark", "user_entered"
     };
     private static final String SUGGEST_SELECTION =
-            "url LIKE ? OR url LIKE ? OR url LIKE ? OR url LIKE ?"
-                + " OR title LIKE ?";
+            "(url LIKE ? OR url LIKE ? OR url LIKE ? OR url LIKE ?"
+                + " OR title LIKE ?) AND (bookmark = 1 OR user_entered = 1)";
     private String[] SUGGEST_ARGS = new String[5];
 
     // shared suggestion array index, make sure to match COLUMNS
@@ -158,7 +158,8 @@
     // 19 -> 20 Added thumbnail
     // 20 -> 21 Added touch_icon
     // 21 -> 22 Remove "clientid"
-    private static final int DATABASE_VERSION = 22;
+    // 22 -> 23 Added user_entered
+    private static final int DATABASE_VERSION = 23;
 
     // Regular expression which matches http://, followed by some stuff, followed by
     // optionally a trailing slash, all matched as separate groups.
@@ -232,7 +233,8 @@
                     "bookmark INTEGER," +
                     "favicon BLOB DEFAULT NULL," +
                     "thumbnail BLOB DEFAULT NULL," +
-                    "touch_icon BLOB DEFAULT NULL" +
+                    "touch_icon BLOB DEFAULT NULL," +
+                    "user_entered INTEGER" +
                     ");");
 
             final CharSequence[] bookmarks = mContext.getResources()
@@ -272,6 +274,9 @@
             if (oldVersion < 22) {
                 db.execSQL("DELETE FROM bookmarks WHERE (bookmark = 0 AND url LIKE \"%.google.%client=ms-%\")");
                 removeGears();
+            }
+            if (oldVersion < 23) {
+                db.execSQL("ALTER TABLE bookmarks ADD COLUMN user_entered INTEGER;");
             } else {
                 db.execSQL("DROP TABLE IF EXISTS bookmarks");
                 db.execSQL("DROP TABLE IF EXISTS searches");