Loading Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -150,7 +150,6 @@ filegroup { ":incidentcompanion_aidl", ":inputconstants_aidl", ":installd_aidl", ":keystore_aidl", ":libaudioclient_aidl", ":libbinder_aidl", ":libbluetooth-binder-aidl", Loading config/hiddenapi-unsupported.txt +0 −1 Original line number Diff line number Diff line Loading @@ -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; Loading core/java/android/hardware/biometrics/BiometricTestSession.java +14 −9 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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); Loading Loading @@ -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(); Loading Loading @@ -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); Loading @@ -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()) { Loading @@ -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; } } core/java/android/security/ConfirmationPrompt.java +31 −149 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading @@ -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 Loading @@ -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); } }); } Loading Loading @@ -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, Loading Loading @@ -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); Loading @@ -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(); } } } /** Loading @@ -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) { Loading @@ -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(); } } } /** Loading @@ -448,9 +333,6 @@ public class ConfirmationPrompt { if (isAccessibilityServiceRunning(context)) { return false; } if (AndroidKeyStoreProvider.isKeystore2Enabled()) { return new AndroidProtectedConfirmation().isConfirmationPromptSupported(); } return KeyStore.getInstance().isConfirmationPromptSupported(); } } keystore/java/android/security/keystore/AndroidKeyStoreSecretKey.java→core/java/android/security/keymaster/KeymasterCertificateChain.aidl +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. Loading @@ -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
Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -150,7 +150,6 @@ filegroup { ":incidentcompanion_aidl", ":inputconstants_aidl", ":installd_aidl", ":keystore_aidl", ":libaudioclient_aidl", ":libbinder_aidl", ":libbluetooth-binder-aidl", Loading
config/hiddenapi-unsupported.txt +0 −1 Original line number Diff line number Diff line Loading @@ -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; Loading
core/java/android/hardware/biometrics/BiometricTestSession.java +14 −9 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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); Loading Loading @@ -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(); Loading Loading @@ -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); Loading @@ -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()) { Loading @@ -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; } }
core/java/android/security/ConfirmationPrompt.java +31 −149 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading @@ -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 Loading @@ -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); } }); } Loading Loading @@ -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, Loading Loading @@ -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); Loading @@ -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(); } } } /** Loading @@ -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) { Loading @@ -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(); } } } /** Loading @@ -448,9 +333,6 @@ public class ConfirmationPrompt { if (isAccessibilityServiceRunning(context)) { return false; } if (AndroidKeyStoreProvider.isKeystore2Enabled()) { return new AndroidProtectedConfirmation().isConfirmationPromptSupported(); } return KeyStore.getInstance().isConfirmationPromptSupported(); } }
keystore/java/android/security/keystore/AndroidKeyStoreSecretKey.java→core/java/android/security/keymaster/KeymasterCertificateChain.aidl +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. Loading @@ -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;