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
This commit is contained in:
Adrian Roos
2016-12-19 16:17:50 -08:00
parent 52a9e0e1dd
commit 6d53de63bb

View File

@@ -745,6 +745,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
@Override @Override
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
checkUserAutohide(v, event); checkUserAutohide(v, event);
checkRemoteInputOutside(event);
if (event.getAction() == MotionEvent.ACTION_DOWN) { if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (mExpandedVisible) { if (mExpandedVisible) {
animateCollapsePanels(); 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() { private void userAutohide() {
cancelAutohide(); cancelAutohide();
mHandler.postDelayed(mAutohide, 350); // longer than app gesture -> flag clear mHandler.postDelayed(mAutohide, 350); // longer than app gesture -> flag clear