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

Commit 4a21a7fa authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed Focusability issues with heads up

The panel was focusable when a heads up came in which
lead to several bugs. Sometimes the user was not able to
type anymore and focus listeners fired.

Bug: 21153703
Bug: 20892889
Change-Id: Iab86e651ef827767225ca092bb2c1e3fe1ddf385
parent 5deaa138
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ public class NotificationPanelView extends PanelView implements
     * intercepted yet.
     */
    private boolean mIntercepting;
    private boolean mPanelExpanded;
    private boolean mQsExpanded;
    private boolean mQsExpandedWhenExpandingStarted;
    private boolean mQsFullyExpanded;
@@ -1496,13 +1497,22 @@ public class NotificationPanelView extends PanelView implements
        updateHeader();
        updateUnlockIcon();
        updateNotificationTranslucency();
        mHeadsUpManager.setIsExpanded(!isFullyCollapsed());
        updatePanelExpanded();
        mNotificationStackScroller.setShadeExpanded(!isFullyCollapsed());
        if (DEBUG) {
            invalidate();
        }
    }

    private void updatePanelExpanded() {
        boolean isExpanded = !isFullyCollapsed();
        if (mPanelExpanded != isExpanded) {
            mHeadsUpManager.setIsExpanded(isExpanded);
            mStatusBar.setPanelExpanded(isExpanded);
            mPanelExpanded = isExpanded;
        }
    }

    /**
     * @return a temporary override of {@link #mQsMaxExpansionHeight}, which is needed when
     *         collapsing QS / the panel when QS was scrolled
+6 −2
Original line number Diff line number Diff line
@@ -1967,6 +1967,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        return !mUnlockMethodCache.isCurrentlyInsecure();
    }

    public void setPanelExpanded(boolean isExpanded) {
        mStatusBarWindowManager.setPanelExpanded(isExpanded);
    }

    /**
     * All changes to the status bar and notifications funnel through here and are batched.
     */
@@ -2027,7 +2031,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,

        // Expand the window to encompass the full screen in anticipation of the drag.
        // This is only possible to do atomically because the status bar is at the top of the screen!
        mStatusBarWindowManager.setStatusBarExpanded(true);
        mStatusBarWindowManager.setPanelVisible(true);
        mStatusBarView.setFocusable(false);

        visibilityChanged(true);
@@ -2156,7 +2160,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        visibilityChanged(false);

        // Shrink the window to the size of the status bar only
        mStatusBarWindowManager.setStatusBarExpanded(false);
        mStatusBarWindowManager.setPanelVisible(false);
        mStatusBarWindowManager.setForceStatusBarVisible(false);
        mStatusBarView.setFocusable(true);

+14 −8
Original line number Diff line number Diff line
@@ -114,12 +114,12 @@ public class StatusBarWindowManager {
    }

    private void applyFocusableFlag(State state) {
        boolean panelFocusable = state.statusBarFocusable && state.panelExpanded;
        if (state.isKeyguardShowingAndNotOccluded() && state.keyguardNeedsInput
                && state.bouncerShowing
                || BaseStatusBar.ENABLE_REMOTE_INPUT && state.statusBarExpanded) {
                && state.bouncerShowing || BaseStatusBar.ENABLE_REMOTE_INPUT && panelFocusable) {
            mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
            mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
        } else if (state.isKeyguardShowingAndNotOccluded() || state.statusBarFocusable) {
        } else if (state.isKeyguardShowingAndNotOccluded() || panelFocusable) {
            mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
            mLpChanged.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
        } else {
@@ -130,7 +130,7 @@ public class StatusBarWindowManager {

    private void applyHeight(State state) {
        boolean expanded = !state.forceCollapsed && (state.isKeyguardShowingAndNotOccluded()
                || state.statusBarExpanded || state.keyguardFadingAway || state.bouncerShowing
                || state.panelVisible || state.keyguardFadingAway || state.bouncerShowing
                || state.headsUpShowing);
        if (expanded) {
            mLpChanged.height = ViewGroup.LayoutParams.MATCH_PARENT;
@@ -213,9 +213,9 @@ public class StatusBarWindowManager {
        apply(mCurrentState);
    }

    public void setStatusBarExpanded(boolean expanded) {
        mCurrentState.statusBarExpanded = expanded;
        mCurrentState.statusBarFocusable = expanded;
    public void setPanelVisible(boolean visible) {
        mCurrentState.panelVisible = visible;
        mCurrentState.statusBarFocusable = visible;
        apply(mCurrentState);
    }

@@ -267,11 +267,17 @@ public class StatusBarWindowManager {
        apply(mCurrentState);
    }

    public void setPanelExpanded(boolean isExpanded) {
        mCurrentState.panelExpanded = isExpanded;
        apply(mCurrentState);
    }

    private static class State {
        boolean keyguardShowing;
        boolean keyguardOccluded;
        boolean keyguardNeedsInput;
        boolean statusBarExpanded;
        boolean panelVisible;
        boolean panelExpanded;
        boolean statusBarFocusable;
        boolean bouncerShowing;
        boolean keyguardFadingAway;