Merge "Prevent face auth from running again after a successful unlock when assistant is active." into tm-qpr-dev
This commit is contained in:
@@ -1537,6 +1537,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void setAssistantVisible(boolean assistantVisible) {
|
void setAssistantVisible(boolean assistantVisible) {
|
||||||
mAssistantVisible = assistantVisible;
|
mAssistantVisible = assistantVisible;
|
||||||
|
mLogger.logAssistantVisible(mAssistantVisible);
|
||||||
updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE,
|
updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE,
|
||||||
FACE_AUTH_UPDATED_ASSISTANT_VISIBILITY_CHANGED);
|
FACE_AUTH_UPDATED_ASSISTANT_VISIBILITY_CHANGED);
|
||||||
if (mAssistantVisible) {
|
if (mAssistantVisible) {
|
||||||
@@ -2678,7 +2679,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
|
|
||||||
private boolean shouldListenForFaceAssistant() {
|
private boolean shouldListenForFaceAssistant() {
|
||||||
BiometricAuthenticated face = mUserFaceAuthenticated.get(getCurrentUser());
|
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)
|
&& !(face != null && face.mAuthenticated)
|
||||||
&& !mUserHasTrust.get(getCurrentUser(), false);
|
&& !mUserHasTrust.get(getCurrentUser(), false);
|
||||||
}
|
}
|
||||||
@@ -3679,6 +3683,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
if (info == null) {
|
if (info == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
mLogger.logTaskStackChangedForAssistant(info.visible);
|
||||||
mHandler.sendMessage(mHandler.obtainMessage(MSG_ASSISTANT_STACK_CHANGED,
|
mHandler.sendMessage(mHandler.obtainMessage(MSG_ASSISTANT_STACK_CHANGED,
|
||||||
info.visible));
|
info.visible));
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
|||||||
@@ -431,4 +431,20 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
|
|||||||
str1 = PowerManager.wakeReasonToString(pmWakeReason)
|
str1 = PowerManager.wakeReasonToString(pmWakeReason)
|
||||||
}, { "Skip updating face listening state on wakeup from $str1"})
|
}, { "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"
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ import android.os.PowerManager;
|
|||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.provider.Settings;
|
|
||||||
import android.service.dreams.IDreamManager;
|
import android.service.dreams.IDreamManager;
|
||||||
import android.service.trust.TrustAgentService;
|
import android.service.trust.TrustAgentService;
|
||||||
import android.telephony.ServiceState;
|
import android.telephony.ServiceState;
|
||||||
@@ -833,6 +832,19 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
verify(mFaceManager).authenticate(any(), any(), any(), any(), anyInt(), anyBoolean());
|
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
|
@Test
|
||||||
public void testTriesToAuthenticate_whenTrustOnAgentKeyguard_ifBypass() {
|
public void testTriesToAuthenticate_whenTrustOnAgentKeyguard_ifBypass() {
|
||||||
mKeyguardUpdateMonitor.dispatchStartedWakingUp(PowerManager.WAKE_REASON_POWER_BUTTON);
|
mKeyguardUpdateMonitor.dispatchStartedWakingUp(PowerManager.WAKE_REASON_POWER_BUTTON);
|
||||||
|
|||||||
Reference in New Issue
Block a user