Merge "Avoid clock and challenge overlap" into pi-dev

This commit is contained in:
Lucas Dupin
2018-03-29 20:18:32 +00:00
committed by Android (Google) Code Review
4 changed files with 40 additions and 5 deletions

View File

@@ -334,6 +334,20 @@ public class KeyguardBouncer {
return mKeyguardView != null && mKeyguardView.hasDismissActions();
}
public int getTop() {
if (mKeyguardView == null) {
return 0;
}
int top = mKeyguardView.getTop();
// The password view has an extra top padding that should be ignored.
if (mKeyguardView.getCurrentSecurityMode() == SecurityMode.Password) {
View messageArea = mKeyguardView.findViewById(R.id.keyguard_message_area);
top += messageArea.getTop();
}
return top;
}
protected void ensureView() {
// Removal of the view might be deferred to reduce unlock latency,
// in this case we need to force the removal, otherwise we'll

View File

@@ -113,6 +113,11 @@ public class KeyguardClockPositionAlgorithm {
*/
private boolean mTracking;
/**
* Distance in pixels between the top of the screen and the first view of the bouncer.
*/
private int mBouncerTop;
/**
* Refreshes the dimension values.
*/
@@ -129,7 +134,7 @@ public class KeyguardClockPositionAlgorithm {
public void setup(int minTopMargin, int maxShadeBottom, int notificationStackHeight,
float expandedHeight, float maxPanelHeight, int parentHeight, int keyguardStatusHeight,
float dark, boolean secure, boolean tracking) {
float dark, boolean secure, boolean tracking, int bouncerTop) {
mMinTopMargin = minTopMargin + mContainerTopPadding;
mMaxShadeBottom = maxShadeBottom;
mNotificationStackHeight = notificationStackHeight;
@@ -140,6 +145,7 @@ public class KeyguardClockPositionAlgorithm {
mDarkAmount = dark;
mCurrentlySecure = secure;
mTracking = tracking;
mBouncerTop = bouncerTop;
}
public void run(Result result) {
@@ -189,8 +195,10 @@ public class KeyguardClockPositionAlgorithm {
private int getClockY() {
// Dark: Align the bottom edge of the clock at about half of the screen:
final float clockYDark = getMaxClockY() + burnInPreventionOffsetY();
float clockYRegular = getExpandedClockPosition();
float clockYTarget = mCurrentlySecure ? mMinTopMargin : -mKeyguardStatusHeight;
final float clockYRegular = getExpandedClockPosition();
final boolean hasEnoughSpace = mMinTopMargin + mKeyguardStatusHeight < mBouncerTop;
float clockYTarget = mCurrentlySecure && hasEnoughSpace ?
mMinTopMargin : -mKeyguardStatusHeight;
// Move clock up while collapsing the shade
float shadeExpansion = mExpandedHeight / mMaxPanelHeight;

View File

@@ -160,6 +160,7 @@ public class NotificationPanelView extends PanelView implements
protected int mQsMinExpansionHeight;
protected int mQsMaxExpansionHeight;
private int mQsPeekHeight;
private int mBouncerTop;
private boolean mStackScrollerOverscrolling;
private boolean mQsExpansionFromOverscroll;
private float mLastOverscroll;
@@ -476,7 +477,8 @@ public class NotificationPanelView extends PanelView implements
mKeyguardStatusView.getHeight(),
mDarkAmount,
mStatusBar.isKeyguardCurrentlySecure(),
mTracking);
mTracking,
mBouncerTop);
mClockPositionAlgorithm.run(mClockPositionResult);
if (animate || mClockAnimator != null) {
startClockAnimation(mClockPositionResult.clockX, mClockPositionResult.clockY);
@@ -550,6 +552,11 @@ public class NotificationPanelView extends PanelView implements
return count;
}
public void setBouncerTop(int bouncerTop) {
mBouncerTop = bouncerTop;
positionClockAndNotifications();
}
private void startClockAnimation(int x, int y) {
if (mClockAnimationTargetX == x && mClockAnimationTargetY == y) {
return;

View File

@@ -135,10 +135,16 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mFingerprintUnlockController = fingerprintUnlockController;
mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext,
mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry);
mContainer.addOnLayoutChangeListener(this::onContainerLayout);
mNotificationPanelView = notificationPanelView;
notificationPanelView.setExpansionListener(this::onPanelExpansionChanged);
}
private void onContainerLayout(View v, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
mNotificationPanelView.setBouncerTop(mBouncer.getTop());
}
private void onPanelExpansionChanged(float expansion, boolean tracking) {
// We don't want to translate the bounce when:
// • Keyguard is occluded, because we're in a FLAG_SHOW_WHEN_LOCKED activity and need to
@@ -156,7 +162,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
if (expansion == 1) {
mBouncer.onFullyHidden();
} else if (!mBouncer.isShowing() && !mBouncer.isAnimatingAway()) {
mBouncer.show(false /* resetSecuritySelection */, false /* notifyFalsing */);
mBouncer.show(false /* resetSecuritySelection */, false /* animated */);
} else if (noLongerTracking) {
// Notify that falsing manager should stop its session when user stops touching,
// even before the animation ends, to guarantee that we're not recording sensitive