Merge "Use InstanceId in SplitscreenEventLogger for non-drag events" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8e55f94e74
@@ -21,6 +21,7 @@ import android.content.Intent;
|
|||||||
import android.content.pm.ShortcutInfo;
|
import android.content.pm.ShortcutInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
import com.android.internal.logging.InstanceId;
|
||||||
import android.view.RemoteAnimationAdapter;
|
import android.view.RemoteAnimationAdapter;
|
||||||
import android.view.RemoteAnimationTarget;
|
import android.view.RemoteAnimationTarget;
|
||||||
import android.window.RemoteTransition;
|
import android.window.RemoteTransition;
|
||||||
@@ -67,34 +68,35 @@ interface ISplitScreen {
|
|||||||
* Starts a shortcut in a stage.
|
* Starts a shortcut in a stage.
|
||||||
*/
|
*/
|
||||||
oneway void startShortcut(String packageName, String shortcutId, int position,
|
oneway void startShortcut(String packageName, String shortcutId, int position,
|
||||||
in Bundle options, in UserHandle user) = 8;
|
in Bundle options, in UserHandle user, in InstanceId instanceId) = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts an activity in a stage.
|
* Starts an activity in a stage.
|
||||||
*/
|
*/
|
||||||
oneway void startIntent(in PendingIntent intent, in Intent fillInIntent, int position,
|
oneway void startIntent(in PendingIntent intent, in Intent fillInIntent, int position,
|
||||||
in Bundle options) = 9;
|
in Bundle options, in InstanceId instanceId) = 9;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts tasks simultaneously in one transition.
|
* Starts tasks simultaneously in one transition.
|
||||||
*/
|
*/
|
||||||
oneway void startTasks(int mainTaskId, in Bundle mainOptions, int sideTaskId,
|
oneway void startTasks(int mainTaskId, in Bundle mainOptions, int sideTaskId,
|
||||||
in Bundle sideOptions, int sidePosition, float splitRatio,
|
in Bundle sideOptions, int sidePosition, float splitRatio,
|
||||||
in RemoteTransition remoteTransition) = 10;
|
in RemoteTransition remoteTransition, in InstanceId instanceId) = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version of startTasks using legacy transition system.
|
* Version of startTasks using legacy transition system.
|
||||||
*/
|
*/
|
||||||
oneway void startTasksWithLegacyTransition(int mainTaskId, in Bundle mainOptions,
|
oneway void startTasksWithLegacyTransition(int mainTaskId, in Bundle mainOptions,
|
||||||
int sideTaskId, in Bundle sideOptions, int sidePosition,
|
int sideTaskId, in Bundle sideOptions, int sidePosition,
|
||||||
float splitRatio, in RemoteAnimationAdapter adapter) = 11;
|
float splitRatio, in RemoteAnimationAdapter adapter, in InstanceId instanceId) = 11;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a pair of intent and task using legacy transition system.
|
* Starts a pair of intent and task using legacy transition system.
|
||||||
*/
|
*/
|
||||||
oneway void startIntentAndTaskWithLegacyTransition(in PendingIntent pendingIntent,
|
oneway void startIntentAndTaskWithLegacyTransition(in PendingIntent pendingIntent,
|
||||||
in Intent fillInIntent, int taskId, in Bundle mainOptions,in Bundle sideOptions,
|
in Intent fillInIntent, int taskId, in Bundle mainOptions,in Bundle sideOptions,
|
||||||
int sidePosition, float splitRatio, in RemoteAnimationAdapter adapter) = 12;
|
int sidePosition, float splitRatio, in RemoteAnimationAdapter adapter,
|
||||||
|
in InstanceId instanceId) = 12;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blocking call that notifies and gets additional split-screen targets when entering
|
* Blocking call that notifies and gets additional split-screen targets when entering
|
||||||
@@ -115,5 +117,5 @@ interface ISplitScreen {
|
|||||||
*/
|
*/
|
||||||
oneway void startShortcutAndTaskWithLegacyTransition(in ShortcutInfo shortcutInfo, int taskId,
|
oneway void startShortcutAndTaskWithLegacyTransition(in ShortcutInfo shortcutInfo, int taskId,
|
||||||
in Bundle mainOptions, in Bundle sideOptions, int sidePosition, float splitRatio,
|
in Bundle mainOptions, in Bundle sideOptions, int sidePosition, float splitRatio,
|
||||||
in RemoteAnimationAdapter adapter) = 15;
|
in RemoteAnimationAdapter adapter, in InstanceId instanceId) = 15;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -387,6 +387,17 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See {@link #startShortcut(String, String, int, Bundle, UserHandle)}
|
||||||
|
* @param instanceId to be used by {@link SplitscreenEventLogger}
|
||||||
|
*/
|
||||||
|
public void startShortcut(String packageName, String shortcutId, @SplitPosition int position,
|
||||||
|
@Nullable Bundle options, UserHandle user, @NonNull InstanceId instanceId) {
|
||||||
|
mStageCoordinator.getLogger().enterRequested(instanceId);
|
||||||
|
startShortcut(packageName, shortcutId, position, options, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void startShortcut(String packageName, String shortcutId, @SplitPosition int position,
|
public void startShortcut(String packageName, String shortcutId, @SplitPosition int position,
|
||||||
@Nullable Bundle options, UserHandle user) {
|
@Nullable Bundle options, UserHandle user) {
|
||||||
IRemoteAnimationRunner wrapper = new IRemoteAnimationRunner.Stub() {
|
IRemoteAnimationRunner wrapper = new IRemoteAnimationRunner.Stub() {
|
||||||
@@ -415,7 +426,6 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
0 /* duration */, 0 /* statusBarTransitionDelay */);
|
0 /* duration */, 0 /* statusBarTransitionDelay */);
|
||||||
ActivityOptions activityOptions = ActivityOptions.fromBundle(options);
|
ActivityOptions activityOptions = ActivityOptions.fromBundle(options);
|
||||||
activityOptions.update(ActivityOptions.makeRemoteAnimation(wrappedAdapter));
|
activityOptions.update(ActivityOptions.makeRemoteAnimation(wrappedAdapter));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LauncherApps launcherApps = mContext.getSystemService(LauncherApps.class);
|
LauncherApps launcherApps = mContext.getSystemService(LauncherApps.class);
|
||||||
launcherApps.startShortcut(packageName, shortcutId, null /* sourceBounds */,
|
launcherApps.startShortcut(packageName, shortcutId, null /* sourceBounds */,
|
||||||
@@ -425,6 +435,17 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See {@link #startIntent(PendingIntent, Intent, int, Bundle)}
|
||||||
|
* @param instanceId to be used by {@link SplitscreenEventLogger}
|
||||||
|
*/
|
||||||
|
public void startIntent(PendingIntent intent, @Nullable Intent fillInIntent,
|
||||||
|
@SplitPosition int position, @Nullable Bundle options, @NonNull InstanceId instanceId) {
|
||||||
|
mStageCoordinator.getLogger().enterRequested(instanceId);
|
||||||
|
startIntent(intent, fillInIntent, position, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void startIntent(PendingIntent intent, @Nullable Intent fillInIntent,
|
public void startIntent(PendingIntent intent, @Nullable Intent fillInIntent,
|
||||||
@SplitPosition int position, @Nullable Bundle options) {
|
@SplitPosition int position, @Nullable Bundle options) {
|
||||||
if (fillInIntent == null) {
|
if (fillInIntent == null) {
|
||||||
@@ -446,7 +467,6 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
mStageCoordinator.startIntentLegacy(intent, fillInIntent, position, options);
|
mStageCoordinator.startIntentLegacy(intent, fillInIntent, position, options);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mStageCoordinator.startIntent(intent, fillInIntent, position, options);
|
mStageCoordinator.startIntent(intent, fillInIntent, position, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -772,60 +792,64 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
@Override
|
@Override
|
||||||
public void startTasksWithLegacyTransition(int mainTaskId, @Nullable Bundle mainOptions,
|
public void startTasksWithLegacyTransition(int mainTaskId, @Nullable Bundle mainOptions,
|
||||||
int sideTaskId, @Nullable Bundle sideOptions, @SplitPosition int sidePosition,
|
int sideTaskId, @Nullable Bundle sideOptions, @SplitPosition int sidePosition,
|
||||||
float splitRatio, RemoteAnimationAdapter adapter) {
|
float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) {
|
||||||
executeRemoteCallWithTaskPermission(mController, "startTasks",
|
executeRemoteCallWithTaskPermission(mController, "startTasks",
|
||||||
(controller) -> controller.mStageCoordinator.startTasksWithLegacyTransition(
|
(controller) -> controller.mStageCoordinator.startTasksWithLegacyTransition(
|
||||||
mainTaskId, mainOptions, sideTaskId, sideOptions, sidePosition,
|
mainTaskId, mainOptions, sideTaskId, sideOptions, sidePosition,
|
||||||
splitRatio, adapter));
|
splitRatio, adapter, instanceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startIntentAndTaskWithLegacyTransition(PendingIntent pendingIntent,
|
public void startIntentAndTaskWithLegacyTransition(PendingIntent pendingIntent,
|
||||||
Intent fillInIntent, int taskId, Bundle mainOptions, Bundle sideOptions,
|
Intent fillInIntent, int taskId, Bundle mainOptions, Bundle sideOptions,
|
||||||
int sidePosition, float splitRatio, RemoteAnimationAdapter adapter) {
|
int sidePosition, float splitRatio, RemoteAnimationAdapter adapter,
|
||||||
|
InstanceId instanceId) {
|
||||||
executeRemoteCallWithTaskPermission(mController,
|
executeRemoteCallWithTaskPermission(mController,
|
||||||
"startIntentAndTaskWithLegacyTransition", (controller) ->
|
"startIntentAndTaskWithLegacyTransition", (controller) ->
|
||||||
controller.mStageCoordinator.startIntentAndTaskWithLegacyTransition(
|
controller.mStageCoordinator.startIntentAndTaskWithLegacyTransition(
|
||||||
pendingIntent, fillInIntent, taskId, mainOptions, sideOptions,
|
pendingIntent, fillInIntent, taskId, mainOptions, sideOptions,
|
||||||
sidePosition, splitRatio, adapter));
|
sidePosition, splitRatio, adapter, instanceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startShortcutAndTaskWithLegacyTransition(ShortcutInfo shortcutInfo,
|
public void startShortcutAndTaskWithLegacyTransition(ShortcutInfo shortcutInfo,
|
||||||
int taskId, @Nullable Bundle mainOptions, @Nullable Bundle sideOptions,
|
int taskId, @Nullable Bundle mainOptions, @Nullable Bundle sideOptions,
|
||||||
@SplitPosition int sidePosition, float splitRatio, RemoteAnimationAdapter adapter) {
|
@SplitPosition int sidePosition, float splitRatio, RemoteAnimationAdapter adapter,
|
||||||
|
InstanceId instanceId) {
|
||||||
executeRemoteCallWithTaskPermission(mController,
|
executeRemoteCallWithTaskPermission(mController,
|
||||||
"startShortcutAndTaskWithLegacyTransition", (controller) ->
|
"startShortcutAndTaskWithLegacyTransition", (controller) ->
|
||||||
controller.mStageCoordinator.startShortcutAndTaskWithLegacyTransition(
|
controller.mStageCoordinator.startShortcutAndTaskWithLegacyTransition(
|
||||||
shortcutInfo, taskId, mainOptions, sideOptions, sidePosition,
|
shortcutInfo, taskId, mainOptions, sideOptions, sidePosition,
|
||||||
splitRatio, adapter));
|
splitRatio, adapter, instanceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startTasks(int mainTaskId, @Nullable Bundle mainOptions,
|
public void startTasks(int mainTaskId, @Nullable Bundle mainOptions,
|
||||||
int sideTaskId, @Nullable Bundle sideOptions,
|
int sideTaskId, @Nullable Bundle sideOptions,
|
||||||
@SplitPosition int sidePosition, float splitRatio,
|
@SplitPosition int sidePosition, float splitRatio,
|
||||||
@Nullable RemoteTransition remoteTransition) {
|
@Nullable RemoteTransition remoteTransition, InstanceId instanceId) {
|
||||||
executeRemoteCallWithTaskPermission(mController, "startTasks",
|
executeRemoteCallWithTaskPermission(mController, "startTasks",
|
||||||
(controller) -> controller.mStageCoordinator.startTasks(mainTaskId, mainOptions,
|
(controller) -> controller.mStageCoordinator.startTasks(mainTaskId, mainOptions,
|
||||||
sideTaskId, sideOptions, sidePosition, splitRatio, remoteTransition));
|
sideTaskId, sideOptions, sidePosition, splitRatio, remoteTransition,
|
||||||
|
instanceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startShortcut(String packageName, String shortcutId, int position,
|
public void startShortcut(String packageName, String shortcutId, int position,
|
||||||
@Nullable Bundle options, UserHandle user) {
|
@Nullable Bundle options, UserHandle user, InstanceId instanceId) {
|
||||||
executeRemoteCallWithTaskPermission(mController, "startShortcut",
|
executeRemoteCallWithTaskPermission(mController, "startShortcut",
|
||||||
(controller) -> {
|
(controller) -> {
|
||||||
controller.startShortcut(packageName, shortcutId, position, options, user);
|
controller.startShortcut(packageName, shortcutId, position, options, user,
|
||||||
|
instanceId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startIntent(PendingIntent intent, Intent fillInIntent, int position,
|
public void startIntent(PendingIntent intent, Intent fillInIntent, int position,
|
||||||
@Nullable Bundle options) {
|
@Nullable Bundle options, InstanceId instanceId) {
|
||||||
executeRemoteCallWithTaskPermission(mController, "startIntent",
|
executeRemoteCallWithTaskPermission(mController, "startIntent",
|
||||||
(controller) -> {
|
(controller) -> {
|
||||||
controller.startIntent(intent, fillInIntent, position, options);
|
controller.startIntent(intent, fillInIntent, position, options, instanceId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.wm.shell.splitscreen;
|
package com.android.wm.shell.splitscreen;
|
||||||
|
|
||||||
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__ENTER_REASON__OVERVIEW;
|
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__ENTER_REASON__LAUNCHER;
|
||||||
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__APP_DOES_NOT_SUPPORT_MULTIWINDOW;
|
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__APP_DOES_NOT_SUPPORT_MULTIWINDOW;
|
||||||
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__APP_FINISHED;
|
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__APP_FINISHED;
|
||||||
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__DEVICE_FOLDED;
|
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__DEVICE_FOLDED;
|
||||||
@@ -59,7 +59,7 @@ public class SplitscreenEventLogger {
|
|||||||
|
|
||||||
// Drag info
|
// Drag info
|
||||||
private @SplitPosition int mDragEnterPosition;
|
private @SplitPosition int mDragEnterPosition;
|
||||||
private InstanceId mDragEnterSessionId;
|
private InstanceId mEnterSessionId;
|
||||||
|
|
||||||
// For deduping async events
|
// For deduping async events
|
||||||
private int mLastMainStagePosition = -1;
|
private int mLastMainStagePosition = -1;
|
||||||
@@ -82,9 +82,17 @@ public class SplitscreenEventLogger {
|
|||||||
/**
|
/**
|
||||||
* May be called before logEnter() to indicate that the session was started from a drag.
|
* May be called before logEnter() to indicate that the session was started from a drag.
|
||||||
*/
|
*/
|
||||||
public void enterRequestedByDrag(@SplitPosition int position, InstanceId dragSessionId) {
|
public void enterRequestedByDrag(@SplitPosition int position, InstanceId enterSessionId) {
|
||||||
mDragEnterPosition = position;
|
mDragEnterPosition = position;
|
||||||
mDragEnterSessionId = dragSessionId;
|
enterRequested(enterSessionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* May be called before logEnter() to indicate that the session was started from launcher.
|
||||||
|
* This specifically is for all the scenarios where split started without a drag interaction
|
||||||
|
*/
|
||||||
|
public void enterRequested(InstanceId enterSessionId) {
|
||||||
|
mEnterSessionId = enterSessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,7 +105,7 @@ public class SplitscreenEventLogger {
|
|||||||
mLoggerSessionId = mIdSequence.newInstanceId();
|
mLoggerSessionId = mIdSequence.newInstanceId();
|
||||||
int enterReason = mDragEnterPosition != SPLIT_POSITION_UNDEFINED
|
int enterReason = mDragEnterPosition != SPLIT_POSITION_UNDEFINED
|
||||||
? getDragEnterReasonFromSplitPosition(mDragEnterPosition, isLandscape)
|
? getDragEnterReasonFromSplitPosition(mDragEnterPosition, isLandscape)
|
||||||
: SPLITSCREEN_UICHANGED__ENTER_REASON__OVERVIEW;
|
: SPLITSCREEN_UICHANGED__ENTER_REASON__LAUNCHER;
|
||||||
updateMainStageState(getMainStagePositionFromSplitPosition(mainStagePosition, isLandscape),
|
updateMainStageState(getMainStagePositionFromSplitPosition(mainStagePosition, isLandscape),
|
||||||
mainStageUid);
|
mainStageUid);
|
||||||
updateSideStageState(getSideStagePositionFromSplitPosition(sideStagePosition, isLandscape),
|
updateSideStageState(getSideStagePositionFromSplitPosition(sideStagePosition, isLandscape),
|
||||||
@@ -112,7 +120,7 @@ public class SplitscreenEventLogger {
|
|||||||
mLastMainStageUid,
|
mLastMainStageUid,
|
||||||
mLastSideStagePosition,
|
mLastSideStagePosition,
|
||||||
mLastSideStageUid,
|
mLastSideStageUid,
|
||||||
mDragEnterSessionId != null ? mDragEnterSessionId.getId() : 0,
|
mEnterSessionId != null ? mEnterSessionId.getId() : 0,
|
||||||
mLoggerSessionId.getId());
|
mLoggerSessionId.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +184,7 @@ public class SplitscreenEventLogger {
|
|||||||
// Reset states
|
// Reset states
|
||||||
mLoggerSessionId = null;
|
mLoggerSessionId = null;
|
||||||
mDragEnterPosition = SPLIT_POSITION_UNDEFINED;
|
mDragEnterPosition = SPLIT_POSITION_UNDEFINED;
|
||||||
mDragEnterSessionId = null;
|
mEnterSessionId = null;
|
||||||
mLastMainStagePosition = -1;
|
mLastMainStagePosition = -1;
|
||||||
mLastMainStageUid = -1;
|
mLastMainStageUid = -1;
|
||||||
mLastSideStagePosition = -1;
|
mLastSideStagePosition = -1;
|
||||||
|
|||||||
@@ -407,6 +407,10 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SplitscreenEventLogger getLogger() {
|
||||||
|
return mLogger;
|
||||||
|
}
|
||||||
|
|
||||||
/** Launches an activity into split. */
|
/** Launches an activity into split. */
|
||||||
void startIntent(PendingIntent intent, Intent fillInIntent, @SplitPosition int position,
|
void startIntent(PendingIntent intent, Intent fillInIntent, @SplitPosition int position,
|
||||||
@Nullable Bundle options) {
|
@Nullable Bundle options) {
|
||||||
@@ -499,7 +503,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
/** Starts 2 tasks in one transition. */
|
/** Starts 2 tasks in one transition. */
|
||||||
void startTasks(int mainTaskId, @Nullable Bundle mainOptions, int sideTaskId,
|
void startTasks(int mainTaskId, @Nullable Bundle mainOptions, int sideTaskId,
|
||||||
@Nullable Bundle sideOptions, @SplitPosition int sidePosition, float splitRatio,
|
@Nullable Bundle sideOptions, @SplitPosition int sidePosition, float splitRatio,
|
||||||
@Nullable RemoteTransition remoteTransition) {
|
@Nullable RemoteTransition remoteTransition, InstanceId instanceId) {
|
||||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
mainOptions = mainOptions != null ? mainOptions : new Bundle();
|
mainOptions = mainOptions != null ? mainOptions : new Bundle();
|
||||||
sideOptions = sideOptions != null ? sideOptions : new Bundle();
|
sideOptions = sideOptions != null ? sideOptions : new Bundle();
|
||||||
@@ -528,46 +532,57 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
|
|
||||||
mSplitTransitions.startEnterTransition(
|
mSplitTransitions.startEnterTransition(
|
||||||
TRANSIT_SPLIT_SCREEN_PAIR_OPEN, wct, remoteTransition, this, null);
|
TRANSIT_SPLIT_SCREEN_PAIR_OPEN, wct, remoteTransition, this, null);
|
||||||
|
setEnterInstanceId(instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Starts 2 tasks in one legacy transition. */
|
/** Starts 2 tasks in one legacy transition. */
|
||||||
void startTasksWithLegacyTransition(int mainTaskId, @Nullable Bundle mainOptions,
|
void startTasksWithLegacyTransition(int mainTaskId, @Nullable Bundle mainOptions,
|
||||||
int sideTaskId, @Nullable Bundle sideOptions, @SplitPosition int sidePosition,
|
int sideTaskId, @Nullable Bundle sideOptions, @SplitPosition int sidePosition,
|
||||||
float splitRatio, RemoteAnimationAdapter adapter) {
|
float splitRatio, RemoteAnimationAdapter adapter,
|
||||||
|
InstanceId instanceId) {
|
||||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
if (sideOptions == null) sideOptions = new Bundle();
|
if (sideOptions == null) sideOptions = new Bundle();
|
||||||
addActivityOptions(sideOptions, mSideStage);
|
addActivityOptions(sideOptions, mSideStage);
|
||||||
wct.startTask(sideTaskId, sideOptions);
|
wct.startTask(sideTaskId, sideOptions);
|
||||||
|
|
||||||
startWithLegacyTransition(wct, mainTaskId, mainOptions, sidePosition, splitRatio, adapter);
|
startWithLegacyTransition(wct, mainTaskId, mainOptions, sidePosition, splitRatio, adapter,
|
||||||
|
instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Start an intent and a task ordered by {@code intentFirst}. */
|
/** Start an intent and a task ordered by {@code intentFirst}. */
|
||||||
void startIntentAndTaskWithLegacyTransition(PendingIntent pendingIntent, Intent fillInIntent,
|
void startIntentAndTaskWithLegacyTransition(PendingIntent pendingIntent, Intent fillInIntent,
|
||||||
int taskId, @Nullable Bundle mainOptions, @Nullable Bundle sideOptions,
|
int taskId, @Nullable Bundle mainOptions, @Nullable Bundle sideOptions,
|
||||||
@SplitPosition int sidePosition, float splitRatio, RemoteAnimationAdapter adapter) {
|
@SplitPosition int sidePosition, float splitRatio, RemoteAnimationAdapter adapter,
|
||||||
|
InstanceId instanceId) {
|
||||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
if (sideOptions == null) sideOptions = new Bundle();
|
if (sideOptions == null) sideOptions = new Bundle();
|
||||||
addActivityOptions(sideOptions, mSideStage);
|
addActivityOptions(sideOptions, mSideStage);
|
||||||
wct.sendPendingIntent(pendingIntent, fillInIntent, sideOptions);
|
wct.sendPendingIntent(pendingIntent, fillInIntent, sideOptions);
|
||||||
|
|
||||||
startWithLegacyTransition(wct, taskId, mainOptions, sidePosition, splitRatio, adapter);
|
startWithLegacyTransition(wct, taskId, mainOptions, sidePosition, splitRatio, adapter,
|
||||||
|
instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void startShortcutAndTaskWithLegacyTransition(ShortcutInfo shortcutInfo,
|
void startShortcutAndTaskWithLegacyTransition(ShortcutInfo shortcutInfo,
|
||||||
int taskId, @Nullable Bundle mainOptions, @Nullable Bundle sideOptions,
|
int taskId, @Nullable Bundle mainOptions, @Nullable Bundle sideOptions,
|
||||||
@SplitPosition int sidePosition, float splitRatio, RemoteAnimationAdapter adapter) {
|
@SplitPosition int sidePosition, float splitRatio, RemoteAnimationAdapter adapter,
|
||||||
|
InstanceId instanceId) {
|
||||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
if (sideOptions == null) sideOptions = new Bundle();
|
if (sideOptions == null) sideOptions = new Bundle();
|
||||||
addActivityOptions(sideOptions, mSideStage);
|
addActivityOptions(sideOptions, mSideStage);
|
||||||
wct.startShortcut(mContext.getPackageName(), shortcutInfo, sideOptions);
|
wct.startShortcut(mContext.getPackageName(), shortcutInfo, sideOptions);
|
||||||
|
|
||||||
startWithLegacyTransition(wct, taskId, mainOptions, sidePosition, splitRatio, adapter);
|
startWithLegacyTransition(wct, taskId, mainOptions, sidePosition, splitRatio, adapter,
|
||||||
|
instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param instanceId if {@code null}, will not log. Otherwise it will be used in
|
||||||
|
* {@link SplitscreenEventLogger#logEnter(float, int, int, int, int, boolean)}
|
||||||
|
*/
|
||||||
private void startWithLegacyTransition(WindowContainerTransaction wct, int mainTaskId,
|
private void startWithLegacyTransition(WindowContainerTransaction wct, int mainTaskId,
|
||||||
@Nullable Bundle mainOptions, @SplitPosition int sidePosition, float splitRatio,
|
@Nullable Bundle mainOptions, @SplitPosition int sidePosition, float splitRatio,
|
||||||
RemoteAnimationAdapter adapter) {
|
RemoteAnimationAdapter adapter, InstanceId instanceId) {
|
||||||
// Init divider first to make divider leash for remote animation target.
|
// Init divider first to make divider leash for remote animation target.
|
||||||
mSplitLayout.init();
|
mSplitLayout.init();
|
||||||
mSplitLayout.setDivideRatio(splitRatio);
|
mSplitLayout.setDivideRatio(splitRatio);
|
||||||
@@ -643,6 +658,14 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
setDividerVisibility(true, t);
|
setDividerVisibility(true, t);
|
||||||
updateSurfaceBounds(mSplitLayout, t, false /* applyResizingOffset */);
|
updateSurfaceBounds(mSplitLayout, t, false /* applyResizingOffset */);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setEnterInstanceId(instanceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setEnterInstanceId(InstanceId instanceId) {
|
||||||
|
if (instanceId != null) {
|
||||||
|
mLogger.enterRequested(instanceId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onRemoteAnimationFinishedOrCancelled(boolean cancel,
|
private void onRemoteAnimationFinishedOrCancelled(boolean cancel,
|
||||||
|
|||||||
Reference in New Issue
Block a user