diff options
| author | Costin Manolache <costin@google.com> | 2011-09-08 11:26:09 -0700 |
|---|---|---|
| committer | Costin Manolache <costin@google.com> | 2011-09-12 12:11:24 -0700 |
| commit | b61e8fbabea2cc40ad65bf4f372a32d526cfc7ac (patch) | |
| tree | c20c26679062bfea7e48fe068eaab4bab91c5944 /core/java/android/accounts/AccountManagerService.java | |
| parent | 6515f50d0c759cfff163aaf7f42a970019d93923 (diff) | |
| download | frameworks_base-b61e8fbabea2cc40ad65bf4f372a32d526cfc7ac.zip frameworks_base-b61e8fbabea2cc40ad65bf4f372a32d526cfc7ac.tar.gz frameworks_base-b61e8fbabea2cc40ad65bf4f372a32d526cfc7ac.tar.bz2 | |
For consistency with getAuthToken, pass UID/PID for add account. Needed for customizing the add account flow
b/5278759 API changes to pass package, options
b/5249018 consistent/customized add account UI
b/5270079 tag who adds the account
Change-Id: I1ee211d751b565c725c89aa1a429ef2f5bebe34a
Diffstat (limited to 'core/java/android/accounts/AccountManagerService.java')
| -rw-r--r-- | core/java/android/accounts/AccountManagerService.java | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java index 20d5b96..173da8d 100644 --- a/core/java/android/accounts/AccountManagerService.java +++ b/core/java/android/accounts/AccountManagerService.java @@ -16,10 +16,6 @@ package android.accounts; -import com.android.internal.R; -import com.android.internal.telephony.ITelephony; -import com.android.internal.telephony.TelephonyIntents; - import android.Manifest; import android.app.ActivityManager; import android.app.Notification; @@ -51,13 +47,13 @@ import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.RemoteException; -import android.os.ServiceManager; import android.os.SystemClock; -import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Log; import android.util.Pair; +import com.android.internal.R; + import java.io.File; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -924,9 +920,6 @@ public class AccountManagerService if (account == null) throw new IllegalArgumentException("account is null"); if (authTokenType == null) throw new IllegalArgumentException("authTokenType is null"); checkBinderPermission(Manifest.permission.USE_CREDENTIALS); - final int callerUid = Binder.getCallingUid(); - final int callerPid = Binder.getCallingPid(); - AccountAuthenticatorCache.ServiceInfo<AuthenticatorDescription> authenticatorInfo = mAuthenticatorCache.getServiceInfo( AuthenticatorDescription.newKey(account.type)); @@ -934,20 +927,19 @@ public class AccountManagerService authenticatorInfo != null && authenticatorInfo.type.customTokens; // skip the check if customTokens + final int callerUid = Binder.getCallingUid(); final boolean permissionGranted = customTokens || permissionIsGranted(account, authTokenType, callerUid); final Bundle loginOptions = (loginOptionsIn == null) ? new Bundle() : loginOptionsIn; - if (customTokens) { - // let authenticator know the identity of the caller - loginOptions.putInt(AccountManager.KEY_CALLER_UID, callerUid); - loginOptions.putInt(AccountManager.KEY_CALLER_PID, callerPid); - if (notifyOnAuthFailure) { - loginOptions.putBoolean(AccountManager.KEY_NOTIFY_ON_FAILURE, true); - } + // let authenticator know the identity of the caller + loginOptions.putInt(AccountManager.KEY_CALLER_UID, callerUid); + loginOptions.putInt(AccountManager.KEY_CALLER_PID, Binder.getCallingPid()); + if (notifyOnAuthFailure) { + loginOptions.putBoolean(AccountManager.KEY_NOTIFY_ON_FAILURE, true); } - + long identityToken = clearCallingIdentity(); try { // if the caller has permission, do the peek. otherwise go the more expensive @@ -1120,7 +1112,7 @@ public class AccountManagerService public void addAcount(final IAccountManagerResponse response, final String accountType, final String authTokenType, final String[] requiredFeatures, - final boolean expectActivityLaunch, final Bundle options) { + final boolean expectActivityLaunch, final Bundle optionsIn) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "addAccount: accountType " + accountType + ", response " + response @@ -1133,6 +1125,13 @@ public class AccountManagerService if (response == null) throw new IllegalArgumentException("response is null"); if (accountType == null) throw new IllegalArgumentException("accountType is null"); checkManageAccountsPermission(); + + final int pid = Binder.getCallingPid(); + final int uid = Binder.getCallingUid(); + final Bundle options = (optionsIn == null) ? new Bundle() : optionsIn; + options.putInt(AccountManager.KEY_CALLER_UID, uid); + options.putInt(AccountManager.KEY_CALLER_PID, pid); + long identityToken = clearCallingIdentity(); try { new Session(response, accountType, expectActivityLaunch, |
