Merge "Update showing udfps keyguard affordance logic" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-03-22 17:07:31 +00:00
committed by Android (Google) Code Review
6 changed files with 50 additions and 22 deletions

View File

@@ -33,6 +33,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
@NonNull private final StatusBarKeyguardViewManager mKeyguardViewManager;
private boolean mForceShow;
private boolean mQsExpanded;
protected UdfpsKeyguardViewController(
@NonNull UdfpsKeyguardView view,
@@ -64,7 +65,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
protected void onViewDetached() {
super.onViewDetached();
mStatusBarStateController.removeCallback(mStateListener);
mAlternateAuthInterceptor.reset();
mAlternateAuthInterceptor.resetForceShow();
mKeyguardViewManager.setAlternateAuthInterceptor(null);
}
@@ -100,6 +101,11 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
if (mForceShow) {
return false;
}
if (mQsExpanded) {
return true;
}
return super.shouldPauseAuth();
}
@@ -130,7 +136,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
}
@Override
public boolean reset() {
public boolean resetForceShow() {
if (!mForceShow) {
return false;
}
@@ -140,7 +146,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
}
@Override
public boolean isShowingAlternativeAuth() {
public boolean isShowingAlternateAuth() {
return mForceShow;
}
@@ -149,6 +155,12 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
return mView.isAnimating();
}
@Override
public void setQsExpanded(boolean expanded) {
mQsExpanded = expanded;
updatePauseAuth();
}
@Override
public void dump(PrintWriter pw) {
pw.print(getTag());

View File

@@ -1824,6 +1824,7 @@ public class NotificationPanelViewController extends PanelViewController {
mNotificationContainerParent.setQsExpanded(expanded);
mPulseExpansionHandler.setQsExpanded(expanded);
mKeyguardBypassController.setQSExpanded(expanded);
mStatusBarKeyguardViewManager.setQsExpanded(expanded);
}
}
@@ -3389,7 +3390,7 @@ public class NotificationPanelViewController extends PanelViewController {
return new TouchHandler() {
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (mStatusBarKeyguardViewManager.isShowingAlternativeAuthOrAnimating()) {
if (mStatusBarKeyguardViewManager.isShowingAlternateAuthOrAnimating()) {
return true;
}
if (mBlockTouches || mQsFullyExpanded && mQs.disallowPanelTouches()) {
@@ -3420,8 +3421,8 @@ public class NotificationPanelViewController extends PanelViewController {
@Override
public boolean onTouch(View v, MotionEvent event) {
final boolean showingOrAnimatingAltAuth =
mStatusBarKeyguardViewManager.isShowingAlternativeAuthOrAnimating();
if (showingOrAnimatingAltAuth) {
mStatusBarKeyguardViewManager.isShowingAlternateAuthOrAnimating();
if (showingOrAnimatingAltAuth && event.getAction() == MotionEvent.ACTION_DOWN) {
mStatusBarKeyguardViewManager.resetAlternateAuth();
}

View File

@@ -454,7 +454,7 @@ public abstract class PanelViewController {
mView.postOnAnimation(mPostCollapseRunnable);
}
} else if (!mStatusBar.isBouncerShowing()
&& !mStatusBarKeyguardViewManager.isShowingAlternativeAuthOrAnimating()) {
&& !mStatusBarKeyguardViewManager.isShowingAlternateAuthOrAnimating()) {
boolean expands = onEmptySpaceClick(mInitialTouchX);
onTrackingStopped(expands);
}

View File

@@ -4224,7 +4224,7 @@ public class StatusBar extends SystemUI implements DemoMode,
mNotificationPanelViewController.isLaunchingAffordanceWithPreview();
mScrimController.setLaunchingAffordanceWithPreview(launchingAffordanceWithPreview);
if (mStatusBarKeyguardViewManager.isShowingAlternativeAuth()) {
if (mStatusBarKeyguardViewManager.isShowingAlternateAuth()) {
mScrimController.transitionTo(ScrimState.AUTH_SCRIMMED);
} else if (mBouncerShowing) {
// Bouncer needs the front scrim when it's on top of an activity,

View File

@@ -476,11 +476,12 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
return;
}
if (mAlternateAuthInterceptor != null
&& mAlternateAuthInterceptor.showAlternativeAuthMethod()) {
mStatusBar.updateScrimController();
if (mAlternateAuthInterceptor != null) {
mAfterKeyguardGoneAction = r;
mKeyguardGoneCancelAction = cancelAction;
if (mAlternateAuthInterceptor.showAlternativeAuthMethod()) {
mStatusBar.updateScrimController();
}
return;
}
@@ -528,7 +529,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
* Stop showing any alternate auth methods
*/
public void resetAlternateAuth() {
if (mAlternateAuthInterceptor != null && mAlternateAuthInterceptor.reset()) {
if (mAlternateAuthInterceptor != null && mAlternateAuthInterceptor.resetForceShow()) {
mStatusBar.updateScrimController();
}
}
@@ -1125,18 +1126,27 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
setDozing(isDozing);
}
/**
* Set whether qs is currently expanded
*/
public void setQsExpanded(boolean expanded) {
if (mAlternateAuthInterceptor != null) {
mAlternateAuthInterceptor.setQsExpanded(expanded);
}
}
public KeyguardBouncer getBouncer() {
return mBouncer;
}
public boolean isShowingAlternativeAuth() {
public boolean isShowingAlternateAuth() {
return mAlternateAuthInterceptor != null
&& mAlternateAuthInterceptor.isShowingAlternativeAuth();
&& mAlternateAuthInterceptor.isShowingAlternateAuth();
}
public boolean isShowingAlternativeAuthOrAnimating() {
public boolean isShowingAlternateAuthOrAnimating() {
return mAlternateAuthInterceptor != null
&& (mAlternateAuthInterceptor.isShowingAlternativeAuth()
&& (mAlternateAuthInterceptor.isShowingAlternateAuth()
|| mAlternateAuthInterceptor.isAnimating());
}
@@ -1169,12 +1179,12 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
* reset the state to the default (only keyguard showing, no auth methods showing)
* @return whether alternative auth method was newly hidden
*/
boolean reset();
boolean resetForceShow();
/**
* @return true if alternative auth method is showing
*/
boolean isShowingAlternativeAuth();
boolean isShowingAlternateAuth();
/**
* print information for the alternate auth interceptor registered
@@ -1185,5 +1195,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
* @return true if the new auth method is currently animating in or out.
*/
boolean isAnimating();
/**
* Set whether qs is currently expanded
*/
void setQsExpanded(boolean expanded);
}
}

View File

@@ -170,11 +170,11 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
mAltAuthInterceptor.showAlternativeAuthMethod(); // force show
assertFalse(mController.shouldPauseAuth());
assertTrue(mAltAuthInterceptor.isShowingAlternativeAuth());
assertTrue(mAltAuthInterceptor.isShowingAlternateAuth());
mAltAuthInterceptor.reset(); // stop force show
mAltAuthInterceptor.resetForceShow(); // stop force show
assertTrue(mController.shouldPauseAuth());
assertFalse(mAltAuthInterceptor.isShowingAlternativeAuth());
assertFalse(mAltAuthInterceptor.isShowingAlternateAuth());
}
@Test
@@ -190,7 +190,7 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
mController.onViewDetached();
// THEN alt auth state reports not showing
assertFalse(mAltAuthInterceptor.isShowingAlternativeAuth());
assertFalse(mAltAuthInterceptor.isShowingAlternateAuth());
}
private void sendStatusBarStateChanged(int statusBarState) {