Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab9e66c2 authored by Jeremy Sim's avatar Jeremy Sim Committed by Android (Google) Code Review
Browse files

Merge "Allows splitscreen with work & personal version of the same app" into udc-dev

parents 5de8f06d 92e1eeb5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -325,6 +325,7 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
                                mItemInfo.getIntent().getComponent(),
                                null,
                                mItemInfo.user),
                        mItemInfo.user.getIdentifier(),
                        new Intent(),
                        getPosition().stagePosition,
                        null,
+2 −1
Original line number Diff line number Diff line
@@ -111,7 +111,8 @@ public class TaskbarShortcutMenuAccessibilityDelegate
                                item.getIntent().getComponent(),
                                /* startActivityOptions= */null,
                                item.user),
                        new Intent(), side, null, instanceIds.first);
                        item.user.getIdentifier(), new Intent(), side, null,
                        instanceIds.first);
            }
            return true;
        } else if (action == DEEP_SHORTCUTS || action == SHORTCUTS_AND_NOTIFICATIONS) {
+22 −20
Original line number Diff line number Diff line
@@ -683,12 +683,12 @@ public class SystemUiProxy implements ISystemUiProxy {
        }
    }

    public void startIntentAndTask(PendingIntent pendingIntent, Bundle options1, int taskId,
            Bundle options2, @SplitConfigurationOptions.StagePosition int splitPosition,
    public void startIntentAndTask(PendingIntent pendingIntent, int userId1, Bundle options1,
            int taskId, Bundle options2, @SplitConfigurationOptions.StagePosition int splitPosition,
            float splitRatio, RemoteTransition remoteTransition, InstanceId instanceId) {
        if (mSystemUiProxy != null) {
            try {
                mSplitScreen.startIntentAndTask(pendingIntent, options1, taskId, options2,
                mSplitScreen.startIntentAndTask(pendingIntent, userId1, options1, taskId, options2,
                        splitPosition, splitRatio, remoteTransition, instanceId);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed call startIntentAndTask");
@@ -696,15 +696,16 @@ public class SystemUiProxy implements ISystemUiProxy {
        }
    }

    public void startIntents(PendingIntent pendingIntent1, @Nullable ShortcutInfo shortcutInfo1,
            Bundle options1, PendingIntent pendingIntent2, @Nullable ShortcutInfo shortcutInfo2,
            Bundle options2, @SplitConfigurationOptions.StagePosition int splitPosition,
            float splitRatio, RemoteTransition remoteTransition, InstanceId instanceId) {
    public void startIntents(PendingIntent pendingIntent1, int userId1,
            @Nullable ShortcutInfo shortcutInfo1, Bundle options1, PendingIntent pendingIntent2,
            int userId2, @Nullable ShortcutInfo shortcutInfo2, Bundle options2,
            @SplitConfigurationOptions.StagePosition int splitPosition, float splitRatio,
            RemoteTransition remoteTransition, InstanceId instanceId) {
        if (mSystemUiProxy != null) {
            try {
                mSplitScreen.startIntents(pendingIntent1, shortcutInfo1, options1, pendingIntent2,
                        shortcutInfo2, options2, splitPosition, splitRatio, remoteTransition,
                        instanceId);
                mSplitScreen.startIntents(pendingIntent1, userId1, shortcutInfo1, options1,
                        pendingIntent2, userId2, shortcutInfo2, options2, splitPosition, splitRatio,
                        remoteTransition, instanceId);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed call startIntents");
            }
@@ -740,14 +741,14 @@ public class SystemUiProxy implements ISystemUiProxy {
        }
    }

    public void startIntentAndTaskWithLegacyTransition(PendingIntent pendingIntent,
    public void startIntentAndTaskWithLegacyTransition(PendingIntent pendingIntent, int userId1,
            Bundle options1, int taskId, Bundle options2,
            @SplitConfigurationOptions.StagePosition int splitPosition, float splitRatio,
            RemoteAnimationAdapter adapter, InstanceId instanceId) {
        if (mSystemUiProxy != null) {
            try {
                mSplitScreen.startIntentAndTaskWithLegacyTransition(pendingIntent, options1, taskId,
                        options2, splitPosition, splitRatio, adapter, instanceId);
                mSplitScreen.startIntentAndTaskWithLegacyTransition(pendingIntent, userId1,
                        options1, taskId, options2, splitPosition, splitRatio, adapter, instanceId);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed call startIntentAndTaskWithLegacyTransition");
            }
@@ -771,16 +772,16 @@ public class SystemUiProxy implements ISystemUiProxy {
     * Starts a pair of intents or shortcuts in split-screen using legacy transition. Passing a
     * non-null shortcut info means to start the app as a shortcut.
     */
    public void startIntentsWithLegacyTransition(PendingIntent pendingIntent1,
    public void startIntentsWithLegacyTransition(PendingIntent pendingIntent1, int userId1,
            @Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1,
            PendingIntent pendingIntent2, @Nullable ShortcutInfo shortcutInfo2,
            PendingIntent pendingIntent2, int userId2, @Nullable ShortcutInfo shortcutInfo2,
            @Nullable Bundle options2, @SplitConfigurationOptions.StagePosition int sidePosition,
            float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) {
        if (mSystemUiProxy != null) {
            try {
                mSplitScreen.startIntentsWithLegacyTransition(pendingIntent1, shortcutInfo1,
                        options1, pendingIntent2, shortcutInfo2, options2, sidePosition, splitRatio,
                        adapter, instanceId);
                mSplitScreen.startIntentsWithLegacyTransition(pendingIntent1, userId1,
                        shortcutInfo1, options1, pendingIntent2, userId2, shortcutInfo2, options2,
                        sidePosition, splitRatio, adapter, instanceId);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed call startIntentsWithLegacyTransition");
            }
@@ -799,11 +800,12 @@ public class SystemUiProxy implements ISystemUiProxy {
        }
    }

    public void startIntent(PendingIntent intent, Intent fillInIntent, int position,
    public void startIntent(PendingIntent intent, int userId, Intent fillInIntent, int position,
            Bundle options, InstanceId instanceId) {
        if (mSplitScreen != null) {
            try {
                mSplitScreen.startIntent(intent, fillInIntent, position, options, instanceId);
                mSplitScreen.startIntent(intent, userId, fillInIntent, position, options,
                        instanceId);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed call startIntent");
            }
+4 −0
Original line number Diff line number Diff line
@@ -207,6 +207,8 @@ class SplitSelectDataHolder(
                secondTaskId,
                initialPendingIntent,
                secondPendingIntent,
                initialUser?.identifier ?: -1,
                secondUser?.identifier ?: -1,
                initialShortcut,
                secondShortcut,
                itemInfo,
@@ -291,6 +293,8 @@ class SplitSelectDataHolder(
            var secondTaskId: Int = INVALID_TASK_ID,
            var initialPendingIntent: PendingIntent? = null,
            var secondPendingIntent: PendingIntent? = null,
            var initialUserId: Int = -1,
            var secondUserId: Int = -1,
            var initialShortcut: ShortcutInfo? = null,
            var secondShortcut: ShortcutInfo? = null,
            var itemInfo: ItemInfo? = null,
+28 −22
Original line number Diff line number Diff line
@@ -372,12 +372,13 @@ public class SplitSelectStateController {
                        shellInstanceId);
            } else {
                mSystemUiProxy.startIntents(getPendingIntent(intent1, mInitialUser),
                        getShortcutInfo(intent1, mInitialUser), options1.toBundle(),
                        hasSecondaryPendingIntent
                        mInitialUser.getIdentifier(), getShortcutInfo(intent1, mInitialUser),
                        options1.toBundle(), hasSecondaryPendingIntent
                                ? mSecondPendingIntent
                                : getPendingIntent(intent2, mSecondUser),
                        getShortcutInfo(intent2, mSecondUser), null /* options2 */,
                        stagePosition, splitRatio, remoteTransition, shellInstanceId);
                        mSecondUser.getIdentifier(), getShortcutInfo(intent2, mSecondUser),
                        null /* options2 */, stagePosition, splitRatio, remoteTransition,
                        shellInstanceId);
            }
        } else {
            final RemoteSplitLaunchAnimationRunner animationRunner =
@@ -399,13 +400,13 @@ public class SplitSelectStateController {
                        shellInstanceId);
            } else {
                mSystemUiProxy.startIntentsWithLegacyTransition(
                        getPendingIntent(intent1, mInitialUser),
                        getPendingIntent(intent1, mInitialUser), mInitialUser.getIdentifier(),
                        getShortcutInfo(intent1, mInitialUser), options1.toBundle(),
                        hasSecondaryPendingIntent
                                ? mSecondPendingIntent
                                : getPendingIntent(intent2, mSecondUser),
                        getShortcutInfo(intent2, mSecondUser), null /* options2 */, stagePosition,
                        splitRatio, adapter, shellInstanceId);
                        mSecondUser.getIdentifier(), getShortcutInfo(intent2, mSecondUser),
                        null /* options2 */, stagePosition, splitRatio, adapter, shellInstanceId);
            }
        }
    }
@@ -425,6 +426,8 @@ public class SplitSelectStateController {
        ShortcutInfo secondShortcut = launchData.getSecondShortcut();
        PendingIntent firstPI = launchData.getInitialPendingIntent();
        PendingIntent secondPI = launchData.getSecondPendingIntent();
        int firstUserId = launchData.getInitialUserId();
        int secondUserId = launchData.getSecondUserId();
        int initialStagePosition = launchData.getInitialStagePosition();
        Bundle optionsBundle = options1.toBundle();

@@ -441,8 +444,8 @@ public class SplitSelectStateController {
                                remoteTransition, shellInstanceId);

                case SPLIT_TASK_PENDINGINTENT ->
                        mSystemUiProxy.startIntentAndTask(secondPI, optionsBundle, firstTaskId,
                                null /*options2*/, initialStagePosition, splitRatio,
                        mSystemUiProxy.startIntentAndTask(secondPI, secondUserId, optionsBundle,
                                firstTaskId, null /*options2*/, initialStagePosition, splitRatio,
                                remoteTransition, shellInstanceId);

                case SPLIT_TASK_SHORTCUT ->
@@ -451,13 +454,14 @@ public class SplitSelectStateController {
                                remoteTransition, shellInstanceId);

                case SPLIT_PENDINGINTENT_TASK ->
                        mSystemUiProxy.startIntentAndTask(firstPI, optionsBundle, secondTaskId,
                                null /*options2*/, initialStagePosition, splitRatio,
                        mSystemUiProxy.startIntentAndTask(firstPI, firstUserId, optionsBundle,
                                secondTaskId, null /*options2*/, initialStagePosition, splitRatio,
                                remoteTransition, shellInstanceId);

                case SPLIT_PENDINGINTENT_PENDINGINTENT ->
                        mSystemUiProxy.startIntents(firstPI, firstShortcut, optionsBundle, secondPI,
                                secondShortcut, null /*options2*/, initialStagePosition, splitRatio,
                        mSystemUiProxy.startIntents(firstPI, firstUserId, firstShortcut,
                                optionsBundle, secondPI, secondUserId, secondShortcut,
                                null /*options2*/, initialStagePosition, splitRatio,
                                remoteTransition, shellInstanceId);

                case SPLIT_SHORTCUT_TASK ->
@@ -479,8 +483,8 @@ public class SplitSelectStateController {

                case SPLIT_TASK_PENDINGINTENT ->
                        mSystemUiProxy.startIntentAndTaskWithLegacyTransition(secondPI,
                                optionsBundle, firstTaskId, null /*options2*/, initialStagePosition,
                                splitRatio, adapter, shellInstanceId);
                                secondUserId, optionsBundle, firstTaskId, null /*options2*/,
                                initialStagePosition, splitRatio, adapter, shellInstanceId);

                case SPLIT_TASK_SHORTCUT ->
                        mSystemUiProxy.startShortcutAndTaskWithLegacyTransition(secondShortcut,
@@ -488,14 +492,15 @@ public class SplitSelectStateController {
                                splitRatio, adapter, shellInstanceId);

                case SPLIT_PENDINGINTENT_TASK ->
                        mSystemUiProxy.startIntentAndTaskWithLegacyTransition(firstPI,
                        mSystemUiProxy.startIntentAndTaskWithLegacyTransition(firstPI, firstUserId,
                                optionsBundle, secondTaskId, null /*options2*/,
                                initialStagePosition, splitRatio, adapter, shellInstanceId);

                case SPLIT_PENDINGINTENT_PENDINGINTENT ->
                        mSystemUiProxy.startIntentsWithLegacyTransition(firstPI, firstShortcut,
                                optionsBundle, secondPI, secondShortcut, null /*options2*/,
                                initialStagePosition, splitRatio, adapter, shellInstanceId);
                        mSystemUiProxy.startIntentsWithLegacyTransition(firstPI, firstUserId,
                                firstShortcut, optionsBundle, secondPI, secondUserId,
                                secondShortcut, null /*options2*/, initialStagePosition, splitRatio,
                                adapter, shellInstanceId);

                case SPLIT_SHORTCUT_TASK ->
                        mSystemUiProxy.startShortcutAndTaskWithLegacyTransition(firstShortcut,
@@ -514,7 +519,7 @@ public class SplitSelectStateController {
                    options1.toBundle(), taskId, null /* options2 */, stagePosition,
                    splitRatio, remoteTransition, shellInstanceId);
        } else {
            mSystemUiProxy.startIntentAndTask(getPendingIntent(intent, user),
            mSystemUiProxy.startIntentAndTask(getPendingIntent(intent, user), user.getIdentifier(),
                    options1.toBundle(), taskId, null /* options2 */, stagePosition, splitRatio,
                    remoteTransition, shellInstanceId);
        }
@@ -531,8 +536,9 @@ public class SplitSelectStateController {
                    splitRatio, adapter, shellInstanceId);
        } else {
            mSystemUiProxy.startIntentAndTaskWithLegacyTransition(
                    getPendingIntent(intent, user), options1.toBundle(), taskId,
                    null /* options2 */, stagePosition, splitRatio, adapter, shellInstanceId);
                    getPendingIntent(intent, user), user.getIdentifier(), options1.toBundle(),
                    taskId, null /* options2 */, stagePosition, splitRatio, adapter,
                    shellInstanceId);
        }
    }