Request split launches using a new enum, snapPosition, rather than a float splitRatio

Split ratios are now stored as an int enum rather than float values. Previously, split ratios were stored as floats, which needed to be recalculated frequently and differed depending on device screen size. Now Shell to store and launch split screen setups using an enum rather than floats.

Bug: 274835596
Bug: 182839788
Test: Existing tests still pass
Change-Id: Iebb8d3c7e8f9d597a59b677e48072300ddea458f
This commit is contained in:
Jeremy Sim committed 2023-09-21 11:34:07 -07:00
1 parent 02b3cc568c
commit da230cf526
14 files changed
+213 -158

No files matched your search

@@ -77,11 +77,6 @@ public final class SplitConfigurationOptions {
public @interface StageType {}
///////////////////////////////////
/**
* Default split ratio for launching app pair from overview.
*/
public static final float DEFAULT_SPLIT_RATIO = 0.5f;
public static class SplitPositionOption {
public final int iconResId;
public final int textResId;
@@ -116,6 +111,8 @@ public final class SplitConfigurationOptions {
public final float leftTaskPercent;
public final float dividerWidthPercent;
public final float dividerHeightPercent;
public final int snapPosition;
/**
* If {@code true}, that means at the time of creation of this object, the
* split-screened apps were vertically stacked. This is useful in scenarios like
@@ -135,11 +132,12 @@ public final class SplitConfigurationOptions {
public final int rightBottomTaskId;
public SplitBounds(Rect leftTopBounds, Rect rightBottomBounds, int leftTopTaskId,
int rightBottomTaskId) {
int rightBottomTaskId, int snapPosition) {
this.leftTopBounds = leftTopBounds;
this.rightBottomBounds = rightBottomBounds;
this.leftTopTaskId = leftTopTaskId;
this.rightBottomTaskId = rightBottomTaskId;
this.snapPosition = snapPosition;
if (rightBottomBounds.top > leftTopBounds.top) {
// vertical apps, horizontal divider