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

Commit 227ba29e authored by Chad Brubaker's avatar Chad Brubaker Committed by Android (Google) Code Review
Browse files

Merge "Clear only keystore credential entires" into mnc-dev

parents b5746cb1 ce10b5ed
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -104,6 +104,12 @@ public final class CredentialStorage extends Activity {

    private final KeyStore mKeyStore = KeyStore.getInstance();

    /**
     * The UIDs that are used for system credential storage in keystore.
     */
    private static final int[] SYSTEM_CREDENTIAL_UIDS = {Process.WIFI_UID, Process.VPN_UID,
        Process.ROOT_UID, Process.SYSTEM_UID};

    /**
     * When non-null, the bundle containing credentials to install.
     */
@@ -333,7 +339,14 @@ public final class CredentialStorage extends Activity {

        @Override protected Boolean doInBackground(Void... unused) {

            mKeyStore.reset();
            // Clear all the users credentials could have been installed in for this user.
            final UserManager um = (UserManager) getSystemService(USER_SERVICE);
            for (UserInfo pi : um.getProfiles(UserHandle.getUserId(Process.myUid()))) {
                for (int uid : SYSTEM_CREDENTIAL_UIDS) {
                    mKeyStore.clearUid(UserHandle.getUid(pi.id, uid));
                }
            }


            try {
                KeyChainConnection keyChainConnection = KeyChain.bind(CredentialStorage.this);