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
This commit is contained in:
@@ -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 -->
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user