Loading quickstep/src/com/android/quickstep/util/SplitSelectDataHolder.kt +15 −1 Original line number Diff line number Diff line Loading @@ -93,6 +93,7 @@ class SplitSelectDataHolder( private var secondTaskId: Int = INVALID_TASK_ID private var initialIntent: Intent? = null private var secondIntent: Intent? = null private var widgetSecondIntent: Intent? = null private var initialUser: UserHandle? = null private var secondUser: UserHandle? = null private var initialPendingIntent: PendingIntent? = null Loading Loading @@ -167,6 +168,16 @@ class SplitSelectDataHolder( secondUser = pendingIntent.creatorUserHandle } /** * Similar to [setSecondTask] except this is to be called for widgets which can pass through * an extra intent from their RemoteResponse. * See [android.widget.RemoteViews.RemoteResponse.getLaunchOptions].first */ fun setSecondWidget(pendingIntent: PendingIntent, widgetIntent: Intent?) { setSecondTask(pendingIntent) widgetSecondIntent = widgetIntent } private fun getShortcutInfo(intent: Intent?, user: UserHandle?): ShortcutInfo? { val intentPackage = intent?.getPackage() ?: return null val shortcutId = intent.getStringExtra(ShortcutKey.EXTRA_SHORTCUT_ID) Loading Loading @@ -241,6 +252,7 @@ class SplitSelectDataHolder( secondTaskId, initialPendingIntent, secondPendingIntent, widgetSecondIntent, initialUser?.identifier ?: -1, secondUser?.identifier ?: -1, initialShortcut, Loading @@ -257,7 +269,8 @@ class SplitSelectDataHolder( * Note that both [initialIntent] and [secondIntent] will be nullified on method return * * One caveat is that if [secondPendingIntent] is set, we will use that and *not* attempt to * convert [secondIntent] * convert [secondIntent]. * This also leaves [widgetSecondIntent] untouched. */ private fun convertIntentsToFinalTypes() { initialShortcut = getShortcutInfo(initialIntent, initialUser) Loading Loading @@ -343,6 +356,7 @@ class SplitSelectDataHolder( var secondTaskId: Int = INVALID_TASK_ID, var initialPendingIntent: PendingIntent? = null, var secondPendingIntent: PendingIntent? = null, var widgetSecondIntent: Intent? = null, var initialUserId: Int = -1, var secondUserId: Int = -1, var initialShortcut: ShortcutInfo? = null, Loading quickstep/src/com/android/quickstep/util/SplitSelectStateController.java +12 −5 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import static com.android.quickstep.util.SplitSelectDataHolder.SPLIT_TASK_PENDIN import static com.android.quickstep.util.SplitSelectDataHolder.SPLIT_TASK_SHORTCUT; import static com.android.quickstep.util.SplitSelectDataHolder.SPLIT_TASK_TASK; import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported; import static com.android.wm.shell.common.split.SplitScreenConstants.KEY_EXTRA_WIDGET_INTENT; import static com.android.wm.shell.common.split.SplitScreenConstants.SNAP_TO_50_50; import android.animation.Animator; Loading Loading @@ -355,6 +356,10 @@ public class SplitSelectStateController { mSplitSelectDataHolder.setSecondTask(pendingIntent); } public void setSecondWidget(PendingIntent pendingIntent, Intent widgetIntent) { mSplitSelectDataHolder.setSecondWidget(pendingIntent, widgetIntent); } /** * To be called when we want to launch split pairs from Overview. Split can be initiated from * either Overview or home, or all apps. Either both taskIds are set, or a pending intent + a Loading @@ -380,11 +385,13 @@ public class SplitSelectStateController { ShortcutInfo secondShortcut = launchData.getSecondShortcut(); PendingIntent firstPI = launchData.getInitialPendingIntent(); PendingIntent secondPI = launchData.getSecondPendingIntent(); Intent widgetIntent = launchData.getWidgetSecondIntent(); int firstUserId = launchData.getInitialUserId(); int secondUserId = launchData.getSecondUserId(); int initialStagePosition = launchData.getInitialStagePosition(); Bundle optionsBundle = options1.toBundle(); Bundle extrasBundle = new Bundle(1); extrasBundle.putParcelable(KEY_EXTRA_WIDGET_INTENT, widgetIntent); if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) { final RemoteTransition remoteTransition = getShellRemoteTransition(firstTaskId, secondTaskId, callback, "LaunchSplitPair"); Loading @@ -396,7 +403,7 @@ public class SplitSelectStateController { case SPLIT_TASK_PENDINGINTENT -> mSystemUiProxy.startIntentAndTask(secondPI, secondUserId, optionsBundle, firstTaskId, null /*options2*/, initialStagePosition, snapPosition, firstTaskId, extrasBundle, initialStagePosition, snapPosition, remoteTransition, shellInstanceId); case SPLIT_TASK_SHORTCUT -> Loading @@ -411,9 +418,9 @@ public class SplitSelectStateController { case SPLIT_PENDINGINTENT_PENDINGINTENT -> mSystemUiProxy.startIntents(firstPI, firstUserId, firstShortcut, optionsBundle, secondPI, secondUserId, secondShortcut, null /*options2*/, initialStagePosition, snapPosition, remoteTransition, shellInstanceId); optionsBundle, secondPI, secondUserId, secondShortcut, extrasBundle, initialStagePosition, snapPosition, remoteTransition, shellInstanceId); case SPLIT_SHORTCUT_TASK -> mSystemUiProxy.startShortcutAndTask(firstShortcut, optionsBundle, Loading quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java +3 −2 Original line number Diff line number Diff line Loading @@ -72,7 +72,8 @@ public class SplitToWorkspaceController { * @return {@code true} if we can attempt launch the widget into split, {@code false} otherwise * to allow launcher to handle the click */ public boolean handleSecondWidgetSelectionForSplit(View view, PendingIntent pendingIntent) { public boolean handleSecondWidgetSelectionForSplit(View view, PendingIntent pendingIntent, Intent remoteResponseIntent) { if (shouldIgnoreSecondSplitLaunch()) { return false; } Loading @@ -86,7 +87,7 @@ public class SplitToWorkspaceController { Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); view.post(() -> { mController.setSecondTask(pendingIntent); mController.setSecondWidget(pendingIntent, remoteResponseIntent); // Convert original widgetView into bitmap to use for animation Canvas canvas = new Canvas(bitmap); view.draw(canvas); Loading Loading
quickstep/src/com/android/quickstep/util/SplitSelectDataHolder.kt +15 −1 Original line number Diff line number Diff line Loading @@ -93,6 +93,7 @@ class SplitSelectDataHolder( private var secondTaskId: Int = INVALID_TASK_ID private var initialIntent: Intent? = null private var secondIntent: Intent? = null private var widgetSecondIntent: Intent? = null private var initialUser: UserHandle? = null private var secondUser: UserHandle? = null private var initialPendingIntent: PendingIntent? = null Loading Loading @@ -167,6 +168,16 @@ class SplitSelectDataHolder( secondUser = pendingIntent.creatorUserHandle } /** * Similar to [setSecondTask] except this is to be called for widgets which can pass through * an extra intent from their RemoteResponse. * See [android.widget.RemoteViews.RemoteResponse.getLaunchOptions].first */ fun setSecondWidget(pendingIntent: PendingIntent, widgetIntent: Intent?) { setSecondTask(pendingIntent) widgetSecondIntent = widgetIntent } private fun getShortcutInfo(intent: Intent?, user: UserHandle?): ShortcutInfo? { val intentPackage = intent?.getPackage() ?: return null val shortcutId = intent.getStringExtra(ShortcutKey.EXTRA_SHORTCUT_ID) Loading Loading @@ -241,6 +252,7 @@ class SplitSelectDataHolder( secondTaskId, initialPendingIntent, secondPendingIntent, widgetSecondIntent, initialUser?.identifier ?: -1, secondUser?.identifier ?: -1, initialShortcut, Loading @@ -257,7 +269,8 @@ class SplitSelectDataHolder( * Note that both [initialIntent] and [secondIntent] will be nullified on method return * * One caveat is that if [secondPendingIntent] is set, we will use that and *not* attempt to * convert [secondIntent] * convert [secondIntent]. * This also leaves [widgetSecondIntent] untouched. */ private fun convertIntentsToFinalTypes() { initialShortcut = getShortcutInfo(initialIntent, initialUser) Loading Loading @@ -343,6 +356,7 @@ class SplitSelectDataHolder( var secondTaskId: Int = INVALID_TASK_ID, var initialPendingIntent: PendingIntent? = null, var secondPendingIntent: PendingIntent? = null, var widgetSecondIntent: Intent? = null, var initialUserId: Int = -1, var secondUserId: Int = -1, var initialShortcut: ShortcutInfo? = null, Loading
quickstep/src/com/android/quickstep/util/SplitSelectStateController.java +12 −5 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import static com.android.quickstep.util.SplitSelectDataHolder.SPLIT_TASK_PENDIN import static com.android.quickstep.util.SplitSelectDataHolder.SPLIT_TASK_SHORTCUT; import static com.android.quickstep.util.SplitSelectDataHolder.SPLIT_TASK_TASK; import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported; import static com.android.wm.shell.common.split.SplitScreenConstants.KEY_EXTRA_WIDGET_INTENT; import static com.android.wm.shell.common.split.SplitScreenConstants.SNAP_TO_50_50; import android.animation.Animator; Loading Loading @@ -355,6 +356,10 @@ public class SplitSelectStateController { mSplitSelectDataHolder.setSecondTask(pendingIntent); } public void setSecondWidget(PendingIntent pendingIntent, Intent widgetIntent) { mSplitSelectDataHolder.setSecondWidget(pendingIntent, widgetIntent); } /** * To be called when we want to launch split pairs from Overview. Split can be initiated from * either Overview or home, or all apps. Either both taskIds are set, or a pending intent + a Loading @@ -380,11 +385,13 @@ public class SplitSelectStateController { ShortcutInfo secondShortcut = launchData.getSecondShortcut(); PendingIntent firstPI = launchData.getInitialPendingIntent(); PendingIntent secondPI = launchData.getSecondPendingIntent(); Intent widgetIntent = launchData.getWidgetSecondIntent(); int firstUserId = launchData.getInitialUserId(); int secondUserId = launchData.getSecondUserId(); int initialStagePosition = launchData.getInitialStagePosition(); Bundle optionsBundle = options1.toBundle(); Bundle extrasBundle = new Bundle(1); extrasBundle.putParcelable(KEY_EXTRA_WIDGET_INTENT, widgetIntent); if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) { final RemoteTransition remoteTransition = getShellRemoteTransition(firstTaskId, secondTaskId, callback, "LaunchSplitPair"); Loading @@ -396,7 +403,7 @@ public class SplitSelectStateController { case SPLIT_TASK_PENDINGINTENT -> mSystemUiProxy.startIntentAndTask(secondPI, secondUserId, optionsBundle, firstTaskId, null /*options2*/, initialStagePosition, snapPosition, firstTaskId, extrasBundle, initialStagePosition, snapPosition, remoteTransition, shellInstanceId); case SPLIT_TASK_SHORTCUT -> Loading @@ -411,9 +418,9 @@ public class SplitSelectStateController { case SPLIT_PENDINGINTENT_PENDINGINTENT -> mSystemUiProxy.startIntents(firstPI, firstUserId, firstShortcut, optionsBundle, secondPI, secondUserId, secondShortcut, null /*options2*/, initialStagePosition, snapPosition, remoteTransition, shellInstanceId); optionsBundle, secondPI, secondUserId, secondShortcut, extrasBundle, initialStagePosition, snapPosition, remoteTransition, shellInstanceId); case SPLIT_SHORTCUT_TASK -> mSystemUiProxy.startShortcutAndTask(firstShortcut, optionsBundle, Loading
quickstep/src/com/android/quickstep/util/SplitToWorkspaceController.java +3 −2 Original line number Diff line number Diff line Loading @@ -72,7 +72,8 @@ public class SplitToWorkspaceController { * @return {@code true} if we can attempt launch the widget into split, {@code false} otherwise * to allow launcher to handle the click */ public boolean handleSecondWidgetSelectionForSplit(View view, PendingIntent pendingIntent) { public boolean handleSecondWidgetSelectionForSplit(View view, PendingIntent pendingIntent, Intent remoteResponseIntent) { if (shouldIgnoreSecondSplitLaunch()) { return false; } Loading @@ -86,7 +87,7 @@ public class SplitToWorkspaceController { Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); view.post(() -> { mController.setSecondTask(pendingIntent); mController.setSecondWidget(pendingIntent, remoteResponseIntent); // Convert original widgetView into bitmap to use for animation Canvas canvas = new Canvas(bitmap); view.draw(canvas); Loading