Bug 1177723 - Remove remaining database system search integration. r=mfinkle
authorRichard Newman <rnewman@mozilla.com>
Wed, 01 Jul 2015 10:49:28 -0700
changeset 251091 a11965c0a317c4895facc0a69ec0ebcfbed7fccc
parent 251090 b9b256c42a62ac7e23fbd421f9a1f6ee6a29e4ac
child 251092 658dca224bfc40edbb43103ae25ba9341b52dced
push id61766
push usercbook@mozilla.com
push dateThu, 02 Jul 2015 13:47:40 +0000
treeherdermozilla-inbound@8ee689f2899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs1177723
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1177723 - Remove remaining database system search integration. r=mfinkle
mobile/android/base/AndroidManifest.xml.in
mobile/android/base/db/BrowserProvider.java
--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -397,22 +397,17 @@
 
         <activity android:name="org.mozilla.gecko.preferences.GeckoPreferences"
                   android:theme="@style/Gecko.Preferences"
                   android:configChanges="orientation|screenSize|locale|layoutDirection"
                   android:excludeFromRecents="true"/>
 
         <provider android:name="org.mozilla.gecko.db.BrowserProvider"
                   android:authorities="@ANDROID_PACKAGE_NAME@.db.browser"
-                  android:permission="@ANDROID_PACKAGE_NAME@.permissions.BROWSER_PROVIDER">
-
-            <path-permission android:pathPrefix="/search_suggest_query"
-                             android:readPermission="android.permission.GLOBAL_SEARCH" />
-
-        </provider>
+                  android:permission="@ANDROID_PACKAGE_NAME@.permissions.BROWSER_PROVIDER"/>
 
 #ifdef MOZ_ANDROID_SHARE_OVERLAY
         <!-- Share overlay activity
 
              Setting launchMode="singleTop" ensures onNewIntent is called when the Activity is
              reused. Ideally we create a new instance but Android L breaks this (bug 1137928). -->
         <activity android:name="org.mozilla.gecko.overlays.ui.ShareDialog"
                   android:label="@string/overlay_share_label"
--- a/mobile/android/base/db/BrowserProvider.java
+++ b/mobile/android/base/db/BrowserProvider.java
@@ -14,17 +14,16 @@ import org.mozilla.gecko.db.BrowserContr
 import org.mozilla.gecko.db.BrowserContract.Combined;
 import org.mozilla.gecko.db.BrowserContract.FaviconColumns;
 import org.mozilla.gecko.db.BrowserContract.Favicons;
 import org.mozilla.gecko.db.BrowserContract.History;
 import org.mozilla.gecko.db.BrowserContract.Schema;
 import org.mozilla.gecko.db.BrowserContract.Thumbnails;
 import org.mozilla.gecko.sync.Utils;
 
-import android.app.SearchManager;
 import android.content.ContentProviderOperation;
 import android.content.ContentProviderResult;
 import android.content.ContentUris;
 import android.content.ContentValues;
 import android.content.OperationApplicationException;
 import android.content.UriMatcher;
 import android.database.Cursor;
 import android.database.DatabaseUtils;
@@ -84,17 +83,17 @@ public class BrowserProvider extends Sha
     static final int SCHEMA = 400;
 
     // Combined bookmarks and history matches
     static final int COMBINED = 500;
 
     // Control matches
     static final int CONTROL = 600;
 
-    // Search Suggest matches
+    // Search Suggest matches. Obsolete.
     static final int SEARCH_SUGGEST = 700;
 
     // Thumbnail matches
     static final int THUMBNAILS = 800;
     static final int THUMBNAIL_ID = 801;
 
     static final String DEFAULT_BOOKMARKS_SORT_ORDER = Bookmarks.TYPE
             + " ASC, " + Bookmarks.POSITION + " ASC, " + Bookmarks._ID
@@ -103,17 +102,16 @@ public class BrowserProvider extends Sha
     static final String DEFAULT_HISTORY_SORT_ORDER = History.DATE_LAST_VISITED + " DESC";
 
     static final UriMatcher URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH);
 
     static final Map<String, String> BOOKMARKS_PROJECTION_MAP;
     static final Map<String, String> HISTORY_PROJECTION_MAP;
     static final Map<String, String> COMBINED_PROJECTION_MAP;
     static final Map<String, String> SCHEMA_PROJECTION_MAP;
