Makes CombinedCursor sync aware

 Bug: 3192765
 SuggestionsAdapter.CombinedCursor was not setting account parameters

Change-Id: I57c341383970105fde8cbb2a6cde3831125cef1b
diff --git a/src/com/android/browser/BookmarkUtils.java b/src/com/android/browser/BookmarkUtils.java
index c72cbd1..58622ce 100644
--- a/src/com/android/browser/BookmarkUtils.java
+++ b/src/com/android/browser/BookmarkUtils.java
@@ -170,16 +170,21 @@
     }
 
     /* package */ static Uri getBookmarksUri(Context context) {
+        return addAccountInfo(context,
+                BrowserContract.Bookmarks.CONTENT_URI.buildUpon()).build();
+    }
+
+    /* package */ static Uri.Builder addAccountInfo(Context context, Uri.Builder ub) {
         Uri uri = BrowserContract.Bookmarks.CONTENT_URI;
         SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
         String accountType = prefs.getString(BrowserBookmarksPage.PREF_ACCOUNT_TYPE, null);
         String accountName = prefs.getString(BrowserBookmarksPage.PREF_ACCOUNT_NAME, null);
         if (!TextUtils.isEmpty(accountName) && !TextUtils.isEmpty(accountType)) {
-            uri = uri.buildUpon()
-                    .appendQueryParameter(BrowserContract.Bookmarks.PARAM_ACCOUNT_NAME, accountName)
-                    .appendQueryParameter(BrowserContract.Bookmarks.PARAM_ACCOUNT_TYPE, accountType)
-                    .build();
+            ub.appendQueryParameter(
+                    BrowserContract.Bookmarks.PARAM_ACCOUNT_NAME,accountName);
+            ub.appendQueryParameter(
+                    BrowserContract.Bookmarks.PARAM_ACCOUNT_TYPE, accountType);
         }
-        return uri;
+        return ub;
     }
-};
+}
diff --git a/src/com/android/browser/SuggestionsAdapter.java b/src/com/android/browser/SuggestionsAdapter.java
index 8c06353..6473dfd 100644
--- a/src/com/android/browser/SuggestionsAdapter.java
+++ b/src/com/android/browser/SuggestionsAdapter.java
@@ -498,10 +498,12 @@
             Uri.Builder ub = BrowserContract.Combined.CONTENT_URI.buildUpon();
             ub.appendQueryParameter(BrowserContract.PARAM_LIMIT,
                     Integer.toString(mLinesPortrait));
+            BookmarkUtils.addAccountInfo(mContext, ub);
             mCursor =
                     mContext.getContentResolver().query(ub.build(), COMBINED_PROJECTION,
                             selection,
                             (constraint != null) ? args : null,
+                            BrowserContract.Combined.IS_BOOKMARK + " DESC, " +
                             BrowserContract.Combined.VISITS + " DESC, " +
                             BrowserContract.Combined.DATE_LAST_VISITED + " DESC");
             if (mCursor != null) {