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

Commit 010b993e authored by Feng Cao's avatar Feng Cao
Browse files

Fix augmented autofill UI.

Test: manual verification

Bug: 120559640

Change-Id: Ifa6df41945c38e6fbb9a0505b66be50cb202337c
parent b78f9295
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.service.autofill.augmented.AugmentedAutofillService.AutofillProxy
import android.service.autofill.augmented.PresentationParams.Area;
import android.util.Log;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
@@ -140,10 +141,24 @@ public final class FillWindow implements AutoCloseable {
            // TODO(b/111330312): make sure all touch events are handled, window is always closed,
            // etc.

            mDialog = new Dialog(rootView.getContext());
            mDialog = new Dialog(rootView.getContext()) {
                @Override
                public boolean onTouchEvent(MotionEvent event) {
                    if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                        FillWindow.this.destroy();
                    }
                    return false;
                }
            };
            mCloseGuard.open("destroy");
            final Window window = mDialog.getWindow();
            window.setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
            // Makes sure touch outside the dialog is received by the window behind the dialog.
            window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
            // Makes sure the touch outside the dialog is received by the dialog to dismiss it.
            window.addFlags(WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH);
            // Makes sure keyboard shows up.
            window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

            final int height = rect.bottom - rect.top;
            final int width = rect.right - rect.left;