My app includes an Input Method Service with a special button that brings up a dialog. For users with Android 9, this dialog is not displayed correctly, only the part above the IME is visible:
The code to create the dialog is
AlertDialog dialog = builder.create();
Window window = dialog.getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
lp.token = inputView.getWindowToken();
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
window.setAttributes(lp);
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
dialog.show();
which is the same as described in https://stackoverflow.com/a/13962770/292233
I also tried TYPE_APPLICATION_PANEL
as suggested in https://stackoverflow.com/a/3508462/292233 but this doesn't help either.
Is there any easy fix to this?