From e76b2b5db74e2ec0c768a419af149e6c80c2b963 Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Wed, 21 Mar 2018 16:22:16 +0100 Subject: [PATCH] Letterbox: make letterbox work with drag resizing Fixes an issue where letterboxing disabled using the insetFrame for drag resizing, leading to unsightly jank when doing so. Also makes sure that the insetFrame is always cleared when not in multi-window mode, because that could lead to stale frames when leaving a non-fullscreen task left multiwindow mode. Change-Id: I5576fe86ce17f8cd377bc6a55b3d50d7703569a0 Fixes: 76009001 Bug: 64369819 Test: Enable double cutout, enter landscape, enter splitscreen, drag handle, verify no weird layout issues. Test: Open ApiDemos > App > Activity > Max Aspect Ratio > 1:1, enter split screen, open other app, drag handle up a bit, drag handle all the way up. Open Api Demos activity again from recents, verify it has correct size. --- services/core/java/com/android/server/wm/WindowState.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 591289723a007..38b7e7945484d 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -857,10 +857,12 @@ class WindowState extends WindowContainer 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 || isLetterboxedAppWindow()) { - mInsetFrame.setEmpty(); - } else if (task != null && isInMultiWindowMode()) { + // Otherwise we need to clear the inset frame, to avoid using a stale frame after leaving + // multi window mode. + if (task != null && isInMultiWindowMode()) { task.getTempInsetBounds(mInsetFrame); + } else { + mInsetFrame.setEmpty(); } // Denotes the actual frame used to calculate the insets and to perform the layout. When