Merge "Prevent face auth from running again after a successful unlock when assistant is active." into tm-qpr-dev am: 7d6c291d61

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21078603

Change-Id: I956e96788f7818c0af567c9791238e21ab11f809
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Chandru S
2023-01-25 02:58:56 +00:00
committed by Automerger Merge Worker
3 changed files with 35 additions and 2 deletions

View File

@@ -1537,6 +1537,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
@VisibleForTesting
void setAssistantVisible(boolean assistantVisible) {
mAssistantVisible = assistantVisible;
mLogger.logAssistantVisible(mAssistantVisible);
updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE,
FACE_AUTH_UPDATED_ASSISTANT_VISIBILITY_CHANGED);
if (mAssistantVisible) {
@@ -2678,7 +2679,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
private boolean shouldListenForFaceAssistant() {
BiometricAuthenticated face = mUserFaceAuthenticated.get(getCurrentUser());
return mAssistantVisible && mKeyguardOccluded
return mAssistantVisible
// There can be intermediate states where mKeyguardShowing is false but
// mKeyguardOccluded is true, we don't want to run face auth in such a scenario.
&& (mKeyguardShowing && mKeyguardOccluded)
&& !(face != null && face.mAuthenticated)
&& !mUserHasTrust.get(getCurrentUser(), false);
}
@@ -3679,6 +3683,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
if (info == null) {
return;
}
mLogger.logTaskStackChangedForAssistant(info.visible);
mHandler.sendMessage(mHandler.obtainMessage(MSG_ASSISTANT_STACK_CHANGED,
info.visible));
} catch (RemoteException e) {

View File

@@ -431,4 +431,20 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
str1 = PowerManager.wakeReasonToString(pmWakeReason)
}, { "Skip updating face listening state on wakeup from $str1"})
}
fun logTaskStackChangedForAssistant(assistantVisible: Boolean) {
logBuffer.log(TAG, VERBOSE, {
bool1 = assistantVisible
}, {
"TaskStackChanged for ACTIVITY_TYPE_ASSISTANT, assistant visible: $bool1"
})
}
fun logAssistantVisible(assistantVisible: Boolean) {
logBuffer.log(TAG, VERBOSE, {
bool1 = assistantVisible
}, {
"Updating mAssistantVisible to new value: $bool1"
})
}
}

View File

@@ -95,7 +95,6 @@ import android.os.PowerManager;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.service.dreams.IDreamManager;
import android.service.trust.TrustAgentService;
import android.telephony.ServiceState;
@@ -833,6 +832,19 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
verify(mFaceManager).authenticate(any(), any(), any(), any(), anyInt(), anyBoolean());
}
@Test
public void doesNotTryToAuthenticateWhenKeyguardIsNotShowingButOccluded_whenAssistant() {
mKeyguardUpdateMonitor.setKeyguardShowing(false, true);
mKeyguardUpdateMonitor.setAssistantVisible(true);
verify(mFaceManager, never()).authenticate(any(),
any(),
any(),
any(),
anyInt(),
anyBoolean());
}
@Test
public void testTriesToAuthenticate_whenTrustOnAgentKeyguard_ifBypass() {
mKeyguardUpdateMonitor.dispatchStartedWakingUp(PowerManager.WAKE_REASON_POWER_BUTTON);