Loading services/core/java/com/android/server/wm/WindowState.java +1 −1 Original line number Diff line number Diff line Loading @@ -765,7 +765,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // If the task has temp inset bounds set, we have to make sure all its windows uses // the temp inset frame. Otherwise different display frames get applied to the main // window and the child window, making them misaligned. if (inFullscreenContainer) { if (inFullscreenContainer || isLetterboxedAppWindow()) { mInsetFrame.setEmpty(); } else if (task != null && isInMultiWindowMode()) { task.getTempInsetBounds(mInsetFrame); Loading services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java +44 −0 Original line number Diff line number Diff line Loading @@ -363,6 +363,50 @@ public class WindowFrameTests extends WindowTestsBase { Math.min(pf.height(), displayInfo.logicalHeight)); } @Test public void testLayoutLetterboxedWindow() { // First verify task behavior in multi-window mode. final DisplayInfo displayInfo = sWm.getDefaultDisplayContentLocked().getDisplayInfo(); final int logicalWidth = displayInfo.logicalWidth; final int logicalHeight = displayInfo.logicalHeight; final int taskLeft = logicalWidth / 5; final int taskTop = logicalHeight / 5; final int taskRight = logicalWidth / 4 * 3; final int taskBottom = logicalHeight / 4 * 3; final Rect taskBounds = new Rect(taskLeft, taskTop, taskRight, taskBottom); TaskWithBounds task = new TaskWithBounds(taskBounds); task.mInsetBounds.set(taskLeft, taskTop, taskRight, taskBottom); task.mFullscreenForTest = false; WindowState w = createWindow(task, FILL_PARENT, FILL_PARENT); w.mAttrs.gravity = Gravity.LEFT | Gravity.TOP; final Rect pf = new Rect(0, 0, logicalWidth, logicalHeight); w.computeFrameLw(pf /* parentFrame */, pf /* displayFrame */, pf /* overscanFrame */, pf /* contentFrame */, pf /* visibleFrame */, pf /* decorFrame */, pf /* stableFrame */, null /* outsetFrame */); // For non fullscreen tasks the containing frame is based off the // task bounds not the parent frame. assertRect(w.mFrame, taskLeft, taskTop, taskRight, taskBottom); assertRect(w.getContentFrameLw(), taskLeft, taskTop, taskRight, taskBottom); assertRect(w.mContentInsets, 0, 0, 0, 0); // Now simulate switch to fullscreen for letterboxed app. final int xInset = logicalWidth / 10; final int yInset = logicalWidth / 10; final Rect cf = new Rect(xInset, yInset, logicalWidth - xInset, logicalHeight - yInset); w.mAppToken.onOverrideConfigurationChanged(w.mAppToken.getOverrideConfiguration(), cf); pf.set(0, 0, logicalWidth, logicalHeight); task.mFullscreenForTest = true; w.computeFrameLw(pf /* parentFrame */, pf /* displayFrame */, pf /* overscanFrame */, cf /* contentFrame */, cf /* visibleFrame */, pf /* decorFrame */, cf /* stableFrame */, null /* outsetFrame */); assertEquals(cf, w.mFrame); assertEquals(cf, w.getContentFrameLw()); assertRect(w.mContentInsets, 0, 0, 0, 0); } private WindowStateWithTask createWindow(Task task, int width, int height) { final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(TYPE_APPLICATION); attrs.width = width; Loading Loading
services/core/java/com/android/server/wm/WindowState.java +1 −1 Original line number Diff line number Diff line Loading @@ -765,7 +765,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // If the task has temp inset bounds set, we have to make sure all its windows uses // the temp inset frame. Otherwise different display frames get applied to the main // window and the child window, making them misaligned. if (inFullscreenContainer) { if (inFullscreenContainer || isLetterboxedAppWindow()) { mInsetFrame.setEmpty(); } else if (task != null && isInMultiWindowMode()) { task.getTempInsetBounds(mInsetFrame); Loading
services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java +44 −0 Original line number Diff line number Diff line Loading @@ -363,6 +363,50 @@ public class WindowFrameTests extends WindowTestsBase { Math.min(pf.height(), displayInfo.logicalHeight)); } @Test public void testLayoutLetterboxedWindow() { // First verify task behavior in multi-window mode. final DisplayInfo displayInfo = sWm.getDefaultDisplayContentLocked().getDisplayInfo(); final int logicalWidth = displayInfo.logicalWidth; final int logicalHeight = displayInfo.logicalHeight; final int taskLeft = logicalWidth / 5; final int taskTop = logicalHeight / 5; final int taskRight = logicalWidth / 4 * 3; final int taskBottom = logicalHeight / 4 * 3; final Rect taskBounds = new Rect(taskLeft, taskTop, taskRight, taskBottom); TaskWithBounds task = new TaskWithBounds(taskBounds); task.mInsetBounds.set(taskLeft, taskTop, taskRight, taskBottom); task.mFullscreenForTest = false; WindowState w = createWindow(task, FILL_PARENT, FILL_PARENT); w.mAttrs.gravity = Gravity.LEFT | Gravity.TOP; final Rect pf = new Rect(0, 0, logicalWidth, logicalHeight); w.computeFrameLw(pf /* parentFrame */, pf /* displayFrame */, pf /* overscanFrame */, pf /* contentFrame */, pf /* visibleFrame */, pf /* decorFrame */, pf /* stableFrame */, null /* outsetFrame */); // For non fullscreen tasks the containing frame is based off the // task bounds not the parent frame. assertRect(w.mFrame, taskLeft, taskTop, taskRight, taskBottom); assertRect(w.getContentFrameLw(), taskLeft, taskTop, taskRight, taskBottom); assertRect(w.mContentInsets, 0, 0, 0, 0); // Now simulate switch to fullscreen for letterboxed app. final int xInset = logicalWidth / 10; final int yInset = logicalWidth / 10; final Rect cf = new Rect(xInset, yInset, logicalWidth - xInset, logicalHeight - yInset); w.mAppToken.onOverrideConfigurationChanged(w.mAppToken.getOverrideConfiguration(), cf); pf.set(0, 0, logicalWidth, logicalHeight); task.mFullscreenForTest = true; w.computeFrameLw(pf /* parentFrame */, pf /* displayFrame */, pf /* overscanFrame */, cf /* contentFrame */, cf /* visibleFrame */, pf /* decorFrame */, cf /* stableFrame */, null /* outsetFrame */); assertEquals(cf, w.mFrame); assertEquals(cf, w.getContentFrameLw()); assertRect(w.mContentInsets, 0, 0, 0, 0); } private WindowStateWithTask createWindow(Task task, int width, int height) { final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(TYPE_APPLICATION); attrs.width = width; Loading