From 4745fb6b29322819fdcd21647253bfed8e508137 Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Thu, 4 May 2017 18:31:24 -0700 Subject: [PATCH] Fixed placemente of Autofill UI for virtual views. The PopupWindow anchoring offset should be based on the bottom of the anchor view, but we were using top. Hence, the PopupWindow.tryFitVertical() was failing to place it above the view in some cases, even when there was plenty of space. Fixes: 37991460 Test: manual verification with virtual view sample Test: CtsAutoFillServiceTestCases pass Change-Id: Iffdfe0d7858e865192338184d63bf5b93ba7108f --- core/java/android/app/Activity.java | 2 +- .../java/com/android/server/autofill/ui/FillUi.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 4f6c0c9d8f916..abe5dc3479636 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -7443,7 +7443,7 @@ public class Activity extends ContextThemeWrapper final int offsetX = (anchorBounds != null) ? anchorBounds.left - actualAnchorBounds.left : 0; int offsetY = (anchorBounds != null) - ? anchorBounds.top - actualAnchorBounds.top : 0; + ? anchorBounds.bottom - actualAnchorBounds.bottom : 0; final boolean wasShowing; diff --git a/services/autofill/java/com/android/server/autofill/ui/FillUi.java b/services/autofill/java/com/android/server/autofill/ui/FillUi.java index dd297a645436c..6015be03083bd 100644 --- a/services/autofill/java/com/android/server/autofill/ui/FillUi.java +++ b/services/autofill/java/com/android/server/autofill/ui/FillUi.java @@ -16,6 +16,7 @@ package com.android.server.autofill.ui; import static com.android.server.autofill.Helper.sDebug; +import static com.android.server.autofill.Helper.sVerbose; import android.annotation.NonNull; import android.annotation.Nullable; @@ -334,6 +335,11 @@ final class FillUi { @Override public void show(WindowManager.LayoutParams p, Rect transitionEpicenter, boolean fitsSystemWindows, int layoutDirection) { + if (sVerbose) { + Slog.v(TAG, "AutofillWindowPresenter.show(): fit=" + fitsSystemWindows + + ", epicenter="+ transitionEpicenter + ", dir=" + layoutDirection + + ", params=" + p); + } UiThread.getHandler().post(() -> mWindow.show(p)); }