Skip to content

Commit b94aa89

Browse files
minaripenguinuwu-gl
authored andcommitted
SystemUI: Implement face unlock recognition text
Change-Id: Ib7a0562e2d134b9fed9e45293939db3786c54f24
1 parent 312a626 commit b94aa89

2 files changed

Lines changed: 53 additions & 2 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright (C) 2025 The SunOS Project
4+
SPDX-License-Identifier: Apache-2.0
5+
-->
6+
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
7+
<!-- Face unlock -->
8+
<string name="face_unlock_recognizing">Recognizing face...</string>
9+
</resources>

packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ public class KeyguardIndicationController {
150150

151151
private static final int MSG_SHOW_ACTION_TO_UNLOCK = 1;
152152
private static final int MSG_RESET_ERROR_MESSAGE_ON_SCREEN_ON = 2;
153+
private static final int MSG_SHOW_RECOGNIZING_FACE = 3;
154+
private static final int MSG_HIDE_RECOGNIZING_FACE = 4;
153155
private static final long TRANSIENT_BIOMETRIC_ERROR_TIMEOUT = 1300;
154156
public static final long DEFAULT_MESSAGE_TIME = 3500;
155157
public static final long DEFAULT_HIDE_DELAY_MS =
@@ -227,6 +229,7 @@ public class KeyguardIndicationController {
227229
private Set<Integer> mCoExFaceAcquisitionMsgIdsToShow;
228230
private final FaceHelpMessageDeferral mFaceAcquiredMessageDeferral;
229231
private boolean mInited;
232+
private boolean mFaceDetectionRunning;
230233

231234
private KeyguardUpdateMonitorCallback mUpdateMonitorCallback;
232235

@@ -267,6 +270,15 @@ public void onScreenTurnedOn() {
267270
mBiometricErrorMessageToShowOnScreenOn = null;
268271
}
269272
}
273+
274+
@Override
275+
public void onScreenTurnedOff() {
276+
if (mFaceDetectionRunning) {
277+
mFaceDetectionRunning = false;
278+
mBiometricErrorMessageToShowOnScreenOn = null;
279+
hideFaceUnlockRecognizingMessage();
280+
}
281+
}
270282
};
271283
private boolean mFaceLockedOutThisAuthSession;
272284

@@ -357,6 +369,11 @@ public void handleMessage(Message msg) {
357369
showActionToUnlock();
358370
} else if (msg.what == MSG_RESET_ERROR_MESSAGE_ON_SCREEN_ON) {
359371
mBiometricErrorMessageToShowOnScreenOn = null;
372+
} else if (msg.what == MSG_SHOW_RECOGNIZING_FACE) {
373+
mBiometricErrorMessageToShowOnScreenOn = null;
374+
showFaceUnlockRecognizingMessage();
375+
} else if (msg.what == MSG_HIDE_RECOGNIZING_FACE) {
376+
hideFaceUnlockRecognizingMessage();
360377
}
361378
}
362379
};
@@ -1033,6 +1050,21 @@ private void hideBiometricMessage() {
10331050
}
10341051
}
10351052

1053+
private void showFaceUnlockRecognizingMessage() {
1054+
String faceUnlockMessage = mContext.getResources().getString(
1055+
R.string.face_unlock_recognizing);
1056+
showBiometricMessage(faceUnlockMessage, FACE);
1057+
}
1058+
1059+
private void hideFaceUnlockRecognizingMessage() {
1060+
String faceUnlockMessage = mContext.getResources().getString(
1061+
R.string.face_unlock_recognizing);
1062+
if (mBiometricMessage != null && mBiometricMessage == faceUnlockMessage) {
1063+
mBiometricMessage = null;
1064+
hideBiometricMessage();
1065+
}
1066+
}
1067+
10361068
/**
10371069
* Hides transient indication.
10381070
*/
@@ -1548,8 +1580,17 @@ public void onTrustAgentErrorMessage(CharSequence message) {
15481580
@Override
15491581
public void onBiometricRunningStateChanged(boolean running,
15501582
BiometricSourceType biometricSourceType) {
1551-
if (!running && biometricSourceType == FACE) {
1552-
showTrustAgentErrorMessage(mTrustAgentErrorMessage);
1583+
if (biometricSourceType == BiometricSourceType.FACE) {
1584+
mFaceDetectionRunning = running;
1585+
if (running) {
1586+
mHandler.removeMessages(MSG_HIDE_RECOGNIZING_FACE);
1587+
mHandler.removeMessages(MSG_SHOW_RECOGNIZING_FACE);
1588+
mHandler.sendEmptyMessageDelayed(MSG_SHOW_RECOGNIZING_FACE, 100);
1589+
} else {
1590+
mHandler.removeMessages(MSG_SHOW_RECOGNIZING_FACE);
1591+
mHandler.removeMessages(MSG_HIDE_RECOGNIZING_FACE);
1592+
mHandler.sendEmptyMessageDelayed(MSG_HIDE_RECOGNIZING_FACE, 100);
1593+
}
15531594
}
15541595
}
15551596

@@ -1727,6 +1768,7 @@ public void onDozingChanged(boolean dozing) {
17271768

17281769
if (mDozing) {
17291770
hideBiometricMessage();
1771+
hideFaceUnlockRecognizingMessage();
17301772
}
17311773
updateDeviceEntryIndication(false);
17321774
}

0 commit comments

Comments
 (0)