diff options
author | Fred Quintana <fredq@google.com> | 2009-08-27 18:28:17 -0700 |
---|---|---|
committer | Fred Quintana <fredq@google.com> | 2009-08-27 20:02:10 -0700 |
commit | c298a8518a8fd73a303132c7db241f10eb46c5b6 (patch) | |
tree | c8013189c5acdb6a48e94f32ba83fde65bade338 | |
parent | 1005569fbb459007ff9d9fddbfa6e49947166166 (diff) | |
download | frameworks_base-c298a8518a8fd73a303132c7db241f10eb46c5b6.zip frameworks_base-c298a8518a8fd73a303132c7db241f10eb46c5b6.tar.gz frameworks_base-c298a8518a8fd73a303132c7db241f10eb46c5b6.tar.bz2 |
add an accessor for Context for use by subclasses
3 files changed, 11 insertions, 0 deletions
diff --git a/core/java/android/accounts/AccountAuthenticatorCache.java b/core/java/android/accounts/AccountAuthenticatorCache.java index 2f52f40..82cadd5 100644 --- a/core/java/android/accounts/AccountAuthenticatorCache.java +++ b/core/java/android/accounts/AccountAuthenticatorCache.java @@ -21,6 +21,7 @@ import android.content.pm.RegisteredServicesCache; import android.content.res.TypedArray; import android.content.Context; import android.util.AttributeSet; +import android.text.TextUtils; /** * A cache of services that export the {@link IAccountAuthenticator} interface. This cache @@ -48,6 +49,9 @@ import android.util.AttributeSet; com.android.internal.R.styleable.AccountAuthenticator_label, 0); final int iconId = sa.getResourceId( com.android.internal.R.styleable.AccountAuthenticator_icon, 0); + if (TextUtils.isEmpty(accountType)) { + return null; + } return new AuthenticatorDescription(accountType, packageName, labelId, iconId); } finally { sa.recycle(); diff --git a/core/java/android/accounts/AuthenticatorDescription.java b/core/java/android/accounts/AuthenticatorDescription.java index f896bf8..672e648 100644 --- a/core/java/android/accounts/AuthenticatorDescription.java +++ b/core/java/android/accounts/AuthenticatorDescription.java @@ -10,6 +10,8 @@ public class AuthenticatorDescription implements Parcelable { final public String packageName; public AuthenticatorDescription(String type, String packageName, int labelId, int iconId) { + if (type == null) throw new IllegalArgumentException("type cannot be null"); + if (packageName == null) throw new IllegalArgumentException("packageName cannot be null"); this.type = type; this.packageName = packageName; this.labelId = labelId; @@ -17,6 +19,7 @@ public class AuthenticatorDescription implements Parcelable { } public static AuthenticatorDescription newKey(String type) { + if (type == null) throw new IllegalArgumentException("type cannot be null"); return new AuthenticatorDescription(type); } diff --git a/core/java/android/content/AbstractThreadedSyncAdapter.java b/core/java/android/content/AbstractThreadedSyncAdapter.java index f4e2a3d..1edcb0a 100644 --- a/core/java/android/content/AbstractThreadedSyncAdapter.java +++ b/core/java/android/content/AbstractThreadedSyncAdapter.java @@ -64,6 +64,10 @@ public abstract class AbstractThreadedSyncAdapter { mAutoInitialize = autoInitialize; } + public Context getContext() { + return mContext; + } + class ISyncAdapterImpl extends ISyncAdapter.Stub { public void startSync(ISyncContext syncContext, String authority, Account account, Bundle extras) { |