-    static final Map<String, String> SEARCH_SUGGEST_PROJECTION_MAP;
     static final Map<String, String> FAVICONS_PROJECTION_MAP;
     static final Map<String, String> THUMBNAILS_PROJECTION_MAP;
     static final Table[] sTables;
 
     static {
         sTables = new Table[] {
             // See awful shortcut assumption hack in getURLMetadataTable.
             new URLMetadataTable()
@@ -211,28 +209,16 @@ public class BrowserProvider extends Sha
         map = new HashMap<String, String>();
         map.put(Schema.VERSION, Schema.VERSION);
         SCHEMA_PROJECTION_MAP = Collections.unmodifiableMap(map);
 
 
         // Control
         URI_MATCHER.addURI(BrowserContract.AUTHORITY, "control", CONTROL);
 
-        // Search Suggest
-        URI_MATCHER.addURI(BrowserContract.AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH_SUGGEST);
-
-        map = new HashMap<String, String>();
-        map.put(SearchManager.SUGGEST_COLUMN_TEXT_1,
-                Combined.TITLE + " AS " + SearchManager.SUGGEST_COLUMN_TEXT_1);
-        map.put(SearchManager.SUGGEST_COLUMN_TEXT_2_URL,
-                Combined.URL + " AS " + SearchManager.SUGGEST_COLUMN_TEXT_2_URL);
-        map.put(SearchManager.SUGGEST_COLUMN_INTENT_DATA,
-                Combined.URL + " AS " + SearchManager.SUGGEST_COLUMN_INTENT_DATA);
-        SEARCH_SUGGEST_PROJECTION_MAP = Collections.unmodifiableMap(map);
-
         for (Table table : sTables) {
             for (Table.ContentProviderInfo type : table.getContentProviderInfo()) {
                 URI_MATCHER.addURI(BrowserContract.AUTHORITY, type.name, type.id);
             }
         }
     }
 
     // Convenience accessor.
@@ -351,19 +337,16 @@ public class BrowserProvider extends Sha
                 trace("URI is BOOKMARKS_ID: " + uri);
                 return Bookmarks.CONTENT_ITEM_TYPE;
             case HISTORY:
                 trace("URI is HISTORY: " + uri);
                 return History.CONTENT_TYPE;
             case HISTORY_ID:
                 trace("URI is HISTORY_ID: " + uri);
                 return History.CONTENT_ITEM_TYPE;
-            case SEARCH_SUGGEST:
-                trace("URI is SEARCH_SUGGEST: " + uri);
-                return SearchManager.SUGGEST_MIME_TYPE;
             default:
                 String type = getContentItemType(match);
                 if (type != null) {
                     trace("URI is " + type);
                     return type;
                 }
 
                 debug("URI has unrecognized type: " + uri);
@@ -770,38 +753,16 @@ public class BrowserProvider extends Sha
                 if (hasFaviconsInProjection(projection))
                     qb.setTables(VIEW_COMBINED_WITH_FAVICONS);
                 else
                     qb.setTables(Combined.VIEW_NAME);
 
                 break;
             }
 
-            case SEARCH_SUGGEST: {
-                debug("Query is on search suggest: " + uri);
-                selection = DBUtils.concatenateWhere(selection, "(" + Combined.URL + " LIKE ? OR " +
-                                                                      Combined.TITLE + " LIKE ?)");
-
-                String keyword = uri.getLastPathSegment();
-                if (keyword == null)
-                    keyword = "";
-
-                selectionArgs = DBUtils.appendSelectionArgs(selectionArgs,
-                        new String[] { "%" + keyword + "%",
-                                       "%" + keyword + "%" });
-
-                if (TextUtils.isEmpty(sortOrder))
-                    sortOrder = DEFAULT_HISTORY_SORT_ORDER;
-
-                qb.setProjectionMap(SEARCH_SUGGEST_PROJECTION_MAP);
-                qb.setTables(VIEW_COMBINED_WITH_FAVICONS);
-
-                break;
-            }
-
             default: {
                 Table table = findTableFor(match);
                 if (table == null) {
                     throw new UnsupportedOperationException("Unknown query URI " + uri);
                 }
                 trace("Update TABLE: " + uri);
                 return table.query(db, uri, match, projection, selection, selectionArgs, sortOrder, groupBy, limit);
             }