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

Commit 1caf7eb5 authored by John Spurlock's avatar John Spurlock
Browse files

Don't always auto-collapse an empty notification shade.

If the user is actively interacting with the shade, don't
collapse it from underneath them.

Bug:10226720
Change-Id: Idf26c8f59dc5a1a5ae3b4314f1ca81740b0517e7
parent e9a6f971
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -967,7 +967,8 @@ public class PhoneStatusBar extends BaseStatusBar {
                mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
            }

            if (CLOSE_PANEL_WHEN_EMPTIED && mNotificationData.size() == 0) {
            if (CLOSE_PANEL_WHEN_EMPTIED && mNotificationData.size() == 0
                    && !mStatusBarWindow.isPointerDown()) {
                animateCollapsePanels();
            }
        }
+18 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ public class StatusBarWindowView extends FrameLayout
    private NotificationRowLayout latestItems;
    private NotificationPanelView mNotificationPanel;
    private ScrollView mScrollView;
    private boolean mPointerDown;

    PhoneStatusBar mService;

@@ -86,6 +87,7 @@ public class StatusBarWindowView extends FrameLayout

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        registerPointer(ev);
        boolean intercept = false;
        if (mNotificationPanel.isFullyExpanded() && mScrollView.getVisibility() == View.VISIBLE) {
            intercept = mExpandHelper.onInterceptTouchEvent(ev);
@@ -131,5 +133,21 @@ public class StatusBarWindowView extends FrameLayout
            mExpandHelper.cancel();
        }
    }

    private void registerPointer(MotionEvent event) {
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                mPointerDown = true;
                break;
            case MotionEvent.ACTION_CANCEL:
            case MotionEvent.ACTION_UP:
                mPointerDown = false;
                break;
        }
    }

    public boolean isPointerDown() {
        return mPointerDown;
    }
}