Refactor SplitBounds to always use creation-time measurements

In flexible split ratios like 90:10 and 10:90, we hide the Overview icon of the smaller app completely (ag/30949010). However, there was an unintentional side effect where one of the icons would disappear when rotating the display.

This happened (basically) because SplitBounds is not recalculated on device rotation, so fields like leftTaskPercent and topTaskPercent should not be used directly when the rotation state is not known. I added an API to SplitBounds that hopefully makes it harder to write bugs like this in the future.

Fixes: 395783367
Flag: com.android.wm.shell.enable_flexible_two_app_split
Test: Icons do not disappear on rotation. When app chip menus are enabled, the (existing) correct behavior is not changed.
Change-Id: I2c1b38f4bd9a76dfb127b7bbf230897d747d3c49
This commit is contained in:
Jeremy Sim committed 2025-02-20 12:45:33 -08:00
1 parent c7e545674d
commit b392f61ced
7 files changed
+65 -87

No files matched your search

@@ -197,8 +197,7 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout {
final boolean isLeftRightSplit = !splitBounds.appsStackedVertically;
final float leftOrTopTaskPercent = isLeftRightSplit
? splitBounds.leftTaskPercent : splitBounds.topTaskPercent;
final float leftOrTopTaskPercent = splitBounds.getLeftTopTaskPercent();
ConstraintLayout.LayoutParams leftTopParams = (ConstraintLayout.LayoutParams)
mThumbnailView1.getLayoutParams();