summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Quintana <fredq@google.com>2010-02-24 13:15:14 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-02-24 13:15:14 -0800
commit4855965a141f020f0a35c174497343aa0c8da320 (patch)
treef5bb5a7d143b80f8b5bc85f69b9d26dcf6d55853
parentc3b91fd26a940f8cee54888f91b490cb1768b03c (diff)
parentd4a9d6c42bb412e27a8383aaacd051419d98a662 (diff)
downloadframeworks_base-4855965a141f020f0a35c174497343aa0c8da320.zip
frameworks_base-4855965a141f020f0a35c174497343aa0c8da320.tar.gz
frameworks_base-4855965a141f020f0a35c174497343aa0c8da320.tar.bz2
Merge "- return the accounts when getAccountByTypeAndFeatures is passed a null or empty features set, http://b/issue?id=2467165 - clear the authtokens when the password changes"
-rw-r--r--core/java/android/accounts/AccountManagerService.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java
index 770554e..d4f4d13 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -691,11 +691,21 @@ public class AccountManagerService
if (account == null) {
return;
}
- ContentValues values = new ContentValues();
- values.put(ACCOUNTS_PASSWORD, password);
- mOpenHelper.getWritableDatabase().update(TABLE_ACCOUNTS, values,
- ACCOUNTS_NAME + "=? AND " + ACCOUNTS_TYPE+ "=?",
- new String[]{account.name, account.type});
+ SQLiteDatabase db = mOpenHelper.getWritableDatabase();
+ db.beginTransaction();
+ try {
+ final ContentValues values = new ContentValues();
+ values.put(ACCOUNTS_PASSWORD, password);
+ final long accountId = getAccountId(db, account);
+ if (accountId >= 0) {
+ final String[] argsAccountId = {String.valueOf(accountId)};
+ db.update(TABLE_ACCOUNTS, values, ACCOUNTS_ID + "=?", argsAccountId);
+ db.delete(TABLE_AUTHTOKENS, AUTHTOKENS_ACCOUNTS_ID + "=?", argsAccountId);
+ db.setTransactionSuccessful();
+ }
+ } finally {
+ db.endTransaction();
+ }
sendAccountsChangedBroadcast();
}
@@ -1134,7 +1144,10 @@ public class AccountManagerService
long identityToken = clearCallingIdentity();
try {
if (features == null || features.length == 0) {
- getAccountsByType(type);
+ Account[] accounts = getAccountsByType(type);
+ Bundle result = new Bundle();
+ result.putParcelableArray(AccountManager.KEY_ACCOUNTS, accounts);
+ onResult(response, result);
return;
}
new GetAccountsByTypeAndFeatureSession(response, type, features).bind();