Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa25c428 authored by Dmitry Dementyev's avatar Dmitry Dementyev
Browse files

Update AccountManagerService checkKeyIntent.

GrantCredentialsPermissionActivity can be opened from system app.
This change makes sure that Intent used launch it was created by AMS

The activity is used by authenticators with customTokens=false

Test: manual
Bug: 314961491
Change-Id: Idcfa6e6e264f64f59b066b436303815549e30bef
parent 31b1d040
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -3152,6 +3152,7 @@ public class AccountManagerService
                                    new AccountAuthenticatorResponse(this),
                                    authTokenType,
                                    true);
                            mCanStartAccountManagerActivity = true;
                            Bundle bundle = new Bundle();
                            bundle.putParcelable(AccountManager.KEY_INTENT, intent);
                            onResult(bundle);
@@ -4933,6 +4934,7 @@ public class AccountManagerService
        IAccountAuthenticator mAuthenticator = null;

        private final boolean mStripAuthTokenFromResult;
        protected boolean mCanStartAccountManagerActivity = false;
        protected final UserAccounts mAccounts;

        public Session(UserAccounts accounts, IAccountManagerResponse response, String accountType,
@@ -5068,9 +5070,13 @@ public class AccountManagerService

        private boolean isExportedSystemActivity(ActivityInfo activityInfo) {
            String className = activityInfo.name;
            return "android".equals(activityInfo.packageName) &&
                    (GrantCredentialsPermissionActivity.class.getName().equals(className)
                    || CantAddAccountActivity.class.getName().equals(className));
            if (!"android".equals(activityInfo.packageName)) {
                return false;

            }
            return (mCanStartAccountManagerActivity
                    && GrantCredentialsPermissionActivity.class.getName().equals(className))
                    || CantAddAccountActivity.class.getName().equals(className);
        }

        private void close() {