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

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

Remove recalibrate notification when user enrolls

Fixes: 134440107

Test: Force RECALIBRATE error to be received, then enroll without
      tapping on the notification. Notification is automatically dismissed

Change-Id: I96ad00cb3599d3f288fed8555176995f9d7e168e
parent 8398a715
Loading
Loading
Loading
Loading
+16 −7
Original line number Original line Diff line number Diff line
@@ -97,6 +97,9 @@ public class FaceService extends BiometricServiceBase {
            "com.android.server.biometrics.face.ACTION_LOCKOUT_RESET";
            "com.android.server.biometrics.face.ACTION_LOCKOUT_RESET";
    private static final int CHALLENGE_TIMEOUT_SEC = 600; // 10 minutes
    private static final int CHALLENGE_TIMEOUT_SEC = 600; // 10 minutes


    private static final String NOTIFICATION_TAG = "FaceService";
    private static final int NOTIFICATION_ID = 1;

    private final class FaceAuthClient extends AuthenticationClientImpl {
    private final class FaceAuthClient extends AuthenticationClientImpl {
        private int mLastAcquire;
        private int mLastAcquire;


@@ -177,13 +180,11 @@ public class FaceService extends BiometricServiceBase {
                        0 /* requestCode */, intent, 0 /* flags */, null /* options */,
                        0 /* requestCode */, intent, 0 /* flags */, null /* options */,
                        UserHandle.CURRENT);
                        UserHandle.CURRENT);


                final String id = "FaceService";
                final String channelName = "FaceEnrollNotificationChannel";


                NotificationManager nm =
                NotificationChannel channel = new NotificationChannel(channelName, name,
                        getContext().getSystemService(NotificationManager.class);
                NotificationChannel channel = new NotificationChannel(id, name,
                        NotificationManager.IMPORTANCE_HIGH);
                        NotificationManager.IMPORTANCE_HIGH);
                Notification notification = new Notification.Builder(getContext(), id)
                Notification notification = new Notification.Builder(getContext(), channelName)
                        .setSmallIcon(R.drawable.ic_lock)
                        .setSmallIcon(R.drawable.ic_lock)
                        .setContentTitle(title)
                        .setContentTitle(title)
                        .setContentText(content)
                        .setContentText(content)
@@ -196,8 +197,9 @@ public class FaceService extends BiometricServiceBase {
                        .setVisibility(Notification.VISIBILITY_SECRET)
                        .setVisibility(Notification.VISIBILITY_SECRET)
                        .build();
                        .build();


                nm.createNotificationChannel(channel);
                mNotificationManager.createNotificationChannel(channel);
                nm.notifyAsUser(null /* tag */, 0 /* id */, notification, UserHandle.CURRENT);
                mNotificationManager.notifyAsUser(NOTIFICATION_TAG, NOTIFICATION_ID, notification,
                        UserHandle.CURRENT);
            }
            }


            return super.onAcquired(acquireInfo, vendorCode);
            return super.onAcquired(acquireInfo, vendorCode);
@@ -231,6 +233,9 @@ public class FaceService extends BiometricServiceBase {
                final int[] disabledFeatures) {
                final int[] disabledFeatures) {
            checkPermission(MANAGE_BIOMETRIC);
            checkPermission(MANAGE_BIOMETRIC);


            mNotificationManager.cancelAsUser(NOTIFICATION_TAG, NOTIFICATION_ID,
                    UserHandle.CURRENT);

            final boolean restricted = isRestricted();
            final boolean restricted = isRestricted();
            final EnrollClientImpl client = new EnrollClientImpl(getContext(), mDaemonWrapper,
            final EnrollClientImpl client = new EnrollClientImpl(getContext(), mDaemonWrapper,
                    mHalDeviceId, token, new ServiceListenerImpl(receiver), mCurrentUserId,
                    mHalDeviceId, token, new ServiceListenerImpl(receiver), mCurrentUserId,
@@ -688,6 +693,8 @@ public class FaceService extends BiometricServiceBase {
    // One of the AuthenticationClient constants
    // One of the AuthenticationClient constants
    private int mCurrentUserLockoutMode;
    private int mCurrentUserLockoutMode;


    private NotificationManager mNotificationManager;

    private int[] mBiometricPromptIgnoreList;
    private int[] mBiometricPromptIgnoreList;
    private int[] mBiometricPromptIgnoreListVendor;
    private int[] mBiometricPromptIgnoreListVendor;
    private int[] mKeyguardIgnoreList;
    private int[] mKeyguardIgnoreList;
@@ -881,6 +888,8 @@ public class FaceService extends BiometricServiceBase {
    public FaceService(Context context) {
    public FaceService(Context context) {
        super(context);
        super(context);


        mNotificationManager = getContext().getSystemService(NotificationManager.class);

        mBiometricPromptIgnoreList = getContext().getResources()
        mBiometricPromptIgnoreList = getContext().getResources()
                .getIntArray(R.array.config_face_acquire_biometricprompt_ignorelist);
                .getIntArray(R.array.config_face_acquire_biometricprompt_ignorelist);
        mBiometricPromptIgnoreListVendor = getContext().getResources()
        mBiometricPromptIgnoreListVendor = getContext().getResources()