Order non-app window containers.
- Add non-app window tokens to the display child container based on
their base layer so the highest based layer is z-ordered on-top.
- Separated DisplayContent.mNonAppWindowContainers into
mAboveAppWindowContainer and mBelowAppWindowContainer where the former
contains non-app windows that should be z-ordered on-top of all app
windows and the later contains non-app windows that should be
z-ordered below app windows.
- Change wallpaper base layer to 1 so that it is always below all other
window types.
- Add Ime related windows/tokens to DisplayContent.mImeWindowContainers
so that we can track them together
- Use alternative binder token when adding window TYPE_INPUT_METHOD_DIALOG
so that it can properly be associated as an IME token in WM vs. with
system_server or sys-ui token.
Test: Existing tests pass.
Bug: 30060889
Change-Id: Ib53e09af12545868c3741d83aaccb7311c872b41
diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java
index 6e871a8..2c4cfb9 100644
--- a/services/core/java/com/android/server/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/InputMethodManagerService.java
@@ -16,7 +16,9 @@
package com.android.server;
import static android.view.Display.DEFAULT_DISPLAY;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
+import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
import static java.lang.annotation.RetentionPolicy.SOURCE;
import com.android.internal.content.PackageMonitor;
@@ -113,6 +115,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManagerInternal;
import android.view.inputmethod.EditorInfo;
@@ -468,6 +471,7 @@
private AlertDialog.Builder mDialogBuilder;
private AlertDialog mSwitchingDialog;
+ private IBinder mSwitchingDialogToken = new Binder();
private View mSwitchingDialogTitleView;
private Toast mSubtypeSwitchedByShortCutToast;
private InputMethodInfo[] mIms;
@@ -3288,11 +3292,16 @@
mSwitchingDialog = mDialogBuilder.create();
mSwitchingDialog.setCanceledOnTouchOutside(true);
- mSwitchingDialog.getWindow().setType(
- WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG);
- mSwitchingDialog.getWindow().getAttributes().privateFlags |=
- WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
- mSwitchingDialog.getWindow().getAttributes().setTitle("Select input method");
+ final Window w = mSwitchingDialog.getWindow();
+ final WindowManager.LayoutParams attrs = w.getAttributes();
+ w.setType(TYPE_INPUT_METHOD_DIALOG);
+ // Use an alternate token for the dialog for that window manager can group the token
+ // with other IME windows based on type vs. grouping based on whichever token happens
+ // to get selected by the system later on.
+ attrs.token = mSwitchingDialogToken;
+ attrs.privateFlags |= PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
+ attrs.setTitle("Select input method");
+ w.setAttributes(attrs);
updateSystemUi(mCurToken, mImeWindowVis, mBackDisposition);
mSwitchingDialog.show();
}