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

Commit ddec8fb4 authored by Michael Wright's avatar Michael Wright
Browse files

Add support for ACTION_OUTSIDE to Dialog

Historically, Dialogs expected to be fullscreen in order to know when to
close.  By adding support for ACTION_OUTSIDE, they can now close when
the user touches outside of them without actually having to be
fullscreen

Bug: 62373955
Test: cts-tradefed run commandAndExit cts-dev \
      -m CtsAutoFillServiceTestCases -t \
      android.autofillservice.cts.LoginActivityTest#testSaveGoesAwayWhenTouchingOutside
Change-Id: I9cd2afc093ee6f252aaf6c23c029059584879004
parent 5472f2b3
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1242,8 +1242,10 @@ public abstract class Window {

    /** @hide */
    public boolean shouldCloseOnTouch(Context context, MotionEvent event) {
        if (mCloseOnTouchOutside && event.getAction() == MotionEvent.ACTION_DOWN
                && isOutOfBounds(context, event) && peekDecorView() != null) {
        final boolean isOutside =
                event.getAction() == MotionEvent.ACTION_DOWN && isOutOfBounds(context, event)
                || event.getAction() == MotionEvent.ACTION_OUTSIDE;
        if (mCloseOnTouchOutside && peekDecorView() != null && isOutside) {
            return true;
        }
        return false;