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

Commit b7b54a60 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Move biometric setting observer from KeyguardUpdateMonitor to BiometricService

Fixes: 116872423

Test: with additional logging, do
      adb shell settings put secure face_unlock_keyguard_enabled 1 (or 0)
Test: content observer updates when user changes
Test: clients receive the current state upon registering

Change-Id: Id37381a8c263b29a0b91abb5241d74bb52364d63
parent e7411425
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -152,9 +152,10 @@ java_defaults {
        ":libcamera_client_framework_aidl",
        "core/java/android/hardware/IConsumerIrService.aidl",
        "core/java/android/hardware/ISerialManager.aidl",
        "core/java/android/hardware/biometrics/IBiometricEnabledOnKeyguardCallback.aidl",
        "core/java/android/hardware/biometrics/IBiometricPromptReceiver.aidl",
        "core/java/android/hardware/biometrics/IBiometricService.aidl",
        "core/java/android/hardware/biometrics/IBiometricServiceReceiver.aidl",
        "core/java/android/hardware/biometrics/IBiometricPromptReceiver.aidl",
        "core/java/android/hardware/biometrics/IBiometricServiceLockoutResetCallback.aidl",
        "core/java/android/hardware/display/IDisplayManager.aidl",
        "core/java/android/hardware/display/IDisplayManagerCallback.aidl",
+19 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.hardware.biometrics;

import static android.Manifest.permission.USE_BIOMETRIC;
import static android.Manifest.permission.USE_BIOMETRIC_INTERNAL;

import android.annotation.RequiresPermission;
import android.content.Context;
@@ -79,4 +80,22 @@ public class BiometricManager {
            return ERROR_UNAVAILABLE;
        }
    }

    /**
     * Listens for changes to biometric eligibility on keyguard from user settings.
     * @param callback
     * @hide
     */
    @RequiresPermission(USE_BIOMETRIC_INTERNAL)
    public void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback) {
        if (mService != null) {
            try {
                mService.registerEnabledOnKeyguardCallback(callback);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        } else {
            Slog.w(TAG, "registerEnabledOnKeyguardCallback(): Service not connected");
        }
    }
}
+26 −0
Original line number 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;

import android.hardware.biometrics.BiometricSourceType;

/**
 * @hide
 */
oneway interface IBiometricEnabledOnKeyguardCallback {
    void onChanged(in BiometricSourceType type, boolean enabled);
}
 No newline at end of file
+0 −3
Original line number Diff line number Diff line
@@ -15,9 +15,6 @@
 */
package android.hardware.biometrics;

import android.os.Bundle;
import android.os.UserHandle;

/**
 * Communication channel from the BiometricPrompt (SysUI) back to AuthenticationClient.
 * @hide
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.hardware.biometrics;

import android.os.Bundle;
import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback;
import android.hardware.biometrics.IBiometricPromptReceiver;
import android.hardware.biometrics.IBiometricServiceReceiver;

@@ -39,4 +40,7 @@ interface IBiometricService {

    // Checks if biometrics can be used.
    int canAuthenticate(String opPackageName);

    // Register callback for when keyguard biometric eligibility changes.
    void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback);
}
 No newline at end of file
Loading