Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf87df15 authored by Vishwath Mohan's avatar Vishwath Mohan
Browse files

Refactor FingerprintDialog to BiometricDialog

This CL changes FingerprintDialog into the more generic
BiometricDialog, which OEMs will be able to extend as necessary to
provide support for alternate biometric modalities.

Bug: 74831038
Test: m -j50 FingerprintDialog (from the associated CL on this topic)
      The app works and authenticates successfully.
Test: make update-api -j56

Change-Id: Ic398ef0a0b448be68dbe3330b30779f93f567243
parent c08aa83b
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -145,11 +145,11 @@ java_library {
        ":libcamera_client_framework_aidl",
        ":libcamera_client_framework_aidl",
        "core/java/android/hardware/IConsumerIrService.aidl",
        "core/java/android/hardware/IConsumerIrService.aidl",
        "core/java/android/hardware/ISerialManager.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/IDisplayManager.aidl",
        "core/java/android/hardware/display/IDisplayManagerCallback.aidl",
        "core/java/android/hardware/display/IDisplayManagerCallback.aidl",
        "core/java/android/hardware/display/IVirtualDisplayCallback.aidl",
        "core/java/android/hardware/display/IVirtualDisplayCallback.aidl",
        "core/java/android/hardware/fingerprint/IFingerprintClientActiveCallback.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/IFingerprintService.aidl",
        "core/java/android/hardware/fingerprint/IFingerprintServiceLockoutResetCallback.aidl",
        "core/java/android/hardware/fingerprint/IFingerprintServiceLockoutResetCallback.aidl",
        "core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl",
        "core/java/android/hardware/fingerprint/IFingerprintServiceReceiver.aidl",
+61 −53
Original line number Original line Diff line number Diff line
@@ -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 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 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 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 USE_SIP = "android.permission.USE_SIP";
    field public static final java.lang.String VIBRATE = "android.permission.VIBRATE";
    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 java.lang.String WAKE_LOCK = "android.permission.WAKE_LOCK";
@@ -6680,9 +6681,12 @@ package android.app.admin {
    field public static final int ID_TYPE_IMEI = 4; // 0x4
    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_MEID = 8; // 0x8
    field public static final int ID_TYPE_SERIAL = 2; // 0x2
    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_ALL = 2147483647; // 0x7fffffff
    field public static final int KEYGUARD_DISABLE_FEATURES_NONE = 0; // 0x0
    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_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_REMOTE_INPUT = 64; // 0x40
    field public static final int KEYGUARD_DISABLE_SECURE_CAMERA = 2; // 0x2
    field public static final int KEYGUARD_DISABLE_SECURE_CAMERA = 2; // 0x2
    field public static final int KEYGUARD_DISABLE_SECURE_NOTIFICATIONS = 4; // 0x4
    field public static final int KEYGUARD_DISABLE_SECURE_NOTIFICATIONS = 4; // 0x4
@@ -15701,6 +15705,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 {
package android.hardware.camera2 {
  public class CameraAccessException extends android.util.AndroidException {
  public class CameraAccessException extends android.util.AndroidException {
@@ -16530,58 +16590,6 @@ package android.hardware.display {
package android.hardware.fingerprint {
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 {
  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 void authenticate(android.hardware.fingerprint.FingerprintManager.CryptoObject, android.os.CancellationSignal, int, android.hardware.fingerprint.FingerprintManager.AuthenticationCallback, android.os.Handler);
    method public deprecated boolean hasEnrolledFingerprints();
    method public deprecated boolean hasEnrolledFingerprints();
+20 −1
Original line number Original line Diff line number Diff line
@@ -3742,7 +3742,7 @@ public class DevicePolicyManager {
    public static final int KEYGUARD_DISABLE_TRUST_AGENTS = 1 << 4;
    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_FINGERPRINT = 1 << 5;


@@ -3751,6 +3751,25 @@ public class DevicePolicyManager {
     */
     */
    public static final int KEYGUARD_DISABLE_REMOTE_INPUT = 1 << 6;
    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.
     * Disable all current and future keyguard customizations.
     */
     */
+165 −0
Original line number Original line Diff line number Diff line
/*
 * 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;
}
Loading