Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 223c864b authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

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

parents 4565da3d 4c2aa390
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -334,6 +334,20 @@ public class KeyguardBouncer {
        return mKeyguardView != null && mKeyguardView.hasDismissActions();
        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() {
    protected void ensureView() {
        // Removal of the view might be deferred to reduce unlock latency,
        // Removal of the view might be deferred to reduce unlock latency,
        // in this case we need to force the removal, otherwise we'll
        // in this case we need to force the removal, otherwise we'll
+11 −3
Original line number Original line Diff line number Diff line
@@ -113,6 +113,11 @@ public class KeyguardClockPositionAlgorithm {
     */
     */
    private boolean mTracking;
    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.
     * Refreshes the dimension values.
     */
     */
@@ -129,7 +134,7 @@ public class KeyguardClockPositionAlgorithm {


    public void setup(int minTopMargin, int maxShadeBottom, int notificationStackHeight,
    public void setup(int minTopMargin, int maxShadeBottom, int notificationStackHeight,
            float expandedHeight, float maxPanelHeight, int parentHeight, int keyguardStatusHeight,
            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;
        mMinTopMargin = minTopMargin + mContainerTopPadding;
        mMaxShadeBottom = maxShadeBottom;
        mMaxShadeBottom = maxShadeBottom;
        mNotificationStackHeight = notificationStackHeight;
        mNotificationStackHeight = notificationStackHeight;
@@ -140,6 +145,7 @@ public class KeyguardClockPositionAlgorithm {
        mDarkAmount = dark;
        mDarkAmount = dark;
        mCurrentlySecure = secure;
        mCurrentlySecure = secure;
        mTracking = tracking;
        mTracking = tracking;
        mBouncerTop = bouncerTop;
    }
    }


    public void run(Result result) {
    public void run(Result result) {
@@ -189,8 +195,10 @@ public class KeyguardClockPositionAlgorithm {
    private int getClockY() {
    private int getClockY() {
        // Dark: Align the bottom edge of the clock at about half of the screen:
        // Dark: Align the bottom edge of the clock at about half of the screen:
        final float clockYDark = getMaxClockY() + burnInPreventionOffsetY();
        final float clockYDark = getMaxClockY() + burnInPreventionOffsetY();
        float clockYRegular = getExpandedClockPosition();
        final float clockYRegular = getExpandedClockPosition();
        float clockYTarget = mCurrentlySecure ? mMinTopMargin : -mKeyguardStatusHeight;
        final boolean hasEnoughSpace = mMinTopMargin + mKeyguardStatusHeight < mBouncerTop;
        float clockYTarget = mCurrentlySecure && hasEnoughSpace ?
                mMinTopMargin : -mKeyguardStatusHeight;


        // Move clock up while collapsing the shade
        // Move clock up while collapsing the shade
        float shadeExpansion = mExpandedHeight / mMaxPanelHeight;
        float shadeExpansion = mExpandedHeight / mMaxPanelHeight;
+8 −1
Original line number Original line Diff line number Diff line
@@ -160,6 +160,7 @@ public class NotificationPanelView extends PanelView implements
    protected int mQsMinExpansionHeight;
    protected int mQsMinExpansionHeight;
    protected int mQsMaxExpansionHeight;
    protected int mQsMaxExpansionHeight;
    private int mQsPeekHeight;
    private int mQsPeekHeight;
    private int mBouncerTop;
    private boolean mStackScrollerOverscrolling;
    private boolean mStackScrollerOverscrolling;
    private boolean mQsExpansionFromOverscroll;
    private boolean mQsExpansionFromOverscroll;
    private float mLastOverscroll;
    private float mLastOverscroll;
@@ -476,7 +477,8 @@ public class NotificationPanelView extends PanelView implements
                    mKeyguardStatusView.getHeight(),
                    mKeyguardStatusView.getHeight(),
                    mDarkAmount,
                    mDarkAmount,
                    mStatusBar.isKeyguardCurrentlySecure(),
                    mStatusBar.isKeyguardCurrentlySecure(),
                    mTracking);
                    mTracking,
                    mBouncerTop);
            mClockPositionAlgorithm.run(mClockPositionResult);
            mClockPositionAlgorithm.run(mClockPositionResult);
            if (animate || mClockAnimator != null) {
            if (animate || mClockAnimator != null) {
                startClockAnimation(mClockPositionResult.clockX, mClockPositionResult.clockY);
                startClockAnimation(mClockPositionResult.clockX, mClockPositionResult.clockY);
@@ -550,6 +552,11 @@ public class NotificationPanelView extends PanelView implements
        return count;
        return count;
    }
    }


    public void setBouncerTop(int bouncerTop) {
        mBouncerTop = bouncerTop;
        positionClockAndNotifications();
    }

    private void startClockAnimation(int x, int y) {
    private void startClockAnimation(int x, int y) {
        if (mClockAnimationTargetX == x && mClockAnimationTargetY == y) {
        if (mClockAnimationTargetX == x && mClockAnimationTargetY == y) {
            return;
            return;
+7 −1
Original line number Original line Diff line number Diff line
@@ -135,10 +135,16 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        mFingerprintUnlockController = fingerprintUnlockController;
        mFingerprintUnlockController = fingerprintUnlockController;
        mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext,
        mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext,
                mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry);
                mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry);
        mContainer.addOnLayoutChangeListener(this::onContainerLayout);
        mNotificationPanelView = notificationPanelView;
        mNotificationPanelView = notificationPanelView;
        notificationPanelView.setExpansionListener(this::onPanelExpansionChanged);
        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) {
    private void onPanelExpansionChanged(float expansion, boolean tracking) {
        // We don't want to translate the bounce when:
        // 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
        // • 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) {
            if (expansion == 1) {
                mBouncer.onFullyHidden();
                mBouncer.onFullyHidden();
            } else if (!mBouncer.isShowing() && !mBouncer.isAnimatingAway()) {
            } else if (!mBouncer.isShowing() && !mBouncer.isAnimatingAway()) {
                mBouncer.show(false /* resetSecuritySelection */, false /* notifyFalsing */);
                mBouncer.show(false /* resetSecuritySelection */, false /* animated */);
            } else if (noLongerTracking) {
            } else if (noLongerTracking) {
                // Notify that falsing manager should stop its session when user stops touching,
                // 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
                // even before the animation ends, to guarantee that we're not recording sensitive