Merge "Fix NavigationBar overlapping with the IME window" into sc-dev
This commit is contained in:
@@ -758,11 +758,15 @@ class WindowToken extends WindowContainer<WindowState> {
|
||||
|
||||
/** @see WindowState#freezeInsetsState() */
|
||||
void setInsetsFrozen(boolean freeze) {
|
||||
if (freeze) {
|
||||
forAllWindows(WindowState::freezeInsetsState, true /* traverseTopToBottom */);
|
||||
} else {
|
||||
forAllWindows(WindowState::clearFrozenInsetsState, true /* traverseTopToBottom */);
|
||||
}
|
||||
forAllWindows(w -> {
|
||||
if (w.mToken == this) {
|
||||
if (freeze) {
|
||||
w.freezeInsetsState();
|
||||
} else {
|
||||
w.clearFrozenInsetsState();
|
||||
}
|
||||
}
|
||||
}, true /* traverseTopToBottom */);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.view.InsetsState.ITYPE_IME;
|
||||
import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||
@@ -250,4 +251,29 @@ public class WindowTokenTests extends WindowTestsBase {
|
||||
|
||||
verify(selectFunc).apply(token2.windowType, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that {@link WindowToken#setInsetsFrozen(boolean)} will set the frozen insets
|
||||
* states for its children windows and by default it shouldn't let IME window setting
|
||||
* the frozen insets state even the window of the window token is the IME layering target.
|
||||
*/
|
||||
@UseTestDisplay(addWindows = W_INPUT_METHOD)
|
||||
@Test
|
||||
public void testSetInsetsFrozen_notAffectImeWindowState() {
|
||||
// Pre-condition: make the IME window be controlled by IME insets provider.
|
||||
mDisplayContent.getInsetsStateController().getSourceProvider(ITYPE_IME).setWindow(
|
||||
mDisplayContent.mInputMethodWindow, null, null);
|
||||
|
||||
// Simulate an app window to be the IME layering target, assume the app window has no
|
||||
// frozen insets state by default.
|
||||
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
|
||||
mDisplayContent.setImeLayeringTarget(app);
|
||||
assertNull(app.getFrozenInsetsState());
|
||||
assertTrue(app.isImeLayeringTarget());
|
||||
|
||||
// Verify invoking setInsetsFrozen shouldn't let IME window setting the frozen insets state.
|
||||
app.mToken.setInsetsFrozen(true);
|
||||
assertNotNull(app.getFrozenInsetsState());
|
||||
assertNull(mDisplayContent.mInputMethodWindow.getFrozenInsetsState());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user