Merge "Eval KG showing, occluded and visibility together" into tm-qpr-dev am: ed7e61d86e am: ff512821fd
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20024904 Change-Id: Ic2326152d253e45aabe4871ba72fbbda28299826 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -69,7 +69,7 @@ open class ClockEventController @Inject constructor(
|
||||
|
||||
private var isCharging = false
|
||||
private var dozeAmount = 0f
|
||||
private var isKeyguardShowing = false
|
||||
private var isKeyguardVisible = false
|
||||
|
||||
private val regionSamplingEnabled =
|
||||
featureFlags.isEnabled(com.android.systemui.flags.Flags.REGION_SAMPLING)
|
||||
@@ -145,7 +145,7 @@ open class ClockEventController @Inject constructor(
|
||||
|
||||
private val batteryCallback = object : BatteryStateChangeCallback {
|
||||
override fun onBatteryLevelChanged(level: Int, pluggedIn: Boolean, charging: Boolean) {
|
||||
if (isKeyguardShowing && !isCharging && charging) {
|
||||
if (isKeyguardVisible && !isCharging && charging) {
|
||||
clock?.animations?.charge()
|
||||
}
|
||||
isCharging = charging
|
||||
@@ -168,9 +168,9 @@ open class ClockEventController @Inject constructor(
|
||||
}
|
||||
|
||||
private val keyguardUpdateMonitorCallback = object : KeyguardUpdateMonitorCallback() {
|
||||
override fun onKeyguardVisibilityChanged(showing: Boolean) {
|
||||
isKeyguardShowing = showing
|
||||
if (!isKeyguardShowing) {
|
||||
override fun onKeyguardVisibilityChanged(visible: Boolean) {
|
||||
isKeyguardVisible = visible
|
||||
if (!isKeyguardVisible) {
|
||||
clock?.animations?.doze(if (isDozing) 1f else 0f)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,9 +212,9 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
if (showing) {
|
||||
if (DEBUG) Slog.v(TAG, "refresh statusview showing:" + showing);
|
||||
public void onKeyguardVisibilityChanged(boolean visible) {
|
||||
if (visible) {
|
||||
if (DEBUG) Slog.v(TAG, "refresh statusview visible:true");
|
||||
refreshTime();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,7 +293,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
HashMap<Integer, ServiceState> mServiceStates = new HashMap<>();
|
||||
|
||||
private int mPhoneState;
|
||||
private boolean mKeyguardIsVisible;
|
||||
private boolean mKeyguardShowing;
|
||||
private boolean mKeyguardOccluded;
|
||||
private boolean mCredentialAttempted;
|
||||
private boolean mKeyguardGoingAway;
|
||||
private boolean mGoingToSleep;
|
||||
@@ -303,7 +304,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
private boolean mAuthInterruptActive;
|
||||
private boolean mNeedsSlowUnlockTransition;
|
||||
private boolean mAssistantVisible;
|
||||
private boolean mKeyguardOccluded;
|
||||
private boolean mOccludingAppRequestingFp;
|
||||
private boolean mOccludingAppRequestingFace;
|
||||
private boolean mSecureCameraLaunched;
|
||||
@@ -666,14 +666,42 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates KeyguardUpdateMonitor's internal state to know if keyguard is occluded
|
||||
* Updates KeyguardUpdateMonitor's internal state to know if keyguard is showing and if
|
||||
* its occluded. The keyguard is considered visible if its showing and NOT occluded.
|
||||
*/
|
||||
public void setKeyguardOccluded(boolean occluded) {
|
||||
mKeyguardOccluded = occluded;
|
||||
updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE,
|
||||
FACE_AUTH_UPDATED_KEYGUARD_OCCLUSION_CHANGED);
|
||||
}
|
||||
public void setKeyguardShowing(boolean showing, boolean occluded) {
|
||||
final boolean occlusionChanged = mKeyguardOccluded != occluded;
|
||||
final boolean showingChanged = mKeyguardShowing != showing;
|
||||
if (!occlusionChanged && !showingChanged) {
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean wasKeyguardVisible = isKeyguardVisible();
|
||||
mKeyguardShowing = showing;
|
||||
mKeyguardOccluded = occluded;
|
||||
final boolean isKeyguardVisible = isKeyguardVisible();
|
||||
mLogger.logKeyguardShowingChanged(showing, occluded, isKeyguardVisible);
|
||||
|
||||
if (isKeyguardVisible != wasKeyguardVisible) {
|
||||
if (isKeyguardVisible) {
|
||||
mSecureCameraLaunched = false;
|
||||
}
|
||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
||||
if (cb != null) {
|
||||
cb.onKeyguardVisibilityChanged(isKeyguardVisible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (occlusionChanged) {
|
||||
updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE,
|
||||
FACE_AUTH_UPDATED_KEYGUARD_OCCLUSION_CHANGED);
|
||||
} else if (showingChanged) {
|
||||
updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE,
|
||||
FACE_AUTH_UPDATED_KEYGUARD_VISIBILITY_CHANGED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to listen for face authentication when an app is occluding keyguard.
|
||||
@@ -2428,7 +2456,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
// Triggers:
|
||||
final boolean triggerActiveUnlockForAssistant = shouldTriggerActiveUnlockForAssistant();
|
||||
final boolean awakeKeyguard = mBouncerFullyShown || mUdfpsBouncerShowing
|
||||
|| (mKeyguardIsVisible && !mGoingToSleep
|
||||
|| (isKeyguardVisible() && !mGoingToSleep
|
||||
&& mStatusBarState != StatusBarState.SHADE_LOCKED);
|
||||
|
||||
// Gates:
|
||||
@@ -2504,7 +2532,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
final boolean userDoesNotHaveTrust = !getUserHasTrust(user);
|
||||
final boolean shouldListenForFingerprintAssistant = shouldListenForFingerprintAssistant();
|
||||
final boolean shouldListenKeyguardState =
|
||||
mKeyguardIsVisible
|
||||
isKeyguardVisible()
|
||||
|| !mDeviceInteractive
|
||||
|| (mBouncerIsOrWillBeShowing && !mKeyguardGoingAway)
|
||||
|| mGoingToSleep
|
||||
@@ -2553,7 +2581,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
mFingerprintLockedOut,
|
||||
mGoingToSleep,
|
||||
mKeyguardGoingAway,
|
||||
mKeyguardIsVisible,
|
||||
isKeyguardVisible(),
|
||||
mKeyguardOccluded,
|
||||
mOccludingAppRequestingFp,
|
||||
mIsPrimaryUser,
|
||||
@@ -2575,7 +2603,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
}
|
||||
|
||||
final boolean statusBarShadeLocked = mStatusBarState == StatusBarState.SHADE_LOCKED;
|
||||
final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive
|
||||
final boolean awakeKeyguard = isKeyguardVisible() && mDeviceInteractive
|
||||
&& !statusBarShadeLocked;
|
||||
final int user = getCurrentUser();
|
||||
final int strongAuth = mStrongAuthTracker.getStrongAuthForUser(user);
|
||||
@@ -3132,32 +3160,18 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
callbacksRefreshCarrierInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the keyguard is showing and not occluded.
|
||||
*/
|
||||
public boolean isKeyguardVisible() {
|
||||
return mKeyguardIsVisible;
|
||||
return isKeyguardShowing() && !mKeyguardOccluded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies that the visibility state of Keyguard has changed.
|
||||
*
|
||||
* <p>Needs to be called from the main thread.
|
||||
* Whether the keyguard is showing. It may still be occluded and not visible.
|
||||
*/
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
Assert.isMainThread();
|
||||
mLogger.logKeyguardVisibilityChanged(showing);
|
||||
mKeyguardIsVisible = showing;
|
||||
|
||||
if (showing) {
|
||||
mSecureCameraLaunched = false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
||||
if (cb != null) {
|
||||
cb.onKeyguardVisibilityChangedRaw(showing);
|
||||
}
|
||||
}
|
||||
updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE,
|
||||
FACE_AUTH_UPDATED_KEYGUARD_VISIBILITY_CHANGED);
|
||||
public boolean isKeyguardShowing() {
|
||||
return mKeyguardShowing;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3366,7 +3380,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
callback.onTimeChanged();
|
||||
callback.onPhoneStateChanged(mPhoneState);
|
||||
callback.onRefreshCarrierInfo();
|
||||
callback.onKeyguardVisibilityChangedRaw(mKeyguardIsVisible);
|
||||
callback.onKeyguardVisibilityChanged(isKeyguardVisible());
|
||||
callback.onTelephonyCapable(mTelephonyCapable);
|
||||
|
||||
for (Entry<Integer, SimData> data : mSimDatas.entrySet()) {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.android.keyguard;
|
||||
|
||||
import android.hardware.biometrics.BiometricSourceType;
|
||||
import android.os.SystemClock;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.view.WindowManagerPolicyConstants;
|
||||
|
||||
@@ -32,10 +31,6 @@ import java.util.TimeZone;
|
||||
*/
|
||||
public class KeyguardUpdateMonitorCallback {
|
||||
|
||||
private static final long VISIBILITY_CHANGED_COLLAPSE_MS = 1000;
|
||||
private long mVisibilityChangedCalled;
|
||||
private boolean mShowing;
|
||||
|
||||
/**
|
||||
* Called when the battery status changes, e.g. when plugged in or unplugged, charge
|
||||
* level, etc. changes.
|
||||
@@ -74,21 +69,6 @@ public class KeyguardUpdateMonitorCallback {
|
||||
*/
|
||||
public void onPhoneStateChanged(int phoneState) { }
|
||||
|
||||
/**
|
||||
* Called when the visibility of the keyguard changes.
|
||||
* @param showing Indicates if the keyguard is now visible.
|
||||
*/
|
||||
public void onKeyguardVisibilityChanged(boolean showing) { }
|
||||
|
||||
public void onKeyguardVisibilityChangedRaw(boolean showing) {
|
||||
final long now = SystemClock.elapsedRealtime();
|
||||
if (showing == mShowing
|
||||
&& (now - mVisibilityChangedCalled) < VISIBILITY_CHANGED_COLLAPSE_MS) return;
|
||||
onKeyguardVisibilityChanged(showing);
|
||||
mVisibilityChangedCalled = now;
|
||||
mShowing = showing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the keyguard enters or leaves bouncer mode.
|
||||
* @param bouncerIsOrWillBeShowing if true, keyguard is showing the bouncer or transitioning
|
||||
@@ -96,6 +76,12 @@ public class KeyguardUpdateMonitorCallback {
|
||||
*/
|
||||
public void onKeyguardBouncerStateChanged(boolean bouncerIsOrWillBeShowing) { }
|
||||
|
||||
/**
|
||||
* Called when the keyguard visibility changes.
|
||||
* @param visible whether the keyguard is showing and is NOT occluded
|
||||
*/
|
||||
public void onKeyguardVisibilityChanged(boolean visible) { }
|
||||
|
||||
/**
|
||||
* Called when the keyguard fully transitions to the bouncer or is no longer the bouncer
|
||||
* @param bouncerIsFullyShowing if true, keyguard is fully showing the bouncer
|
||||
|
||||
@@ -448,14 +448,6 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
||||
|
||||
private final KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback =
|
||||
new KeyguardUpdateMonitorCallback() {
|
||||
@Override
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
// reset mIsBouncerShowing state in case it was preemptively set
|
||||
// onLongPress
|
||||
mIsBouncerShowing = mKeyguardViewController.isBouncerShowing();
|
||||
updateVisibility();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyguardBouncerStateChanged(boolean bouncer) {
|
||||
mIsBouncerShowing = bouncer;
|
||||
@@ -509,6 +501,11 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
||||
// If biometrics were removed, local vars mCanDismissLockScreen and
|
||||
// mUserUnlockedWithBiometric may not be updated.
|
||||
mCanDismissLockScreen = mKeyguardStateController.canDismissLockScreen();
|
||||
|
||||
// reset mIsBouncerShowing state in case it was preemptively set
|
||||
// onLongPress
|
||||
mIsBouncerShowing = mKeyguardViewController.isBouncerShowing();
|
||||
|
||||
updateKeyguardShowing();
|
||||
if (mIsKeyguardShowing) {
|
||||
mUserUnlockedWithBiometric =
|
||||
|
||||
@@ -170,8 +170,14 @@ class KeyguardUpdateMonitorLogger @Inject constructor(
|
||||
logBuffer.log(TAG, VERBOSE, { str1 = "$model" }, { str1!! })
|
||||
}
|
||||
|
||||
fun logKeyguardVisibilityChanged(showing: Boolean) {
|
||||
logBuffer.log(TAG, DEBUG, { bool1 = showing }, { "onKeyguardVisibilityChanged($bool1)" })
|
||||
fun logKeyguardShowingChanged(showing: Boolean, occluded: Boolean, visible: Boolean) {
|
||||
logBuffer.log(TAG, DEBUG, {
|
||||
bool1 = showing
|
||||
bool2 = occluded
|
||||
bool3 = visible
|
||||
}, {
|
||||
"keyguardShowingChanged(showing=$bool1 occluded=$bool2 visible=$bool3)"
|
||||
})
|
||||
}
|
||||
|
||||
fun logMissingSupervisorAppError(userId: Int) {
|
||||
|
||||
@@ -61,8 +61,8 @@ public class AccessibilityFloatingMenuController implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
mIsKeyguardVisible = showing;
|
||||
public void onKeyguardVisibilityChanged(boolean visible) {
|
||||
mIsKeyguardVisible = visible;
|
||||
handleFloatingMenuVisibility(mIsKeyguardVisible, mBtnMode, mBtnTargets);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ class AuthRippleController @Inject constructor(
|
||||
}
|
||||
|
||||
fun showUnlockRipple(biometricSourceType: BiometricSourceType?) {
|
||||
if (!(keyguardUpdateMonitor.isKeyguardVisible || keyguardUpdateMonitor.isDreaming) ||
|
||||
if (!keyguardStateController.isShowing ||
|
||||
keyguardUpdateMonitor.userNeedsStrongAuth()) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -431,8 +431,8 @@ public class DozeLog implements Dumpable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
traceKeyguard(showing);
|
||||
public void onKeyguardVisibilityChanged(boolean visible) {
|
||||
traceKeyguard(visible);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -155,11 +155,11 @@ class DozeLogger @Inject constructor(
|
||||
})
|
||||
}
|
||||
|
||||
fun logKeyguardVisibilityChange(isShowing: Boolean) {
|
||||
fun logKeyguardVisibilityChange(isVisible: Boolean) {
|
||||
buffer.log(TAG, INFO, {
|
||||
bool1 = isShowing
|
||||
bool1 = isVisible
|
||||
}, {
|
||||
"Keyguard visibility change, isShowing=$bool1"
|
||||
"Keyguard visibility change, isVisible=$bool1"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -511,9 +511,9 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
|
||||
KeyguardUpdateMonitorCallback mUpdateCallback = new KeyguardUpdateMonitorCallback() {
|
||||
|
||||
@Override
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
public void onKeyguardVisibilityChanged(boolean visible) {
|
||||
synchronized (KeyguardViewMediator.this) {
|
||||
if (!showing && mPendingPinLock) {
|
||||
if (!visible && mPendingPinLock) {
|
||||
Log.i(TAG, "PIN lock requested, starting keyguard");
|
||||
|
||||
// Bring the keyguard back in order to show the PIN lock
|
||||
@@ -1806,7 +1806,6 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
|
||||
|
||||
if (mOccluded != isOccluded) {
|
||||
mOccluded = isOccluded;
|
||||
mUpdateMonitor.setKeyguardOccluded(isOccluded);
|
||||
mKeyguardViewControllerLazy.get().setOccluded(isOccluded, animate
|
||||
&& mDeviceInteractive);
|
||||
adjustStatusBarLocked();
|
||||
|
||||
@@ -93,13 +93,13 @@ public class DozeParameters implements
|
||||
private boolean mControlScreenOffAnimation;
|
||||
private boolean mIsQuickPickupEnabled;
|
||||
|
||||
private boolean mKeyguardShowing;
|
||||
private boolean mKeyguardVisible;
|
||||
@VisibleForTesting
|
||||
final KeyguardUpdateMonitorCallback mKeyguardVisibilityCallback =
|
||||
new KeyguardUpdateMonitorCallback() {
|
||||
@Override
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
mKeyguardShowing = showing;
|
||||
public void onKeyguardVisibilityChanged(boolean visible) {
|
||||
mKeyguardVisible = visible;
|
||||
updateControlScreenOff();
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ public class DozeParameters implements
|
||||
public void updateControlScreenOff() {
|
||||
if (!getDisplayNeedsBlanking()) {
|
||||
final boolean controlScreenOff =
|
||||
getAlwaysOn() && (mKeyguardShowing || shouldControlUnlockedScreenOff());
|
||||
getAlwaysOn() && (mKeyguardVisible || shouldControlUnlockedScreenOff());
|
||||
setControlScreenOffAnimation(controlScreenOff);
|
||||
}
|
||||
}
|
||||
@@ -348,7 +348,7 @@ public class DozeParameters implements
|
||||
}
|
||||
|
||||
private boolean willAnimateFromLockScreenToAod() {
|
||||
return getAlwaysOn() && mKeyguardShowing;
|
||||
return getAlwaysOn() && mKeyguardVisible;
|
||||
}
|
||||
|
||||
private boolean getBoolean(String propName, int resId) {
|
||||
|
||||
@@ -88,7 +88,7 @@ class KeyguardLiftController @Inject constructor(
|
||||
updateListeningState()
|
||||
}
|
||||
|
||||
override fun onKeyguardVisibilityChanged(showing: Boolean) {
|
||||
override fun onKeyguardVisibilityChanged(visible: Boolean) {
|
||||
updateListeningState()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,8 +187,8 @@ public class KeyguardStatusBarViewController extends ViewController<KeyguardStat
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
if (showing) {
|
||||
public void onKeyguardVisibilityChanged(boolean visible) {
|
||||
if (visible) {
|
||||
updateUserSwitcher();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1534,7 +1534,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
||||
private class KeyguardVisibilityCallback extends KeyguardUpdateMonitorCallback {
|
||||
|
||||
@Override
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
public void onKeyguardVisibilityChanged(boolean visible) {
|
||||
mNeedsDrawableColorUpdate = true;
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
@@ -1135,8 +1135,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
if (occluded != mLastOccluded || mFirstUpdate) {
|
||||
mKeyguardStateController.notifyKeyguardState(showing, occluded);
|
||||
}
|
||||
if ((showing && !occluded) != (mLastShowing && !mLastOccluded) || mFirstUpdate) {
|
||||
mKeyguardUpdateManager.onKeyguardVisibilityChanged(showing && !occluded);
|
||||
if (occluded != mLastOccluded || mShowing != showing || mFirstUpdate) {
|
||||
mKeyguardUpdateManager.setKeyguardShowing(showing, occluded);
|
||||
}
|
||||
if (bouncerIsOrWillBeShowing != mLastBouncerIsOrWillBeShowing || mFirstUpdate
|
||||
|| bouncerShowing != mLastBouncerShowing) {
|
||||
|
||||
@@ -435,7 +435,7 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
public void onKeyguardVisibilityChanged(boolean visible) {
|
||||
update(false /* updateAlways */);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,11 +91,11 @@ public class KeyguardUserSwitcherController extends ViewController<KeyguardUserS
|
||||
private final KeyguardUpdateMonitorCallback mInfoCallback =
|
||||
new KeyguardUpdateMonitorCallback() {
|
||||
@Override
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
if (DEBUG) Log.d(TAG, String.format("onKeyguardVisibilityChanged %b", showing));
|
||||
public void onKeyguardVisibilityChanged(boolean visible) {
|
||||
if (DEBUG) Log.d(TAG, String.format("onKeyguardVisibilityChanged %b", visible));
|
||||
// Any time the keyguard is hidden, try to close the user switcher menu to
|
||||
// restore keyguard to the default state
|
||||
if (!showing) {
|
||||
if (!visible) {
|
||||
closeSwitcherIfOpenAndNotSimple(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
public void testTriesToAuthenticate_whenKeyguard() {
|
||||
mKeyguardUpdateMonitor.dispatchStartedWakingUp();
|
||||
mTestableLooper.processAllMessages();
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
keyguardIsVisible();
|
||||
verify(mFaceManager).authenticate(any(), any(), any(), any(), anyInt(), anyBoolean());
|
||||
}
|
||||
|
||||
@@ -618,7 +618,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
mKeyguardUpdateMonitor.dispatchStartedWakingUp();
|
||||
mTestableLooper.processAllMessages();
|
||||
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
keyguardIsVisible();
|
||||
verify(mFaceManager, never()).authenticate(any(), any(), any(), any(), anyInt(),
|
||||
anyBoolean());
|
||||
}
|
||||
@@ -631,7 +631,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
|
||||
mKeyguardUpdateMonitor.dispatchStartedWakingUp();
|
||||
mTestableLooper.processAllMessages();
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
keyguardIsVisible();
|
||||
verify(mFaceManager, never()).authenticate(any(), any(), any(), any(), anyInt(),
|
||||
anyBoolean());
|
||||
}
|
||||
@@ -655,7 +655,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
|
||||
mKeyguardUpdateMonitor.dispatchStartedWakingUp();
|
||||
mTestableLooper.processAllMessages();
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
keyguardIsVisible();
|
||||
verify(mFaceManager).authenticate(any(), any(), any(), any(), anyInt(), anyBoolean());
|
||||
|
||||
// Stop scanning when bouncer becomes visible
|
||||
@@ -669,7 +669,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void testTriesToAuthenticate_whenAssistant() {
|
||||
mKeyguardUpdateMonitor.setKeyguardOccluded(true);
|
||||
mKeyguardUpdateMonitor.setKeyguardShowing(true, true);
|
||||
mKeyguardUpdateMonitor.setAssistantVisible(true);
|
||||
|
||||
verify(mFaceManager).authenticate(any(), any(), any(), any(), anyInt(), anyBoolean());
|
||||
@@ -684,7 +684,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
mKeyguardUpdateMonitor.onTrustChanged(true /* enabled */,
|
||||
KeyguardUpdateMonitor.getCurrentUser(), 0 /* flags */,
|
||||
new ArrayList<>());
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
keyguardIsVisible();
|
||||
verify(mFaceManager).authenticate(any(), any(), any(), any(), anyInt(), anyBoolean());
|
||||
}
|
||||
|
||||
@@ -694,7 +694,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
mTestableLooper.processAllMessages();
|
||||
mKeyguardUpdateMonitor.onTrustChanged(true /* enabled */,
|
||||
KeyguardUpdateMonitor.getCurrentUser(), 0 /* flags */, new ArrayList<>());
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
keyguardIsVisible();
|
||||
verify(mFaceManager, never()).authenticate(any(), any(), any(), any(), anyInt(),
|
||||
anyBoolean());
|
||||
}
|
||||
@@ -706,7 +706,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
when(mStrongAuthTracker.getStrongAuthForUser(anyInt())).thenReturn(
|
||||
KeyguardUpdateMonitor.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN);
|
||||
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
keyguardIsVisible();
|
||||
verify(mFaceManager, never()).authenticate(any(), any(), any(), any(), anyInt(),
|
||||
anyBoolean());
|
||||
}
|
||||
@@ -718,7 +718,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
when(mStrongAuthTracker.getStrongAuthForUser(anyInt())).thenReturn(
|
||||
KeyguardUpdateMonitor.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_LOCKOUT);
|
||||
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
keyguardIsVisible();
|
||||
verify(mFaceManager).authenticate(any(), any(), any(), any(), anyInt(), anyBoolean());
|
||||
}
|
||||
|
||||
@@ -739,7 +739,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
public void testFaceAndFingerprintLockout_onlyFace() {
|
||||
mKeyguardUpdateMonitor.dispatchStartedWakingUp();
|
||||
mTestableLooper.processAllMessages();
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
keyguardIsVisible();
|
||||
|
||||
faceAuthLockedOut();
|
||||
|
||||
@@ -750,7 +750,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
public void testFaceAndFingerprintLockout_onlyFingerprint() {
|
||||
mKeyguardUpdateMonitor.dispatchStartedWakingUp();
|
||||
mTestableLooper.processAllMessages();
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
keyguardIsVisible();
|
||||
|
||||
mKeyguardUpdateMonitor.mFingerprintAuthenticationCallback
|
||||
.onAuthenticationError(FINGERPRINT_ERROR_LOCKOUT_PERMANENT, "");
|
||||
@@ -762,7 +762,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
public void testFaceAndFingerprintLockout() {
|
||||
mKeyguardUpdateMonitor.dispatchStartedWakingUp();
|
||||
mTestableLooper.processAllMessages();
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
keyguardIsVisible();
|
||||
|
||||
faceAuthLockedOut();
|
||||
mKeyguardUpdateMonitor.mFingerprintAuthenticationCallback
|
||||
@@ -861,7 +861,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
|
||||
mKeyguardUpdateMonitor.dispatchStartedWakingUp();
|
||||
mTestableLooper.processAllMessages();
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
keyguardIsVisible();
|
||||
|
||||
verify(mFaceManager).authenticate(any(), any(), any(), any(), anyInt(), anyBoolean());
|
||||
verify(mFingerprintManager).authenticate(any(), any(), any(), any(), anyInt(), anyInt(),
|
||||
@@ -1034,8 +1034,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
public void testOccludingAppFingerprintListeningState() {
|
||||
// GIVEN keyguard isn't visible (app occluding)
|
||||
mKeyguardUpdateMonitor.dispatchStartedWakingUp();
|
||||
mKeyguardUpdateMonitor.setKeyguardOccluded(true);
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(false);
|
||||
mKeyguardUpdateMonitor.setKeyguardShowing(true, true);
|
||||
when(mStrongAuthTracker.hasUserAuthenticatedSinceBoot()).thenReturn(true);
|
||||
|
||||
// THEN we shouldn't listen for fingerprints
|
||||
@@ -1050,8 +1049,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
public void testOccludingAppRequestsFingerprint() {
|
||||
// GIVEN keyguard isn't visible (app occluding)
|
||||
mKeyguardUpdateMonitor.dispatchStartedWakingUp();
|
||||
mKeyguardUpdateMonitor.setKeyguardOccluded(true);
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(false);
|
||||
mKeyguardUpdateMonitor.setKeyguardShowing(true, true);
|
||||
|
||||
// WHEN an occluding app requests fp
|
||||
mKeyguardUpdateMonitor.requestFingerprintAuthOnOccludingApp(true);
|
||||
@@ -1143,7 +1141,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
setKeyguardBouncerVisibility(false /* isVisible */);
|
||||
mKeyguardUpdateMonitor.dispatchStartedWakingUp();
|
||||
when(mKeyguardBypassController.canBypass()).thenReturn(true);
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
keyguardIsVisible();
|
||||
|
||||
// WHEN status bar state reports a change to the keyguard that would normally indicate to
|
||||
// start running face auth
|
||||
@@ -1154,8 +1152,9 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
// listening state to update
|
||||
assertThat(mKeyguardUpdateMonitor.isFaceDetectionRunning()).isEqualTo(false);
|
||||
|
||||
// WHEN biometric listening state is updated
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
// WHEN biometric listening state is updated when showing state changes from false => true
|
||||
mKeyguardUpdateMonitor.setKeyguardShowing(false, false);
|
||||
mKeyguardUpdateMonitor.setKeyguardShowing(true, false);
|
||||
|
||||
// THEN face unlock is running
|
||||
assertThat(mKeyguardUpdateMonitor.isFaceDetectionRunning()).isEqualTo(true);
|
||||
@@ -1521,7 +1520,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
public void testFingerprintCanAuth_whenCancellationNotReceivedAndAuthFailed() {
|
||||
mKeyguardUpdateMonitor.dispatchStartedWakingUp();
|
||||
mTestableLooper.processAllMessages();
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
keyguardIsVisible();
|
||||
|
||||
verify(mFaceManager).authenticate(any(), any(), any(), any(), anyInt(), anyBoolean());
|
||||
verify(mFingerprintManager).authenticate(any(), any(), any(), any(), anyInt(), anyInt(),
|
||||
@@ -1530,7 +1529,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
mKeyguardUpdateMonitor.onFaceAuthenticated(0, false);
|
||||
// Make sure keyguard is going away after face auth attempt, and that it calls
|
||||
// updateBiometricStateListeningState.
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(false);
|
||||
mKeyguardUpdateMonitor.setKeyguardShowing(false, false);
|
||||
mTestableLooper.processAllMessages();
|
||||
|
||||
verify(mHandler).postDelayed(mKeyguardUpdateMonitor.mFpCancelNotReceived,
|
||||
@@ -1590,7 +1589,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
private void keyguardIsVisible() {
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
mKeyguardUpdateMonitor.setKeyguardShowing(true, false);
|
||||
}
|
||||
|
||||
private void triggerAuthInterrupt() {
|
||||
|
||||
@@ -117,13 +117,12 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testFingerprintTrigger_KeyguardVisible_Ripple() {
|
||||
// GIVEN fp exists, keyguard is visible, user doesn't need strong auth
|
||||
fun testFingerprintTrigger_KeyguardShowing_Ripple() {
|
||||
// GIVEN fp exists, keyguard is showing, user doesn't need strong auth
|
||||
val fpsLocation = Point(5, 5)
|
||||
`when`(authController.fingerprintSensorLocation).thenReturn(fpsLocation)
|
||||
controller.onViewAttached()
|
||||
`when`(keyguardUpdateMonitor.isKeyguardVisible).thenReturn(true)
|
||||
`when`(keyguardUpdateMonitor.isDreaming).thenReturn(false)
|
||||
`when`(keyguardStateController.isShowing).thenReturn(true)
|
||||
`when`(keyguardUpdateMonitor.userNeedsStrongAuth()).thenReturn(false)
|
||||
|
||||
// WHEN fingerprint authenticated
|
||||
@@ -140,39 +139,15 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testFingerprintTrigger_Dreaming_Ripple() {
|
||||
// GIVEN fp exists, keyguard is visible, user doesn't need strong auth
|
||||
val fpsLocation = Point(5, 5)
|
||||
`when`(authController.fingerprintSensorLocation).thenReturn(fpsLocation)
|
||||
controller.onViewAttached()
|
||||
`when`(keyguardUpdateMonitor.isKeyguardVisible).thenReturn(false)
|
||||
`when`(keyguardUpdateMonitor.isDreaming).thenReturn(true)
|
||||
`when`(keyguardUpdateMonitor.userNeedsStrongAuth()).thenReturn(false)
|
||||
|
||||
// WHEN fingerprint authenticated
|
||||
val captor = ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback::class.java)
|
||||
verify(keyguardUpdateMonitor).registerCallback(captor.capture())
|
||||
captor.value.onBiometricAuthenticated(
|
||||
0 /* userId */,
|
||||
BiometricSourceType.FINGERPRINT /* type */,
|
||||
false /* isStrongBiometric */)
|
||||
|
||||
// THEN update sensor location and show ripple
|
||||
verify(rippleView).setFingerprintSensorLocation(fpsLocation, 0f)
|
||||
verify(rippleView).startUnlockedRipple(any())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testFingerprintTrigger_KeyguardNotVisible_NotDreaming_NoRipple() {
|
||||
fun testFingerprintTrigger_KeyguardNotShowing_NoRipple() {
|
||||
// GIVEN fp exists & user doesn't need strong auth
|
||||
val fpsLocation = Point(5, 5)
|
||||
`when`(authController.udfpsLocation).thenReturn(fpsLocation)
|
||||
controller.onViewAttached()
|
||||
`when`(keyguardUpdateMonitor.userNeedsStrongAuth()).thenReturn(false)
|
||||
|
||||
// WHEN keyguard is NOT visible & fingerprint authenticated
|
||||
`when`(keyguardUpdateMonitor.isKeyguardVisible).thenReturn(false)
|
||||
`when`(keyguardUpdateMonitor.isDreaming).thenReturn(false)
|
||||
// WHEN keyguard is NOT showing & fingerprint authenticated
|
||||
`when`(keyguardStateController.isShowing).thenReturn(false)
|
||||
val captor = ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback::class.java)
|
||||
verify(keyguardUpdateMonitor).registerCallback(captor.capture())
|
||||
captor.value.onBiometricAuthenticated(
|
||||
@@ -186,11 +161,11 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
||||
|
||||
@Test
|
||||
fun testFingerprintTrigger_StrongAuthRequired_NoRipple() {
|
||||
// GIVEN fp exists & keyguard is visible
|
||||
// GIVEN fp exists & keyguard is showing
|
||||
val fpsLocation = Point(5, 5)
|
||||
`when`(authController.udfpsLocation).thenReturn(fpsLocation)
|
||||
controller.onViewAttached()
|
||||
`when`(keyguardUpdateMonitor.isKeyguardVisible).thenReturn(true)
|
||||
`when`(keyguardStateController.isShowing).thenReturn(true)
|
||||
|
||||
// WHEN user needs strong auth & fingerprint authenticated
|
||||
`when`(keyguardUpdateMonitor.userNeedsStrongAuth()).thenReturn(true)
|
||||
@@ -207,12 +182,12 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
||||
|
||||
@Test
|
||||
fun testFaceTriggerBypassEnabled_Ripple() {
|
||||
// GIVEN face auth sensor exists, keyguard is visible & strong auth isn't required
|
||||
// GIVEN face auth sensor exists, keyguard is showing & strong auth isn't required
|
||||
val faceLocation = Point(5, 5)
|
||||
`when`(authController.faceSensorLocation).thenReturn(faceLocation)
|
||||
controller.onViewAttached()
|
||||
|
||||
`when`(keyguardUpdateMonitor.isKeyguardVisible).thenReturn(true)
|
||||
`when`(keyguardStateController.isShowing).thenReturn(true)
|
||||
`when`(keyguardUpdateMonitor.userNeedsStrongAuth()).thenReturn(false)
|
||||
|
||||
// WHEN bypass is enabled & face authenticated
|
||||
@@ -299,7 +274,7 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
||||
val fpsLocation = Point(5, 5)
|
||||
`when`(authController.fingerprintSensorLocation).thenReturn(fpsLocation)
|
||||
controller.onViewAttached()
|
||||
`when`(keyguardUpdateMonitor.isKeyguardVisible).thenReturn(true)
|
||||
`when`(keyguardStateController.isShowing).thenReturn(true)
|
||||
`when`(biometricUnlockController.isWakeAndUnlock).thenReturn(true)
|
||||
|
||||
controller.showUnlockRipple(BiometricSourceType.FINGERPRINT)
|
||||
@@ -317,7 +292,7 @@ class AuthRippleControllerTest : SysuiTestCase() {
|
||||
val faceLocation = Point(5, 5)
|
||||
`when`(authController.faceSensorLocation).thenReturn(faceLocation)
|
||||
controller.onViewAttached()
|
||||
`when`(keyguardUpdateMonitor.isKeyguardVisible).thenReturn(true)
|
||||
`when`(keyguardStateController.isShowing).thenReturn(true)
|
||||
`when`(biometricUnlockController.isWakeAndUnlock).thenReturn(true)
|
||||
`when`(authController.isUdfpsFingerDown).thenReturn(true)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user