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

Commit c5cd1325 authored by Feng Cao's avatar Feng Cao Committed by Android (Google) Code Review
Browse files

Merge "Fix augmented autofill window positioning to be right below the input field."

parents f445d59c 023b84c3
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -163,14 +163,15 @@ public final class FillWindow implements AutoCloseable {
            final int height = rect.bottom - rect.top;
            final int width = rect.right - rect.left;
            final WindowManager.LayoutParams windowParams = window.getAttributes();
            windowParams.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
            windowParams.y = rect.top - height;
            windowParams.gravity = Gravity.TOP | Gravity.LEFT;
            windowParams.y = rect.top + height;
            windowParams.height = height;
            windowParams.x = rect.left;
            windowParams.width = width;

            window.setAttributes(windowParams);
            window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
            window.setBackgroundDrawableResource(android.R.color.transparent);

            mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            final ViewGroup.LayoutParams diagParams = new ViewGroup.LayoutParams(width, height);
+5 −5
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ import java.util.List;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

//TODO: use java.lang.ref.Cleaner once Android supports Java 9
import sun.misc.Cleaner;

@@ -2966,12 +2965,13 @@ public final class AutofillManager {
            if (afm == null) return null;

            final View view = afm.getClient().autofillClientFindViewByAutofillIdTraversal(id);
            // TODO(b/111330312): optimize (for example, use temp rect from attach info) and
            // fix (for example, take system status bar height into account) logic below
            final Rect windowVisibleDisplayFrame = new Rect();
            view.getWindowVisibleDisplayFrame(windowVisibleDisplayFrame);
            final int[] location = new int[2];
            view.getLocationOnScreen(location);
            final Rect rect = new Rect(location[0], location[1], location[0] + view.getWidth(),
                    location[1] + view.getHeight());
            final Rect rect = new Rect(location[0], location[1] - windowVisibleDisplayFrame.top,
                    location[0] + view.getWidth(),
                    location[1] - windowVisibleDisplayFrame.top + view.getHeight());
            if (sVerbose) {
                Log.v(TAG, "Coordinates for " + id + ": " + rect);
            }