From a11380d37081c8232eb78bf29e704a38df3237f2 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Thu, 24 Aug 2017 11:30:03 -0700 Subject: Fix bug where mw landscape cell size is calculated incorretly. The problem is that the height we pass to the multi-window DeviceProfile includes the top insets, so we tell widgets that the cell size height is larger than it actually is. We use Display#getSize to pass in the size of the window in multi-window mode. The docs say "the returned size may be adjusted to exclude certain system decor elememts." To ensure that system decor elements is always excluded, we take the minimum sizes of the main profile and it's multi-window variant -- since the multi-window DeviceProfile sizes are never going to be larger. Bug: 64851168 Change-Id: I274f838c54f3d01d43dc51e0ff921a6124e12cf7 --- src/com/android/launcher3/DeviceProfile.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 150bc5309..db788ed3a 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -267,6 +267,10 @@ public class DeviceProfile { } DeviceProfile getMultiWindowProfile(Context context, Point mwSize) { + // We take the minimum sizes of this profile and it's multi-window variant to ensure that + // the system decor is always excluded. + mwSize.set(Math.min(availableWidthPx, mwSize.x), Math.min(availableHeightPx, mwSize.y)); + // In multi-window mode, we can have widthPx = availableWidthPx // and heightPx = availableHeightPx because Launcher uses the InvariantDeviceProfiles' // widthPx and heightPx values where it's needed. -- cgit v1.2.3