From b8042fc9b036db0a6692ca853428fc6ab1e60892 Mon Sep 17 00:00:00 2001
From: Justin Klaassen
Date: Sun, 15 Apr 2018 00:41:15 -0400
Subject: Import Android SDK Platform P [4719250]
/google/data/ro/projects/android/fetch_artifact \
--bid 4719250 \
--target sdk_phone_armv7-win_sdk \
sdk-repo-linux-sources-4719250.zip
AndroidVersion.ApiLevel has been modified to appear as 28
Change-Id: I9ec0a12c9251b8449dba0d86b0cfdbcca16b0a7c
---
android/hardware/biometrics/BiometricDialog.java | 494 ---------------------
android/hardware/biometrics/BiometricPrompt.java | 494 +++++++++++++++++++++
android/hardware/camera2/CameraManager.java | 34 ++
android/hardware/camera2/CaptureRequest.java | 6 +-
android/hardware/camera2/CaptureResult.java | 6 +-
.../hardware/display/BrightnessConfiguration.java | 8 +-
android/hardware/display/Curve.java | 62 +++
android/hardware/display/DisplayManager.java | 17 +
android/hardware/display/DisplayManagerGlobal.java | 19 +
.../hardware/fingerprint/FingerprintManager.java | 44 +-
10 files changed, 662 insertions(+), 522 deletions(-)
delete mode 100644 android/hardware/biometrics/BiometricDialog.java
create mode 100644 android/hardware/biometrics/BiometricPrompt.java
create mode 100644 android/hardware/display/Curve.java
(limited to 'android/hardware')
diff --git a/android/hardware/biometrics/BiometricDialog.java b/android/hardware/biometrics/BiometricDialog.java
deleted file mode 100644
index dd848a34..00000000
--- a/android/hardware/biometrics/BiometricDialog.java
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.biometrics;
-
-import static android.Manifest.permission.USE_BIOMETRIC;
-
-import android.annotation.CallbackExecutor;
-import android.annotation.NonNull;
-import android.annotation.RequiresPermission;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.pm.PackageManager;
-import android.hardware.fingerprint.FingerprintManager;
-import android.os.Bundle;
-import android.os.CancellationSignal;
-import android.text.TextUtils;
-
-import java.security.Signature;
-import java.util.concurrent.Executor;
-
-import javax.crypto.Cipher;
-import javax.crypto.Mac;
-
-/**
- * A class that manages a system-provided biometric dialog.
- */
-public class BiometricDialog implements BiometricAuthenticator, BiometricConstants {
-
- /**
- * @hide
- */
- public static final String KEY_TITLE = "title";
- /**
- * @hide
- */
- public static final String KEY_SUBTITLE = "subtitle";
- /**
- * @hide
- */
- public static final String KEY_DESCRIPTION = "description";
- /**
- * @hide
- */
- public static final String KEY_POSITIVE_TEXT = "positive_text";
- /**
- * @hide
- */
- public static final String KEY_NEGATIVE_TEXT = "negative_text";
-
- /**
- * Error/help message will show for this amount of time.
- * For error messages, the dialog will also be dismissed after this amount of time.
- * Error messages will be propagated back to the application via AuthenticationCallback
- * after this amount of time.
- * @hide
- */
- public static final int HIDE_DIALOG_DELAY = 2000; // ms
- /**
- * @hide
- */
- public static final int DISMISSED_REASON_POSITIVE = 1;
-
- /**
- * @hide
- */
- public static final int DISMISSED_REASON_NEGATIVE = 2;
-
- /**
- * @hide
- */
- public static final int DISMISSED_REASON_USER_CANCEL = 3;
-
- private static class ButtonInfo {
- Executor executor;
- DialogInterface.OnClickListener listener;
- ButtonInfo(Executor ex, DialogInterface.OnClickListener l) {
- executor = ex;
- listener = l;
- }
- }
-
- /**
- * A builder that collects arguments to be shown on the system-provided biometric dialog.
- **/
- public static class Builder {
- private final Bundle mBundle;
- private ButtonInfo mPositiveButtonInfo;
- private ButtonInfo mNegativeButtonInfo;
- private Context mContext;
-
- /**
- * Creates a builder for a biometric dialog.
- * @param context
- */
- public Builder(Context context) {
- mBundle = new Bundle();
- mContext = context;
- }
-
- /**
- * Required: Set the title to display.
- * @param title
- * @return
- */
- public Builder setTitle(@NonNull CharSequence title) {
- mBundle.putCharSequence(KEY_TITLE, title);
- return this;
- }
-
- /**
- * Optional: Set the subtitle to display.
- * @param subtitle
- * @return
- */
- public Builder setSubtitle(@NonNull CharSequence subtitle) {
- mBundle.putCharSequence(KEY_SUBTITLE, subtitle);
- return this;
- }
-
- /**
- * Optional: Set the description to display.
- * @param description
- * @return
- */
- public Builder setDescription(@NonNull CharSequence description) {
- mBundle.putCharSequence(KEY_DESCRIPTION, description);
- return this;
- }
-
- /**
- * Optional: Set the text for the positive button. If not set, the positive button
- * will not show.
- * @param text
- * @return
- * @hide
- */
- public Builder setPositiveButton(@NonNull CharSequence text,
- @NonNull @CallbackExecutor Executor executor,
- @NonNull DialogInterface.OnClickListener listener) {
- if (TextUtils.isEmpty(text)) {
- throw new IllegalArgumentException("Text must be set and non-empty");
- }
- if (executor == null) {
- throw new IllegalArgumentException("Executor must not be null");
- }
- if (listener == null) {
- throw new IllegalArgumentException("Listener must not be null");
- }
- mBundle.putCharSequence(KEY_POSITIVE_TEXT, text);
- mPositiveButtonInfo = new ButtonInfo(executor, listener);
- return this;
- }
-
- /**
- * Required: Set the text for the negative button. This would typically be used as a
- * "Cancel" button, but may be also used to show an alternative method for authentication,
- * such as screen that asks for a backup password.
- * @param text
- * @return
- */
- public Builder setNegativeButton(@NonNull CharSequence text,
- @NonNull @CallbackExecutor Executor executor,
- @NonNull DialogInterface.OnClickListener listener) {
- if (TextUtils.isEmpty(text)) {
- throw new IllegalArgumentException("Text must be set and non-empty");
- }
- if (executor == null) {
- throw new IllegalArgumentException("Executor must not be null");
- }
- if (listener == null) {
- throw new IllegalArgumentException("Listener must not be null");
- }
- mBundle.putCharSequence(KEY_NEGATIVE_TEXT, text);
- mNegativeButtonInfo = new ButtonInfo(executor, listener);
- return this;
- }
-
- /**
- * Creates a {@link BiometricDialog}.
- * @return a {@link BiometricDialog}
- * @throws IllegalArgumentException if any of the required fields are not set.
- */
- public BiometricDialog build() {
- final CharSequence title = mBundle.getCharSequence(KEY_TITLE);
- final CharSequence negative = mBundle.getCharSequence(KEY_NEGATIVE_TEXT);
-
- if (TextUtils.isEmpty(title)) {
- throw new IllegalArgumentException("Title must be set and non-empty");
- } else if (TextUtils.isEmpty(negative)) {
- throw new IllegalArgumentException("Negative text must be set and non-empty");
- }
- return new BiometricDialog(mContext, mBundle, mPositiveButtonInfo, mNegativeButtonInfo);
- }
- }
-
- private PackageManager mPackageManager;
- private FingerprintManager mFingerprintManager;
- private Bundle mBundle;
- private ButtonInfo mPositiveButtonInfo;
- private ButtonInfo mNegativeButtonInfo;
-
- IBiometricDialogReceiver mDialogReceiver = new IBiometricDialogReceiver.Stub() {
- @Override
- public void onDialogDismissed(int reason) {
- // Check the reason and invoke OnClickListener(s) if necessary
- if (reason == DISMISSED_REASON_POSITIVE) {
- mPositiveButtonInfo.executor.execute(() -> {
- mPositiveButtonInfo.listener.onClick(null, DialogInterface.BUTTON_POSITIVE);
- });
- } else if (reason == DISMISSED_REASON_NEGATIVE) {
- mNegativeButtonInfo.executor.execute(() -> {
- mNegativeButtonInfo.listener.onClick(null, DialogInterface.BUTTON_NEGATIVE);
- });
- }
- }
- };
-
- private BiometricDialog(Context context, Bundle bundle,
- ButtonInfo positiveButtonInfo, ButtonInfo negativeButtonInfo) {
- mBundle = bundle;
- mPositiveButtonInfo = positiveButtonInfo;
- mNegativeButtonInfo = negativeButtonInfo;
- mFingerprintManager = context.getSystemService(FingerprintManager.class);
- mPackageManager = context.getPackageManager();
- }
-
- /**
- * A wrapper class for the crypto objects supported by BiometricDialog. Currently the framework
- * supports {@link Signature}, {@link Cipher} and {@link Mac} objects.
- */
- public static final class CryptoObject extends android.hardware.biometrics.CryptoObject {
- public CryptoObject(@NonNull Signature signature) {
- super(signature);
- }
-
- public CryptoObject(@NonNull Cipher cipher) {
- super(cipher);
- }
-
- public CryptoObject(@NonNull Mac mac) {
- super(mac);
- }
-
- /**
- * Get {@link Signature} object.
- * @return {@link Signature} object or null if this doesn't contain one.
- */
- public Signature getSignature() {
- return super.getSignature();
- }
-
- /**
- * Get {@link Cipher} object.
- * @return {@link Cipher} object or null if this doesn't contain one.
- */
- public Cipher getCipher() {
- return super.getCipher();
- }
-
- /**
- * Get {@link Mac} object.
- * @return {@link Mac} object or null if this doesn't contain one.
- */
- public Mac getMac() {
- return super.getMac();
- }
- }
-
- /**
- * Container for callback data from {@link #authenticate( CancellationSignal, Executor,
- * AuthenticationCallback)} and {@link #authenticate(CryptoObject, CancellationSignal, Executor,
- * AuthenticationCallback)}
- */
- public static class AuthenticationResult extends BiometricAuthenticator.AuthenticationResult {
- /**
- * Authentication result
- * @param crypto
- * @param identifier
- * @param userId
- * @hide
- */
- public AuthenticationResult(CryptoObject crypto, BiometricIdentifier identifier,
- int userId) {
- super(crypto, identifier, userId);
- }
- /**
- * Obtain the crypto object associated with this transaction
- * @return crypto object provided to {@link #authenticate( CryptoObject, CancellationSignal,
- * Executor, AuthenticationCallback)}
- */
- public CryptoObject getCryptoObject() {
- return (CryptoObject) super.getCryptoObject();
- }
- }
-
- /**
- * Callback structure provided to {@link BiometricDialog#authenticate(CancellationSignal,
- * Executor, AuthenticationCallback)} or {@link BiometricDialog#authenticate(CryptoObject,
- * CancellationSignal, Executor, AuthenticationCallback)}. Users must provide an implementation
- * of this for listening to authentication events.
- */
- public abstract static class AuthenticationCallback extends
- BiometricAuthenticator.AuthenticationCallback {
- /**
- * Called when an unrecoverable error has been encountered and the operation is complete.
- * No further actions will be made on this object.
- * @param errorCode An integer identifying the error message
- * @param errString A human-readable error string that can be shown on an UI
- */
- @Override
- public void onAuthenticationError(int errorCode, CharSequence errString) {}
-
- /**
- * Called when a recoverable error has been encountered during authentication. The help
- * string is provided to give the user guidance for what went wrong, such as "Sensor dirty,
- * please clean it."
- * @param helpCode An integer identifying the error message
- * @param helpString A human-readable string that can be shown on an UI
- */
- @Override
- public void onAuthenticationHelp(int helpCode, CharSequence helpString) {}
-
- /**
- * Called when a biometric is recognized.
- * @param result An object containing authentication-related data
- */
- public void onAuthenticationSucceeded(AuthenticationResult result) {}
-
- /**
- * Called when a biometric is valid but not recognized.
- */
- @Override
- public void onAuthenticationFailed() {}
-
- /**
- * Called when a biometric has been acquired, but hasn't been processed yet.
- * @hide
- */
- @Override
- public void onAuthenticationAcquired(int acquireInfo) {}
-
- /**
- * @param result An object containing authentication-related data
- * @hide
- */
- @Override
- public void onAuthenticationSucceeded(BiometricAuthenticator.AuthenticationResult result) {
- onAuthenticationSucceeded(new AuthenticationResult(
- (CryptoObject) result.getCryptoObject(),
- result.getId(),
- result.getUserId()));
- }
- }
-
- /**
- * @param crypto Object associated with the call
- * @param cancel An object that can be used to cancel authentication
- * @param executor An executor to handle callback events
- * @param callback An object to receive authentication events
- * @hide
- */
- @Override
- public void authenticate(@NonNull android.hardware.biometrics.CryptoObject crypto,
- @NonNull CancellationSignal cancel,
- @NonNull @CallbackExecutor Executor executor,
- @NonNull BiometricAuthenticator.AuthenticationCallback callback) {
- if (!(callback instanceof BiometricDialog.AuthenticationCallback)) {
- throw new IllegalArgumentException("Callback cannot be casted");
- }
- authenticate(crypto, cancel, executor, (AuthenticationCallback) callback);
- }
-
- /**
- *
- * @param cancel An object that can be used to cancel authentication
- * @param executor An executor to handle callback events
- * @param callback An object to receive authentication events
- * @hide
- */
- @Override
- public void authenticate(@NonNull CancellationSignal cancel,
- @NonNull @CallbackExecutor Executor executor,
- @NonNull BiometricAuthenticator.AuthenticationCallback callback) {
- if (!(callback instanceof BiometricDialog.AuthenticationCallback)) {
- throw new IllegalArgumentException("Callback cannot be casted");
- }
- authenticate(cancel, executor, (AuthenticationCallback) callback);
- }
-
- /**
- * This call warms up the fingerprint hardware, displays a system-provided dialog, and starts
- * scanning for a fingerprint. It terminates when {@link
- * AuthenticationCallback#onAuthenticationError(int, CharSequence)} is called, when {@link
- * AuthenticationCallback#onAuthenticationSucceeded( AuthenticationResult)}, or when the user
- * dismisses the system-provided dialog, at which point the crypto object becomes invalid. This
- * operation can be canceled by using the provided cancel object. The application will receive
- * authentication errors through {@link AuthenticationCallback}, and button events through the
- * corresponding callback set in {@link Builder#setNegativeButton(CharSequence, Executor,
- * DialogInterface.OnClickListener)}. It is safe to reuse the {@link BiometricDialog} object,
- * and calling {@link BiometricDialog#authenticate( CancellationSignal, Executor,
- * AuthenticationCallback)} while an existing authentication attempt is occurring will stop the
- * previous client and start a new authentication. The interrupted client will receive a
- * cancelled notification through {@link AuthenticationCallback#onAuthenticationError(int,
- * CharSequence)}.
- *
- * @throws IllegalArgumentException If any of the arguments are null
- *
- * @param crypto Object associated with the call
- * @param cancel An object that can be used to cancel authentication
- * @param executor An executor to handle callback events
- * @param callback An object to receive authentication events
- */
- @RequiresPermission(USE_BIOMETRIC)
- public void authenticate(@NonNull CryptoObject crypto,
- @NonNull CancellationSignal cancel,
- @NonNull @CallbackExecutor Executor executor,
- @NonNull AuthenticationCallback callback) {
- if (handlePreAuthenticationErrors(callback, executor)) {
- return;
- }
- mFingerprintManager.authenticate(crypto, cancel, mBundle, executor, mDialogReceiver,
- callback);
- }
-
- /**
- * This call warms up the fingerprint hardware, displays a system-provided dialog, and starts
- * scanning for a fingerprint. It terminates when {@link
- * AuthenticationCallback#onAuthenticationError(int, CharSequence)} is called, when {@link
- * AuthenticationCallback#onAuthenticationSucceeded( AuthenticationResult)} is called, or when
- * the user dismisses the system-provided dialog. This operation can be canceled by using the
- * provided cancel object. The application will receive authentication errors through {@link
- * AuthenticationCallback}, and button events through the corresponding callback set in {@link
- * Builder#setNegativeButton(CharSequence, Executor, DialogInterface.OnClickListener)}. It is
- * safe to reuse the {@link BiometricDialog} object, and calling {@link
- * BiometricDialog#authenticate(CancellationSignal, Executor, AuthenticationCallback)} while
- * an existing authentication attempt is occurring will stop the previous client and start a new
- * authentication. The interrupted client will receive a cancelled notification through {@link
- * AuthenticationCallback#onAuthenticationError(int, CharSequence)}.
- *
- * @throws IllegalArgumentException If any of the arguments are null
- *
- * @param cancel An object that can be used to cancel authentication
- * @param executor An executor to handle callback events
- * @param callback An object to receive authentication events
- */
- @RequiresPermission(USE_BIOMETRIC)
- public void authenticate(@NonNull CancellationSignal cancel,
- @NonNull @CallbackExecutor Executor executor,
- @NonNull AuthenticationCallback callback) {
- if (handlePreAuthenticationErrors(callback, executor)) {
- return;
- }
- mFingerprintManager.authenticate(cancel, mBundle, executor, mDialogReceiver, callback);
- }
-
- private boolean handlePreAuthenticationErrors(AuthenticationCallback callback,
- Executor executor) {
- if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
- sendError(BiometricDialog.BIOMETRIC_ERROR_HW_NOT_PRESENT, callback,
- executor);
- return true;
- } else if (!mFingerprintManager.isHardwareDetected()) {
- sendError(BiometricDialog.BIOMETRIC_ERROR_HW_UNAVAILABLE, callback,
- executor);
- return true;
- } else if (!mFingerprintManager.hasEnrolledFingerprints()) {
- sendError(BiometricDialog.BIOMETRIC_ERROR_NO_BIOMETRICS, callback,
- executor);
- return true;
- }
- return false;
- }
-
- private void sendError(int error, AuthenticationCallback callback, Executor executor) {
- executor.execute(() -> {
- callback.onAuthenticationError(error, mFingerprintManager.getErrorString(
- error, 0 /* vendorCode */));
- });
- }
-}
diff --git a/android/hardware/biometrics/BiometricPrompt.java b/android/hardware/biometrics/BiometricPrompt.java
new file mode 100644
index 00000000..1c9de457
--- /dev/null
+++ b/android/hardware/biometrics/BiometricPrompt.java
@@ -0,0 +1,494 @@
+/*
+ * Copyright (C) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.biometrics;
+
+import static android.Manifest.permission.USE_BIOMETRIC;
+
+import android.annotation.CallbackExecutor;
+import android.annotation.NonNull;
+import android.annotation.RequiresPermission;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.pm.PackageManager;
+import android.hardware.fingerprint.FingerprintManager;
+import android.os.Bundle;
+import android.os.CancellationSignal;
+import android.text.TextUtils;
+
+import java.security.Signature;
+import java.util.concurrent.Executor;
+
+import javax.crypto.Cipher;
+import javax.crypto.Mac;
+
+/**
+ * A class that manages a system-provided biometric dialog.
+ */
+public class BiometricPrompt implements BiometricAuthenticator, BiometricConstants {
+
+ /**
+ * @hide
+ */
+ public static final String KEY_TITLE = "title";
+ /**
+ * @hide
+ */
+ public static final String KEY_SUBTITLE = "subtitle";
+ /**
+ * @hide
+ */
+ public static final String KEY_DESCRIPTION = "description";
+ /**
+ * @hide
+ */
+ public static final String KEY_POSITIVE_TEXT = "positive_text";
+ /**
+ * @hide
+ */
+ public static final String KEY_NEGATIVE_TEXT = "negative_text";
+
+ /**
+ * Error/help message will show for this amount of time.
+ * For error messages, the dialog will also be dismissed after this amount of time.
+ * Error messages will be propagated back to the application via AuthenticationCallback
+ * after this amount of time.
+ * @hide
+ */
+ public static final int HIDE_DIALOG_DELAY = 2000; // ms
+ /**
+ * @hide
+ */
+ public static final int DISMISSED_REASON_POSITIVE = 1;
+
+ /**
+ * @hide
+ */
+ public static final int DISMISSED_REASON_NEGATIVE = 2;
+
+ /**
+ * @hide
+ */
+ public static final int DISMISSED_REASON_USER_CANCEL = 3;
+
+ private static class ButtonInfo {
+ Executor executor;
+ DialogInterface.OnClickListener listener;
+ ButtonInfo(Executor ex, DialogInterface.OnClickListener l) {
+ executor = ex;
+ listener = l;
+ }
+ }
+
+ /**
+ * A builder that collects arguments to be shown on the system-provided biometric dialog.
+ **/
+ public static class Builder {
+ private final Bundle mBundle;
+ private ButtonInfo mPositiveButtonInfo;
+ private ButtonInfo mNegativeButtonInfo;
+ private Context mContext;
+
+ /**
+ * Creates a builder for a biometric dialog.
+ * @param context
+ */
+ public Builder(Context context) {
+ mBundle = new Bundle();
+ mContext = context;
+ }
+
+ /**
+ * Required: Set the title to display.
+ * @param title
+ * @return
+ */
+ public Builder setTitle(@NonNull CharSequence title) {
+ mBundle.putCharSequence(KEY_TITLE, title);
+ return this;
+ }
+
+ /**
+ * Optional: Set the subtitle to display.
+ * @param subtitle
+ * @return
+ */
+ public Builder setSubtitle(@NonNull CharSequence subtitle) {
+ mBundle.putCharSequence(KEY_SUBTITLE, subtitle);
+ return this;
+ }
+
+ /**
+ * Optional: Set the description to display.
+ * @param description
+ * @return
+ */
+ public Builder setDescription(@NonNull CharSequence description) {
+ mBundle.putCharSequence(KEY_DESCRIPTION, description);
+ return this;
+ }
+
+ /**
+ * Optional: Set the text for the positive button. If not set, the positive button
+ * will not show.
+ * @param text
+ * @return
+ * @hide
+ */
+ public Builder setPositiveButton(@NonNull CharSequence text,
+ @NonNull @CallbackExecutor Executor executor,
+ @NonNull DialogInterface.OnClickListener listener) {
+ if (TextUtils.isEmpty(text)) {
+ throw new IllegalArgumentException("Text must be set and non-empty");
+ }
+ if (executor == null) {
+ throw new IllegalArgumentException("Executor must not be null");
+ }
+ if (listener == null) {
+ throw new IllegalArgumentException("Listener must not be null");
+ }
+ mBundle.putCharSequence(KEY_POSITIVE_TEXT, text);
+ mPositiveButtonInfo = new ButtonInfo(executor, listener);
+ return this;
+ }
+
+ /**
+ * Required: Set the text for the negative button. This would typically be used as a
+ * "Cancel" button, but may be also used to show an alternative method for authentication,
+ * such as screen that asks for a backup password.
+ * @param text
+ * @return
+ */
+ public Builder setNegativeButton(@NonNull CharSequence text,
+ @NonNull @CallbackExecutor Executor executor,
+ @NonNull DialogInterface.OnClickListener listener) {
+ if (TextUtils.isEmpty(text)) {
+ throw new IllegalArgumentException("Text must be set and non-empty");
+ }
+ if (executor == null) {
+ throw new IllegalArgumentException("Executor must not be null");
+ }
+ if (listener == null) {
+ throw new IllegalArgumentException("Listener must not be null");
+ }
+ mBundle.putCharSequence(KEY_NEGATIVE_TEXT, text);
+ mNegativeButtonInfo = new ButtonInfo(executor, listener);
+ return this;
+ }
+
+ /**
+ * Creates a {@link BiometricPrompt}.
+ * @return a {@link BiometricPrompt}
+ * @throws IllegalArgumentException if any of the required fields are not set.
+ */
+ public BiometricPrompt build() {
+ final CharSequence title = mBundle.getCharSequence(KEY_TITLE);
+ final CharSequence negative = mBundle.getCharSequence(KEY_NEGATIVE_TEXT);
+
+ if (TextUtils.isEmpty(title)) {
+ throw new IllegalArgumentException("Title must be set and non-empty");
+ } else if (TextUtils.isEmpty(negative)) {
+ throw new IllegalArgumentException("Negative text must be set and non-empty");
+ }
+ return new BiometricPrompt(mContext, mBundle, mPositiveButtonInfo, mNegativeButtonInfo);
+ }
+ }
+
+ private PackageManager mPackageManager;
+ private FingerprintManager mFingerprintManager;
+ private Bundle mBundle;
+ private ButtonInfo mPositiveButtonInfo;
+ private ButtonInfo mNegativeButtonInfo;
+
+ IBiometricPromptReceiver mDialogReceiver = new IBiometricPromptReceiver.Stub() {
+ @Override
+ public void onDialogDismissed(int reason) {
+ // Check the reason and invoke OnClickListener(s) if necessary
+ if (reason == DISMISSED_REASON_POSITIVE) {
+ mPositiveButtonInfo.executor.execute(() -> {
+ mPositiveButtonInfo.listener.onClick(null, DialogInterface.BUTTON_POSITIVE);
+ });
+ } else if (reason == DISMISSED_REASON_NEGATIVE) {
+ mNegativeButtonInfo.executor.execute(() -> {
+ mNegativeButtonInfo.listener.onClick(null, DialogInterface.BUTTON_NEGATIVE);
+ });
+ }
+ }
+ };
+
+ private BiometricPrompt(Context context, Bundle bundle,
+ ButtonInfo positiveButtonInfo, ButtonInfo negativeButtonInfo) {
+ mBundle = bundle;
+ mPositiveButtonInfo = positiveButtonInfo;
+ mNegativeButtonInfo = negativeButtonInfo;
+ mFingerprintManager = context.getSystemService(FingerprintManager.class);
+ mPackageManager = context.getPackageManager();
+ }
+
+ /**
+ * A wrapper class for the crypto objects supported by BiometricPrompt. Currently the framework
+ * supports {@link Signature}, {@link Cipher} and {@link Mac} objects.
+ */
+ public static final class CryptoObject extends android.hardware.biometrics.CryptoObject {
+ public CryptoObject(@NonNull Signature signature) {
+ super(signature);
+ }
+
+ public CryptoObject(@NonNull Cipher cipher) {
+ super(cipher);
+ }
+
+ public CryptoObject(@NonNull Mac mac) {
+ super(mac);
+ }
+
+ /**
+ * Get {@link Signature} object.
+ * @return {@link Signature} object or null if this doesn't contain one.
+ */
+ public Signature getSignature() {
+ return super.getSignature();
+ }
+
+ /**
+ * Get {@link Cipher} object.
+ * @return {@link Cipher} object or null if this doesn't contain one.
+ */
+ public Cipher getCipher() {
+ return super.getCipher();
+ }
+
+ /**
+ * Get {@link Mac} object.
+ * @return {@link Mac} object or null if this doesn't contain one.
+ */
+ public Mac getMac() {
+ return super.getMac();
+ }
+ }
+
+ /**
+ * Container for callback data from {@link #authenticate( CancellationSignal, Executor,
+ * AuthenticationCallback)} and {@link #authenticate(CryptoObject, CancellationSignal, Executor,
+ * AuthenticationCallback)}
+ */
+ public static class AuthenticationResult extends BiometricAuthenticator.AuthenticationResult {
+ /**
+ * Authentication result
+ * @param crypto
+ * @param identifier
+ * @param userId
+ * @hide
+ */
+ public AuthenticationResult(CryptoObject crypto, BiometricIdentifier identifier,
+ int userId) {
+ super(crypto, identifier, userId);
+ }
+ /**
+ * Obtain the crypto object associated with this transaction
+ * @return crypto object provided to {@link #authenticate( CryptoObject, CancellationSignal,
+ * Executor, AuthenticationCallback)}
+ */
+ public CryptoObject getCryptoObject() {
+ return (CryptoObject) super.getCryptoObject();
+ }
+ }
+
+ /**
+ * Callback structure provided to {@link BiometricPrompt#authenticate(CancellationSignal,
+ * Executor, AuthenticationCallback)} or {@link BiometricPrompt#authenticate(CryptoObject,
+ * CancellationSignal, Executor, AuthenticationCallback)}. Users must provide an implementation
+ * of this for listening to authentication events.
+ */
+ public abstract static class AuthenticationCallback extends
+ BiometricAuthenticator.AuthenticationCallback {
+ /**
+ * Called when an unrecoverable error has been encountered and the operation is complete.
+ * No further actions will be made on this object.
+ * @param errorCode An integer identifying the error message
+ * @param errString A human-readable error string that can be shown on an UI
+ */
+ @Override
+ public void onAuthenticationError(int errorCode, CharSequence errString) {}
+
+ /**
+ * Called when a recoverable error has been encountered during authentication. The help
+ * string is provided to give the user guidance for what went wrong, such as "Sensor dirty,
+ * please clean it."
+ * @param helpCode An integer identifying the error message
+ * @param helpString A human-readable string that can be shown on an UI
+ */
+ @Override
+ public void onAuthenticationHelp(int helpCode, CharSequence helpString) {}
+
+ /**
+ * Called when a biometric is recognized.
+ * @param result An object containing authentication-related data
+ */
+ public void onAuthenticationSucceeded(AuthenticationResult result) {}
+
+ /**
+ * Called when a biometric is valid but not recognized.
+ */
+ @Override
+ public void onAuthenticationFailed() {}
+
+ /**
+ * Called when a biometric has been acquired, but hasn't been processed yet.
+ * @hide
+ */
+ @Override
+ public void onAuthenticationAcquired(int acquireInfo) {}
+
+ /**
+ * @param result An object containing authentication-related data
+ * @hide
+ */
+ @Override
+ public void onAuthenticationSucceeded(BiometricAuthenticator.AuthenticationResult result) {
+ onAuthenticationSucceeded(new AuthenticationResult(
+ (CryptoObject) result.getCryptoObject(),
+ result.getId(),
+ result.getUserId()));
+ }
+ }
+
+ /**
+ * @param crypto Object associated with the call
+ * @param cancel An object that can be used to cancel authentication
+ * @param executor An executor to handle callback events
+ * @param callback An object to receive authentication events
+ * @hide
+ */
+ @Override
+ public void authenticate(@NonNull android.hardware.biometrics.CryptoObject crypto,
+ @NonNull CancellationSignal cancel,
+ @NonNull @CallbackExecutor Executor executor,
+ @NonNull BiometricAuthenticator.AuthenticationCallback callback) {
+ if (!(callback instanceof BiometricPrompt.AuthenticationCallback)) {
+ throw new IllegalArgumentException("Callback cannot be casted");
+ }
+ authenticate(crypto, cancel, executor, (AuthenticationCallback) callback);
+ }
+
+ /**
+ *
+ * @param cancel An object that can be used to cancel authentication
+ * @param executor An executor to handle callback events
+ * @param callback An object to receive authentication events
+ * @hide
+ */
+ @Override
+ public void authenticate(@NonNull CancellationSignal cancel,
+ @NonNull @CallbackExecutor Executor executor,
+ @NonNull BiometricAuthenticator.AuthenticationCallback callback) {
+ if (!(callback instanceof BiometricPrompt.AuthenticationCallback)) {
+ throw new IllegalArgumentException("Callback cannot be casted");
+ }
+ authenticate(cancel, executor, (AuthenticationCallback) callback);
+ }
+
+ /**
+ * This call warms up the fingerprint hardware, displays a system-provided dialog, and starts
+ * scanning for a fingerprint. It terminates when {@link
+ * AuthenticationCallback#onAuthenticationError(int, CharSequence)} is called, when {@link
+ * AuthenticationCallback#onAuthenticationSucceeded( AuthenticationResult)}, or when the user
+ * dismisses the system-provided dialog, at which point the crypto object becomes invalid. This
+ * operation can be canceled by using the provided cancel object. The application will receive
+ * authentication errors through {@link AuthenticationCallback}, and button events through the
+ * corresponding callback set in {@link Builder#setNegativeButton(CharSequence, Executor,
+ * DialogInterface.OnClickListener)}. It is safe to reuse the {@link BiometricPrompt} object,
+ * and calling {@link BiometricPrompt#authenticate( CancellationSignal, Executor,
+ * AuthenticationCallback)} while an existing authentication attempt is occurring will stop the
+ * previous client and start a new authentication. The interrupted client will receive a
+ * cancelled notification through {@link AuthenticationCallback#onAuthenticationError(int,
+ * CharSequence)}.
+ *
+ * @throws IllegalArgumentException If any of the arguments are null
+ *
+ * @param crypto Object associated with the call
+ * @param cancel An object that can be used to cancel authentication
+ * @param executor An executor to handle callback events
+ * @param callback An object to receive authentication events
+ */
+ @RequiresPermission(USE_BIOMETRIC)
+ public void authenticate(@NonNull CryptoObject crypto,
+ @NonNull CancellationSignal cancel,
+ @NonNull @CallbackExecutor Executor executor,
+ @NonNull AuthenticationCallback callback) {
+ if (handlePreAuthenticationErrors(callback, executor)) {
+ return;
+ }
+ mFingerprintManager.authenticate(crypto, cancel, mBundle, executor, mDialogReceiver,
+ callback);
+ }
+
+ /**
+ * This call warms up the fingerprint hardware, displays a system-provided dialog, and starts
+ * scanning for a fingerprint. It terminates when {@link
+ * AuthenticationCallback#onAuthenticationError(int, CharSequence)} is called, when {@link
+ * AuthenticationCallback#onAuthenticationSucceeded( AuthenticationResult)} is called, or when
+ * the user dismisses the system-provided dialog. This operation can be canceled by using the
+ * provided cancel object. The application will receive authentication errors through {@link
+ * AuthenticationCallback}, and button events through the corresponding callback set in {@link
+ * Builder#setNegativeButton(CharSequence, Executor, DialogInterface.OnClickListener)}. It is
+ * safe to reuse the {@link BiometricPrompt} object, and calling {@link
+ * BiometricPrompt#authenticate(CancellationSignal, Executor, AuthenticationCallback)} while
+ * an existing authentication attempt is occurring will stop the previous client and start a new
+ * authentication. The interrupted client will receive a cancelled notification through {@link
+ * AuthenticationCallback#onAuthenticationError(int, CharSequence)}.
+ *
+ * @throws IllegalArgumentException If any of the arguments are null
+ *
+ * @param cancel An object that can be used to cancel authentication
+ * @param executor An executor to handle callback events
+ * @param callback An object to receive authentication events
+ */
+ @RequiresPermission(USE_BIOMETRIC)
+ public void authenticate(@NonNull CancellationSignal cancel,
+ @NonNull @CallbackExecutor Executor executor,
+ @NonNull AuthenticationCallback callback) {
+ if (handlePreAuthenticationErrors(callback, executor)) {
+ return;
+ }
+ mFingerprintManager.authenticate(cancel, mBundle, executor, mDialogReceiver, callback);
+ }
+
+ private boolean handlePreAuthenticationErrors(AuthenticationCallback callback,
+ Executor executor) {
+ if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
+ sendError(BiometricPrompt.BIOMETRIC_ERROR_HW_NOT_PRESENT, callback,
+ executor);
+ return true;
+ } else if (!mFingerprintManager.isHardwareDetected()) {
+ sendError(BiometricPrompt.BIOMETRIC_ERROR_HW_UNAVAILABLE, callback,
+ executor);
+ return true;
+ } else if (!mFingerprintManager.hasEnrolledFingerprints()) {
+ sendError(BiometricPrompt.BIOMETRIC_ERROR_NO_BIOMETRICS, callback,
+ executor);
+ return true;
+ }
+ return false;
+ }
+
+ private void sendError(int error, AuthenticationCallback callback, Executor executor) {
+ executor.execute(() -> {
+ callback.onAuthenticationError(error, mFingerprintManager.getErrorString(
+ error, 0 /* vendorCode */));
+ });
+ }
+}
diff --git a/android/hardware/camera2/CameraManager.java b/android/hardware/camera2/CameraManager.java
index 4124536d..7ebe0f9a 100644
--- a/android/hardware/camera2/CameraManager.java
+++ b/android/hardware/camera2/CameraManager.java
@@ -43,6 +43,9 @@ import android.util.ArrayMap;
import android.util.Log;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException;
@@ -924,6 +927,37 @@ public final class CameraManager {
idCount++;
}
}
+
+ // The sort logic must match the logic in
+ // libcameraservice/common/CameraProviderManager.cpp::getAPI1CompatibleCameraDeviceIds
+ Arrays.sort(cameraIds, new Comparator() {
+ @Override
+ public int compare(String s1, String s2) {
+ int s1Int = 0, s2Int = 0;
+ try {
+ s1Int = Integer.parseInt(s1);
+ } catch (NumberFormatException e) {
+ s1Int = -1;
+ }
+
+ try {
+ s2Int = Integer.parseInt(s2);
+ } catch (NumberFormatException e) {
+ s2Int = -1;
+ }
+
+ // Uint device IDs first
+ if (s1Int >= 0 && s2Int >= 0) {
+ return s1Int - s2Int;
+ } else if (s1Int >= 0) {
+ return -1;
+ } else if (s2Int >= 0) {
+ return 1;
+ } else {
+ // Simple string compare if both id are not uint
+ return s1.compareTo(s2);
+ }
+ }});
return cameraIds;
}
diff --git a/android/hardware/camera2/CaptureRequest.java b/android/hardware/camera2/CaptureRequest.java
index 22525719..411a97e3 100644
--- a/android/hardware/camera2/CaptureRequest.java
+++ b/android/hardware/camera2/CaptureRequest.java
@@ -2105,8 +2105,8 @@ public final class CaptureRequest extends CameraMetadata>
* the thumbnail data will also be rotated.
* Note that this orientation is relative to the orientation of the camera sensor, given
* by {@link CameraCharacteristics#SENSOR_ORIENTATION android.sensor.orientation}.
- * To translate from the device orientation given by the Android sensor APIs, the following
- * sample code may be used:
+ * To translate from the device orientation given by the Android sensor APIs for camera
+ * sensors which are not EXTERNAL, the following sample code may be used:
* private int getJpegOrientation(CameraCharacteristics c, int deviceOrientation) {
* if (deviceOrientation == android.view.OrientationEventListener.ORIENTATION_UNKNOWN) return 0;
* int sensorOrientation = c.get(CameraCharacteristics.SENSOR_ORIENTATION);
@@ -2125,6 +2125,8 @@ public final class CaptureRequest extends CameraMetadata>
* return jpegOrientation;
* }
*
+ * For EXTERNAL cameras the sensor orientation will always be set to 0 and the facing will
+ * also be set to EXTERNAL. The above code is not relevant in such case.
* Units: Degrees in multiples of 90
* Range of valid values:
* 0, 90, 180, 270
diff --git a/android/hardware/camera2/CaptureResult.java b/android/hardware/camera2/CaptureResult.java
index 8df54472..c1566161 100644
--- a/android/hardware/camera2/CaptureResult.java
+++ b/android/hardware/camera2/CaptureResult.java
@@ -2422,8 +2422,8 @@ public class CaptureResult extends CameraMetadata> {
* the thumbnail data will also be rotated.
* Note that this orientation is relative to the orientation of the camera sensor, given
* by {@link CameraCharacteristics#SENSOR_ORIENTATION android.sensor.orientation}.
- * To translate from the device orientation given by the Android sensor APIs, the following
- * sample code may be used:
+ * To translate from the device orientation given by the Android sensor APIs for camera
+ * sensors which are not EXTERNAL, the following sample code may be used:
* private int getJpegOrientation(CameraCharacteristics c, int deviceOrientation) {
* if (deviceOrientation == android.view.OrientationEventListener.ORIENTATION_UNKNOWN) return 0;
* int sensorOrientation = c.get(CameraCharacteristics.SENSOR_ORIENTATION);
@@ -2442,6 +2442,8 @@ public class CaptureResult extends CameraMetadata> {
* return jpegOrientation;
* }
*
+ * For EXTERNAL cameras the sensor orientation will always be set to 0 and the facing will
+ * also be set to EXTERNAL. The above code is not relevant in such case.
* Units: Degrees in multiples of 90
* Range of valid values:
* 0, 90, 180, 270
diff --git a/android/hardware/display/BrightnessConfiguration.java b/android/hardware/display/BrightnessConfiguration.java
index 67e97bfd..6d9ba778 100644
--- a/android/hardware/display/BrightnessConfiguration.java
+++ b/android/hardware/display/BrightnessConfiguration.java
@@ -86,7 +86,9 @@ public final class BrightnessConfiguration implements Parcelable {
sb.append("(").append(mLux[i]).append(", ").append(mNits[i]).append(")");
}
sb.append("], '");
- sb.append(mDescription);
+ if (mDescription != null) {
+ sb.append(mDescription);
+ }
sb.append("'}");
return sb.toString();
}
@@ -96,7 +98,9 @@ public final class BrightnessConfiguration implements Parcelable {
int result = 1;
result = result * 31 + Arrays.hashCode(mLux);
result = result * 31 + Arrays.hashCode(mNits);
- result = result * 31 + mDescription.hashCode();
+ if (mDescription != null) {
+ result = result * 31 + mDescription.hashCode();
+ }
return result;
}
diff --git a/android/hardware/display/Curve.java b/android/hardware/display/Curve.java
new file mode 100644
index 00000000..ac28fdd6
--- /dev/null
+++ b/android/hardware/display/Curve.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.display;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/** @hide */
+public final class Curve implements Parcelable {
+ private final float[] mX;
+ private final float[] mY;
+
+ public Curve(float[] x, float[] y) {
+ mX = x;
+ mY = y;
+ }
+
+ public float[] getX() {
+ return mX;
+ }
+
+ public float[] getY() {
+ return mY;
+ }
+
+ public static final Creator CREATOR = new Creator() {
+ public Curve createFromParcel(Parcel in) {
+ float[] x = in.createFloatArray();
+ float[] y = in.createFloatArray();
+ return new Curve(x, y);
+ }
+
+ public Curve[] newArray(int size) {
+ return new Curve[size];
+ }
+ };
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeFloatArray(mX);
+ out.writeFloatArray(mY);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+}
diff --git a/android/hardware/display/DisplayManager.java b/android/hardware/display/DisplayManager.java
index efb9517a..b182fa2e 100644
--- a/android/hardware/display/DisplayManager.java
+++ b/android/hardware/display/DisplayManager.java
@@ -28,6 +28,7 @@ import android.content.Context;
import android.graphics.Point;
import android.media.projection.MediaProjection;
import android.os.Handler;
+import android.util.Pair;
import android.util.SparseArray;
import android.view.Display;
import android.view.Surface;
@@ -747,6 +748,22 @@ public final class DisplayManager {
mGlobal.setTemporaryAutoBrightnessAdjustment(adjustment);
}
+ /**
+ * Returns the minimum brightness curve, which guarantess that any brightness curve that dips
+ * below it is rejected by the system.
+ * This prevent auto-brightness from setting the screen so dark as to prevent the user from
+ * resetting or disabling it, and maps lux to the absolute minimum nits that are still readable
+ * in that ambient brightness.
+ *
+ * @return The minimum brightness curve (as lux values and their corresponding nits values).
+ *
+ * @hide
+ */
+ @SystemApi
+ public Pair getMinimumBrightnessCurve() {
+ return mGlobal.getMinimumBrightnessCurve();
+ }
+
/**
* Listens for changes in available display devices.
*/
diff --git a/android/hardware/display/DisplayManagerGlobal.java b/android/hardware/display/DisplayManagerGlobal.java
index 2d0ef2f2..d968a3e9 100644
--- a/android/hardware/display/DisplayManagerGlobal.java
+++ b/android/hardware/display/DisplayManagerGlobal.java
@@ -31,6 +31,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.text.TextUtils;
import android.util.Log;
+import android.util.Pair;
import android.util.SparseArray;
import android.view.Display;
import android.view.DisplayAdjustments;
@@ -562,6 +563,24 @@ public final class DisplayManagerGlobal {
}
}
+ /**
+ * Returns the minimum brightness curve, which guarantess that any brightness curve that dips
+ * below it is rejected by the system.
+ * This prevent auto-brightness from setting the screen so dark as to prevent the user from
+ * resetting or disabling it, and maps lux to the absolute minimum nits that are still readable
+ * in that ambient brightness.
+ *
+ * @return The minimum brightness curve (as lux values and their corresponding nits values).
+ */
+ public Pair getMinimumBrightnessCurve() {
+ try {
+ Curve curve = mDm.getMinimumBrightnessCurve();
+ return Pair.create(curve.getX(), curve.getY());
+ } catch (RemoteException ex) {
+ throw ex.rethrowFromSystemServer();
+ }
+ }
+
/**
* Retrieves ambient brightness stats.
*/
diff --git a/android/hardware/fingerprint/FingerprintManager.java b/android/hardware/fingerprint/FingerprintManager.java
index a6c8c67d..40d31bfe 100644
--- a/android/hardware/fingerprint/FingerprintManager.java
+++ b/android/hardware/fingerprint/FingerprintManager.java
@@ -31,9 +31,9 @@ import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.biometrics.BiometricAuthenticator;
-import android.hardware.biometrics.BiometricDialog;
import android.hardware.biometrics.BiometricFingerprintConstants;
-import android.hardware.biometrics.IBiometricDialogReceiver;
+import android.hardware.biometrics.BiometricPrompt;
+import android.hardware.biometrics.IBiometricPromptReceiver;
import android.os.Binder;
import android.os.Bundle;
import android.os.CancellationSignal;
@@ -57,7 +57,7 @@ import javax.crypto.Mac;
/**
* A class that coordinates access to the fingerprint hardware.
- * @deprecated See {@link BiometricDialog} which shows a system-provided dialog upon starting
+ * @deprecated See {@link BiometricPrompt} which shows a system-provided dialog upon starting
* authentication. In a world where devices may have different types of biometric authentication,
* it's much more realistic to have a system-provided authentication dialog since the method may
* vary by vendor/device.
@@ -111,7 +111,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
/**
* A wrapper class for the crypto objects supported by FingerprintManager. Currently the
* framework supports {@link Signature}, {@link Cipher} and {@link Mac} objects.
- * @deprecated See {@link android.hardware.biometrics.BiometricDialog.CryptoObject}
+ * @deprecated See {@link android.hardware.biometrics.BiometricPrompt.CryptoObject}
*/
@Deprecated
public static final class CryptoObject extends android.hardware.biometrics.CryptoObject {
@@ -155,7 +155,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
/**
* Container for callback data from {@link FingerprintManager#authenticate(CryptoObject,
* CancellationSignal, int, AuthenticationCallback, Handler)}.
- * @deprecated See {@link android.hardware.biometrics.BiometricDialog.AuthenticationResult}
+ * @deprecated See {@link android.hardware.biometrics.BiometricPrompt.AuthenticationResult}
*/
@Deprecated
public static class AuthenticationResult {
@@ -204,7 +204,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
* FingerprintManager#authenticate(CryptoObject, CancellationSignal,
* int, AuthenticationCallback, Handler) } must provide an implementation of this for listening to
* fingerprint events.
- * @deprecated See {@link android.hardware.biometrics.BiometricDialog.AuthenticationCallback}
+ * @deprecated See {@link android.hardware.biometrics.BiometricPrompt.AuthenticationCallback}
*/
@Deprecated
public static abstract class AuthenticationCallback
@@ -378,10 +378,10 @@ public class FingerprintManager implements BiometricFingerprintConstants {
* by Android Keystore
* facility.
* @throws IllegalStateException if the crypto primitive is not initialized.
- * @deprecated See {@link BiometricDialog#authenticate(CancellationSignal, Executor,
- * BiometricDialog.AuthenticationCallback)} and {@link BiometricDialog#authenticate(
- * BiometricDialog.CryptoObject, CancellationSignal, Executor,
- * BiometricDialog.AuthenticationCallback)}
+ * @deprecated See {@link BiometricPrompt#authenticate(CancellationSignal, Executor,
+ * BiometricPrompt.AuthenticationCallback)} and {@link BiometricPrompt#authenticate(
+ * BiometricPrompt.CryptoObject, CancellationSignal, Executor,
+ * BiometricPrompt.AuthenticationCallback)}
*/
@Deprecated
@RequiresPermission(anyOf = {USE_BIOMETRIC, USE_FINGERPRINT})
@@ -444,7 +444,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
/**
* Per-user version, see {@link FingerprintManager#authenticate(CryptoObject,
- * CancellationSignal, Bundle, Executor, IBiometricDialogReceiver, AuthenticationCallback)}
+ * CancellationSignal, Bundle, Executor, IBiometricPromptReceiver, AuthenticationCallback)}
* @param userId the user ID that the fingerprint hardware will authenticate for.
*/
private void authenticate(int userId,
@@ -452,7 +452,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
@NonNull CancellationSignal cancel,
@NonNull Bundle bundle,
@NonNull @CallbackExecutor Executor executor,
- @NonNull IBiometricDialogReceiver receiver,
+ @NonNull IBiometricPromptReceiver receiver,
@NonNull BiometricAuthenticator.AuthenticationCallback callback) {
mCryptoObject = crypto;
if (cancel.isCanceled()) {
@@ -480,8 +480,8 @@ public class FingerprintManager implements BiometricFingerprintConstants {
}
/**
- * Private method, see {@link BiometricDialog#authenticate(CancellationSignal, Executor,
- * BiometricDialog.AuthenticationCallback)}
+ * Private method, see {@link BiometricPrompt#authenticate(CancellationSignal, Executor,
+ * BiometricPrompt.AuthenticationCallback)}
* @param cancel
* @param executor
* @param callback
@@ -491,7 +491,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
@NonNull CancellationSignal cancel,
@NonNull Bundle bundle,
@NonNull @CallbackExecutor Executor executor,
- @NonNull IBiometricDialogReceiver receiver,
+ @NonNull IBiometricPromptReceiver receiver,
@NonNull BiometricAuthenticator.AuthenticationCallback callback) {
if (cancel == null) {
throw new IllegalArgumentException("Must supply a cancellation signal");
@@ -512,8 +512,8 @@ public class FingerprintManager implements BiometricFingerprintConstants {
}
/**
- * Private method, see {@link BiometricDialog#authenticate(BiometricDialog.CryptoObject,
- * CancellationSignal, Executor, BiometricDialog.AuthenticationCallback)}
+ * Private method, see {@link BiometricPrompt#authenticate(BiometricPrompt.CryptoObject,
+ * CancellationSignal, Executor, BiometricPrompt.AuthenticationCallback)}
* @param crypto
* @param cancel
* @param executor
@@ -524,7 +524,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
@NonNull CancellationSignal cancel,
@NonNull Bundle bundle,
@NonNull @CallbackExecutor Executor executor,
- @NonNull IBiometricDialogReceiver receiver,
+ @NonNull IBiometricPromptReceiver receiver,
@NonNull BiometricAuthenticator.AuthenticationCallback callback) {
if (crypto == null) {
throw new IllegalArgumentException("Must supply a crypto object");
@@ -743,7 +743,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
* Determine if there is at least one fingerprint enrolled.
*
* @return true if at least one fingerprint is enrolled, false otherwise
- * @deprecated See {@link BiometricDialog} and
+ * @deprecated See {@link BiometricPrompt} and
* {@link FingerprintManager#FINGERPRINT_ERROR_NO_FINGERPRINTS}
*/
@Deprecated
@@ -777,7 +777,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
* Determine if fingerprint hardware is present and functional.
*
* @return true if hardware is present and functional, false otherwise.
- * @deprecated See {@link BiometricDialog} and
+ * @deprecated See {@link BiometricPrompt} and
* {@link FingerprintManager#FINGERPRINT_ERROR_HW_UNAVAILABLE}
*/
@Deprecated
@@ -1158,7 +1158,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
@Override // binder call
public void onError(long deviceId, int error, int vendorCode) {
if (mExecutor != null) {
- // BiometricDialog case
+ // BiometricPrompt case
if (error == FingerprintManager.FINGERPRINT_ERROR_USER_CANCELED) {
// User tapped somewhere to cancel, the biometric dialog is already dismissed.
mExecutor.execute(() -> {
@@ -1172,7 +1172,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
mExecutor.execute(() -> {
sendErrorResult(deviceId, error, vendorCode);
});
- }, BiometricDialog.HIDE_DIALOG_DELAY);
+ }, BiometricPrompt.HIDE_DIALOG_DELAY);
}
} else {
mHandler.obtainMessage(MSG_ERROR, error, vendorCode, deviceId).sendToTarget();
--
cgit v1.2.3