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

Commit 6d53de63 authored by Adrian Roos's avatar Adrian Roos
Browse files

DirectReply: Close if touching outside status bar

Close direct reply when a touch outside the status bar window
happens. This is especially important with HUNs, where we allow
the touch to go through to the underlying window.

Change-Id: I12b9cbd5c699b86bcf1f56723a2f0ac5de7e5a42
Test: Receive SMS while unlocked, click Reply on heads-up notification, click in between notification and IME. Verify direct reply closes.
Fixes: 32022071
parent 52a9e0e1
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -745,6 +745,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                checkUserAutohide(v, event);
                checkRemoteInputOutside(event);
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    if (mExpandedVisible) {
                        animateCollapsePanels();
@@ -3203,6 +3204,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        }
    }

    private void checkRemoteInputOutside(MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_OUTSIDE // touch outside the source bar
                && event.getX() == 0 && event.getY() == 0  // a touch outside both bars
                && mRemoteInputController.isRemoteInputActive()) {
            mRemoteInputController.closeRemoteInputs();
        }
    }

    private void userAutohide() {
        cancelAutohide();
        mHandler.postDelayed(mAutohide, 350); // longer than app gesture -> flag clear