diff options
author | Alexandra Gherghina <alexgherghina@google.com> | 2014-07-18 09:50:57 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-17 19:51:18 +0000 |
commit | ccdc369e4772ed3d97508938861ee00457f8ba3e (patch) | |
tree | 4a03b8ed0e5c38bc8079501e1047e514a89e2ba3 /src/com/android/settings | |
parent | c08c67be886082c579983beceeac1d935d8e1c3b (diff) | |
parent | 9ce0da9cf1a25eec322e2c7f9f2bc9ba15158e90 (diff) | |
download | packages_apps_Settings-ccdc369e4772ed3d97508938861ee00457f8ba3e.tar.gz packages_apps_Settings-ccdc369e4772ed3d97508938861ee00457f8ba3e.tar.bz2 packages_apps_Settings-ccdc369e4772ed3d97508938861ee00457f8ba3e.zip |
Merge "Add account for managed user" into lmp-dev
Diffstat (limited to 'src/com/android/settings')
-rw-r--r-- | src/com/android/settings/accounts/AddAccountSettings.java | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/com/android/settings/accounts/AddAccountSettings.java b/src/com/android/settings/accounts/AddAccountSettings.java index 0af026062..4e97c05b6 100644 --- a/src/com/android/settings/accounts/AddAccountSettings.java +++ b/src/com/android/settings/accounts/AddAccountSettings.java @@ -98,7 +98,7 @@ public class AddAccountSettings extends Activity { Utils.hasMultipleUsers(AddAccountSettings.this)); addAccountOptions.putParcelable(EXTRA_USER, mUserHandle); intent.putExtras(addAccountOptions); - startActivityForResult(intent, ADD_ACCOUNT_REQUEST); + startActivityForResultAsUser(intent, ADD_ACCOUNT_REQUEST, mUserHandle); } else { setResult(RESULT_OK); if (mPendingIntent != null) { @@ -199,22 +199,15 @@ public class AddAccountSettings extends Activity { mPendingIntent = PendingIntent.getBroadcast(this, 0, new Intent(), 0); addAccountOptions.putParcelable(KEY_CALLER_IDENTITY, mPendingIntent); addAccountOptions.putBoolean(EXTRA_HAS_MULTIPLE_USERS, Utils.hasMultipleUsers(this)); - // TODO: We need an API to add an account to a different user. See: http://b/15466880 - int userId = mUserHandle.getIdentifier(); - int callingUserId = UserHandle.getCallingUserId(); - if (userId != callingUserId) { - Log.w(TAG, "Cannot add an account for user " + userId + " from " + callingUserId + "."); - finish(); - return; - } - AccountManager.get(this).addAccount( + AccountManager.get(this).addAccountAsUser( accountType, null, /* authTokenType */ null, /* requiredFeatures */ addAccountOptions, null, mCallback, - null /* handler */); + null /* handler */, + mUserHandle); mAddAccountCalled = true; } } |