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

Commit 48df6678 authored by Diya Bera's avatar Diya Bera Committed by Android (Google) Code Review
Browse files

Merge "Add callback to check biometric prompt status on keyguard" into main

parents 02356bf6 6c63e87a
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -536,6 +536,24 @@ public class BiometricManager {
        }
    }

    /**
     * Listens for biometric prompt status, i.e., if it is being shown or idle.
     * @hide
     */
    @RequiresPermission(USE_BIOMETRIC_INTERNAL)
    public void registerBiometricPromptStatusListener(
            IBiometricPromptStatusListener callback) {
        if (mService != null) {
            try {
                mService.registerBiometricPromptStatusListener(callback);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        } else {
            Slog.w(TAG, "registerBiometricPromptOnKeyguardCallback(): Service not connected");
        }
    }

    /**
     * Requests all {@link Authenticators.Types#BIOMETRIC_STRONG} sensors to have their
     * authenticatorId invalidated for the specified user. This happens when enrollments have been
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.hardware.biometrics;

import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
import android.hardware.biometrics.IBiometricPromptStatusListener;
import android.hardware.biometrics.IBiometricServiceReceiver;
import android.hardware.biometrics.IInvalidationCallback;
import android.hardware.biometrics.ITestSession;
@@ -63,6 +64,9 @@ interface IAuthService {
    // Register callback for when keyguard biometric eligibility changes.
    void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback);

    // Register callback to check biometric prompt status.
    void registerBiometricPromptStatusListener(IBiometricPromptStatusListener callback);

    // Requests all BIOMETRIC_STRONG sensors to have their authenticatorId invalidated for the
    // specified user. This happens when enrollments have been added on devices with multiple
    // biometric sensors.
+27 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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;

/**
 * Communication channel to propagate biometric prompt status. Implementation of this interface
 * should be registered in BiometricService#registerBiometricPromptStatusListener.
 * @hide
 */
oneway interface IBiometricPromptStatusListener {
    void onBiometricPromptShowing();
    void onBiometricPromptIdle();
}
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.hardware.biometrics;

import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
import android.hardware.biometrics.IBiometricPromptStatusListener;
import android.hardware.biometrics.IBiometricServiceReceiver;
import android.hardware.biometrics.IBiometricAuthenticator;
import android.hardware.biometrics.IInvalidationCallback;
@@ -68,6 +69,10 @@ interface IBiometricService {
    @EnforcePermission("USE_BIOMETRIC_INTERNAL")
    void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback);

    // Register a callback for biometric prompt status on keyguard.
    @EnforcePermission("USE_BIOMETRIC_INTERNAL")
    void registerBiometricPromptStatusListener(IBiometricPromptStatusListener callback);

    // Notify BiometricService when <Biometric>Service is ready to start the prepared client.
    // Client lifecycle is still managed in <Biometric>Service.
    @EnforcePermission("USE_BIOMETRIC_INTERNAL")
+13 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.hardware.biometrics.BiometricManager;
import android.hardware.biometrics.ComponentInfoInternal;
import android.hardware.biometrics.IAuthService;
import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
import android.hardware.biometrics.IBiometricPromptStatusListener;
import android.hardware.biometrics.IBiometricService;
import android.hardware.biometrics.IBiometricServiceReceiver;
import android.hardware.biometrics.IInvalidationCallback;
@@ -356,6 +357,18 @@ public class AuthService extends SystemService {
            }
        }

        @Override
        public void registerBiometricPromptStatusListener(
                IBiometricPromptStatusListener listener) throws RemoteException {
            checkInternalPermission();
            final long identity = Binder.clearCallingIdentity();
            try {
                mBiometricService.registerBiometricPromptStatusListener(listener);
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
        }

        @Override
        public void invalidateAuthenticatorIds(int userId, int fromSensorId,
                IInvalidationCallback callback) throws RemoteException {
Loading