summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-06-27 17:25:23 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-06-27 17:25:23 -0700
commit749b93662b6c3152899d91dbd80139224dc46961 (patch)
treece3543b9e7a46e000dcd326a5f07d513aa5c4451
parent94ee4d2470e2ae45c48e4baff4fd664c0e5277dc (diff)
parent7ffb8957966fde0de338f4d42067d0edae295a9e (diff)
downloadpackages_apps_Browser-749b93662b6c3152899d91dbd80139224dc46961.zip
packages_apps_Browser-749b93662b6c3152899d91dbd80139224dc46961.tar.gz
packages_apps_Browser-749b93662b6c3152899d91dbd80139224dc46961.tar.bz2
Merge "Prevent duplicates in omnibox"
-rw-r--r--src/com/android/browser/SuggestionsAdapter.java3
-rw-r--r--src/com/android/browser/provider/BrowserProvider2.java7
2 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/browser/SuggestionsAdapter.java b/src/com/android/browser/SuggestionsAdapter.java
index 242e170..9a099cb 100644
--- a/src/com/android/browser/SuggestionsAdapter.java
+++ b/src/com/android/browser/SuggestionsAdapter.java
@@ -16,6 +16,7 @@
package com.android.browser;
+import com.android.browser.provider.BrowserProvider2;
import com.android.browser.search.SearchEngine;
import android.app.SearchManager;
@@ -472,6 +473,8 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable,
Uri.Builder ub = BrowserContract.Combined.CONTENT_URI.buildUpon();
ub.appendQueryParameter(BrowserContract.PARAM_LIMIT,
Integer.toString(Math.max(mLinesLandscape, mLinesPortrait)));
+ ub.appendQueryParameter(BrowserProvider2.PARAM_GROUP_BY,
+ BrowserContract.Combined.URL);
mCursor =
mContext.getContentResolver().query(ub.build(), COMBINED_PROJECTION,
selection,
diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java
index 724cbad..06e4e4a 100644
--- a/src/com/android/browser/provider/BrowserProvider2.java
+++ b/src/com/android/browser/provider/BrowserProvider2.java
@@ -80,6 +80,8 @@ public class BrowserProvider2 extends SQLiteContentProvider {
public static final String FAVICON = History.FAVICON;
}
+ public static final String PARAM_GROUP_BY = "groupBy";
+
public static final String LEGACY_AUTHORITY = "browser";
static final Uri LEGACY_AUTHORITY_URI = new Uri.Builder()
.authority(LEGACY_AUTHORITY).scheme("content").build();
@@ -795,6 +797,7 @@ public class BrowserProvider2 extends SQLiteContentProvider {
final int match = URI_MATCHER.match(uri);
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
String limit = uri.getQueryParameter(BrowserContract.PARAM_LIMIT);
+ String groupBy = uri.getQueryParameter(PARAM_GROUP_BY);
switch (match) {
case ACCOUNTS: {
qb.setTables(VIEW_ACCOUNTS);
@@ -1023,8 +1026,8 @@ public class BrowserProvider2 extends SQLiteContentProvider {
}
}
- Cursor cursor = qb.query(db, projection, selection, selectionArgs, null, null, sortOrder,
- limit);
+ Cursor cursor = qb.query(db, projection, selection, selectionArgs, groupBy,
+ null, sortOrder, limit);
cursor.setNotificationUri(getContext().getContentResolver(), BrowserContract.AUTHORITY_URI);
return cursor;
}