Merge "Support to launch app pair from overview with recorded split ratio." into sc-v2-dev
This commit is contained in:
@@ -565,12 +565,12 @@ public class SystemUiProxy implements ISystemUiProxy,
|
||||
|
||||
/** Start multiple tasks in split-screen simultaneously. */
|
||||
public void startTasks(int mainTaskId, Bundle mainOptions, int sideTaskId, Bundle sideOptions,
|
||||
@SplitConfigurationOptions.StagePosition int sidePosition,
|
||||
@SplitConfigurationOptions.StagePosition int sidePosition, float splitRatio,
|
||||
RemoteTransitionCompat remoteTransition) {
|
||||
if (mSystemUiProxy != null) {
|
||||
try {
|
||||
mSplitScreen.startTasks(mainTaskId, mainOptions, sideTaskId, sideOptions,
|
||||
sidePosition, remoteTransition.getTransition());
|
||||
sidePosition, splitRatio, remoteTransition.getTransition());
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call startTask");
|
||||
}
|
||||
@@ -582,11 +582,11 @@ public class SystemUiProxy implements ISystemUiProxy,
|
||||
*/
|
||||
public void startTasksWithLegacyTransition(int mainTaskId, Bundle mainOptions, int sideTaskId,
|
||||
Bundle sideOptions, @SplitConfigurationOptions.StagePosition int sidePosition,
|
||||
RemoteAnimationAdapter adapter) {
|
||||
float splitRatio, RemoteAnimationAdapter adapter) {
|
||||
if (mSystemUiProxy != null) {
|
||||
try {
|
||||
mSplitScreen.startTasksWithLegacyTransition(mainTaskId, mainOptions, sideTaskId,
|
||||
sideOptions, sidePosition, adapter);
|
||||
sideOptions, sidePosition, splitRatio, adapter);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call startTasksWithLegacyTransition");
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.quickstep.util;
|
||||
|
||||
import static com.android.launcher3.Utilities.postAsyncCallback;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.DEFAULT_SPLIT_RATIO;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
|
||||
|
||||
@@ -30,7 +31,6 @@ import android.view.RemoteAnimationAdapter;
|
||||
import android.view.SurfaceControl;
|
||||
import android.window.TransitionInfo;
|
||||
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.statehandlers.DepthController;
|
||||
@@ -95,7 +95,7 @@ public class SplitSelectStateController {
|
||||
public void setSecondTaskId(Task task, Consumer<Boolean> callback) {
|
||||
mSecondTask = task;
|
||||
launchTasks(mInitialTask, mSecondTask, mStagePosition, callback,
|
||||
false /* freezeTaskList */);
|
||||
false /* freezeTaskList */, DEFAULT_SPLIT_RATIO);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,14 +107,15 @@ public class SplitSelectStateController {
|
||||
TaskView.TaskIdAttributeContainer[] taskIdAttributeContainers =
|
||||
groupedTaskView.getTaskIdAttributeContainers();
|
||||
launchTasks(taskIdAttributeContainers[0].getTask(), taskIdAttributeContainers[1].getTask(),
|
||||
taskIdAttributeContainers[0].getStagePosition(), callback, freezeTaskList);
|
||||
taskIdAttributeContainers[0].getStagePosition(), callback, freezeTaskList,
|
||||
groupedTaskView.getSplitRatio());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stagePosition representing location of task1
|
||||
*/
|
||||
public void launchTasks(Task task1, Task task2, @StagePosition int stagePosition,
|
||||
Consumer<Boolean> callback, boolean freezeTaskList) {
|
||||
Consumer<Boolean> callback, boolean freezeTaskList, float splitRatio) {
|
||||
// Assume initial task is for top/left part of screen
|
||||
final int[] taskIds = stagePosition == STAGE_POSITION_TOP_OR_LEFT
|
||||
? new int[]{task1.key.id, task2.key.id}
|
||||
@@ -123,7 +124,7 @@ public class SplitSelectStateController {
|
||||
RemoteSplitLaunchTransitionRunner animationRunner =
|
||||
new RemoteSplitLaunchTransitionRunner(task1, task2);
|
||||
mSystemUiProxy.startTasks(taskIds[0], null /* mainOptions */, taskIds[1],
|
||||
null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT,
|
||||
null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT, splitRatio,
|
||||
new RemoteTransitionCompat(animationRunner, MAIN_EXECUTOR,
|
||||
ActivityThread.currentActivityThread().getApplicationThread()));
|
||||
} else {
|
||||
@@ -140,7 +141,7 @@ public class SplitSelectStateController {
|
||||
}
|
||||
mSystemUiProxy.startTasksWithLegacyTransition(taskIds[0], mainOpts.toBundle(),
|
||||
taskIds[1], null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT,
|
||||
adapter);
|
||||
splitRatio, adapter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.android.quickstep.views;
|
||||
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.DEFAULT_SPLIT_RATIO;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
|
||||
|
||||
@@ -122,6 +123,14 @@ public class GroupedTaskView extends TaskView {
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public float getSplitRatio() {
|
||||
if (mSplitBoundsConfig != null) {
|
||||
return mSplitBoundsConfig.appsStackedVertically
|
||||
? mSplitBoundsConfig.topTaskPercent : mSplitBoundsConfig.leftTaskPercent;
|
||||
}
|
||||
return DEFAULT_SPLIT_RATIO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean offerTouchToChildren(MotionEvent event) {
|
||||
computeAndSetIconTouchDelegate(mIconView2, mIcon2CenterCoords, mIcon2TouchDelegate);
|
||||
@@ -157,7 +166,8 @@ public class GroupedTaskView extends TaskView {
|
||||
@Override
|
||||
public void launchTask(@NonNull Consumer<Boolean> callback, boolean freezeTaskList) {
|
||||
getRecentsView().getSplitPlaceholder().launchTasks(mTask, mSecondaryTask,
|
||||
STAGE_POSITION_TOP_OR_LEFT, callback, freezeTaskList);
|
||||
STAGE_POSITION_TOP_OR_LEFT, callback, freezeTaskList,
|
||||
getSplitRatio());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -68,6 +68,11 @@ 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;
|
||||
|
||||
Reference in New Issue
Block a user