[Co-ex] Show 'too_dark' face acquired messages
Update message. If fingerprint is enrolled, and face too_dark message is received, then tell the user to there's not enough light (for face auth) and suggest trying fingerprint to unlock. Test: atest KeyguardIndicationControllerTest Fixes: 234886175 Fixes: 243405121 Change-Id: Ia40e0e01895b04b906924d967763bb48d53124b5
This commit is contained in:
@@ -1804,7 +1804,7 @@
|
|||||||
<!-- Message shown during face acquisition when the image is too bright [CHAR LIMIT=50] -->
|
<!-- Message shown during face acquisition when the image is too bright [CHAR LIMIT=50] -->
|
||||||
<string name="face_acquired_too_bright">Too bright. Try gentler lighting.</string>
|
<string name="face_acquired_too_bright">Too bright. Try gentler lighting.</string>
|
||||||
<!-- Message shown during face acquisition when the image is too dark [CHAR LIMIT=50] -->
|
<!-- Message shown during face acquisition when the image is too dark [CHAR LIMIT=50] -->
|
||||||
<string name="face_acquired_too_dark">Try brighter lighting</string>
|
<string name="face_acquired_too_dark">Not enough light</string>
|
||||||
<!-- Message shown during face acquisition when the user is too close to sensor [CHAR LIMIT=50] -->
|
<!-- Message shown during face acquisition when the user is too close to sensor [CHAR LIMIT=50] -->
|
||||||
<string name="face_acquired_too_close">Move phone farther away</string>
|
<string name="face_acquired_too_close">Move phone farther away</string>
|
||||||
<!-- Message shown during face acquisition when the user is too far from sensor [CHAR LIMIT=50] -->
|
<!-- Message shown during face acquisition when the user is too far from sensor [CHAR LIMIT=50] -->
|
||||||
|
|||||||
@@ -617,8 +617,9 @@
|
|||||||
<!-- Which face help messages to surface when fingerprint is also enrolled.
|
<!-- Which face help messages to surface when fingerprint is also enrolled.
|
||||||
Message ids correspond with the acquired ids in BiometricFaceConstants -->
|
Message ids correspond with the acquired ids in BiometricFaceConstants -->
|
||||||
<integer-array name="config_face_help_msgs_when_fingerprint_enrolled">
|
<integer-array name="config_face_help_msgs_when_fingerprint_enrolled">
|
||||||
<item>25</item>
|
<item>3</item> <!-- TOO_DARK -->
|
||||||
<item>26</item>
|
<item>25</item> <!-- DARK_GLASSES -->
|
||||||
|
<item>26</item> <!-- MOUTH_COVERING_DETECTED -->
|
||||||
</integer-array>
|
</integer-array>
|
||||||
|
|
||||||
<!-- Whether the communal service should be enabled -->
|
<!-- Whether the communal service should be enabled -->
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar;
|
|||||||
import static android.app.admin.DevicePolicyManager.DEVICE_OWNER_TYPE_FINANCED;
|
import static android.app.admin.DevicePolicyManager.DEVICE_OWNER_TYPE_FINANCED;
|
||||||
import static android.app.admin.DevicePolicyResources.Strings.SystemUi.KEYGUARD_MANAGEMENT_DISCLOSURE;
|
import static android.app.admin.DevicePolicyResources.Strings.SystemUi.KEYGUARD_MANAGEMENT_DISCLOSURE;
|
||||||
import static android.app.admin.DevicePolicyResources.Strings.SystemUi.KEYGUARD_NAMED_MANAGEMENT_DISCLOSURE;
|
import static android.app.admin.DevicePolicyResources.Strings.SystemUi.KEYGUARD_NAMED_MANAGEMENT_DISCLOSURE;
|
||||||
|
import static android.hardware.biometrics.BiometricFaceConstants.FACE_ACQUIRED_TOO_DARK;
|
||||||
import static android.hardware.biometrics.BiometricSourceType.FACE;
|
import static android.hardware.biometrics.BiometricSourceType.FACE;
|
||||||
import static android.view.View.GONE;
|
import static android.view.View.GONE;
|
||||||
import static android.view.View.VISIBLE;
|
import static android.view.View.VISIBLE;
|
||||||
@@ -178,7 +179,7 @@ public class KeyguardIndicationController {
|
|||||||
private boolean mBatteryPresent = true;
|
private boolean mBatteryPresent = true;
|
||||||
private long mChargingTimeRemaining;
|
private long mChargingTimeRemaining;
|
||||||
private String mBiometricErrorMessageToShowOnScreenOn;
|
private String mBiometricErrorMessageToShowOnScreenOn;
|
||||||
private final Set<Integer> mCoExFaceHelpMsgIdsToShow;
|
private final Set<Integer> mCoExFaceAcquisitionMsgIdsToShow;
|
||||||
private boolean mInited;
|
private boolean mInited;
|
||||||
|
|
||||||
private KeyguardUpdateMonitorCallback mUpdateMonitorCallback;
|
private KeyguardUpdateMonitorCallback mUpdateMonitorCallback;
|
||||||
@@ -249,11 +250,11 @@ public class KeyguardIndicationController {
|
|||||||
mScreenLifecycle = screenLifecycle;
|
mScreenLifecycle = screenLifecycle;
|
||||||
mScreenLifecycle.addObserver(mScreenObserver);
|
mScreenLifecycle.addObserver(mScreenObserver);
|
||||||
|
|
||||||
mCoExFaceHelpMsgIdsToShow = new HashSet<>();
|
mCoExFaceAcquisitionMsgIdsToShow = new HashSet<>();
|
||||||
int[] msgIds = context.getResources().getIntArray(
|
int[] msgIds = context.getResources().getIntArray(
|
||||||
com.android.systemui.R.array.config_face_help_msgs_when_fingerprint_enrolled);
|
com.android.systemui.R.array.config_face_help_msgs_when_fingerprint_enrolled);
|
||||||
for (int msgId : msgIds) {
|
for (int msgId : msgIds) {
|
||||||
mCoExFaceHelpMsgIdsToShow.add(msgId);
|
mCoExFaceAcquisitionMsgIdsToShow.add(msgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
mHandler = new Handler(mainLooper) {
|
mHandler = new Handler(mainLooper) {
|
||||||
@@ -990,7 +991,7 @@ public class KeyguardIndicationController {
|
|||||||
mTopIndicationView == null ? null : mTopIndicationView.getText()));
|
mTopIndicationView == null ? null : mTopIndicationView.getText()));
|
||||||
pw.println(" computePowerIndication(): " + computePowerIndication());
|
pw.println(" computePowerIndication(): " + computePowerIndication());
|
||||||
pw.println(" trustGrantedIndication: " + getTrustGrantedIndication());
|
pw.println(" trustGrantedIndication: " + getTrustGrantedIndication());
|
||||||
pw.println(" mCoExFaceHelpMsgIdsToShow=" + mCoExFaceHelpMsgIdsToShow);
|
pw.println(" mCoExFaceHelpMsgIdsToShow=" + mCoExFaceAcquisitionMsgIdsToShow);
|
||||||
mRotateTextViewController.dump(pw, args);
|
mRotateTextViewController.dump(pw, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1055,9 +1056,9 @@ public class KeyguardIndicationController {
|
|||||||
final boolean isUnlockWithFingerprintPossible =
|
final boolean isUnlockWithFingerprintPossible =
|
||||||
mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible(
|
mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible(
|
||||||
getCurrentUser());
|
getCurrentUser());
|
||||||
if (faceAuthSoftError
|
final boolean isCoExFaceAcquisitionMessage =
|
||||||
&& isUnlockWithFingerprintPossible
|
faceAuthSoftError && isUnlockWithFingerprintPossible;
|
||||||
&& !mCoExFaceHelpMsgIdsToShow.contains(msgId)) {
|
if (isCoExFaceAcquisitionMessage && !mCoExFaceAcquisitionMsgIdsToShow.contains(msgId)) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "skip showing msgId=" + msgId + " helpString=" + helpString
|
Log.d(TAG, "skip showing msgId=" + msgId + " helpString=" + helpString
|
||||||
+ ", due to co-ex logic");
|
+ ", due to co-ex logic");
|
||||||
@@ -1067,7 +1068,12 @@ public class KeyguardIndicationController {
|
|||||||
mStatusBarKeyguardViewManager.showBouncerMessage(helpString,
|
mStatusBarKeyguardViewManager.showBouncerMessage(helpString,
|
||||||
mInitialTextColorState);
|
mInitialTextColorState);
|
||||||
} else if (mScreenLifecycle.getScreenState() == SCREEN_ON) {
|
} else if (mScreenLifecycle.getScreenState() == SCREEN_ON) {
|
||||||
if (faceAuthFailed && isUnlockWithFingerprintPossible) {
|
if (isCoExFaceAcquisitionMessage && msgId == FACE_ACQUIRED_TOO_DARK) {
|
||||||
|
showBiometricMessage(
|
||||||
|
helpString,
|
||||||
|
mContext.getString(R.string.keyguard_suggest_fingerprint)
|
||||||
|
);
|
||||||
|
} else if (faceAuthFailed && isUnlockWithFingerprintPossible) {
|
||||||
showBiometricMessage(
|
showBiometricMessage(
|
||||||
mContext.getString(R.string.keyguard_face_failed),
|
mContext.getString(R.string.keyguard_face_failed),
|
||||||
mContext.getString(R.string.keyguard_suggest_fingerprint)
|
mContext.getString(R.string.keyguard_suggest_fingerprint)
|
||||||
|
|||||||
@@ -667,7 +667,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
|||||||
final String helpString = "helpString";
|
final String helpString = "helpString";
|
||||||
final int[] msgIds = new int[]{
|
final int[] msgIds = new int[]{
|
||||||
BiometricFaceConstants.FACE_ACQUIRED_MOUTH_COVERING_DETECTED,
|
BiometricFaceConstants.FACE_ACQUIRED_MOUTH_COVERING_DETECTED,
|
||||||
BiometricFaceConstants.FACE_ACQUIRED_DARK_GLASSES_DETECTED
|
BiometricFaceConstants.FACE_ACQUIRED_DARK_GLASSES_DETECTED,
|
||||||
|
BiometricFaceConstants.FACE_ACQUIRED_TOO_DARK
|
||||||
};
|
};
|
||||||
Set<CharSequence> messages = new HashSet<>();
|
Set<CharSequence> messages = new HashSet<>();
|
||||||
for (int msgId : msgIds) {
|
for (int msgId : msgIds) {
|
||||||
@@ -698,8 +699,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
|||||||
BiometricFaceConstants.FACE_ACQUIRED_TOO_LEFT,
|
BiometricFaceConstants.FACE_ACQUIRED_TOO_LEFT,
|
||||||
BiometricFaceConstants.FACE_ACQUIRED_TOO_HIGH,
|
BiometricFaceConstants.FACE_ACQUIRED_TOO_HIGH,
|
||||||
BiometricFaceConstants.FACE_ACQUIRED_TOO_LOW,
|
BiometricFaceConstants.FACE_ACQUIRED_TOO_LOW,
|
||||||
BiometricFaceConstants.FACE_ACQUIRED_TOO_BRIGHT,
|
BiometricFaceConstants.FACE_ACQUIRED_TOO_BRIGHT
|
||||||
BiometricFaceConstants.FACE_ACQUIRED_TOO_DARK
|
|
||||||
};
|
};
|
||||||
for (int msgId : msgIds) {
|
for (int msgId : msgIds) {
|
||||||
mKeyguardUpdateMonitorCallback.onBiometricHelp(
|
mKeyguardUpdateMonitorCallback.onBiometricHelp(
|
||||||
@@ -742,6 +742,28 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
|
|||||||
verifyIndicationMessages(INDICATION_TYPE_BIOMETRIC_MESSAGE, helpStrings);
|
verifyIndicationMessages(INDICATION_TYPE_BIOMETRIC_MESSAGE, helpStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void sendTooDarkFaceHelpMessages_fingerprintEnrolled() {
|
||||||
|
createController();
|
||||||
|
|
||||||
|
// GIVEN fingerprint enrolled
|
||||||
|
when(mKeyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible(
|
||||||
|
0)).thenReturn(true);
|
||||||
|
|
||||||
|
// WHEN help message received
|
||||||
|
final String helpString = "helpMsg";
|
||||||
|
mKeyguardUpdateMonitorCallback.onBiometricHelp(
|
||||||
|
BiometricFaceConstants.FACE_ACQUIRED_TOO_DARK,
|
||||||
|
helpString,
|
||||||
|
BiometricSourceType.FACE
|
||||||
|
);
|
||||||
|
|
||||||
|
// THEN help message shown and try fingerprint message shown
|
||||||
|
verifyIndicationMessage(INDICATION_TYPE_BIOMETRIC_MESSAGE, helpString);
|
||||||
|
verifyIndicationMessage(INDICATION_TYPE_BIOMETRIC_MESSAGE_FOLLOW_UP,
|
||||||
|
mContext.getString(R.string.keyguard_suggest_fingerprint));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateMonitor_listenerUpdatesIndication() {
|
public void updateMonitor_listenerUpdatesIndication() {
|
||||||
createController();
|
createController();
|
||||||
|
|||||||
Reference in New Issue
Block a user