diff options
author | John Reck <jreck@google.com> | 2011-05-26 17:02:17 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-05-26 17:02:17 -0700 |
commit | 74147ba74e6c7f40ffd55c9992bf3ae10ad1aecd (patch) | |
tree | 49b02d11d0bb7f872eb226e784c6774936caee45 | |
parent | e28f6ada8f0ea32306b5c607958eac40aa5a1025 (diff) | |
parent | 749542ee3500a9060b0961de968f2634269f2845 (diff) | |
download | packages_apps_browser-74147ba74e6c7f40ffd55c9992bf3ae10ad1aecd.zip packages_apps_browser-74147ba74e6c7f40ffd55c9992bf3ae10ad1aecd.tar.gz packages_apps_browser-74147ba74e6c7f40ffd55c9992bf3ae10ad1aecd.tar.bz2 |
Merge "Remove no longer needed sync settings/code"
-rw-r--r-- | AndroidManifest.xml | 5 | ||||
-rw-r--r-- | src/com/android/browser/AccountsChangedReceiver.java | 62 | ||||
-rw-r--r-- | src/com/android/browser/BookmarkUtils.java | 12 | ||||
-rw-r--r-- | src/com/android/browser/Bookmarks.java | 4 | ||||
-rw-r--r-- | src/com/android/browser/BrowserHistoryPage.java | 4 | ||||
-rw-r--r-- | src/com/android/browser/provider/BrowserProvider2.java | 27 |
6 files changed, 0 insertions, 114 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 2782538..00354a4 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -228,11 +228,6 @@ android:readPermission="com.android.browser.permission.READ_HISTORY_BOOKMARKS" android:exported="false" /> - <receiver android:name=".AccountsChangedReceiver"> - <intent-filter> - <action android:name="android.accounts.LOGIN_ACCOUNTS_CHANGED" /> - </intent-filter> - </receiver> </application> </manifest> diff --git a/src/com/android/browser/AccountsChangedReceiver.java b/src/com/android/browser/AccountsChangedReceiver.java deleted file mode 100644 index aff78ca..0000000 --- a/src/com/android/browser/AccountsChangedReceiver.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2011 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. - */ - -package com.android.browser; - -import com.android.browser.widget.BookmarkThumbnailWidgetProvider; - -import android.accounts.Account; -import android.accounts.AccountManager; -import android.content.BroadcastReceiver; -import android.content.ContentResolver; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.preference.PreferenceManager; -import android.provider.BrowserContract; - -public class AccountsChangedReceiver extends BroadcastReceiver { - - @Override - public void onReceive(Context context, Intent intent) { - // Validate that the account we are syncing to still exists - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - String accountType = prefs.getString(BrowserBookmarksPage.PREF_ACCOUNT_TYPE, null); - String accountName = prefs.getString(BrowserBookmarksPage.PREF_ACCOUNT_NAME, null); - if (accountType == null || accountName == null) { - // Not syncing, nothing to do - return; - } - Account[] accounts = AccountManager.get(context).getAccountsByType(accountType); - for (Account a : accounts) { - if (accountName.equals(a.name)) { - // Still have a valid account, sweet - return; - } - } - // Account deleted - disable sync - prefs.edit() - .remove(BrowserBookmarksPage.PREF_ACCOUNT_TYPE) - .remove(BrowserBookmarksPage.PREF_ACCOUNT_NAME) - .commit(); - BrowserContract.Settings.setSyncEnabled(context, false); - for (Account a : accounts) { - ContentResolver.setSyncAutomatically(a, BrowserContract.AUTHORITY, false); - ContentResolver.setIsSyncable(a, BrowserContract.AUTHORITY, 0); - } - } - -} diff --git a/src/com/android/browser/BookmarkUtils.java b/src/com/android/browser/BookmarkUtils.java index 383dc7e..491c16c 100644 --- a/src/com/android/browser/BookmarkUtils.java +++ b/src/com/android/browser/BookmarkUtils.java @@ -219,18 +219,6 @@ public class BookmarkUtils { return BrowserContract.Bookmarks.CONTENT_URI; } - @Deprecated - public static Uri.Builder addAccountInfo(Context context, Uri.Builder ub) { - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - String accountType = prefs.getString(BrowserBookmarksPage.PREF_ACCOUNT_TYPE, null); - String accountName = prefs.getString(BrowserBookmarksPage.PREF_ACCOUNT_NAME, null); - ub.appendQueryParameter( - BrowserContract.Bookmarks.PARAM_ACCOUNT_NAME,accountName); - ub.appendQueryParameter( - BrowserContract.Bookmarks.PARAM_ACCOUNT_TYPE, accountType); - return ub; - } - /** * Show a confirmation dialog to remove a bookmark. * @param id Id of the bookmark to remove diff --git a/src/com/android/browser/Bookmarks.java b/src/com/android/browser/Bookmarks.java index e7dc729..bd3b872 100644 --- a/src/com/android/browser/Bookmarks.java +++ b/src/com/android/browser/Bookmarks.java @@ -72,10 +72,6 @@ public class Bookmarks { ContentValues values = new ContentValues(); try { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - String accountType = prefs.getString(BrowserBookmarksPage.PREF_ACCOUNT_TYPE, null); - String accountName = prefs.getString(BrowserBookmarksPage.PREF_ACCOUNT_NAME, null); - values.put(BrowserContract.Bookmarks.ACCOUNT_TYPE, accountType); - values.put(BrowserContract.Bookmarks.ACCOUNT_NAME, accountName); values.put(BrowserContract.Bookmarks.TITLE, name); values.put(BrowserContract.Bookmarks.URL, url); values.put(BrowserContract.Bookmarks.IS_FOLDER, 0); diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java index e728254..bcc33e2 100644 --- a/src/com/android/browser/BrowserHistoryPage.java +++ b/src/com/android/browser/BrowserHistoryPage.java @@ -136,11 +136,7 @@ public class BrowserHistoryPage extends Fragment public Loader<Cursor> onCreateLoader(int id, Bundle args) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences( getActivity()); - String accountType = prefs.getString(BrowserBookmarksPage.PREF_ACCOUNT_TYPE, null); - String accountName = prefs.getString(BrowserBookmarksPage.PREF_ACCOUNT_NAME, null); Uri.Builder combinedBuilder = Combined.CONTENT_URI.buildUpon(); - combinedBuilder.appendQueryParameter(BrowserContract.Bookmarks.PARAM_ACCOUNT_TYPE, accountType); - combinedBuilder.appendQueryParameter(BrowserContract.Bookmarks.PARAM_ACCOUNT_NAME, accountName); switch (id) { case LOADER_HISTORY: { diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java index a8739ca..a44f050 100644 --- a/src/com/android/browser/provider/BrowserProvider2.java +++ b/src/com/android/browser/provider/BrowserProvider2.java @@ -944,10 +944,6 @@ public class BrowserProvider2 extends SQLiteContentProvider { && projection == null) { projection = Browser.HISTORY_PROJECTION; } - if (match == LEGACY) { - uri = BookmarkUtils.addAccountInfo(getContext(), - uri.buildUpon()).build(); - } String[] args = createCombinedQuery(uri, projection, qb); if (selectionArgs == null) { selectionArgs = args; @@ -996,19 +992,6 @@ public class BrowserProvider2 extends SQLiteContentProvider { selection = DatabaseUtils.concatenateWhere(selection, Bookmarks.IS_DELETED + "=0 AND " + Bookmarks.IS_FOLDER + "=0"); - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); - 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)) { - selection = DatabaseUtils.concatenateWhere(selection, - Bookmarks.ACCOUNT_TYPE + "=? AND " + Bookmarks.ACCOUNT_NAME + "=? "); - selectionArgs = DatabaseUtils.appendSelectionArgs(selectionArgs, - new String[] { accountType, accountName }); - } else { - selection = DatabaseUtils.concatenateWhere(selection, - Bookmarks.ACCOUNT_TYPE + " IS NULL AND " + - Bookmarks.ACCOUNT_NAME + " IS NULL "); - } Cursor c = mOpenHelper.getReadableDatabase().query(TABLE_BOOKMARKS, SUGGEST_PROJECTION, selection, selectionArgs, null, null, DEFAULT_BOOKMARKS_SORT_ORDER, null); @@ -1148,8 +1131,6 @@ public class BrowserProvider2 extends SQLiteContentProvider { String[] projection = new String[] { Combined._ID, Combined.IS_BOOKMARK, Combined.URL }; SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); - uri = BookmarkUtils.addAccountInfo(getContext(), uri.buildUpon()) - .build(); String[] args = createCombinedQuery(uri, projection, qb); if (selectionArgs == null) { selectionArgs = args; @@ -1219,14 +1200,6 @@ public class BrowserProvider2 extends SQLiteContentProvider { values.remove(BookmarkColumns.DATE); values.remove(BookmarkColumns.VISITS); values.remove(BookmarkColumns.USER_ENTERED); - SharedPreferences prefs = PreferenceManager - .getDefaultSharedPreferences(getContext()); - String accountType = prefs.getString( - BrowserBookmarksPage.PREF_ACCOUNT_TYPE, null); - String accountName = prefs.getString( - BrowserBookmarksPage.PREF_ACCOUNT_NAME, null); - values.put(Bookmarks.ACCOUNT_TYPE, accountType); - values.put(Bookmarks.ACCOUNT_NAME, accountName); values.put(Bookmarks.IS_FOLDER, 0); } } |