From 66f5ed87772defe5eddbf8655522acab25c93b6e Mon Sep 17 00:00:00 2001 From: Beverly Date: Mon, 6 Jun 2022 17:27:47 +0000 Subject: [PATCH] Show FACE_COVERING and DARK_GLASSES messages When both face & fingerprint are enrolled, still surface face covering and dark glasses soft error messages. Test: atest KeyguardIndicationControllerTest Test: face auth with face mask Fixes: 231733975 Change-Id: I48ec1d3c650e734506dc7e8ccddad8c84b6e21fe --- packages/SystemUI/res/values/config.xml | 3 +- .../KeyguardIndicationController.java | 21 ++++-------- .../KeyguardIndicationControllerTest.java | 32 +++++++++++++++++-- 3 files changed, 37 insertions(+), 19 deletions(-) diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 7a72a58e5b9a4..597e88093de85 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -617,7 +617,8 @@ - + 25 + 26 diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index c107f46fa0da2..ee8c232c5b7ff 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -56,7 +56,6 @@ import android.os.Message; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; -import android.provider.Settings; import android.text.TextUtils; import android.text.format.Formatter; import android.util.Log; @@ -244,19 +243,10 @@ public class KeyguardIndicationController { mScreenLifecycle.addObserver(mScreenObserver); mCoExFaceHelpMsgIdsToShow = new HashSet<>(); - final String msgsToShowOverride = Settings.Global.getString(mContext.getContentResolver(), - "coex_face_help_msgs"); // TODO: remove after UX testing b/231733975 - if (msgsToShowOverride != null) { - final String[] msgIds = msgsToShowOverride.split("\\|"); - for (String msgId : msgIds) { - mCoExFaceHelpMsgIdsToShow.add(Integer.parseInt(msgId)); - } - } else { - int[] msgIds = context.getResources().getIntArray( - com.android.systemui.R.array.config_face_help_msgs_when_fingerprint_enrolled); - for (int msgId : msgIds) { - mCoExFaceHelpMsgIdsToShow.add(msgId); - } + int[] msgIds = context.getResources().getIntArray( + com.android.systemui.R.array.config_face_help_msgs_when_fingerprint_enrolled); + for (int msgId : msgIds) { + mCoExFaceHelpMsgIdsToShow.add(msgId); } mHandler = new Handler(mainLooper) { @@ -1032,7 +1022,8 @@ public class KeyguardIndicationController { return; } - if (msgId == FaceManager.FACE_ERROR_TIMEOUT) { + if (biometricSourceType == BiometricSourceType.FACE + && msgId == FaceManager.FACE_ERROR_TIMEOUT) { if (mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( KeyguardUpdateMonitor.getCurrentUser())) { // no message if fingerprint is also enrolled diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java index 9ae2d43ee9b05..d67e26f138f27 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java @@ -598,18 +598,44 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { } @Test - public void doNotSendFaceHelpMessages_fingerprintEnrolled() { + public void sendFaceHelpMessages_fingerprintEnrolled() { createController(); // GIVEN fingerprint enrolled when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( 0)).thenReturn(true); - // WHEN help messages received + // WHEN help messages received that are allowed to show + final String helpString = "helpString"; + final int[] msgIds = new int[]{ + BiometricFaceConstants.FACE_ACQUIRED_MOUTH_COVERING_DETECTED, + BiometricFaceConstants.FACE_ACQUIRED_DARK_GLASSES_DETECTED + }; + Set messages = new HashSet<>(); + for (int msgId : msgIds) { + final String message = helpString + msgId; + messages.add(message); + mKeyguardUpdateMonitorCallback.onBiometricHelp( + msgId, message, BiometricSourceType.FACE); + } + + // THEN FACE_ACQUIRED_MOUTH_COVERING_DETECTED and DARK_GLASSES help messages shown + verifyIndicationMessages(INDICATION_TYPE_BIOMETRIC_MESSAGE, + messages); + } + + @Test + public void doNotSendMostFaceHelpMessages_fingerprintEnrolled() { + createController(); + + // GIVEN fingerprint enrolled + when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( + 0)).thenReturn(true); + + // WHEN help messages received that aren't supposed to show final String helpString = "helpString"; final int[] msgIds = new int[]{ BiometricFaceConstants.FACE_ACQUIRED_FACE_OBSCURED, - BiometricFaceConstants.FACE_ACQUIRED_DARK_GLASSES_DETECTED, BiometricFaceConstants.FACE_ACQUIRED_TOO_RIGHT, BiometricFaceConstants.FACE_ACQUIRED_TOO_LEFT, BiometricFaceConstants.FACE_ACQUIRED_TOO_HIGH,