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

Commit 875b9b7a authored by Peter Kalauskas's avatar Peter Kalauskas
Browse files

Fix visibility issue in QS detail panels

Fixes visibility issue where keyguard could enter a bad state where QS
remains visible even though it should be hidden.

Previously, keyguard could enter a bad state if QS was closed while it
had a detail panel open that had animations disabled.

To fix issue, run animations when closing detail panels, even if they
requested not to be animated on close.

Test: Turn off all animations (i.e. adb shell 'settings put global
      animator_duration_scale 0.0 && settings put global
      transition_animation_scale 0.0 && settings put global
      window_animation_scale 0.0'), open QS, tap user icon, tap close,
      ensure you are taken back to the lock screen and that the UI looks
      normal
Test: Rapidly tap the user icon and bottom of keyguard in quick
      succession, ensure that keyguard UI never enters a bad state
Fixes: 193549640
Fixes: 193545214
Change-Id: Ie092f83031edaff0240194832b5499df3b4eab12
parent 00b9b119
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -72,7 +72,8 @@ public interface DetailAdapter {
    }

    /**
     * @return if detail panel should animate when shown or closed
     * Indicates whether the detail view wants to animate when shown. This has no affect over the
     * closing animation. Detail panels will always animate when closed.
     */
    default boolean shouldAnimate() {
        return true;
+14 −4
Original line number Diff line number Diff line
@@ -212,6 +212,11 @@ public class QSDetail extends LinearLayout {
                Dependency.get(CommandQueue.class).animateCollapsePanels();
                mTriggeredExpand = false;
            }
            // Always animate on close, even if the last opened detail adapter had shouldAnimate()
            // return false. This is necessary to avoid a race condition which could leave the
            // keyguard in a bad state where QS remains visible underneath the notifications, clock,
            // and status area.
            mShouldAnimate = true;
        }

        boolean visibleDiff = wasShowingDetail != showingDetail;
@@ -245,11 +250,16 @@ public class QSDetail extends LinearLayout {
            mClosingDetail = true;
            mDetailAdapter = null;
            listener = mTeardownDetailWhenDone;
            // Only update visibility if already expanded. Otherwise, a race condition can cause the
            // keyguard to enter a bad state where the QS tiles are displayed underneath the
            // notifications, clock, and status area.
            if (mQsPanelController.isExpanded()) {
                mHeader.setVisibility(View.VISIBLE);
                mFooter.setVisibility(View.VISIBLE);
                mQsPanelController.setGridContentVisibility(true);
                mQsPanelCallback.onScanStateChanged(false);
            }
        }
        sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
        animateDetailVisibleDiff(x, y, visibleDiff, listener);
        if (mContainer != null) {
+4 −1
Original line number Diff line number Diff line
@@ -1571,7 +1571,10 @@ public class NotificationPanelViewController extends PanelViewController {
    public void expandWithQsDetail(DetailAdapter qsDetailAdapter) {
        traceQsJank(true /* startTracing */, false /* wasCancelled */);
        flingSettings(0 /* velocity */, FLING_EXPAND);
        mQSDetailDisplayer.showDetailAdapter(qsDetailAdapter, 0, 0);
        // When expanding with a panel, there's no meaningful touch point to correspond to. Set the
        // origin to somewhere above the screen. This is used for animations.
        int x = mQsFrame.getWidth() / 2;
        mQSDetailDisplayer.showDetailAdapter(qsDetailAdapter, x, -getHeight());
        if (mAccessibilityManager.isEnabled()) {
            mView.setAccessibilityPaneTitle(determineAccessibilityPaneTitle());
        }
+3 −1
Original line number Diff line number Diff line
@@ -148,8 +148,10 @@ public class QSDetailTest extends SysuiTestCase {
                eq(true) /* in */, any());
        clearInvocations(mQsDetail.mClipper);

        // Detail adapters should always animate on close. shouldAnimate() should only affect the
        // open transition
        mQsDetail.handleShowingDetail(null, 0, 0, false);
        verify(mQsDetail.mClipper).updateCircularClip(eq(false) /* animate */, anyInt(), anyInt(),
        verify(mQsDetail.mClipper).updateCircularClip(eq(true) /* animate */, anyInt(), anyInt(),
                eq(false) /* in */, any());
    }