am c298a851: add an accessor for Context for use by subclasses
Merge commit 'c298a8518a8fd73a303132c7db241f10eb46c5b6' into eclair-plus-aosp * commit 'c298a8518a8fd73a303132c7db241f10eb46c5b6': add an accessor for Context for use by subclasses
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user