Merge "Refactor FingerprintDialog to BiometricDialog" into pi-dev

This commit is contained in:
Vishwath Mohan
2018-03-28 18:46:34 +00:00
committed by Android (Google) Code Review
18 changed files with 417 additions and 211 deletions

View File

@@ -145,11 +145,11 @@ java_library {
":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",

View File

@@ -142,7 +142,8 @@ package android {
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";
@@ -6684,9 +6685,12 @@ package android.app.admin {
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
@@ -15725,6 +15729,62 @@ package android.hardware {
}
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 {
@@ -16560,58 +16620,6 @@ package android.hardware.display {
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();

View File

@@ -3742,7 +3742,7 @@ public class DevicePolicyManager {
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;
@@ -3751,6 +3751,25 @@ public class DevicePolicyManager {
*/
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.
*/

View File

@@ -0,0 +1,165 @@
/*
* 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;
}

View File

@@ -14,9 +14,9 @@
* 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;
@@ -24,10 +24,7 @@ import android.annotation.RequiresPermission;
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;
@@ -39,9 +36,9 @@ import javax.crypto.Cipher;
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
@@ -97,18 +94,21 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
}
/**
* 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;
}
/**
@@ -117,7 +117,7 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
* @return
*/
public Builder setTitle(@NonNull CharSequence title) {
bundle.putCharSequence(KEY_TITLE, title);
mBundle.putCharSequence(KEY_TITLE, title);
return this;
}
@@ -127,7 +127,7 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
* @return
*/
public Builder setSubtitle(@NonNull CharSequence subtitle) {
bundle.putCharSequence(KEY_SUBTITLE, subtitle);
mBundle.putCharSequence(KEY_SUBTITLE, subtitle);
return this;
}
@@ -137,7 +137,7 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
* @return
*/
public Builder setDescription(@NonNull CharSequence description) {
bundle.putCharSequence(KEY_DESCRIPTION, description);
mBundle.putCharSequence(KEY_DESCRIPTION, description);
return this;
}
@@ -160,8 +160,8 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
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;
}
@@ -184,27 +184,26 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
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);
}
}
@@ -214,7 +213,7 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
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
@@ -230,7 +229,7 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
}
};
private FingerprintDialog(Context context, Bundle bundle,
private BiometricDialog(Context context, Bundle bundle,
ButtonInfo positiveButtonInfo, ButtonInfo negativeButtonInfo) {
mBundle = bundle;
mPositiveButtonInfo = positiveButtonInfo;
@@ -240,8 +239,8 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
}
/**
* 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) {
@@ -282,9 +281,8 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
}
/**
* 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 {
@@ -301,8 +299,8 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
}
/**
* 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();
@@ -310,12 +308,12 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
}
/**
* 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.
@@ -368,7 +366,6 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
}
}
/**
* @param crypto Object associated with the call
* @param cancel An object that can be used to cancel authentication
@@ -381,7 +378,7 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
@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);
@@ -398,30 +395,26 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
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
@@ -431,7 +424,7 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
* @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,
@@ -444,23 +437,19 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
}
/**
* 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
*
@@ -468,7 +457,7 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
* @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) {
@@ -481,13 +470,16 @@ public class FingerprintDialog implements BiometricAuthenticator, BiometricFinge
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;

View File

@@ -13,16 +13,15 @@
* 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);
}

View File

@@ -18,6 +18,7 @@ package android.hardware.fingerprint;
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;
@@ -30,7 +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.os.Binder;
import android.os.Bundle;
import android.os.CancellationSignal;
@@ -54,10 +57,10 @@ import javax.crypto.Mac;
/**
* 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)
@@ -108,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.fingerprint.FingerprintDialog.CryptoObject}
* @deprecated See {@link android.hardware.biometrics.BiometricDialog.CryptoObject}
*/
@Deprecated
public static final class CryptoObject extends android.hardware.biometrics.CryptoObject {
@@ -152,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.fingerprint.FingerprintDialog.AuthenticationResult}
* @deprecated See {@link android.hardware.biometrics.BiometricDialog.AuthenticationResult}
*/
@Deprecated
public static class AuthenticationResult {
@@ -201,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.fingerprint.FingerprintDialog.AuthenticationCallback}
* @deprecated See {@link android.hardware.biometrics.BiometricDialog.AuthenticationCallback}
*/
@Deprecated
public static abstract class AuthenticationCallback
@@ -375,13 +378,13 @@ public class FingerprintManager implements BiometricFingerprintConstants {
* 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());
@@ -405,7 +408,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
* @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) {
@@ -441,7 +444,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
/**
* 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,
@@ -449,7 +452,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
@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()) {
@@ -477,8 +480,8 @@ public class FingerprintManager implements BiometricFingerprintConstants {
}
/**
* 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
@@ -488,7 +491,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
@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");
@@ -509,8 +512,8 @@ public class FingerprintManager implements BiometricFingerprintConstants {
}
/**
* 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
@@ -521,7 +524,7 @@ public class FingerprintManager implements BiometricFingerprintConstants {
@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");
@@ -740,8 +743,8 @@ 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 FingerprintDialog} and
* {@link FingerprintDialog#FINGERPRINT_ERROR_NO_FINGERPRINTS}
* @deprecated See {@link BiometricDialog} and
* {@link FingerprintManager#FINGERPRINT_ERROR_NO_FINGERPRINTS}
*/
@Deprecated
@RequiresPermission(USE_FINGERPRINT)
@@ -774,8 +777,8 @@ 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 FingerprintDialog} and
* {@link FingerprintDialog#FINGERPRINT_ERROR_HW_UNAVAILABLE}
* @deprecated See {@link BiometricDialog} and
* {@link FingerprintManager#FINGERPRINT_ERROR_HW_UNAVAILABLE}
*/
@Deprecated
@RequiresPermission(USE_FINGERPRINT)
@@ -1155,14 +1158,14 @@ public class FingerprintManager implements BiometricFingerprintConstants {
@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();
}

View File

@@ -16,8 +16,8 @@
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;
@@ -31,7 +31,7 @@ interface IFingerprintService {
// 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);

View File

@@ -18,7 +18,7 @@ package com.android.internal.statusbar;
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;
@@ -141,7 +141,7 @@ oneway interface IStatusBar
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

View File

@@ -20,7 +20,7 @@ import android.content.ComponentName;
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;
@@ -88,7 +88,7 @@ interface IStatusBarService
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

View File

@@ -1104,6 +1104,8 @@
<!-- 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"
@@ -1111,6 +1113,15 @@
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 -->
<!-- ====================================================================== -->

View File

@@ -1325,6 +1325,11 @@
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. -->

View File

@@ -18,8 +18,8 @@ package com.android.systemui.fingerprint;
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;
@@ -48,7 +48,7 @@ public class FingerprintDialogImpl extends SystemUI implements CommandQueue.Call
private FingerprintDialogView mDialogView;
private WindowManager mWindowManager;
private IFingerprintDialogReceiver mReceiver;
private IBiometricDialogReceiver mReceiver;
private boolean mDialogShowing;
private Handler mHandler = new Handler() {
@@ -97,7 +97,7 @@ public class FingerprintDialogImpl extends SystemUI implements CommandQueue.Call
}
@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);
@@ -139,7 +139,7 @@ public class FingerprintDialogImpl extends SystemUI implements CommandQueue.Call
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;
@@ -177,7 +177,7 @@ public class FingerprintDialogImpl extends SystemUI implements CommandQueue.Call
}
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);
}
@@ -193,7 +193,7 @@ public class FingerprintDialogImpl extends SystemUI implements CommandQueue.Call
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);
}
@@ -206,7 +206,7 @@ public class FingerprintDialogImpl extends SystemUI implements CommandQueue.Call
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);
}

