diff options
| author | 2022-06-06 17:27:47 +0000 | |
|---|---|---|
| committer | 2022-06-10 13:05:32 +0000 | |
| commit | 66f5ed87772defe5eddbf8655522acab25c93b6e (patch) | |
| tree | eab6cc8d21e359ab65258b86e76c9a026464b017 | |
| parent | 09786d477c7b70ed610c31061882a2710ca4a596 (diff) | |
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
3 files changed, 37 insertions, 19 deletions
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 7a72a58e5b9a..597e88093de8 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -617,7 +617,8 @@ <!-- Which face help messages to surface when fingerprint is also enrolled. Message ids correspond with the acquired ids in BiometricFaceConstants --> <integer-array name="config_face_help_msgs_when_fingerprint_enrolled"> - <!-- for example: <item>26</item> for FACE_ACQUIRED_MOUTH_COVERING_DETECTED --> + <item>25</item> + <item>26</item> </integer-array> <!-- Whether the communal service should be enabled --> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index c107f46fa0da..ee8c232c5b7f 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 9ae2d43ee9b0..d67e26f138f2 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<CharSequence> 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, |