":libcamera_client_framework_aidl",
"core/java/android/hardware/IConsumerIrService.aidl",
"core/java/android/hardware/ISerialManager.aidl",
+ "core/java/android/hardware/biometrics/IBiometricDialogReceiver.aidl",
"core/java/android/hardware/display/IDisplayManager.aidl",
"core/java/android/hardware/display/IDisplayManagerCallback.aidl",
"core/java/android/hardware/display/IVirtualDisplayCallback.aidl",
"core/java/android/hardware/fingerprint/IFingerprintClientActiveCallback.aidl",
- "core/java/android/hardware/fingerprint/IFingerprintDialogReceiver.aidl",
"core/java/android/hardware/fingerprint/IFingerprintService.aidl",
"core/java/android/hardware/fingerprint/IFingerprintServiceLockoutResetCallback.aidl",
"core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl",
field public static final java.lang.String TRANSMIT_IR = "android.permission.TRANSMIT_IR";
field public static final java.lang.String UNINSTALL_SHORTCUT = "com.android.launcher.permission.UNINSTALL_SHORTCUT";
field public static final java.lang.String UPDATE_DEVICE_STATS = "android.permission.UPDATE_DEVICE_STATS";
- field public static final java.lang.String USE_FINGERPRINT = "android.permission.USE_FINGERPRINT";
+ field public static final java.lang.String USE_BIOMETRIC = "android.permission.USE_BIOMETRIC";
+ field public static final deprecated java.lang.String USE_FINGERPRINT = "android.permission.USE_FINGERPRINT";
field public static final java.lang.String USE_SIP = "android.permission.USE_SIP";
field public static final java.lang.String VIBRATE = "android.permission.VIBRATE";
field public static final java.lang.String WAKE_LOCK = "android.permission.WAKE_LOCK";
field public static final int ID_TYPE_IMEI = 4; // 0x4
field public static final int ID_TYPE_MEID = 8; // 0x8
field public static final int ID_TYPE_SERIAL = 2; // 0x2
+ field public static final int KEYGUARD_DISABLE_BIOMETRICS = 416; // 0x1a0
+ field public static final int KEYGUARD_DISABLE_FACE = 128; // 0x80
field public static final int KEYGUARD_DISABLE_FEATURES_ALL = 2147483647; // 0x7fffffff
field public static final int KEYGUARD_DISABLE_FEATURES_NONE = 0; // 0x0
field public static final int KEYGUARD_DISABLE_FINGERPRINT = 32; // 0x20
+ field public static final int KEYGUARD_DISABLE_IRIS = 256; // 0x100
field public static final int KEYGUARD_DISABLE_REMOTE_INPUT = 64; // 0x40
field public static final int KEYGUARD_DISABLE_SECURE_CAMERA = 2; // 0x2
field public static final int KEYGUARD_DISABLE_SECURE_NOTIFICATIONS = 4; // 0x4
}
+package android.hardware.biometrics {
+
+ public class BiometricDialog {
+ method public void authenticate(android.hardware.biometrics.BiometricDialog.CryptoObject, android.os.CancellationSignal, java.util.concurrent.Executor, android.hardware.biometrics.BiometricDialog.AuthenticationCallback);
+ method public void authenticate(android.os.CancellationSignal, java.util.concurrent.Executor, android.hardware.biometrics.BiometricDialog.AuthenticationCallback);
+ field public static final int BIOMETRIC_ACQUIRED_GOOD = 0; // 0x0
+ field public static final int BIOMETRIC_ACQUIRED_IMAGER_DIRTY = 3; // 0x3
+ field public static final int BIOMETRIC_ACQUIRED_INSUFFICIENT = 2; // 0x2
+ field public static final int BIOMETRIC_ACQUIRED_PARTIAL = 1; // 0x1
+ field public static final int BIOMETRIC_ACQUIRED_TOO_FAST = 5; // 0x5
+ field public static final int BIOMETRIC_ACQUIRED_TOO_SLOW = 4; // 0x4
+ field public static final int BIOMETRIC_ERROR_CANCELED = 5; // 0x5
+ field public static final int BIOMETRIC_ERROR_HW_NOT_PRESENT = 12; // 0xc
+ field public static final int BIOMETRIC_ERROR_HW_UNAVAILABLE = 1; // 0x1
+ field public static final int BIOMETRIC_ERROR_LOCKOUT = 7; // 0x7
+ field public static final int BIOMETRIC_ERROR_LOCKOUT_PERMANENT = 9; // 0x9
+ field public static final int BIOMETRIC_ERROR_NO_BIOMETRICS = 11; // 0xb
+ field public static final int BIOMETRIC_ERROR_NO_SPACE = 4; // 0x4
+ field public static final int BIOMETRIC_ERROR_TIMEOUT = 3; // 0x3
+ field public static final int BIOMETRIC_ERROR_UNABLE_TO_PROCESS = 2; // 0x2
+ field public static final int BIOMETRIC_ERROR_USER_CANCELED = 10; // 0xa
+ field public static final int BIOMETRIC_ERROR_VENDOR = 8; // 0x8
+ }
+
+ public static abstract class BiometricDialog.AuthenticationCallback {
+ ctor public BiometricDialog.AuthenticationCallback();
+ method public void onAuthenticationError(int, java.lang.CharSequence);
+ method public void onAuthenticationFailed();
+ method public void onAuthenticationHelp(int, java.lang.CharSequence);
+ method public void onAuthenticationSucceeded(android.hardware.biometrics.BiometricDialog.AuthenticationResult);
+ }
+
+ public static class BiometricDialog.AuthenticationResult {
+ method public android.hardware.biometrics.BiometricDialog.CryptoObject getCryptoObject();
+ }
+
+ public static class BiometricDialog.Builder {
+ ctor public BiometricDialog.Builder(android.content.Context);
+ method public android.hardware.biometrics.BiometricDialog build();
+ method public android.hardware.biometrics.BiometricDialog.Builder setDescription(java.lang.CharSequence);
+ method public android.hardware.biometrics.BiometricDialog.Builder setNegativeButton(java.lang.CharSequence, java.util.concurrent.Executor, android.content.DialogInterface.OnClickListener);
+ method public android.hardware.biometrics.BiometricDialog.Builder setSubtitle(java.lang.CharSequence);
+ method public android.hardware.biometrics.BiometricDialog.Builder setTitle(java.lang.CharSequence);
+ }
+
+ public static final class BiometricDialog.CryptoObject {
+ ctor public BiometricDialog.CryptoObject(java.security.Signature);
+ ctor public BiometricDialog.CryptoObject(javax.crypto.Cipher);
+ ctor public BiometricDialog.CryptoObject(javax.crypto.Mac);
+ method public javax.crypto.Cipher getCipher();
+ method public javax.crypto.Mac getMac();
+ method public java.security.Signature getSignature();
+ }
+
+}
+
package android.hardware.camera2 {
public class CameraAccessException extends android.util.AndroidException {
package android.hardware.fingerprint {
- public class FingerprintDialog {
- method public void authenticate(android.hardware.fingerprint.FingerprintDialog.CryptoObject, android.os.CancellationSignal, java.util.concurrent.Executor, android.hardware.fingerprint.FingerprintDialog.AuthenticationCallback);
- method public void authenticate(android.os.CancellationSignal, java.util.concurrent.Executor, android.hardware.fingerprint.FingerprintDialog.AuthenticationCallback);
- field public static final int FINGERPRINT_ACQUIRED_GOOD = 0; // 0x0
- field public static final int FINGERPRINT_ACQUIRED_IMAGER_DIRTY = 3; // 0x3
- field public static final int FINGERPRINT_ACQUIRED_INSUFFICIENT = 2; // 0x2
- field public static final int FINGERPRINT_ACQUIRED_PARTIAL = 1; // 0x1
- field public static final int FINGERPRINT_ACQUIRED_TOO_FAST = 5; // 0x5
- field public static final int FINGERPRINT_ACQUIRED_TOO_SLOW = 4; // 0x4
- field public static final int FINGERPRINT_ERROR_CANCELED = 5; // 0x5
- field public static final int FINGERPRINT_ERROR_HW_NOT_PRESENT = 12; // 0xc
- field public static final int FINGERPRINT_ERROR_HW_UNAVAILABLE = 1; // 0x1
- field public static final int FINGERPRINT_ERROR_LOCKOUT = 7; // 0x7
- field public static final int FINGERPRINT_ERROR_LOCKOUT_PERMANENT = 9; // 0x9
- field public static final int FINGERPRINT_ERROR_NO_FINGERPRINTS = 11; // 0xb
- field public static final int FINGERPRINT_ERROR_NO_SPACE = 4; // 0x4
- field public static final int FINGERPRINT_ERROR_TIMEOUT = 3; // 0x3
- field public static final int FINGERPRINT_ERROR_UNABLE_TO_PROCESS = 2; // 0x2
- field public static final int FINGERPRINT_ERROR_USER_CANCELED = 10; // 0xa
- field public static final int FINGERPRINT_ERROR_VENDOR = 8; // 0x8
- }
-
- public static abstract class FingerprintDialog.AuthenticationCallback {
- ctor public FingerprintDialog.AuthenticationCallback();
- method public void onAuthenticationError(int, java.lang.CharSequence);
- method public void onAuthenticationFailed();
- method public void onAuthenticationHelp(int, java.lang.CharSequence);
- method public void onAuthenticationSucceeded(android.hardware.fingerprint.FingerprintDialog.AuthenticationResult);
- }
-
- public static class FingerprintDialog.AuthenticationResult {
- method public android.hardware.fingerprint.FingerprintDialog.CryptoObject getCryptoObject();
- }
-
- public static class FingerprintDialog.Builder {
- ctor public FingerprintDialog.Builder();
- method public android.hardware.fingerprint.FingerprintDialog build(android.content.Context);
- method public android.hardware.fingerprint.FingerprintDialog.Builder setDescription(java.lang.CharSequence);
- method public android.hardware.fingerprint.FingerprintDialog.Builder setNegativeButton(java.lang.CharSequence, java.util.concurrent.Executor, android.content.DialogInterface.OnClickListener);
- method public android.hardware.fingerprint.FingerprintDialog.Builder setSubtitle(java.lang.CharSequence);
- method public android.hardware.fingerprint.FingerprintDialog.Builder setTitle(java.lang.CharSequence);
- }
-
- public static final class FingerprintDialog.CryptoObject {
- ctor public FingerprintDialog.CryptoObject(java.security.Signature);
- ctor public FingerprintDialog.CryptoObject(javax.crypto.Cipher);
- ctor public FingerprintDialog.CryptoObject(javax.crypto.Mac);
- method public javax.crypto.Cipher getCipher();
- method public javax.crypto.Mac getMac();
- method public java.security.Signature getSignature();
- }
-
public deprecated class FingerprintManager {
method public deprecated void authenticate(android.hardware.fingerprint.FingerprintManager.CryptoObject, android.os.CancellationSignal, int, android.hardware.fingerprint.FingerprintManager.AuthenticationCallback, android.os.Handler);
method public deprecated boolean hasEnrolledFingerprints();
public static final int KEYGUARD_DISABLE_TRUST_AGENTS = 1 << 4;
/**
- * Disable fingerprint sensor on keyguard secure screens (e.g. PIN/Pattern/Password).
+ * Disable fingerprint authentication on keyguard secure screens (e.g. PIN/Pattern/Password).
*/
public static final int KEYGUARD_DISABLE_FINGERPRINT = 1 << 5;
public static final int KEYGUARD_DISABLE_REMOTE_INPUT = 1 << 6;
/**
+ * Disable face authentication on keyguard secure screens (e.g. PIN/Pattern/Password).
+ */
+ public static final int KEYGUARD_DISABLE_FACE = 1 << 7;
+
+ /**
+ * Disable iris authentication on keyguard secure screens (e.g. PIN/Pattern/Password).
+ */
+ public static final int KEYGUARD_DISABLE_IRIS = 1 << 8;
+
+ /**
+ * Disable all biometric authentication on keyguard secure screens (e.g. PIN/Pattern/Password).
+ */
+ public static final int KEYGUARD_DISABLE_BIOMETRICS =
+ DevicePolicyManager.KEYGUARD_DISABLE_FACE
+ | DevicePolicyManager.KEYGUARD_DISABLE_IRIS
+ | DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT;
+
+
+ /**
* Disable all current and future keyguard customizations.
*/
public static final int KEYGUARD_DISABLE_FEATURES_ALL = 0x7fffffff;
--- /dev/null
+/*
+ * 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;
+
+
+/**
+ * Interface containing all of the biometric modality agnostic constants.
+ * @hide
+ */
+public interface BiometricConstants {
+ //
+ // Error messages from biometric hardware during initilization, enrollment, authentication or
+ // removal.
+ //
+
+ /**
+ * The hardware is unavailable. Try again later.
+ */
+ int BIOMETRIC_ERROR_HW_UNAVAILABLE = 1;
+
+ /**
+ * Error state returned when the sensor was unable to process the current image.
+ */
+ int BIOMETRIC_ERROR_UNABLE_TO_PROCESS = 2;
+
+ /**
+ * Error state returned when the current request has been running too long. This is intended to
+ * prevent programs from waiting for the biometric sensor indefinitely. The timeout is platform
+ * and sensor-specific, but is generally on the order of 30 seconds.
+ */
+ int BIOMETRIC_ERROR_TIMEOUT = 3;
+
+ /**
+ * Error state returned for operations like enrollment; the operation cannot be completed
+ * because there's not enough storage remaining to complete the operation.
+ */
+ int BIOMETRIC_ERROR_NO_SPACE = 4;
+
+ /**
+ * The operation was canceled because the biometric sensor is unavailable. For example, this may
+ * happen when the user is switched, the device is locked or another pending operation prevents
+ * or disables it.
+ */
+ int BIOMETRIC_ERROR_CANCELED = 5;
+
+ /**
+ * The {@link BiometricManager#remove} call failed. Typically this will happen when the provided
+ * biometric id was incorrect.
+ *
+ * @hide
+ */
+ int BIOMETRIC_ERROR_UNABLE_TO_REMOVE = 6;
+
+ /**
+ * The operation was canceled because the API is locked out due to too many attempts.
+ * This occurs after 5 failed attempts, and lasts for 30 seconds.
+ */
+ int BIOMETRIC_ERROR_LOCKOUT = 7;
+
+ /**
+ * Hardware vendors may extend this list if there are conditions that do not fall under one of
+ * the above categories. Vendors are responsible for providing error strings for these errors.
+ * These messages are typically reserved for internal operations such as enrollment, but may be
+ * used to express vendor errors not otherwise covered. Applications are expected to show the
+ * error message string if they happen, but are advised not to rely on the message id since they
+ * will be device and vendor-specific
+ */
+ int BIOMETRIC_ERROR_VENDOR = 8;
+
+ /**
+ * The operation was canceled because BIOMETRIC_ERROR_LOCKOUT occurred too many times.
+ * Biometric authentication is disabled until the user unlocks with strong authentication
+ * (PIN/Pattern/Password)
+ */
+ int BIOMETRIC_ERROR_LOCKOUT_PERMANENT = 9;
+
+ /**
+ * The user canceled the operation. Upon receiving this, applications should use alternate
+ * authentication (e.g. a password). The application should also provide the means to return to
+ * biometric authentication, such as a "use <biometric>" button.
+ */
+ int BIOMETRIC_ERROR_USER_CANCELED = 10;
+
+ /**
+ * The user does not have any biometrics enrolled.
+ */
+ int BIOMETRIC_ERROR_NO_BIOMETRICS = 11;
+
+ /**
+ * The device does not have a biometric sensor.
+ */
+ int BIOMETRIC_ERROR_HW_NOT_PRESENT = 12;
+
+ /**
+ * @hide
+ */
+ int BIOMETRIC_ERROR_VENDOR_BASE = 1000;
+
+ //
+ // Image acquisition messages.
+ //
+
+ /**
+ * The image acquired was good.
+ */
+ int BIOMETRIC_ACQUIRED_GOOD = 0;
+
+ /**
+ * Only a partial biometric image was detected. During enrollment, the user should be informed
+ * on what needs to happen to resolve this problem, e.g. "press firmly on sensor." (for
+ * fingerprint)
+ */
+ int BIOMETRIC_ACQUIRED_PARTIAL = 1;
+
+ /**
+ * The biometric image was too noisy to process due to a detected condition or a possibly dirty
+ * sensor (See {@link #BIOMETRIC_ACQUIRED_IMAGER_DIRTY}).
+ */
+ int BIOMETRIC_ACQUIRED_INSUFFICIENT = 2;
+
+ /**
+ * The biometric image was too noisy due to suspected or detected dirt on the sensor. For
+ * example, it's reasonable return this after multiple {@link #BIOMETRIC_ACQUIRED_INSUFFICIENT}
+ * or actual detection of dirt on the sensor (stuck pixels, swaths, etc.). The user is expected
+ * to take action to clean the sensor when this is returned.
+ */
+ int BIOMETRIC_ACQUIRED_IMAGER_DIRTY = 3;
+
+ /**
+ * The biometric image was unreadable due to lack of motion.
+ */
+ int BIOMETRIC_ACQUIRED_TOO_SLOW = 4;
+
+ /**
+ * The biometric image was incomplete due to quick motion. For example, this could also happen
+ * if the user moved during acquisition. The user should be asked to repeat the operation more
+ * slowly.
+ */
+ int BIOMETRIC_ACQUIRED_TOO_FAST = 5;
+
+ /**
+ * Hardware vendors may extend this list if there are conditions that do not fall under one of
+ * the above categories. Vendors are responsible for providing error strings for these errors.
+ * @hide
+ */
+ int BIOMETRIC_ACQUIRED_VENDOR = 6;
+ /**
+ * @hide
+ */
+ int BIOMETRICT_ACQUIRED_VENDOR_BASE = 1000;
+}
* limitations under the License.
*/
-package android.hardware.fingerprint;
+package android.hardware.biometrics;
-import static android.Manifest.permission.USE_FINGERPRINT;
+import static android.Manifest.permission.USE_BIOMETRIC;
import android.annotation.CallbackExecutor;
import android.annotation.NonNull;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
-import android.hardware.biometrics.BiometricAuthenticator;
-import android.hardware.biometrics.BiometricFingerprintConstants;
-import android.hardware.biometrics.CryptoObject;
-import android.hardware.fingerprint.IFingerprintDialogReceiver;
+import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.text.TextUtils;
import javax.crypto.Mac;
/**
- * A class that manages a system-provided fingerprint dialog.
+ * A class that manages a system-provided biometric dialog.
*/
-public class FingerprintDialog implements BiometricAuthenticator, BiometricFingerprintConstants {
+public class BiometricDialog implements BiometricAuthenticator, BiometricConstants {
/**
* @hide
}
/**
- * A builder that collects arguments, to be shown on the system-provided fingerprint dialog.
+ * A builder that collects arguments to be shown on the system-provided biometric dialog.
**/
public static class Builder {
- private final Bundle bundle;
- private ButtonInfo positiveButtonInfo;
- private ButtonInfo negativeButtonInfo;
+ private final Bundle mBundle;
+ private ButtonInfo mPositiveButtonInfo;
+ private ButtonInfo mNegativeButtonInfo;
+ private Context mContext;
/**
- * Creates a builder for a fingerprint dialog.
+ * Creates a builder for a biometric dialog.
+ * @param context
*/
- public Builder() {
- bundle = new Bundle();
+ public Builder(Context context) {
+ mBundle = new Bundle();
+ mContext = context;
}
/**
* @return
*/
public Builder setTitle(@NonNull CharSequence title) {
- bundle.putCharSequence(KEY_TITLE, title);
+ mBundle.putCharSequence(KEY_TITLE, title);
return this;
}
* @return
*/
public Builder setSubtitle(@NonNull CharSequence subtitle) {
- bundle.putCharSequence(KEY_SUBTITLE, subtitle);
+ mBundle.putCharSequence(KEY_SUBTITLE, subtitle);
return this;
}
* @return
*/
public Builder setDescription(@NonNull CharSequence description) {
- bundle.putCharSequence(KEY_DESCRIPTION, description);
+ mBundle.putCharSequence(KEY_DESCRIPTION, description);
return this;
}
if (listener == null) {
throw new IllegalArgumentException("Listener must not be null");
}
- bundle.putCharSequence(KEY_POSITIVE_TEXT, text);
- positiveButtonInfo = new ButtonInfo(executor, listener);
+ mBundle.putCharSequence(KEY_POSITIVE_TEXT, text);
+ mPositiveButtonInfo = new ButtonInfo(executor, listener);
return this;
}
if (listener == null) {
throw new IllegalArgumentException("Listener must not be null");
}
- bundle.putCharSequence(KEY_NEGATIVE_TEXT, text);
- negativeButtonInfo = new ButtonInfo(executor, listener);
+ mBundle.putCharSequence(KEY_NEGATIVE_TEXT, text);
+ mNegativeButtonInfo = new ButtonInfo(executor, listener);
return this;
}
/**
- * Creates a {@link FingerprintDialog} with the arguments supplied to this builder.
- * @param context
- * @return a {@link FingerprintDialog}
+ * Creates a {@link BiometricDialog}.
+ * @return a {@link BiometricDialog}
* @throws IllegalArgumentException if any of the required fields are not set.
*/
- public FingerprintDialog build(Context context) {
- final CharSequence title = bundle.getCharSequence(KEY_TITLE);
- final CharSequence negative = bundle.getCharSequence(KEY_NEGATIVE_TEXT);
+ 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 FingerprintDialog(context, bundle, positiveButtonInfo, negativeButtonInfo);
+ return new BiometricDialog(mContext, mBundle, mPositiveButtonInfo, mNegativeButtonInfo);
}
}
private ButtonInfo mPositiveButtonInfo;
private ButtonInfo mNegativeButtonInfo;
- IFingerprintDialogReceiver mDialogReceiver = new IFingerprintDialogReceiver.Stub() {
+ IBiometricDialogReceiver mDialogReceiver = new IBiometricDialogReceiver.Stub() {
@Override
public void onDialogDismissed(int reason) {
// Check the reason and invoke OnClickListener(s) if necessary
}
};
- private FingerprintDialog(Context context, Bundle bundle,
+ private BiometricDialog(Context context, Bundle bundle,
ButtonInfo positiveButtonInfo, ButtonInfo negativeButtonInfo) {
mBundle = bundle;
mPositiveButtonInfo = positiveButtonInfo;
}
/**
- * A wrapper class for the crypto objects supported by FingerprintManager. Currently the
- * framework supports {@link Signature}, {@link Cipher} and {@link Mac} objects.
+ * 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) {
}
/**
- * Container for callback data from {@link #authenticate(
- * CancellationSignal, Executor, AuthenticationCallback)} and
- * {@link #authenticate(CryptoObject, CancellationSignal, Executor,
+ * Container for callback data from {@link #authenticate( CancellationSignal, Executor,
+ * AuthenticationCallback)} and {@link #authenticate(CryptoObject, CancellationSignal, Executor,
* AuthenticationCallback)}
*/
public static class AuthenticationResult extends BiometricAuthenticator.AuthenticationResult {
}
/**
* Obtain the crypto object associated with this transaction
- * @return crypto object provided to {@link #authenticate(
- * CryptoObject, CancellationSignal, Executor, AuthenticationCallback)}
+ * @return crypto object provided to {@link #authenticate( CryptoObject, CancellationSignal,
+ * Executor, AuthenticationCallback)}
*/
public CryptoObject getCryptoObject() {
return (CryptoObject) super.getCryptoObject();
}
/**
- * Callback structure provided to {@link FingerprintDialog#authenticate(CancellationSignal,
- * Executor, AuthenticationCallback)} or {@link FingerprintDialog#authenticate(CryptoObject,
+ * 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 static abstract class AuthenticationCallback extends
+ public abstract static class AuthenticationCallback extends
BiometricAuthenticator.AuthenticationCallback {
/**
* Called when an unrecoverable error has been encountered and the operation is complete.
}
}
-
/**
* @param crypto Object associated with the call
* @param cancel An object that can be used to cancel authentication
@NonNull CancellationSignal cancel,
@NonNull @CallbackExecutor Executor executor,
@NonNull BiometricAuthenticator.AuthenticationCallback callback) {
- if (!(callback instanceof FingerprintDialog.AuthenticationCallback)) {
+ if (!(callback instanceof BiometricDialog.AuthenticationCallback)) {
throw new IllegalArgumentException("Callback cannot be casted");
}
authenticate(crypto, cancel, executor, (AuthenticationCallback) callback);
public void authenticate(@NonNull CancellationSignal cancel,
@NonNull @CallbackExecutor Executor executor,
@NonNull BiometricAuthenticator.AuthenticationCallback callback) {
- if (!(callback instanceof FingerprintDialog.AuthenticationCallback)) {
+ 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 FingerprintDialog} object, and calling {@link FingerprintDialog#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,
+ * 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 executor An executor to handle callback events
* @param callback An object to receive authentication events
*/
- @RequiresPermission(USE_FINGERPRINT)
+ @RequiresPermission(USE_BIOMETRIC)
public void authenticate(@NonNull CryptoObject crypto,
@NonNull CancellationSignal cancel,
@NonNull @CallbackExecutor Executor executor,
}
/**
- * 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 FingerprintDialog} object, and calling
- * {@link FingerprintDialog#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)}.
+ * 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 executor An executor to handle callback events
* @param callback An object to receive authentication events
*/
- @RequiresPermission(USE_FINGERPRINT)
+ @RequiresPermission(USE_BIOMETRIC)
public void authenticate(@NonNull CancellationSignal cancel,
@NonNull @CallbackExecutor Executor executor,
@NonNull AuthenticationCallback callback) {
private boolean handlePreAuthenticationErrors(AuthenticationCallback callback,
Executor executor) {
if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
- sendError(FINGERPRINT_ERROR_HW_NOT_PRESENT, callback, executor);
+ sendError(BiometricDialog.BIOMETRIC_ERROR_HW_NOT_PRESENT, callback,
+ executor);
return true;
} else if (!mFingerprintManager.isHardwareDetected()) {
- sendError(FINGERPRINT_ERROR_HW_UNAVAILABLE, callback, executor);
+ sendError(BiometricDialog.BIOMETRIC_ERROR_HW_UNAVAILABLE, callback,
+ executor);
return true;
} else if (!mFingerprintManager.hasEnrolledFingerprints()) {
- sendError(FINGERPRINT_ERROR_NO_FINGERPRINTS, callback, executor);
+ sendError(BiometricDialog.BIOMETRIC_ERROR_NO_BIOMETRICS, callback,
+ executor);
return true;
}
return false;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.hardware.fingerprint;
+package android.hardware.biometrics;
-import android.hardware.fingerprint.Fingerprint;
import android.os.Bundle;
import android.os.UserHandle;
/**
- * Communication channel from the FingerprintDialog (SysUI) back to AuthenticationClient.
+ * Communication channel from the BiometricDialog (SysUI) back to AuthenticationClient.
* @hide
*/
-oneway interface IFingerprintDialogReceiver {
+oneway interface IBiometricDialogReceiver {
void onDialogDismissed(int reason);
}
import static android.Manifest.permission.INTERACT_ACROSS_USERS;
import static android.Manifest.permission.MANAGE_FINGERPRINT;
+import static android.Manifest.permission.USE_BIOMETRIC;
import static android.Manifest.permission.USE_FINGERPRINT;
import android.annotation.CallbackExecutor;
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.os.Binder;
import android.os.Bundle;
import android.os.CancellationSignal;
/**
* A class that coordinates access to the fingerprint hardware.
- * @deprecated See {@link FingerprintDialog} which shows a system-provided dialog upon starting
- * authentication. In a world where devices may have in-display fingerprint sensors, it's much
- * more realistic to have a system-provided authentication dialog since the in-display sensor
- * location may vary by vendor/device.
+ * @deprecated See {@link BiometricDialog} 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.
*/
@Deprecated
@SystemService(Context.FINGERPRINT_SERVICE)
/**
* 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.fingerprint.FingerprintDialog.CryptoObject}
+ * @deprecated See {@link android.hardware.biometrics.BiometricDialog.CryptoObject}
*/
@Deprecated
public static final class CryptoObject extends android.hardware.biometrics.CryptoObject {
/**
* Container for callback data from {@link FingerprintManager#authenticate(CryptoObject,
* CancellationSignal, int, AuthenticationCallback, Handler)}.
- * @deprecated See {@link android.hardware.fingerprint.FingerprintDialog.AuthenticationResult}
+ * @deprecated See {@link android.hardware.biometrics.BiometricDialog.AuthenticationResult}
*/
@Deprecated
public static class AuthenticationResult {
* FingerprintManager#authenticate(CryptoObject, CancellationSignal,
* int, AuthenticationCallback, Handler) } must provide an implementation of this for listening to
* fingerprint events.
- * @deprecated See {@link android.hardware.fingerprint.FingerprintDialog.AuthenticationCallback}
+ * @deprecated See {@link android.hardware.biometrics.BiometricDialog.AuthenticationCallback}
*/
@Deprecated
public static abstract class AuthenticationCallback
* by <a href="{@docRoot}training/articles/keystore.html">Android Keystore
* facility</a>.
* @throws IllegalStateException if the crypto primitive is not initialized.
- * @deprecated See {@link FingerprintDialog#authenticate(CancellationSignal, Executor,
- * FingerprintDialog.AuthenticationCallback)} and {@link FingerprintDialog#authenticate(
- * FingerprintDialog.CryptoObject, CancellationSignal, Executor,
- * FingerprintDialog.AuthenticationCallback)}
+ * @deprecated See {@link BiometricDialog#authenticate(CancellationSignal, Executor,
+ * BiometricDialog.AuthenticationCallback)} and {@link BiometricDialog#authenticate(
+ * BiometricDialog.CryptoObject, CancellationSignal, Executor,
+ * BiometricDialog.AuthenticationCallback)}
*/
@Deprecated
- @RequiresPermission(USE_FINGERPRINT)
+ @RequiresPermission(anyOf = {USE_BIOMETRIC, USE_FINGERPRINT})
public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSignal cancel,
int flags, @NonNull AuthenticationCallback callback, @Nullable Handler handler) {
authenticate(crypto, cancel, flags, callback, handler, mContext.getUserId());
* @param userId the user ID that the fingerprint hardware will authenticate for.
* @hide
*/
- @RequiresPermission(USE_FINGERPRINT)
+ @RequiresPermission(anyOf = {USE_BIOMETRIC, USE_FINGERPRINT})
public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSignal cancel,
int flags, @NonNull AuthenticationCallback callback, Handler handler, int userId) {
if (callback == null) {
/**
* Per-user version, see {@link FingerprintManager#authenticate(CryptoObject,
- * CancellationSignal, Bundle, Executor, IFingerprintDialogReceiver, AuthenticationCallback)}
+ * CancellationSignal, Bundle, Executor, IBiometricDialogReceiver, AuthenticationCallback)}
* @param userId the user ID that the fingerprint hardware will authenticate for.
*/
private void authenticate(int userId,
@NonNull CancellationSignal cancel,
@NonNull Bundle bundle,
@NonNull @CallbackExecutor Executor executor,
- @NonNull IFingerprintDialogReceiver receiver,
+ @NonNull IBiometricDialogReceiver receiver,
@NonNull BiometricAuthenticator.AuthenticationCallback callback) {
mCryptoObject = crypto;
if (cancel.isCanceled()) {
}
/**
- * Private method, see {@link FingerprintDialog#authenticate(CancellationSignal, Executor,
- * AuthenticationCallback)}
+ * Private method, see {@link BiometricDialog#authenticate(CancellationSignal, Executor,
+ * BiometricDialog.AuthenticationCallback)}
* @param cancel
* @param executor
* @param callback
@NonNull CancellationSignal cancel,
@NonNull Bundle bundle,
@NonNull @CallbackExecutor Executor executor,
- @NonNull IFingerprintDialogReceiver receiver,
+ @NonNull IBiometricDialogReceiver receiver,
@NonNull BiometricAuthenticator.AuthenticationCallback callback) {
if (cancel == null) {
throw new IllegalArgumentException("Must supply a cancellation signal");
}
/**
- * Private method, see {@link FingerprintDialog#authenticate(CryptoObject, CancellationSignal,
- * Executor, AuthenticationCallback)}
+ * Private method, see {@link BiometricDialog#authenticate(BiometricDialog.CryptoObject,
+ * CancellationSignal, Executor, BiometricDialog.AuthenticationCallback)}
* @param crypto
* @param cancel
* @param executor
@NonNull CancellationSignal cancel,
@NonNull Bundle bundle,
@NonNull @CallbackExecutor Executor executor,
- @NonNull IFingerprintDialogReceiver receiver,
+ @NonNull IBiometricDialogReceiver receiver,
@NonNull BiometricAuthenticator.AuthenticationCallback callback) {
if (crypto == null) {
throw new IllegalArgumentException("Must supply a crypto object");
* Determine if there is at least one fingerprint enrolled.
*
* @return true if at least one fingerprint is enrolled, false otherwise
- * @deprecated See {@link FingerprintDialog} and
- * {@link FingerprintDialog#FINGERPRINT_ERROR_NO_FINGERPRINTS}
+ * @deprecated See {@link BiometricDialog} and
+ * {@link FingerprintManager#FINGERPRINT_ERROR_NO_FINGERPRINTS}
*/
@Deprecated
@RequiresPermission(USE_FINGERPRINT)
* Determine if fingerprint hardware is present and functional.
*
* @return true if hardware is present and functional, false otherwise.
- * @deprecated See {@link FingerprintDialog} and
- * {@link FingerprintDialog#FINGERPRINT_ERROR_HW_UNAVAILABLE}
+ * @deprecated See {@link BiometricDialog} and
+ * {@link FingerprintManager#FINGERPRINT_ERROR_HW_UNAVAILABLE}
*/
@Deprecated
@RequiresPermission(USE_FINGERPRINT)
@Override // binder call
public void onError(long deviceId, int error, int vendorCode) {
if (mExecutor != null) {
- // FingerprintDialog case, post a delayed runnable on the FingerprintManager handler
+ // BiometricDialog case, post a delayed runnable on the FingerprintManager handler
// that sends the error message after FingerprintDialog.HIDE_DIALOG_DELAY to send
// the error to the application.
mHandler.postDelayed(() -> {
mExecutor.execute(() -> {
sendErrorResult(deviceId, error, vendorCode);
});
- }, FingerprintDialog.HIDE_DIALOG_DELAY);
+ }, BiometricDialog.HIDE_DIALOG_DELAY);
} else {
mHandler.obtainMessage(MSG_ERROR, error, vendorCode, deviceId).sendToTarget();
}
package android.hardware.fingerprint;
import android.os.Bundle;
+import android.hardware.biometrics.IBiometricDialogReceiver;
import android.hardware.fingerprint.IFingerprintClientActiveCallback;
-import android.hardware.fingerprint.IFingerprintDialogReceiver;
import android.hardware.fingerprint.IFingerprintServiceReceiver;
import android.hardware.fingerprint.IFingerprintServiceLockoutResetCallback;
import android.hardware.fingerprint.Fingerprint;
// Authenticate the given sessionId with a fingerprint
void authenticate(IBinder token, long sessionId, int userId,
IFingerprintServiceReceiver receiver, int flags, String opPackageName,
- in Bundle bundle, IFingerprintDialogReceiver dialogReceiver);
+ in Bundle bundle, IBiometricDialogReceiver dialogReceiver);
// Cancel authentication for the given sessionId
void cancelAuthentication(IBinder token, String opPackageName);
import android.content.ComponentName;
import android.graphics.Rect;
-import android.hardware.fingerprint.IFingerprintDialogReceiver;
+import android.hardware.biometrics.IBiometricDialogReceiver;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;
void showShutdownUi(boolean isReboot, String reason);
// Used to show the dialog when FingerprintService starts authentication
- void showFingerprintDialog(in Bundle bundle, IFingerprintDialogReceiver receiver);
+ void showFingerprintDialog(in Bundle bundle, IBiometricDialogReceiver receiver);
// Used to hide the dialog when a finger is authenticated
void onFingerprintAuthenticated();
// Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc
import android.graphics.Rect;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;
-import android.hardware.fingerprint.IFingerprintDialogReceiver;
+import android.hardware.biometrics.IBiometricDialogReceiver;
import com.android.internal.statusbar.IStatusBar;
import com.android.internal.statusbar.StatusBarIcon;
void showPinningEscapeToast();
// Used to show the dialog when FingerprintService starts authentication
- void showFingerprintDialog(in Bundle bundle, IFingerprintDialogReceiver receiver);
+ void showFingerprintDialog(in Bundle bundle, IBiometricDialogReceiver receiver);
// Used to hide the dialog when a finger is authenticated
void onFingerprintAuthenticated();
// Used to set a temporary message, e.g. fingerprint not recognized, finger moved too fast, etc
<!-- Allows an app to use fingerprint hardware.
<p>Protection level: normal
+ @deprecated Applications should request {@link
+ android.Manifest.permission#USE_BIOMETRIC} instead
-->
<permission android:name="android.permission.USE_FINGERPRINT"
android:permissionGroup="android.permission-group.SENSORS"
android:description="@string/permdesc_useFingerprint"
android:protectionLevel="normal" />
+ <!-- Allows an app to use device supported biometric modalities.
+ <p>Protection level: normal
+ -->
+ <permission android:name="android.permission.USE_BIOMETRIC"
+ android:permissionGroup="android.permission-group.SENSORS"
+ android:label="@string/permlab_useBiometric"
+ android:description="@string/permdesc_useBiometric"
+ android:protectionLevel="normal" />
+
<!-- ====================================================================== -->
<!-- REMOVED PERMISSIONS -->
<!-- ====================================================================== -->
disables the keylock when receiving an incoming phone call, then
re-enables the keylock when the call is finished.</string>
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=NONE] -->
+ <string name="permlab_useBiometric">use biometric hardware</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this.[CHAR_LIMIT=NONE] -->
+ <string name="permdesc_useBiometric">Allows the app to use biometric hardware for authentication</string>
+
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_manageFingerprint">manage fingerprint hardware</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
import android.content.Context;
import android.content.pm.PackageManager;
-import android.hardware.fingerprint.FingerprintDialog;
-import android.hardware.fingerprint.IFingerprintDialogReceiver;
+import android.hardware.biometrics.BiometricDialog;
+import android.hardware.biometrics.IBiometricDialogReceiver;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
private FingerprintDialogView mDialogView;
private WindowManager mWindowManager;
- private IFingerprintDialogReceiver mReceiver;
+ private IBiometricDialogReceiver mReceiver;
private boolean mDialogShowing;
private Handler mHandler = new Handler() {
}
@Override
- public void showFingerprintDialog(Bundle bundle, IFingerprintDialogReceiver receiver) {
+ public void showFingerprintDialog(Bundle bundle, IBiometricDialogReceiver receiver) {
if (DEBUG) Log.d(TAG, "showFingerprintDialog");
// Remove these messages as they are part of the previous client
mHandler.removeMessages(MSG_FINGERPRINT_ERROR);
Log.w(TAG, "Dialog already showing");
return;
}
- mReceiver = (IFingerprintDialogReceiver) args.arg2;
+ mReceiver = (IBiometricDialogReceiver) args.arg2;
mDialogView.setBundle((Bundle)args.arg1);
mWindowManager.addView(mDialogView, mDialogView.getLayoutParams());
mDialogShowing = true;
}
if (userCanceled) {
try {
- mReceiver.onDialogDismissed(FingerprintDialog.DISMISSED_REASON_USER_CANCEL);
+ mReceiver.onDialogDismissed(BiometricDialog.DISMISSED_REASON_USER_CANCEL);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException when hiding dialog", e);
}
return;
}
try {
- mReceiver.onDialogDismissed(FingerprintDialog.DISMISSED_REASON_NEGATIVE);
+ mReceiver.onDialogDismissed(BiometricDialog.DISMISSED_REASON_NEGATIVE);
} catch (RemoteException e) {
Log.e(TAG, "Remote exception when handling negative button", e);
}
return;
}
try {
- mReceiver.onDialogDismissed(FingerprintDialog.DISMISSED_REASON_POSITIVE);
+ mReceiver.onDialogDismissed(BiometricDialog.DISMISSED_REASON_POSITIVE);
} catch (RemoteException e) {
Log.e(TAG, "Remote exception when handling positive button", e);
}
import android.graphics.PorterDuff;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
-import android.hardware.fingerprint.FingerprintDialog;
+import android.hardware.biometrics.BiometricDialog;
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
mLastState = STATE_NONE;
updateFingerprintIcon(STATE_FINGERPRINT);
- title.setText(mBundle.getCharSequence(FingerprintDialog.KEY_TITLE));
+ title.setText(mBundle.getCharSequence(BiometricDialog.KEY_TITLE));
title.setSelected(true);
- final CharSequence subtitleText = mBundle.getCharSequence(FingerprintDialog.KEY_SUBTITLE);
+ final CharSequence subtitleText = mBundle.getCharSequence(BiometricDialog.KEY_SUBTITLE);
if (subtitleText == null) {
subtitle.setVisibility(View.GONE);
} else {
subtitle.setText(subtitleText);
}
- final CharSequence descriptionText = mBundle.getCharSequence(FingerprintDialog.KEY_DESCRIPTION);
+ final CharSequence descriptionText = mBundle.getCharSequence(BiometricDialog.KEY_DESCRIPTION);
if (descriptionText == null) {
subtitle.setVisibility(View.VISIBLE);
description.setVisibility(View.GONE);
} else {
- description.setText(mBundle.getCharSequence(FingerprintDialog.KEY_DESCRIPTION));
+ description.setText(mBundle.getCharSequence(BiometricDialog.KEY_DESCRIPTION));
}
- negative.setText(mBundle.getCharSequence(FingerprintDialog.KEY_NEGATIVE_TEXT));
+ negative.setText(mBundle.getCharSequence(BiometricDialog.KEY_NEGATIVE_TEXT));
final CharSequence positiveText =
- mBundle.getCharSequence(FingerprintDialog.KEY_POSITIVE_TEXT);
+ mBundle.getCharSequence(BiometricDialog.KEY_POSITIVE_TEXT);
positive.setText(positiveText); // needs to be set for marquee to work
if (positiveText != null) {
positive.setVisibility(View.VISIBLE);
mErrorText.setTextColor(mErrorTextColor);
mErrorText.setContentDescription(message);
mHandler.sendMessageDelayed(mHandler.obtainMessage(FingerprintDialogImpl.MSG_CLEAR_MESSAGE),
- FingerprintDialog.HIDE_DIALOG_DELAY);
+ BiometricDialog.HIDE_DIALOG_DELAY);
}
public void showHelpMessage(String message) {
public void showErrorMessage(String error) {
showTemporaryMessage(error);
mHandler.sendMessageDelayed(mHandler.obtainMessage(FingerprintDialogImpl.MSG_HIDE_DIALOG,
- false /* userCanceled */), FingerprintDialog.HIDE_DIALOG_DELAY);
+ false /* userCanceled */), BiometricDialog.HIDE_DIALOG_DELAY);
}
private void updateFingerprintIcon(int newState) {
import android.content.ComponentName;
import android.graphics.Rect;
-import android.hardware.fingerprint.IFingerprintDialogReceiver;
+import android.hardware.biometrics.IBiometricDialogReceiver;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
default void onRotationProposal(int rotation, boolean isValid) { }
- default void showFingerprintDialog(Bundle bundle, IFingerprintDialogReceiver receiver) { }
+ default void showFingerprintDialog(Bundle bundle, IBiometricDialogReceiver receiver) { }
default void onFingerprintAuthenticated() { }
default void onFingerprintHelp(String message) { }
default void onFingerprintError(String error) { }
}
@Override
- public void showFingerprintDialog(Bundle bundle, IFingerprintDialogReceiver receiver) {
+ public void showFingerprintDialog(Bundle bundle, IBiometricDialogReceiver receiver) {
synchronized (mLock) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = bundle;
for (int i = 0; i < mCallbacks.size(); i++) {
mCallbacks.get(i).showFingerprintDialog(
(Bundle)((SomeArgs)msg.obj).arg1,
- (IFingerprintDialogReceiver)((SomeArgs)msg.obj).arg2);
+ (IBiometricDialogReceiver)((SomeArgs)msg.obj).arg2);
}
break;
case MSG_FINGERPRINT_AUTHENTICATED:
}
}
}
-
import android.content.Context;
import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint;
+import android.hardware.biometrics.BiometricDialog;
+import android.hardware.biometrics.IBiometricDialogReceiver;
import android.hardware.fingerprint.Fingerprint;
-import android.hardware.fingerprint.FingerprintDialog;
import android.hardware.fingerprint.FingerprintManager;
-import android.hardware.fingerprint.IFingerprintDialogReceiver;
import android.hardware.fingerprint.IFingerprintServiceReceiver;
import android.os.Bundle;
import android.os.IBinder;
public static final int LOCKOUT_PERMANENT = 2;
// Callback mechanism received from the client
- // (FingerprintDialog -> FingerprintManager -> FingerprintService -> AuthenticationClient)
- private IFingerprintDialogReceiver mDialogReceiverFromClient;
+ // (BiometricDialog -> FingerprintManager -> FingerprintService -> AuthenticationClient)
+ private IBiometricDialogReceiver mDialogReceiverFromClient;
private Bundle mBundle;
private IStatusBarService mStatusBarService;
private boolean mInLockout;
protected boolean mDialogDismissed;
// Receives events from SystemUI and handles them before forwarding them to FingerprintDialog
- protected IFingerprintDialogReceiver mDialogReceiver = new IFingerprintDialogReceiver.Stub() {
+ protected IBiometricDialogReceiver mDialogReceiver = new IBiometricDialogReceiver.Stub() {
@Override // binder call
public void onDialogDismissed(int reason) {
if (mBundle != null && mDialogReceiverFromClient != null) {
try {
mDialogReceiverFromClient.onDialogDismissed(reason);
- if (reason == FingerprintDialog.DISMISSED_REASON_USER_CANCEL) {
+ if (reason == BiometricDialog.DISMISSED_REASON_USER_CANCEL) {
onError(FingerprintManager.FINGERPRINT_ERROR_USER_CANCELED,
0 /* vendorCode */);
}
public AuthenticationClient(Context context, long halDeviceId, IBinder token,
IFingerprintServiceReceiver receiver, int targetUserId, int groupId, long opId,
boolean restricted, String owner, Bundle bundle,
- IFingerprintDialogReceiver dialogReceiver, IStatusBarService statusBarService) {
+ IBiometricDialogReceiver dialogReceiver, IStatusBarService statusBarService) {
super(context, halDeviceId, token, receiver, targetUserId, groupId, restricted, owner);
mOpId = opId;
mBundle = bundle;
// If the user already cancelled authentication (via some interaction with the
// dialog, we do not need to hide it since it's already hidden.
// If the device is in lockout, don't hide the dialog - it will automatically hide
- // after FingerprintDialog.HIDE_DIALOG_DELAY
+ // after BiometricDialog.HIDE_DIALOG_DELAY
if (mBundle != null && !mDialogDismissed && !mInLockout) {
try {
mStatusBarService.hideFingerprintDialog();
import static android.Manifest.permission.INTERACT_ACROSS_USERS;
import static android.Manifest.permission.MANAGE_FINGERPRINT;
import static android.Manifest.permission.RESET_FINGERPRINT_LOCKOUT;
+import static android.Manifest.permission.USE_BIOMETRIC;
import static android.Manifest.permission.USE_FINGERPRINT;
import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.UserInfo;
+import android.hardware.biometrics.IBiometricDialogReceiver;
import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint;
import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprintClientCallback;
import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.IFingerprintClientActiveCallback;
-import android.hardware.fingerprint.IFingerprintDialogReceiver;
import android.hardware.fingerprint.IFingerprintService;
import android.hardware.fingerprint.IFingerprintServiceLockoutResetCallback;
import android.hardware.fingerprint.IFingerprintServiceReceiver;
*/
private boolean canUseFingerprint(String opPackageName, boolean requireForeground, int uid,
int pid, int userId) {
- checkPermission(USE_FINGERPRINT);
+ if (getContext().checkCallingPermission(USE_FINGERPRINT)
+ != PackageManager.PERMISSION_GRANTED) {
+ checkPermission(USE_BIOMETRIC);
+ }
+
if (isKeyguard(opPackageName)) {
return true; // Keyguard is always allowed
}
private void startAuthentication(IBinder token, long opId, int callingUserId, int groupId,
IFingerprintServiceReceiver receiver, int flags, boolean restricted,
- String opPackageName, Bundle bundle, IFingerprintDialogReceiver dialogReceiver) {
+ String opPackageName, Bundle bundle, IBiometricDialogReceiver dialogReceiver) {
updateActiveGroup(groupId, opPackageName);
if (DEBUG) Slog.v(TAG, "startAuthentication(" + opPackageName + ")");
public void authenticate(final IBinder token, final long opId, final int groupId,
final IFingerprintServiceReceiver receiver, final int flags,
final String opPackageName, final Bundle bundle,
- final IFingerprintDialogReceiver dialogReceiver) {
+ final IBiometricDialogReceiver dialogReceiver) {
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
final int callingUserId = UserHandle.getCallingUserId();
import android.content.ComponentName;
import android.content.Context;
import android.graphics.Rect;
-import android.hardware.fingerprint.IFingerprintDialogReceiver;
+import android.hardware.biometrics.IBiometricDialogReceiver;
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
}
@Override
- public void showFingerprintDialog(Bundle bundle, IFingerprintDialogReceiver receiver) {
+ public void showFingerprintDialog(Bundle bundle, IBiometricDialogReceiver receiver) {
if (mBar != null) {
try {
mBar.showFingerprintDialog(bundle, receiver);