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

Commit cc490831 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7257099 from 90c634b0 to sc-release

Change-Id: I4e1ec6778316ac47c38d98894ec48942bb292ce9
parents 8373d856 90c634b0
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -150,7 +150,6 @@ filegroup {
        ":incidentcompanion_aidl",
        ":inputconstants_aidl",
        ":installd_aidl",
        ":keystore_aidl",
        ":libaudioclient_aidl",
        ":libbinder_aidl",
        ":libbluetooth-binder-aidl",
+0 −1
Original line number Diff line number Diff line
@@ -208,7 +208,6 @@ Landroid/os/storage/IObbActionListener$Stub;-><init>()V
Landroid/os/storage/IStorageManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/os/storage/IStorageManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/storage/IStorageManager;
Landroid/security/IKeyChainService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/security/IKeyChainService;
Landroid/security/keystore/IKeystoreService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/security/keystore/IKeystoreService;
Landroid/service/dreams/IDreamManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/dreams/IDreamManager;
Landroid/service/notification/INotificationListener$Stub;-><init>()V
Landroid/service/persistentdata/IPersistentDataBlockService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/persistentdata/IPersistentDataBlockService;
+14 −9
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit;
 */
@TestApi
public class BiometricTestSession implements AutoCloseable {
    private static final String TAG = "BiometricTestSession";
    private static final String BASE_TAG = "BiometricTestSession";

    /**
     * @hide
@@ -66,12 +66,12 @@ public class BiometricTestSession implements AutoCloseable {
    private final ITestSessionCallback mCallback = new ITestSessionCallback.Stub() {
        @Override
        public void onCleanupStarted(int userId) {
            Log.d(TAG, "onCleanupStarted, sensor: " + mSensorId + ", userId: " + userId);
            Log.d(getTag(), "onCleanupStarted, sensor: " + mSensorId + ", userId: " + userId);
        }

        @Override
        public void onCleanupFinished(int userId) {
            Log.d(TAG, "onCleanupFinished, sensor: " + mSensorId
            Log.d(getTag(), "onCleanupFinished, sensor: " + mSensorId
                    + ", userId: " + userId
                    + ", remaining users: " + mUsersCleaningUp.size());
            mUsersCleaningUp.remove(userId);
@@ -107,7 +107,7 @@ public class BiometricTestSession implements AutoCloseable {
    @RequiresPermission(TEST_BIOMETRIC)
    private void setTestHalEnabled(boolean enabled) {
        try {
            Log.w(TAG, "setTestHalEnabled, sensor: " + mSensorId + " enabled: " + enabled);
            Log.w(getTag(), "setTestHalEnabled, sensor: " + mSensorId + " enabled: " + enabled);
            mTestSession.setTestHalEnabled(enabled);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
@@ -217,7 +217,7 @@ public class BiometricTestSession implements AutoCloseable {
    public void cleanupInternalState(int userId) {
        try {
            if (mUsersCleaningUp.contains(userId)) {
                Log.w(TAG, "Cleanup already in progress for user: " + userId);
                Log.w(getTag(), "Cleanup already in progress for user: " + userId);
            }

            mUsersCleaningUp.add(userId);
@@ -230,6 +230,7 @@ public class BiometricTestSession implements AutoCloseable {
    @Override
    @RequiresPermission(TEST_BIOMETRIC)
    public void close() {
        Log.d(getTag(), "Close, mTestedUsers size; " + mTestedUsers.size());
        // Cleanup can be performed using the test HAL, since it always responds to enumerate with
        // zero enrollments.
        if (!mTestedUsers.isEmpty()) {
@@ -239,15 +240,19 @@ public class BiometricTestSession implements AutoCloseable {
            }

            try {
                Log.d(TAG, "Awaiting latch...");
                mCloseLatch.await(10, TimeUnit.SECONDS);
                Log.d(TAG, "Finished awaiting");
                Log.d(getTag(), "Awaiting latch...");
                mCloseLatch.await(3, TimeUnit.SECONDS);
                Log.d(getTag(), "Finished awaiting");
            } catch (InterruptedException e) {
                Log.e(TAG, "Latch interrupted", e);
                Log.e(getTag(), "Latch interrupted", e);
            }
        }

        // Disable the test HAL after the sensor becomes idle.
        setTestHalEnabled(false);
    }

    private String getTag() {
        return BASE_TAG + "_" + mSensorId;
    }
}
+31 −149
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.content.ContentResolver;
import android.content.Context;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.security.keystore.AndroidKeyStoreProvider;
import android.text.TextUtils;
import android.util.Log;

@@ -105,32 +104,6 @@ public class ConfirmationPrompt {

    private void doCallback(int responseCode, byte[] dataThatWasConfirmed,
            ConfirmationCallback callback) {
        switch (responseCode) {
            case KeyStore.CONFIRMATIONUI_OK:
                callback.onConfirmed(dataThatWasConfirmed);
                break;

            case KeyStore.CONFIRMATIONUI_CANCELED:
                callback.onDismissed();
                break;

            case KeyStore.CONFIRMATIONUI_ABORTED:
                callback.onCanceled();
                break;

            case KeyStore.CONFIRMATIONUI_SYSTEM_ERROR:
                callback.onError(new Exception("System error returned by ConfirmationUI."));
                break;

            default:
                callback.onError(new Exception("Unexpected responseCode=" + responseCode
                                + " from onConfirmtionPromptCompleted() callback."));
                break;
        }
    }

    private void doCallback2(int responseCode, byte[] dataThatWasConfirmed,
            ConfirmationCallback callback) {
        switch (responseCode) {
            case AndroidProtectedConfirmation.ERROR_OK:
                callback.onConfirmed(dataThatWasConfirmed);
@@ -155,31 +128,6 @@ public class ConfirmationPrompt {
        }
    }

    private final android.os.IBinder mCallbackBinder =
            new android.security.IConfirmationPromptCallback.Stub() {
                @Override
                public void onConfirmationPromptCompleted(
                        int responseCode, final byte[] dataThatWasConfirmed)
                        throws android.os.RemoteException {
                    if (mCallback != null) {
                        ConfirmationCallback callback = mCallback;
                        Executor executor = mExecutor;
                        mCallback = null;
                        mExecutor = null;
                        if (executor == null) {
                            doCallback(responseCode, dataThatWasConfirmed, callback);
                        } else {
                            executor.execute(new Runnable() {
                                    @Override
                                    public void run() {
                                        doCallback(responseCode, dataThatWasConfirmed, callback);
                                    }
                                });
                        }
                    }
                }
            };

    private final android.security.apc.IConfirmationCallback mConfirmationCallback =
            new android.security.apc.IConfirmationCallback.Stub() {
                @Override
@@ -191,11 +139,11 @@ public class ConfirmationPrompt {
                        mCallback = null;
                        mExecutor = null;
                        if (executor == null) {
                            doCallback2(result, dataThatWasConfirmed, callback);
                            doCallback(result, dataThatWasConfirmed, callback);
                        } else {
                            executor.execute(new Runnable() {
                                @Override public void run() {
                                    doCallback2(result, dataThatWasConfirmed, callback);
                                    doCallback(result, dataThatWasConfirmed, callback);
                                }
                            });
                        }
@@ -266,29 +214,7 @@ public class ConfirmationPrompt {
        mExtraData = extraData;
    }

    private static final int UI_OPTION_ACCESSIBILITY_INVERTED_FLAG = 1 << 0;
    private static final int UI_OPTION_ACCESSIBILITY_MAGNIFIED_FLAG = 1 << 1;

    private int getUiOptionsAsFlags() {
        if (AndroidKeyStoreProvider.isKeystore2Enabled()) {
            return getUiOptionsAsFlags2();
        }
        int uiOptionsAsFlags = 0;
        ContentResolver contentResolver = mContext.getContentResolver();
        int inversionEnabled = Settings.Secure.getInt(contentResolver,
                Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 0);
        if (inversionEnabled == 1) {
            uiOptionsAsFlags |= UI_OPTION_ACCESSIBILITY_INVERTED_FLAG;
        }
        float fontScale = Settings.System.getFloat(contentResolver,
                Settings.System.FONT_SCALE, (float) 1.0);
        if (fontScale > 1.0) {
            uiOptionsAsFlags |= UI_OPTION_ACCESSIBILITY_MAGNIFIED_FLAG;
        }
        return uiOptionsAsFlags;
    }

    private int getUiOptionsAsFlags2() {
        int uiOptionsAsFlags = 0;
        ContentResolver contentResolver = mContext.getContentResolver();
        int inversionEnabled = Settings.Secure.getInt(contentResolver,
@@ -349,8 +275,7 @@ public class ConfirmationPrompt {
        mExecutor = executor;

        String locale = Locale.getDefault().toLanguageTag();
        if (AndroidKeyStoreProvider.isKeystore2Enabled()) {
            int uiOptionsAsFlags = getUiOptionsAsFlags2();
        int uiOptionsAsFlags = getUiOptionsAsFlags();
        int responseCode = getService().presentConfirmationPrompt(
                mConfirmationCallback, mPromptText.toString(), mExtraData, locale,
                uiOptionsAsFlags);
@@ -371,31 +296,6 @@ public class ConfirmationPrompt {
                                + " from presentConfirmationPrompt() call.");
                throw new IllegalArgumentException();
        }
        } else {
            int uiOptionsAsFlags = getUiOptionsAsFlags();
            int responseCode = mKeyStore.presentConfirmationPrompt(
                    mCallbackBinder, mPromptText.toString(), mExtraData, locale, uiOptionsAsFlags);
            switch (responseCode) {
                case KeyStore.CONFIRMATIONUI_OK:
                    return;

                case KeyStore.CONFIRMATIONUI_OPERATION_PENDING:
                    throw new ConfirmationAlreadyPresentingException();

                case KeyStore.CONFIRMATIONUI_UNIMPLEMENTED:
                    throw new ConfirmationNotAvailableException();

                case KeyStore.CONFIRMATIONUI_UIERROR:
                    throw new IllegalArgumentException();

                default:
                    // Unexpected error code.
                    Log.w(TAG,
                            "Unexpected responseCode=" + responseCode
                                    + " from presentConfirmationPrompt() call.");
                    throw new IllegalArgumentException();
            }
        }
    }

    /**
@@ -408,7 +308,6 @@ public class ConfirmationPrompt {
     * @throws IllegalStateException if no prompt is currently being presented.
     */
    public void cancelPrompt() {
        if (AndroidKeyStoreProvider.isKeystore2Enabled()) {
        int responseCode =
                getService().cancelConfirmationPrompt(mConfirmationCallback);
        if (responseCode == AndroidProtectedConfirmation.ERROR_OK) {
@@ -422,20 +321,6 @@ public class ConfirmationPrompt {
                            + " from cancelConfirmationPrompt() call.");
            throw new IllegalStateException();
        }
        } else {
            int responseCode = mKeyStore.cancelConfirmationPrompt(mCallbackBinder);
            if (responseCode == KeyStore.CONFIRMATIONUI_OK) {
                return;
            } else if (responseCode == KeyStore.CONFIRMATIONUI_OPERATION_PENDING) {
                throw new IllegalStateException();
            } else {
                // Unexpected error code.
                Log.w(TAG,
                        "Unexpected responseCode=" + responseCode
                                + " from cancelConfirmationPrompt() call.");
                throw new IllegalStateException();
            }
        }
    }

    /**
@@ -448,9 +333,6 @@ public class ConfirmationPrompt {
        if (isAccessibilityServiceRunning(context)) {
            return false;
        }
        if (AndroidKeyStoreProvider.isKeystore2Enabled()) {
        return new AndroidProtectedConfirmation().isConfirmationPromptSupported();
    }
        return KeyStore.getInstance().isConfirmationPromptSupported();
    }
}
+3 −15
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 The Android Open Source Project
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -14,18 +14,6 @@
 * limitations under the License.
 */

package android.security.keystore;
package android.security.keymaster;

import javax.crypto.SecretKey;

/**
 * {@link SecretKey} backed by Android Keystore.
 *
 * @hide
 */
public class AndroidKeyStoreSecretKey extends AndroidKeyStoreKey implements SecretKey {

    public AndroidKeyStoreSecretKey(String alias, int uid, String algorithm) {
        super(alias, uid, algorithm);
    }
}
parcelable KeymasterCertificateChain;
Loading