summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2017-08-24 11:30:03 -0700
committerJon Miranda <jonmiranda@google.com>2017-08-24 11:30:03 -0700
commita11380d37081c8232eb78bf29e704a38df3237f2 (patch)
tree1b9a559d824ed04fcfd48dd6f727f51859cdd847
parent86ba394ad0792d31dc9b4400ea362942413251f3 (diff)
downloadandroid_packages_apps_Trebuchet-a11380d37081c8232eb78bf29e704a38df3237f2.tar.gz
android_packages_apps_Trebuchet-a11380d37081c8232eb78bf29e704a38df3237f2.tar.bz2
android_packages_apps_Trebuchet-a11380d37081c8232eb78bf29e704a38df3237f2.zip
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
-rw-r--r--src/com/android/launcher3/DeviceProfile.java4
1 files changed, 4 insertions, 0 deletions
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.