Save app pair with 50-50 snap target if snap position is SNAP_TO_NONE

It was not possible to save an app pair if free snap mode was enabled
and the snap position was SNAP_TO_NONE. Just default to 50-50 split if
the current divider snap position is SNAP_TO_NONE.

Cherrypicked from isak.lilja@sony.com's CL at https://partner-android-review.git.corp.google.com/c/platform/packages/apps/Launcher3/+/2835425.

Bug: 343219704
Test: N/A
Flag: EXEMPT bugfix
Change-Id: I62347ac13440f714a493366ac66e893578a2d8d9
This commit is contained in:
Isak Lilja
2024-05-29 15:57:05 +02:00
committed by Jeremy Sim
parent 92b73a4f09
commit 29322e82fe

View File

@@ -27,6 +27,8 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
import static com.android.wm.shell.common.split.SplitScreenConstants.SNAP_TO_50_50;
import static com.android.wm.shell.common.split.SplitScreenConstants.SNAP_TO_NONE;
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT;
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT;
import static com.android.wm.shell.common.split.SplitScreenConstants.isPersistentSnapPosition;
@@ -186,6 +188,10 @@ public class AppPairsController {
}
@PersistentSnapPosition int snapPosition = gtv.getSnapPosition();
if (snapPosition == SNAP_TO_NONE) {
// Free snap mode is enabled, just save it as 50/50 split.
snapPosition = SNAP_TO_50_50;
}
if (!isPersistentSnapPosition(snapPosition)) {
// If we received an illegal snap position, log an error and do not create the app pair
Log.wtf(TAG, "Tried to save an app pair with illegal snapPosition "