diff options
| author | 2018-04-03 11:36:51 -0700 | |
|---|---|---|
| committer | 2018-04-04 11:36:40 -0700 | |
| commit | 640e9b9bf4b031f9df75178d2049d88f02755524 (patch) | |
| tree | 30b2d1744f149a24347732fa23afa0f9539e1167 | |
| parent | fd533c751b31ea584c1aee29175b74718a191247 (diff) | |
autofill: fix window location in splitwindow and dialog
autofill should use relative location to app window as PopupWindow
is based on relative location.
The fixed reverted changes made in compatibility mode CL that made
autofill window TYPE_SYSTEM_DIALOG.
Changing PopupWindow to use absolute screen location is another fix
choice, but it does not allow autofill window to be automatically
moved when app window changes location (e.g. adjust split window
separator or bring up IME)
The autofill window switches to TYPE_APPLICATION_ABOVE_SUB_PANEL with
IME disabled. So it still appears above IME and most other app
windows, unless app window is TYPE_APPLICATION_ABOVE_SUB_PANEL too.
Fixes: 73555917
Bug: 77587135
Test: manually tested compability mode with chrome amazon login
manually tested splitted window
atest CtsAutoFillServiceTestCases
Change-Id: I6b8ecf3fe7a91cebea1f7a868f4b15fbed8b0051
| -rw-r--r-- | core/java/android/view/autofill/AutofillPopupWindow.java | 6 | ||||
| -rw-r--r-- | services/autofill/java/com/android/server/autofill/ui/FillUi.java | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/core/java/android/view/autofill/AutofillPopupWindow.java b/core/java/android/view/autofill/AutofillPopupWindow.java index 1da998d01ba3..9b4924857983 100644 --- a/core/java/android/view/autofill/AutofillPopupWindow.java +++ b/core/java/android/view/autofill/AutofillPopupWindow.java @@ -79,6 +79,12 @@ public class AutofillPopupWindow extends PopupWindow { public AutofillPopupWindow(@NonNull IAutofillWindowPresenter presenter) { mWindowPresenter = new WindowPresenter(presenter); + // Here is a bit of voodoo - we want to show the window as system + // controlled one so it covers app windows, but at the same time it has to be + // an application type (so it's contained inside the application area). + // Hence, we set it to the application type with the highest z-order, which currently + // is TYPE_APPLICATION_ABOVE_SUB_PANEL. + setWindowLayoutType(WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL); setTouchModal(false); setOutsideTouchable(true); setInputMethodMode(INPUT_METHOD_NOT_NEEDED); 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 7c0671ff5e1b..d29ca051ad94 100644 --- a/services/autofill/java/com/android/server/autofill/ui/FillUi.java +++ b/services/autofill/java/com/android/server/autofill/ui/FillUi.java @@ -656,6 +656,8 @@ final class FillUi { private final WindowManager mWm; private final View mContentView; private boolean mShowing; + // Used on dump only + private WindowManager.LayoutParams mShowParams; /** * Constructor. @@ -672,16 +674,13 @@ final class FillUi { * Shows the window. */ public void show(WindowManager.LayoutParams params) { + mShowParams = params; if (sVerbose) { Slog.v(TAG, "show(): showing=" + mShowing + ", params=" + paramsToString(params)); } try { - // Okay here is a bit of voodoo - we want to show the window as system - // controlled one so it covers app windows - adjust the params accordingly. - params.type = WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG; - params.token = null; params.packageName = "android"; - params.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; + params.setTitle("Autofill UI"); // Title is set for debugging purposes if (!mShowing) { params.accessibilityTitle = mContentView.getContext() .getString(R.string.autofill_picker_accessibility_title); @@ -760,6 +759,9 @@ final class FillUi { pw.println(); pw.print(prefix2); pw.print("showing: "); pw.println(mWindow.mShowing); pw.print(prefix2); pw.print("view: "); pw.println(mWindow.mContentView); + if (mWindow.mShowParams != null) { + pw.print(prefix2); pw.print("params: "); pw.println(mWindow.mShowParams); + } pw.print(prefix2); pw.print("screen coordinates: "); if (mWindow.mContentView == null) { pw.println("N/A"); |