Fixing incorrect taskView size in multiwindow-landscape
RecentsView uses deviceProfile to calculate the padding.
Device profile had incorrect sizes in multiwindow mode as it
was not considering the insets.
Bug: 155816922
Change-Id: Iaa5b939624b4128ed634e6de1abf8453e2ae852b
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 51b21aa..72831f4 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -29,6 +29,7 @@
import com.android.launcher3.icons.DotRenderer;
import com.android.launcher3.icons.IconNormalizer;
import com.android.launcher3.util.DefaultDisplay;
+import com.android.launcher3.util.WindowBounds;
public class DeviceProfile {
@@ -265,19 +266,16 @@
/**
* TODO: Move this to the builder as part of setMultiWindowMode
*/
- public DeviceProfile getMultiWindowProfile(Context context, Rect windowPosition) {
+ public DeviceProfile getMultiWindowProfile(Context context, WindowBounds windowBounds) {
// We take the minimum sizes of this profile and it's multi-window variant to ensure that
// the system decor is always excluded.
- Point mwSize = new Point(Math.min(availableWidthPx, windowPosition.width()),
- Math.min(availableHeightPx, windowPosition.height()));
+ Point mwSize = new Point(Math.min(availableWidthPx, windowBounds.availableSize.x),
+ Math.min(availableHeightPx, windowBounds.availableSize.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.
DeviceProfile profile = toBuilder(context)
.setSizeRange(mwSize, mwSize)
- .setSize(mwSize.x, mwSize.y)
- .setWindowPosition(windowPosition.left, windowPosition.top)
+ .setSize(windowBounds.bounds.width(), windowBounds.bounds.height())
+ .setWindowPosition(windowBounds.bounds.left, windowBounds.bounds.top)
.setMultiWindowMode(true)
.build();
@@ -299,7 +297,7 @@
}
/**
- * Inverse of {@link #getMultiWindowProfile(Context, Rect)}
+ * Inverse of {@link #getMultiWindowProfile(Context, WindowBounds)}
* @return device profile corresponding to the current orientation in non multi-window mode.
*/
public DeviceProfile getFullScreenProfile() {