Loading services/core/java/com/android/server/wm/ActivityRecord.java +6 −5 Original line number Diff line number Diff line Loading @@ -6456,14 +6456,15 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A @Override public boolean matchParentBounds() { if (super.matchParentBounds() && mCompatDisplayInsets == null) { final Rect overrideBounds = getResolvedOverrideBounds(); if (overrideBounds.isEmpty()) { return true; } // An activity in size compatibility mode may have resolved override bounds, so the exact // bounds should also be checked. Otherwise IME window will show with offset. See // {@link DisplayContent#isImeAttachedToApp}. // An activity in size compatibility mode may have override bounds which equals to its // parent bounds, so the exact bounds should also be checked to allow IME window to attach // to the activity. See {@link DisplayContent#isImeAttachedToApp}. final WindowContainer parent = getParent(); return parent == null || parent.getBounds().equals(getResolvedOverrideBounds()); return parent == null || parent.getBounds().equals(overrideBounds); } @Override Loading services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +7 −0 Original line number Diff line number Diff line Loading @@ -251,6 +251,13 @@ public class SizeCompatTests extends ActivityTestsBase { mActivity.mDisplayContent.mInputMethodTarget = addWindowToActivity(mActivity); // Make sure IME cannot attach to the app, otherwise IME window will also be shifted. assertFalse(mActivity.mDisplayContent.isImeAttachedToApp()); // Recompute the natural configuration without resolving size compat configuration. mActivity.clearSizeCompatMode(); mActivity.onConfigurationChanged(mTask.getConfiguration()); // It should keep non-attachable because the resolved bounds will be computed according to // the aspect ratio that won't match its parent bounds. assertFalse(mActivity.mDisplayContent.isImeAttachedToApp()); } @Test Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +6 −5 Original line number Diff line number Diff line Loading @@ -6456,14 +6456,15 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A @Override public boolean matchParentBounds() { if (super.matchParentBounds() && mCompatDisplayInsets == null) { final Rect overrideBounds = getResolvedOverrideBounds(); if (overrideBounds.isEmpty()) { return true; } // An activity in size compatibility mode may have resolved override bounds, so the exact // bounds should also be checked. Otherwise IME window will show with offset. See // {@link DisplayContent#isImeAttachedToApp}. // An activity in size compatibility mode may have override bounds which equals to its // parent bounds, so the exact bounds should also be checked to allow IME window to attach // to the activity. See {@link DisplayContent#isImeAttachedToApp}. final WindowContainer parent = getParent(); return parent == null || parent.getBounds().equals(getResolvedOverrideBounds()); return parent == null || parent.getBounds().equals(overrideBounds); } @Override Loading
services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +7 −0 Original line number Diff line number Diff line Loading @@ -251,6 +251,13 @@ public class SizeCompatTests extends ActivityTestsBase { mActivity.mDisplayContent.mInputMethodTarget = addWindowToActivity(mActivity); // Make sure IME cannot attach to the app, otherwise IME window will also be shifted. assertFalse(mActivity.mDisplayContent.isImeAttachedToApp()); // Recompute the natural configuration without resolving size compat configuration. mActivity.clearSizeCompatMode(); mActivity.onConfigurationChanged(mTask.getConfiguration()); // It should keep non-attachable because the resolved bounds will be computed according to // the aspect ratio that won't match its parent bounds. assertFalse(mActivity.mDisplayContent.isImeAttachedToApp()); } @Test Loading