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