summaryrefslogtreecommitdiffstats
path: root/core/java/android/accounts/AccountManagerService.java
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2011-04-06 15:41:29 -0700
committerBrian Carlstrom <bdc@google.com>2011-04-07 11:58:37 -0700
commit46703b099516c383a6882815bcf9cd4df0ec538d (patch)
tree0b4f84436ce6d2b30ad7865facd03d889ea916be /core/java/android/accounts/AccountManagerService.java
parente651c68ee8f9de7fe3c342c5b5f6690c729f6014 (diff)
downloadframeworks_base-46703b099516c383a6882815bcf9cd4df0ec538d.zip
frameworks_base-46703b099516c383a6882815bcf9cd4df0ec538d.tar.gz
frameworks_base-46703b099516c383a6882815bcf9cd4df0ec538d.tar.bz2
Tolerate missing AccountManager resource, not just missing resource name
In addition to the primary change in the subject, also some minor cleanup of javadoc, typos, CloseGuard warning, etc found while working on a new AbstractAccountAuthenticator. Change-Id: I73f3408773a43a0021a15f8d051fd3dbbdf898a5
Diffstat (limited to 'core/java/android/accounts/AccountManagerService.java')
-rw-r--r--core/java/android/accounts/AccountManagerService.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java
index 93983a6..20d5b96 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -37,6 +37,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.RegisteredServicesCache;
import android.content.pm.RegisteredServicesCacheListener;
+import android.content.res.Resources;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase;
@@ -73,8 +74,7 @@ import java.util.concurrent.atomic.AtomicReference;
* accounts on the device. Some of these calls are implemented with the help of the corresponding
* {@link IAccountAuthenticator} services. This service is not accessed by users directly,
* instead one uses an instance of {@link AccountManager}, which can be accessed as follows:
- * AccountManager accountManager =
- * (AccountManager)context.getSystemService(Context.ACCOUNT_SERVICE)
+ * AccountManager accountManager = AccountManager.get(context);
* @hide
*/
public class AccountManagerService
@@ -1064,14 +1064,18 @@ public class AccountManagerService
} catch (PackageManager.NameNotFoundException e) {
throw new IllegalArgumentException("unknown account type: " + accountType);
}
- return authContext.getString(serviceInfo.type.labelId);
+ try {
+ return authContext.getString(serviceInfo.type.labelId);
+ } catch (Resources.NotFoundException e) {
+ throw new IllegalArgumentException("unknown account type: " + accountType);
+ }
}
private Intent newGrantCredentialsPermissionIntent(Account account, int uid,
AccountAuthenticatorResponse response, String authTokenType, String authTokenLabel) {
Intent intent = new Intent(mContext, GrantCredentialsPermissionActivity.class);
- // See FLAT_ACTIVITY_NEW_TASK docs for limitations and benefits of the flag.
+ // See FLAG_ACTIVITY_NEW_TASK docs for limitations and benefits of the flag.
// Since it was set in Eclair+ we can't change it without breaking apps using
// the intent from a non-Activity context.
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);