Skip to content

Commit e5847ad

Browse files
committed
b/5316640 fix bundle add
Change-Id: I567c26f6d8fc1a0ea5827fd32f9012b979cbea71
1 parent f9fa754 commit e5847ad

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

core/java/android/accounts/AccountManager.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,10 @@ public AccountManagerFuture<Bundle> getAuthToken(
815815
final Activity activity, AccountManagerCallback<Bundle> callback, Handler handler) {
816816
if (account == null) throw new IllegalArgumentException("account is null");
817817
if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null");
818-
final Bundle optionsIn = options == null ? new Bundle() : options;
818+
final Bundle optionsIn = new Bundle();
819+
if (options != null) {
820+
optionsIn.putAll(options);
821+
}
819822
optionsIn.putString(KEY_ANDROID_PACKAGE_NAME, mContext.getPackageName());
820823
return new AmsTask(activity, handler, callback) {
821824
public void doWork() throws RemoteException {
@@ -982,7 +985,10 @@ public AccountManagerFuture<Bundle> getAuthToken(
982985

983986
if (account == null) throw new IllegalArgumentException("account is null");
984987
if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null");
985-
final Bundle optionsIn = options == null ? new Bundle() : options;
988+
final Bundle optionsIn = new Bundle();
989+
if (options != null) {
990+
optionsIn.putAll(options);
991+
}
986992
optionsIn.putString(KEY_ANDROID_PACKAGE_NAME, mContext.getPackageName());
987993
return new AmsTask(null, handler, callback) {
988994
public void doWork() throws RemoteException {
@@ -1045,14 +1051,16 @@ public AccountManagerFuture<Bundle> addAccount(final String accountType,
10451051
final Bundle addAccountOptions,
10461052
final Activity activity, AccountManagerCallback<Bundle> callback, Handler handler) {
10471053
if (accountType == null) throw new IllegalArgumentException("accountType is null");
1048-
final Bundle options = (addAccountOptions == null) ? new Bundle() :
1049-
addAccountOptions;
1050-
options.putString(KEY_ANDROID_PACKAGE_NAME, mContext.getPackageName());
1054+
final Bundle optionsIn = new Bundle();
1055+
if (addAccountOptions != null) {
1056+
optionsIn.putAll(addAccountOptions);
1057+
}
1058+
optionsIn.putString(KEY_ANDROID_PACKAGE_NAME, mContext.getPackageName());
10511059

10521060
return new AmsTask(activity, handler, callback) {
10531061
public void doWork() throws RemoteException {
10541062
mService.addAcount(mResponse, accountType, authTokenType,
1055-
requiredFeatures, activity != null, options);
1063+
requiredFeatures, activity != null, optionsIn);
10561064
}
10571065
}.start();
10581066
}

0 commit comments

Comments
 (0)