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

Commit d27b2962 authored by Beverly Tai's avatar Beverly Tai Committed by Automerger Merge Worker
Browse files

Merge "Show FACE_COVERING and DARK_GLASSES messages" into tm-d1-dev am: b71d120e

parents beb008e8 b71d120e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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 -->
+6 −15
Original line number Diff line number Diff line
@@ -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,20 +243,11 @@ 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);
        }
        }

        mHandler = new Handler(mainLooper) {
            @Override
@@ -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
+29 −3
Original line number Diff line number Diff line
@@ -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,