View File

@@ -23,7 +23,7 @@ import android.graphics.PixelFormat;
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;
@@ -163,10 +163,10 @@ public class FingerprintDialogView extends LinearLayout {
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 {
@@ -174,18 +174,18 @@ public class FingerprintDialogView extends LinearLayout {
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);
@@ -271,7 +271,7 @@ public class FingerprintDialogView extends LinearLayout {
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) {
@@ -281,7 +281,7 @@ public class FingerprintDialogView extends LinearLayout {
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) {

View File

@@ -18,7 +18,7 @@ package com.android.systemui.statusbar;
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;
@@ -160,7 +160,7 @@ public class CommandQueue extends IStatusBar.Stub {
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) { }
@@ -513,7 +513,7 @@ public class CommandQueue extends IStatusBar.Stub {
}
@Override
public void showFingerprintDialog(Bundle bundle, IFingerprintDialogReceiver receiver) {
public void showFingerprintDialog(Bundle bundle, IBiometricDialogReceiver receiver) {
synchronized (mLock) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = bundle;
@@ -759,7 +759,7 @@ public class CommandQueue extends IStatusBar.Stub {
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:
@@ -810,4 +810,3 @@ public class CommandQueue extends IStatusBar.Stub {
}
}
}

View File

@@ -18,10 +18,10 @@ package com.android.server.fingerprint;
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;
@@ -46,8 +46,8 @@ public abstract class AuthenticationClient extends ClientMonitor {
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;
@@ -55,13 +55,13 @@ public abstract class AuthenticationClient extends ClientMonitor {
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 */);
}
@@ -88,7 +88,7 @@ public abstract class AuthenticationClient extends ClientMonitor {
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;
@@ -299,7 +299,7 @@ public abstract class AuthenticationClient extends ClientMonitor {
// 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();

View File

@@ -19,6 +19,7 @@ package com.android.server.fingerprint;
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;
@@ -37,12 +38,12 @@ import android.content.Intent;
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;
@@ -778,7 +779,11 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
*/
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
}
@@ -845,7 +850,7 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
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 + ")");
@@ -1156,7 +1161,7 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
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();

View File

@@ -23,7 +23,7 @@ import android.app.StatusBarManager;
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;
@@ -547,7 +547,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
}
@Override
public void showFingerprintDialog(Bundle bundle, IFingerprintDialogReceiver receiver) {
public void showFingerprintDialog(Bundle bundle, IBiometricDialogReceiver receiver) {
if (mBar != null) {
try {
mBar.showFingerprintDialog(bundle, receiver);