Loading api/current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -5101,7 +5101,7 @@ package android.app { } public class KeyguardManager { method public android.content.Intent createConfirmDeviceCredentialIntent(CharSequence, CharSequence); method @Deprecated public android.content.Intent createConfirmDeviceCredentialIntent(CharSequence, CharSequence); method @Deprecated @RequiresPermission(android.Manifest.permission.DISABLE_KEYGUARD) public void exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult); method @Deprecated public boolean inKeyguardRestrictedInputMode(); method public boolean isDeviceLocked(); Loading Loading @@ -16498,6 +16498,7 @@ package android.hardware.biometrics { ctor public BiometricPrompt.Builder(android.content.Context); method public android.hardware.biometrics.BiometricPrompt build(); method public android.hardware.biometrics.BiometricPrompt.Builder setDescription(@NonNull CharSequence); method public android.hardware.biometrics.BiometricPrompt.Builder setEnableFallback(boolean); method public android.hardware.biometrics.BiometricPrompt.Builder setNegativeButton(@NonNull CharSequence, @NonNull java.util.concurrent.Executor, @NonNull android.content.DialogInterface.OnClickListener); method public android.hardware.biometrics.BiometricPrompt.Builder setRequireConfirmation(boolean); method public android.hardware.biometrics.BiometricPrompt.Builder setSubtitle(@NonNull CharSequence); core/java/android/app/KeyguardManager.java +16 −36 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.hardware.biometrics.BiometricPrompt; import android.os.Binder; import android.os.Build; import android.os.Handler; Loading Loading @@ -86,6 +87,12 @@ public class KeyguardManager { public static final String ACTION_CONFIRM_FRP_CREDENTIAL = "android.app.action.CONFIRM_FRP_CREDENTIAL"; /** * @hide */ public static final String EXTRA_BIOMETRIC_PROMPT_BUNDLE = "android.app.extra.BIOMETRIC_PROMPT_BUNDLE"; /** * A CharSequence dialog title to show to the user when used with a * {@link #ACTION_CONFIRM_DEVICE_CREDENTIAL}. Loading @@ -100,12 +107,6 @@ public class KeyguardManager { */ public static final String EXTRA_DESCRIPTION = "android.app.extra.DESCRIPTION"; /** * A boolean value to forward to {@link android.hardware.biometrics.BiometricPrompt}. * @hide */ public static final String EXTRA_USE_IMPLICIT = "android.app.extra.USE_IMPLICIT"; /** * A CharSequence description to show to the user on the alternate button when used with * {@link #ACTION_CONFIRM_FRP_CREDENTIAL}. Loading @@ -124,44 +125,23 @@ public class KeyguardManager { public static final int RESULT_ALTERNATE = 1; /** * Get an intent to prompt the user to confirm credentials (pin, pattern or password) * for the current user of the device. The caller is expected to launch this activity using * {@link android.app.Activity#startActivityForResult(Intent, int)} and check for * @deprecated see {@link BiometricPrompt.Builder#setEnableFallback(boolean)} * * Get an intent to prompt the user to confirm credentials (pin, pattern, password or biometrics * if enrolled) for the current user of the device. The caller is expected to launch this * activity using {@link android.app.Activity#startActivityForResult(Intent, int)} and check for * {@link android.app.Activity#RESULT_OK} if the user successfully completes the challenge. * * @param title Title to be shown on the dialog. * @param description Description to be shown on the dialog. * @return the intent for launching the activity or null if no password is required. **/ @Deprecated @RequiresFeature(PackageManager.FEATURE_SECURE_LOCK_SCREEN) public Intent createConfirmDeviceCredentialIntent(CharSequence title, CharSequence description) { return createConfirmDeviceCredentialIntent(title, description, false /* useImplicit */); } /** * Get an intent to prompt the user to confirm credentials (pin, pattern or password) * for the current user of the device. The caller is expected to launch this activity using * {@link android.app.Activity#startActivityForResult(Intent, int)} and check for * {@link android.app.Activity#RESULT_OK} if the user successfully completes the challenge. * * @param title Title to be shown on the dialog. * @param description Description to be shown on the dialog. * @param useImplicit If useImplicit is set to true, ConfirmDeviceCredentials will invoke * {@link android.hardware.biometrics.BiometricPrompt} with * {@link android.hardware.biometrics.BiometricPrompt.Builder#setRequireConfirmation( * boolean)} set to false. * @return the intent for launching the activity or null if no password is required. * @hide */ public Intent createConfirmDeviceCredentialIntent(CharSequence title, CharSequence description, boolean useImplicit) { if (!isDeviceSecure()) { return null; } public Intent createConfirmDeviceCredentialIntent(CharSequence title, CharSequence description) { if (!isDeviceSecure()) return null; Intent intent = new Intent(ACTION_CONFIRM_DEVICE_CREDENTIAL); intent.putExtra(EXTRA_TITLE, title); intent.putExtra(EXTRA_DESCRIPTION, description); intent.putExtra(EXTRA_USE_IMPLICIT, useImplicit); // explicitly set the package for security intent.setPackage(getSettingsPackageForIntent(intent)); Loading core/java/android/hardware/biometrics/BiometricManager.java +34 −0 Original line number Diff line number Diff line Loading @@ -171,5 +171,39 @@ public class BiometricManager { Slog.w(TAG, "resetTimeout(): Service not connected"); } } /** * TODO(b/123378871): Remove when moved. * @hide */ @RequiresPermission(USE_BIOMETRIC_INTERNAL) public void onConfirmDeviceCredentialSuccess() { if (mService != null) { try { mService.onConfirmDeviceCredentialSuccess(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } else { Slog.w(TAG, "onConfirmDeviceCredentialSuccess(): Service not connected"); } } /** * TODO(b/123378871): Remove when moved. * @hide */ @RequiresPermission(USE_BIOMETRIC_INTERNAL) public void onConfirmDeviceCredentialError(int error, String message) { if (mService != null) { try { mService.onConfirmDeviceCredentialError(error, message); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } else { Slog.w(TAG, "onConfirmDeviceCredentialError(): Service not connected"); } } } core/java/android/hardware/biometrics/BiometricPrompt.java +24 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,10 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan * @hide */ public static final String KEY_REQUIRE_CONFIRMATION = "require_confirmation"; /** * @hide */ public static final String KEY_ENABLE_FALLBACK = "enable_fallback"; /** * Error/help message will show for this amount of time. Loading Loading @@ -241,6 +245,18 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan return this; } /** * The user will first be prompted to authenticate with biometrics, but also given the * option to authenticate with their device PIN, pattern, or password. * @param enable When true, the prompt will fall back to ask for the user's device * credentials (PIN, pattern, or password). * @return */ public Builder setEnableFallback(boolean enable) { mBundle.putBoolean(KEY_ENABLE_FALLBACK, enable); return this; } /** * Creates a {@link BiometricPrompt}. * @return a {@link BiometricPrompt} Loading @@ -250,11 +266,15 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan final CharSequence title = mBundle.getCharSequence(KEY_TITLE); final CharSequence negative = mBundle.getCharSequence(KEY_NEGATIVE_TEXT); final boolean useDefaultTitle = mBundle.getBoolean(KEY_USE_DEFAULT_TITLE); final boolean enableFallback = mBundle.getBoolean(KEY_ENABLE_FALLBACK); if (TextUtils.isEmpty(title) && !useDefaultTitle) { throw new IllegalArgumentException("Title must be set and non-empty"); } else if (TextUtils.isEmpty(negative)) { } else if (TextUtils.isEmpty(negative) && !enableFallback) { throw new IllegalArgumentException("Negative text must be set and non-empty"); } else if (!TextUtils.isEmpty(negative) && enableFallback) { throw new IllegalArgumentException("Can't have both negative button behavior" + " and fallback enabled"); } return new BiometricPrompt(mContext, mBundle, mPositiveButtonInfo, mNegativeButtonInfo); } Loading Loading @@ -514,6 +534,9 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan if (callback == null) { throw new IllegalArgumentException("Must supply a callback"); } if (mBundle.getBoolean(KEY_ENABLE_FALLBACK)) { throw new IllegalArgumentException("Fallback not supported with crypto"); } authenticateInternal(crypto, cancel, executor, callback, mContext.getUserId()); } Loading core/java/android/hardware/biometrics/IBiometricService.aidl +8 −0 Original line number Diff line number Diff line Loading @@ -51,4 +51,12 @@ interface IBiometricService { // Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password) void resetTimeout(in byte [] token); // TODO(b/123378871): Remove when moved. // CDCA needs to send results to BiometricService if it was invoked using BiometricPrompt's // setEnableFallback method, since there's no way for us to intercept onActivityResult. // CDCA is launched from BiometricService (startActivityAsUser) instead of *ForResult. void onConfirmDeviceCredentialSuccess(); // TODO(b/123378871): Remove when moved. void onConfirmDeviceCredentialError(int error, String message); } Loading
api/current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -5101,7 +5101,7 @@ package android.app { } public class KeyguardManager { method public android.content.Intent createConfirmDeviceCredentialIntent(CharSequence, CharSequence); method @Deprecated public android.content.Intent createConfirmDeviceCredentialIntent(CharSequence, CharSequence); method @Deprecated @RequiresPermission(android.Manifest.permission.DISABLE_KEYGUARD) public void exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult); method @Deprecated public boolean inKeyguardRestrictedInputMode(); method public boolean isDeviceLocked(); Loading Loading @@ -16498,6 +16498,7 @@ package android.hardware.biometrics { ctor public BiometricPrompt.Builder(android.content.Context); method public android.hardware.biometrics.BiometricPrompt build(); method public android.hardware.biometrics.BiometricPrompt.Builder setDescription(@NonNull CharSequence); method public android.hardware.biometrics.BiometricPrompt.Builder setEnableFallback(boolean); method public android.hardware.biometrics.BiometricPrompt.Builder setNegativeButton(@NonNull CharSequence, @NonNull java.util.concurrent.Executor, @NonNull android.content.DialogInterface.OnClickListener); method public android.hardware.biometrics.BiometricPrompt.Builder setRequireConfirmation(boolean); method public android.hardware.biometrics.BiometricPrompt.Builder setSubtitle(@NonNull CharSequence);
core/java/android/app/KeyguardManager.java +16 −36 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.hardware.biometrics.BiometricPrompt; import android.os.Binder; import android.os.Build; import android.os.Handler; Loading Loading @@ -86,6 +87,12 @@ public class KeyguardManager { public static final String ACTION_CONFIRM_FRP_CREDENTIAL = "android.app.action.CONFIRM_FRP_CREDENTIAL"; /** * @hide */ public static final String EXTRA_BIOMETRIC_PROMPT_BUNDLE = "android.app.extra.BIOMETRIC_PROMPT_BUNDLE"; /** * A CharSequence dialog title to show to the user when used with a * {@link #ACTION_CONFIRM_DEVICE_CREDENTIAL}. Loading @@ -100,12 +107,6 @@ public class KeyguardManager { */ public static final String EXTRA_DESCRIPTION = "android.app.extra.DESCRIPTION"; /** * A boolean value to forward to {@link android.hardware.biometrics.BiometricPrompt}. * @hide */ public static final String EXTRA_USE_IMPLICIT = "android.app.extra.USE_IMPLICIT"; /** * A CharSequence description to show to the user on the alternate button when used with * {@link #ACTION_CONFIRM_FRP_CREDENTIAL}. Loading @@ -124,44 +125,23 @@ public class KeyguardManager { public static final int RESULT_ALTERNATE = 1; /** * Get an intent to prompt the user to confirm credentials (pin, pattern or password) * for the current user of the device. The caller is expected to launch this activity using * {@link android.app.Activity#startActivityForResult(Intent, int)} and check for * @deprecated see {@link BiometricPrompt.Builder#setEnableFallback(boolean)} * * Get an intent to prompt the user to confirm credentials (pin, pattern, password or biometrics * if enrolled) for the current user of the device. The caller is expected to launch this * activity using {@link android.app.Activity#startActivityForResult(Intent, int)} and check for * {@link android.app.Activity#RESULT_OK} if the user successfully completes the challenge. * * @param title Title to be shown on the dialog. * @param description Description to be shown on the dialog. * @return the intent for launching the activity or null if no password is required. **/ @Deprecated @RequiresFeature(PackageManager.FEATURE_SECURE_LOCK_SCREEN) public Intent createConfirmDeviceCredentialIntent(CharSequence title, CharSequence description) { return createConfirmDeviceCredentialIntent(title, description, false /* useImplicit */); } /** * Get an intent to prompt the user to confirm credentials (pin, pattern or password) * for the current user of the device. The caller is expected to launch this activity using * {@link android.app.Activity#startActivityForResult(Intent, int)} and check for * {@link android.app.Activity#RESULT_OK} if the user successfully completes the challenge. * * @param title Title to be shown on the dialog. * @param description Description to be shown on the dialog. * @param useImplicit If useImplicit is set to true, ConfirmDeviceCredentials will invoke * {@link android.hardware.biometrics.BiometricPrompt} with * {@link android.hardware.biometrics.BiometricPrompt.Builder#setRequireConfirmation( * boolean)} set to false. * @return the intent for launching the activity or null if no password is required. * @hide */ public Intent createConfirmDeviceCredentialIntent(CharSequence title, CharSequence description, boolean useImplicit) { if (!isDeviceSecure()) { return null; } public Intent createConfirmDeviceCredentialIntent(CharSequence title, CharSequence description) { if (!isDeviceSecure()) return null; Intent intent = new Intent(ACTION_CONFIRM_DEVICE_CREDENTIAL); intent.putExtra(EXTRA_TITLE, title); intent.putExtra(EXTRA_DESCRIPTION, description); intent.putExtra(EXTRA_USE_IMPLICIT, useImplicit); // explicitly set the package for security intent.setPackage(getSettingsPackageForIntent(intent)); Loading
core/java/android/hardware/biometrics/BiometricManager.java +34 −0 Original line number Diff line number Diff line Loading @@ -171,5 +171,39 @@ public class BiometricManager { Slog.w(TAG, "resetTimeout(): Service not connected"); } } /** * TODO(b/123378871): Remove when moved. * @hide */ @RequiresPermission(USE_BIOMETRIC_INTERNAL) public void onConfirmDeviceCredentialSuccess() { if (mService != null) { try { mService.onConfirmDeviceCredentialSuccess(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } else { Slog.w(TAG, "onConfirmDeviceCredentialSuccess(): Service not connected"); } } /** * TODO(b/123378871): Remove when moved. * @hide */ @RequiresPermission(USE_BIOMETRIC_INTERNAL) public void onConfirmDeviceCredentialError(int error, String message) { if (mService != null) { try { mService.onConfirmDeviceCredentialError(error, message); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } else { Slog.w(TAG, "onConfirmDeviceCredentialError(): Service not connected"); } } }
core/java/android/hardware/biometrics/BiometricPrompt.java +24 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,10 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan * @hide */ public static final String KEY_REQUIRE_CONFIRMATION = "require_confirmation"; /** * @hide */ public static final String KEY_ENABLE_FALLBACK = "enable_fallback"; /** * Error/help message will show for this amount of time. Loading Loading @@ -241,6 +245,18 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan return this; } /** * The user will first be prompted to authenticate with biometrics, but also given the * option to authenticate with their device PIN, pattern, or password. * @param enable When true, the prompt will fall back to ask for the user's device * credentials (PIN, pattern, or password). * @return */ public Builder setEnableFallback(boolean enable) { mBundle.putBoolean(KEY_ENABLE_FALLBACK, enable); return this; } /** * Creates a {@link BiometricPrompt}. * @return a {@link BiometricPrompt} Loading @@ -250,11 +266,15 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan final CharSequence title = mBundle.getCharSequence(KEY_TITLE); final CharSequence negative = mBundle.getCharSequence(KEY_NEGATIVE_TEXT); final boolean useDefaultTitle = mBundle.getBoolean(KEY_USE_DEFAULT_TITLE); final boolean enableFallback = mBundle.getBoolean(KEY_ENABLE_FALLBACK); if (TextUtils.isEmpty(title) && !useDefaultTitle) { throw new IllegalArgumentException("Title must be set and non-empty"); } else if (TextUtils.isEmpty(negative)) { } else if (TextUtils.isEmpty(negative) && !enableFallback) { throw new IllegalArgumentException("Negative text must be set and non-empty"); } else if (!TextUtils.isEmpty(negative) && enableFallback) { throw new IllegalArgumentException("Can't have both negative button behavior" + " and fallback enabled"); } return new BiometricPrompt(mContext, mBundle, mPositiveButtonInfo, mNegativeButtonInfo); } Loading Loading @@ -514,6 +534,9 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan if (callback == null) { throw new IllegalArgumentException("Must supply a callback"); } if (mBundle.getBoolean(KEY_ENABLE_FALLBACK)) { throw new IllegalArgumentException("Fallback not supported with crypto"); } authenticateInternal(crypto, cancel, executor, callback, mContext.getUserId()); } Loading
core/java/android/hardware/biometrics/IBiometricService.aidl +8 −0 Original line number Diff line number Diff line Loading @@ -51,4 +51,12 @@ interface IBiometricService { // Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password) void resetTimeout(in byte [] token); // TODO(b/123378871): Remove when moved. // CDCA needs to send results to BiometricService if it was invoked using BiometricPrompt's // setEnableFallback method, since there's no way for us to intercept onActivityResult. // CDCA is launched from BiometricService (startActivityAsUser) instead of *ForResult. void onConfirmDeviceCredentialSuccess(); // TODO(b/123378871): Remove when moved. void onConfirmDeviceCredentialError(int error, String message); }