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

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

Merge "Face and fingerprint re-enrollment notification" into udc-dev

parents 1b41718a cc14b18f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.os.PowerManager;
import android.os.RemoteException;
import android.os.Trace;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.Slog;
import android.view.Surface;

@@ -127,6 +128,11 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
        @Override // binder call
        public void onRemoved(Face face, int remaining) {
            mHandler.obtainMessage(MSG_REMOVED, remaining, 0, face).sendToTarget();
            if (remaining == 0) {
                Settings.Secure.putIntForUser(mContext.getContentResolver(),
                        Settings.Secure.FACE_UNLOCK_RE_ENROLL, 0,
                        UserHandle.USER_CURRENT);
            }
        }

        @Override
+1 −1
Original line number Diff line number Diff line
@@ -832,7 +832,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
    }

    /**
     * Removes all face templates for the given user.
     * Removes all fingerprint templates for the given user.
     * @hide
     */
    @RequiresPermission(MANAGE_FINGERPRINT)
+1 −3
Original line number Diff line number Diff line
@@ -10202,9 +10202,7 @@ public final class Settings {
         *
         * Face unlock re enroll.
         *  0 = No re enrollment.
         *  1 = Re enrollment is suggested.
         *  2 = Re enrollment is required after a set time period.
         *  3 = Re enrollment is required immediately.
         *  1 = Re enrollment is required.
         *
         * @hide
         */
+28 −1
Original line number Diff line number Diff line
@@ -404,7 +404,34 @@
    <string name="biometric_dialog_last_pin_attempt_before_wipe_profile">If you enter an incorrect PIN on the next attempt, your work profile and its data will be deleted.</string>
    <!-- Content of a dialog shown when the user only has one attempt left to provide the correct password before the work profile is removed. [CHAR LIMIT=NONE] -->
    <string name="biometric_dialog_last_password_attempt_before_wipe_profile">If you enter an incorrect password on the next attempt, your work profile and its data will be deleted.</string>

    <!-- Confirmation button label for a dialog shown when the system requires the user to re-enroll their biometrics. [CHAR LIMIT=20] -->
    <string name="biometric_re_enroll_dialog_confirm">Set up</string>
    <!-- Cancel button label for a dialog shown when the system requires the user to re-enroll their biometric. [CHAR LIMIT=20] -->
    <string name="biometric_re_enroll_dialog_cancel">Not now</string>
    <!-- Notification content shown when the system requires the user to re-enroll their biometrics. [CHAR LIMIT=NONE] -->
    <string name="biometric_re_enroll_notification_content">This is required to improve security and performance</string>
    <!-- Notification title shown when the system requires the user to re-enroll their fingerprint. [CHAR LIMIT=NONE] -->
    <string name="fingerprint_re_enroll_notification_title">Set up Fingerprint Unlock again</string>
    <!-- Name shown for system notifications related to the fingerprint unlock feature. [CHAR LIMIT=NONE] -->
    <string name="fingerprint_re_enroll_notification_name">Fingerprint Unlock</string>
    <!-- Title for a dialog shown when the system requires the user to re-enroll their fingerprint. [CHAR LIMIT=NONE] -->
    <string name="fingerprint_re_enroll_dialog_title">Set up Fingerprint Unlock</string>
    <!-- Content for a dialog shown when the system requires the user to re-enroll their fingerprint. [CHAR LIMIT=NONE] -->
    <string name="fingerprint_re_enroll_dialog_content">To set up Fingerprint Unlock again, your current fingerprint images and models will be deleted.\n\nAfter they\’re deleted, you\’ll need to set up Fingerprint Unlock again to use your fingerprint to unlock your phone or verify it\’s you.</string>
    <!-- Content for a dialog shown when the system requires the user to re-enroll their fingerprint (singular). [CHAR LIMIT=NONE] -->
    <string name="fingerprint_re_enroll_dialog_content_singular">To set up Fingerprint Unlock again, your current fingerprint images and model will be deleted.\n\nAfter they\’re deleted, you\’ll need to set up Fingerprint Unlock again to use your fingerprint to unlock your phone or verify it\’s you.</string>
    <!-- Content for a dialog shown when an error occurs while the user is trying to re-enroll their fingerprint. [CHAR LIMIT=NONE] -->
    <string name="fingerprint_reenroll_failure_dialog_content">Couldn\u2019t set up fingerprint unlock. Go to Settings to try again.</string>
    <!-- Notification title shown when the system requires the user to re-enroll their face. [CHAR LIMIT=NONE] -->
    <string name="face_re_enroll_notification_title">Set up Face Unlock again</string>
    <!-- Name shown for system notifications related to the face unlock feature. [CHAR LIMIT=NONE] -->
    <string name="face_re_enroll_notification_name">Face Unlock</string>
    <!-- Title for a dialog shown when the system requires the user to re-enroll their face. [CHAR LIMIT=NONE] -->
    <string name="face_re_enroll_dialog_title">Set up Face Unlock</string>
    <!-- Content for a dialog shown when the system requires the user to re-enroll their face. [CHAR LIMIT=NONE] -->
    <string name="face_re_enroll_dialog_content">To set up Face Unlock again, your current face model will be deleted.\n\nYou\’ll need to set up this feature again to use your face to unlock your phone.</string>
    <!-- Content for a dialog shown when an error occurs while the user is trying to re-enroll their face. [CHAR LIMIT=NONE] -->
    <string name="face_reenroll_failure_dialog_content">Couldn\u2019t set up face unlock. Go to Settings to try again.</string>
    <!-- Message shown when the system-provided fingerprint dialog is shown, asking for authentication -->
    <string name="fingerprint_dialog_touch_sensor">Touch the fingerprint sensor</string>
    <!-- Message shown to inform the user a face cannot be recognized and fingerprint should instead be used.[CHAR LIMIT=50] -->
+72 −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 com.android.systemui.biometrics;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.hardware.biometrics.BiometricSourceType;

import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.statusbar.phone.SystemUIDialog;

import javax.inject.Inject;

/**
 * Receives broadcasts sent by {@link BiometricNotificationService} and takes
 * the appropriate action.
 */
@SysUISingleton
public class BiometricNotificationBroadcastReceiver extends BroadcastReceiver {
    static final String ACTION_SHOW_FACE_REENROLL_DIALOG = "face_action_show_reenroll_dialog";
    static final String ACTION_SHOW_FINGERPRINT_REENROLL_DIALOG =
            "fingerprint_action_show_reenroll_dialog";

    private static final String TAG = "BiometricNotificationBroadcastReceiver";

    private final Context mContext;
    private final BiometricNotificationDialogFactory mNotificationDialogFactory;
    @Inject
    BiometricNotificationBroadcastReceiver(Context context,
            BiometricNotificationDialogFactory notificationDialogFactory) {
        mContext = context;
        mNotificationDialogFactory = notificationDialogFactory;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        final String action = intent.getAction();

        switch (action) {
            case ACTION_SHOW_FACE_REENROLL_DIALOG:
                mNotificationDialogFactory.createReenrollDialog(mContext,
                        new SystemUIDialog(mContext),
                        BiometricSourceType.FACE)
                        .show();
                break;
            case ACTION_SHOW_FINGERPRINT_REENROLL_DIALOG:
                mNotificationDialogFactory.createReenrollDialog(
                        mContext,
                        new SystemUIDialog(mContext),
                        BiometricSourceType.FINGERPRINT)
                        .show();
                break;
            default:
                break;
        }
    }
}
Loading