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

Commit c39acd23 authored by Michał Brzeziński's avatar Michał Brzeziński Committed by Automerger Merge Worker
Browse files

Merge "Fixing empty split shade after rotation from expanded QS on lockscreen"...

Merge "Fixing empty split shade after rotation from expanded QS on lockscreen" into tm-qpr-dev am: 58bc0c4c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18670152



Change-Id: If2f692f0f058858e851b81bda07051681dbcdd66
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 8028865f 58bc0c4c
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -22,18 +22,21 @@ package com.android.systemui.statusbar;
public class StatusBarState {

    /**
     * The status bar is in the "normal" shade mode.
     * The status bar is in the "normal", unlocked mode or the device is still locked but we're
     * accessing camera from power button double-tap shortcut.
     */
    public static final int SHADE = 0;

    /**
     * Status bar is currently the Keyguard.
     * Status bar is currently the Keyguard. In single column mode, when you swipe from the top of
     * the keyguard to expand QS immediately, it's still KEYGUARD state.
     */
    public static final int KEYGUARD = 1;

    /**
     * Status bar is in the special mode, where it is fully interactive but still locked. So
     * dismissing the shade will still show the bouncer.
     * Status bar is in the special mode, where it was transitioned from lockscreen to shade.
     * Depending on user's security settings, dismissing the shade will either show the
     * bouncer or go directly to unlocked {@link #SHADE} mode.
     */
    public static final int SHADE_LOCKED = 2;

+21 −8
Original line number Diff line number Diff line
@@ -1163,16 +1163,29 @@ public class NotificationPanelViewController extends PanelViewController {
        mKeyguardMediaController.refreshMediaPosition();

        if (splitShadeChanged) {
            // when we switch from split shade to regular shade we want to enforce setting qs to
            onSplitShadeEnabledChanged();
        }
    }

    private void onSplitShadeEnabledChanged() {
        // when we switch between split shade and regular shade we want to enforce setting qs to
        // the default state: expanded for split shade and collapsed otherwise
        if (!isOnKeyguard() && mPanelExpanded) {
            setQsExpanded(mSplitShadeEnabled);
        }
        if (isOnKeyguard() && mQsExpanded && mSplitShadeEnabled) {
            // In single column keyguard - when you swipe from the top - QS is fully expanded and
            // StatusBarState is KEYGUARD. That state doesn't make sense for split shade,
            // where notifications are always visible and we effectively go to fully expanded
            // shade, that is SHADE_LOCKED.
            // Also we might just be switching from regular expanded shade, so we don't want
            // to force state transition if it's already correct.
            mStatusBarStateController.setState(StatusBarState.SHADE_LOCKED, /* force= */false);
        }
        updateClockAppearance();
        updateQsState();
        mNotificationStackScrollLayoutController.updateFooter();
    }
    }

    private View reInflateStub(int viewId, int stubId, int layoutId, boolean enabled) {
        View view = mView.findViewById(viewId);
+10 −0
Original line number Diff line number Diff line
@@ -1005,6 +1005,16 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
        verify(mTapAgainViewController).show();
    }

    @Test
    public void testRotatingToSplitShadeWithQsExpanded_transitionsToShadeLocked() {
        mStatusBarStateController.setState(KEYGUARD);
        mNotificationPanelViewController.setQsExpanded(true);

        enableSplitShade(true);

        assertThat(mStatusBarStateController.getState()).isEqualTo(SHADE_LOCKED);
    }

    @Test
    public void testSwitchesToCorrectClockInSinglePaneShade() {
        mStatusBarStateController.setState(KEYGUARD);