Merge "Allow bypass + show errors on alt bouncer" into sc-dev
This commit is contained in:
@@ -54,6 +54,7 @@ public class KeyguardMessageArea extends TextView implements SecurityMessageDisp
|
||||
private CharSequence mMessage;
|
||||
private ColorStateList mNextMessageColorState = ColorStateList.valueOf(DEFAULT_COLOR);
|
||||
private boolean mBouncerVisible;
|
||||
private boolean mAltBouncerShowing;
|
||||
|
||||
public KeyguardMessageArea(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -144,7 +145,8 @@ public class KeyguardMessageArea extends TextView implements SecurityMessageDisp
|
||||
|
||||
void update() {
|
||||
CharSequence status = mMessage;
|
||||
setVisibility(TextUtils.isEmpty(status) || !mBouncerVisible ? INVISIBLE : VISIBLE);
|
||||
setVisibility(TextUtils.isEmpty(status) || (!mBouncerVisible && !mAltBouncerShowing)
|
||||
? INVISIBLE : VISIBLE);
|
||||
setText(status);
|
||||
ColorStateList colorState = mDefaultColorState;
|
||||
if (mNextMessageColorState.getDefaultColor() != DEFAULT_COLOR) {
|
||||
@@ -158,6 +160,16 @@ public class KeyguardMessageArea extends TextView implements SecurityMessageDisp
|
||||
mBouncerVisible = bouncerVisible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the alt bouncer is showing
|
||||
*/
|
||||
void setAltBouncerShowing(boolean showing) {
|
||||
if (mAltBouncerShowing != showing) {
|
||||
mAltBouncerShowing = showing;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runnable used to delay accessibility announcements.
|
||||
*/
|
||||
|
||||
@@ -28,7 +28,7 @@ import javax.inject.Inject;
|
||||
public class KeyguardMessageAreaController extends ViewController<KeyguardMessageArea> {
|
||||
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
||||
private final ConfigurationController mConfigurationController;
|
||||
|
||||
private boolean mAltBouncerShowing;
|
||||
|
||||
private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
|
||||
public void onFinishedGoingToSleep(int why) {
|
||||
@@ -81,6 +81,13 @@ public class KeyguardMessageAreaController extends ViewController<KeyguardMessag
|
||||
mKeyguardUpdateMonitor.removeCallback(mInfoCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether alt bouncer is showing
|
||||
*/
|
||||
public void setAltBouncerShowing(boolean showing) {
|
||||
mView.setAltBouncerShowing(showing);
|
||||
}
|
||||
|
||||
public void setMessage(CharSequence s) {
|
||||
mView.setMessage(s);
|
||||
}
|
||||
|
||||
@@ -797,8 +797,12 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
|
||||
}
|
||||
|
||||
if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
|
||||
String message = mContext.getString(R.string.keyguard_retry);
|
||||
mStatusBarKeyguardViewManager.showBouncerMessage(message, mInitialTextColorState);
|
||||
if (mStatusBarKeyguardViewManager.isShowingAlternateAuth()) {
|
||||
return; // udfps affordance is highlighted, no need to surface face auth error
|
||||
} else {
|
||||
String message = mContext.getString(R.string.keyguard_retry);
|
||||
mStatusBarKeyguardViewManager.showBouncerMessage(message, mInitialTextColorState);
|
||||
}
|
||||
} else if (mKeyguardUpdateMonitor.isScreenOn()) {
|
||||
showTransientIndication(mContext.getString(R.string.keyguard_unlock),
|
||||
false /* isError */, true /* hideOnScreenOff */);
|
||||
@@ -922,6 +926,11 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
|
||||
&& mKeyguardUpdateMonitor.isFingerprintDetectionRunning()) {
|
||||
// suggest trying fingerprint
|
||||
showTransientIndication(R.string.keyguard_try_fingerprint);
|
||||
} else if (mStatusBarKeyguardViewManager.isShowingAlternateAuth()) {
|
||||
mStatusBarKeyguardViewManager.showBouncerMessage(
|
||||
mContext.getResources().getString(R.string.keyguard_try_fingerprint),
|
||||
mInitialTextColorState
|
||||
);
|
||||
} else {
|
||||
// suggest swiping up to unlock (try face auth again or swipe up to bouncer)
|
||||
showSwipeUpToUnlock();
|
||||
|
||||
@@ -588,7 +588,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
|
||||
return MODE_UNLOCK_COLLAPSING;
|
||||
}
|
||||
if (mKeyguardViewController.isShowing()) {
|
||||
if (mKeyguardViewController.bouncerIsOrWillBeShowing() && unlockingAllowed) {
|
||||
if ((mKeyguardViewController.bouncerIsOrWillBeShowing()
|
||||
|| mKeyguardBypassController.getAltBouncerShowing()) && unlockingAllowed) {
|
||||
if (bypass && mKeyguardBypassController.canPlaySubtleWindowAnimations()) {
|
||||
return MODE_UNLOCK_FADING;
|
||||
} else {
|
||||
|
||||
@@ -82,6 +82,7 @@ open class KeyguardBypassController : Dumpable {
|
||||
private set
|
||||
|
||||
var bouncerShowing: Boolean = false
|
||||
var altBouncerShowing: Boolean = false
|
||||
var launchingAffordance: Boolean = false
|
||||
var qSExpanded = false
|
||||
set(value) {
|
||||
@@ -172,6 +173,7 @@ open class KeyguardBypassController : Dumpable {
|
||||
if (bypassEnabled) {
|
||||
return when {
|
||||
bouncerShowing -> true
|
||||
altBouncerShowing -> true
|
||||
statusBarStateController.state != StatusBarState.KEYGUARD -> false
|
||||
launchingAffordance -> false
|
||||
isPulseExpanding || qSExpanded -> false
|
||||
@@ -210,6 +212,7 @@ open class KeyguardBypassController : Dumpable {
|
||||
pw.println(" bypassEnabled: $bypassEnabled")
|
||||
pw.println(" canBypass: ${canBypass()}")
|
||||
pw.println(" bouncerShowing: $bouncerShowing")
|
||||
pw.println(" altBouncerShowing: $altBouncerShowing")
|
||||
pw.println(" isPulseExpanding: $isPulseExpanding")
|
||||
pw.println(" launchingAffordance: $launchingAffordance")
|
||||
pw.println(" qSExpanded: $qSExpanded")
|
||||
|
||||
@@ -42,6 +42,8 @@ import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.internal.util.LatencyTracker;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.keyguard.KeyguardMessageArea;
|
||||
import com.android.keyguard.KeyguardMessageAreaController;
|
||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||
import com.android.keyguard.KeyguardUpdateMonitorCallback;
|
||||
import com.android.keyguard.KeyguardViewController;
|
||||
@@ -107,6 +109,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
private final KeyguardBouncer.Factory mKeyguardBouncerFactory;
|
||||
private final WakefulnessLifecycle mWakefulnessLifecycle;
|
||||
private final UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
|
||||
private final KeyguardMessageAreaController.Factory mKeyguardMessageAreaFactory;
|
||||
private KeyguardMessageAreaController mKeyguardMessageAreaController;
|
||||
private final BouncerExpansionCallback mExpansionCallback = new BouncerExpansionCallback() {
|
||||
@Override
|
||||
public void onFullyShown() {
|
||||
@@ -238,7 +242,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
NotificationMediaManager notificationMediaManager,
|
||||
KeyguardBouncer.Factory keyguardBouncerFactory,
|
||||
WakefulnessLifecycle wakefulnessLifecycle,
|
||||
UnlockedScreenOffAnimationController unlockedScreenOffAnimationController) {
|
||||
UnlockedScreenOffAnimationController unlockedScreenOffAnimationController,
|
||||
KeyguardMessageAreaController.Factory keyguardMessageAreaFactory) {
|
||||
mContext = context;
|
||||
mViewMediatorCallback = callback;
|
||||
mLockPatternUtils = lockPatternUtils;
|
||||
@@ -254,6 +259,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
mKeyguardBouncerFactory = keyguardBouncerFactory;
|
||||
mWakefulnessLifecycle = wakefulnessLifecycle;
|
||||
mUnlockedScreenOffAnimationController = unlockedScreenOffAnimationController;
|
||||
mKeyguardMessageAreaFactory = keyguardMessageAreaFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -271,6 +277,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
notificationPanelViewController.addExpansionListener(this);
|
||||
mBypassController = bypassController;
|
||||
mNotificationContainer = notificationContainer;
|
||||
mKeyguardMessageAreaController = mKeyguardMessageAreaFactory.create(
|
||||
KeyguardMessageArea.findSecurityMessageDisplay(container));
|
||||
mFaceAuthScreenBrightnessController.ifPresent((it) -> {
|
||||
View overlay = new View(mContext);
|
||||
container.addView(overlay);
|
||||
@@ -412,9 +420,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
*/
|
||||
public void showGenericBouncer(boolean scrimmed) {
|
||||
if (mAlternateAuthInterceptor != null) {
|
||||
if (mAlternateAuthInterceptor.showAlternateAuthBouncer()) {
|
||||
mStatusBar.updateScrimController();
|
||||
}
|
||||
updateAlternateAuthShowing(mAlternateAuthInterceptor.showAlternateAuthBouncer());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -481,9 +487,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
mKeyguardGoneCancelAction = null;
|
||||
}
|
||||
|
||||
if (mAlternateAuthInterceptor.showAlternateAuthBouncer()) {
|
||||
mStatusBar.updateScrimController();
|
||||
}
|
||||
updateAlternateAuthShowing(mAlternateAuthInterceptor.showAlternateAuthBouncer());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -536,9 +540,19 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
* Stop showing any alternate auth methods
|
||||
*/
|
||||
public void resetAlternateAuth(boolean forceUpdateScrim) {
|
||||
if ((mAlternateAuthInterceptor != null
|
||||
final boolean updateScrim = (mAlternateAuthInterceptor != null
|
||||
&& mAlternateAuthInterceptor.hideAlternateAuthBouncer())
|
||||
|| forceUpdateScrim) {
|
||||
|| forceUpdateScrim;
|
||||
updateAlternateAuthShowing(updateScrim);
|
||||
}
|
||||
|
||||
private void updateAlternateAuthShowing(boolean updateScrim) {
|
||||
if (mKeyguardMessageAreaController != null) {
|
||||
mKeyguardMessageAreaController.setAltBouncerShowing(isShowingAlternateAuth());
|
||||
}
|
||||
mBypassController.setAltBouncerShowing(isShowingAlternateAuth());
|
||||
|
||||
if (updateScrim) {
|
||||
mStatusBar.updateScrimController();
|
||||
}
|
||||
}
|
||||
@@ -875,7 +889,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
|
||||
@Override
|
||||
public boolean isBouncerShowing() {
|
||||
return mBouncer.isShowing();
|
||||
return mBouncer.isShowing() || isShowingAlternateAuth();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1089,7 +1103,14 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
}
|
||||
|
||||
public void showBouncerMessage(String message, ColorStateList colorState) {
|
||||
mBouncer.showMessage(message, colorState);
|
||||
if (isShowingAlternateAuth()) {
|
||||
if (mKeyguardMessageAreaController != null) {
|
||||
mKeyguardMessageAreaController.setNextMessageColor(colorState);
|
||||
mKeyguardMessageAreaController.setMessage(message);
|
||||
}
|
||||
} else {
|
||||
mBouncer.showMessage(message, colorState);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyFloat;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.clearInvocations;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
@@ -38,6 +39,8 @@ import android.view.ViewGroup;
|
||||
import androidx.test.filters.SmallTest;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.keyguard.KeyguardMessageArea;
|
||||
import com.android.keyguard.KeyguardMessageAreaController;
|
||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||
import com.android.keyguard.ViewMediatorCallback;
|
||||
import com.android.systemui.SysuiTestCase;
|
||||
@@ -93,9 +96,13 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
||||
@Mock
|
||||
private KeyguardBouncer.Factory mKeyguardBouncerFactory;
|
||||
@Mock
|
||||
private KeyguardMessageAreaController.Factory mKeyguardMessageAreaFactory;
|
||||
@Mock
|
||||
private KeyguardBouncer mBouncer;
|
||||
@Mock
|
||||
private UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
|
||||
@Mock
|
||||
private KeyguardMessageArea mKeyguardMessageArea;
|
||||
|
||||
private WakefulnessLifecycle mWakefulnessLifecycle;
|
||||
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
|
||||
@@ -108,6 +115,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
||||
any(KeyguardBouncer.BouncerExpansionCallback.class)))
|
||||
.thenReturn(mBouncer);
|
||||
|
||||
when(mContainer.findViewById(anyInt())).thenReturn(mKeyguardMessageArea);
|
||||
mWakefulnessLifecycle = new WakefulnessLifecycle(getContext(), null);
|
||||
mStatusBarKeyguardViewManager = new StatusBarKeyguardViewManager(
|
||||
getContext(),
|
||||
@@ -124,7 +132,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
||||
mock(NotificationMediaManager.class),
|
||||
mKeyguardBouncerFactory,
|
||||
mWakefulnessLifecycle,
|
||||
mUnlockedScreenOffAnimationController);
|
||||
mUnlockedScreenOffAnimationController,
|
||||
mKeyguardMessageAreaFactory);
|
||||
mStatusBarKeyguardViewManager.registerStatusBar(mStatusBar, mContainer,
|
||||
mNotificationPanelView, mBiometrucUnlockController,
|
||||
mNotificationContainer, mBypassController);
|
||||
|
||||
Reference in New Issue
Block a user