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

Commit 5de1e9db authored by Jerry Chang's avatar Jerry Chang Committed by Automerger Merge Worker
Browse files

Merge "Support entering split screen with a shortcut and an intent" into...

Merge "Support entering split screen with a shortcut and an intent" into tm-qpr-dev am: 0b3ff821 am: e4abd743

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21256452



Change-Id: I9602e6776a7c16e47f77a11ec739e1a8ede0fa0a
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents a11ecd59 e4abd743
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -122,9 +122,9 @@ interface ISplitScreen {
     * Start a pair of intents using legacy transition system.
     */
    oneway void startIntentsWithLegacyTransition(in PendingIntent pendingIntent1,
            in Bundle options1, in PendingIntent pendingIntent2, in Bundle options2,
            int splitPosition, float splitRatio, in RemoteAnimationAdapter adapter,
            in InstanceId instanceId) = 18;
            in ShortcutInfo shortcutInfo1, in Bundle options1, in PendingIntent pendingIntent2,
            in ShortcutInfo shortcutInfo2, in Bundle options2, int splitPosition, float splitRatio,
            in RemoteAnimationAdapter adapter, in InstanceId instanceId) = 18;

    /**
     * Start a pair of intents in one transition.
+13 −11
Original line number Diff line number Diff line
@@ -583,9 +583,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
    }

    private void startIntentsWithLegacyTransition(PendingIntent pendingIntent1,
            @Nullable Bundle options1, PendingIntent pendingIntent2,
            @Nullable Bundle options2, @SplitPosition int splitPosition,
            float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) {
            @Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1,
            PendingIntent pendingIntent2, @Nullable ShortcutInfo shortcutInfo2,
            @Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio,
            RemoteAnimationAdapter adapter, InstanceId instanceId) {
        Intent fillInIntent1 = null;
        Intent fillInIntent2 = null;
        final String packageName1 = SplitScreenUtils.getPackageName(pendingIntent1);
@@ -605,9 +606,9 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
                        Toast.LENGTH_SHORT).show();
            }
        }
        mStageCoordinator.startIntentsWithLegacyTransition(pendingIntent1, fillInIntent1, options1,
                pendingIntent2, fillInIntent2, options2, splitPosition, splitRatio, adapter,
                instanceId);
        mStageCoordinator.startIntentsWithLegacyTransition(pendingIntent1, fillInIntent1,
                shortcutInfo1, options1, pendingIntent2, fillInIntent2, shortcutInfo2, options2,
                splitPosition, splitRatio, adapter, instanceId);
    }

    @Override
@@ -1037,13 +1038,14 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,

        @Override
        public void startIntentsWithLegacyTransition(PendingIntent pendingIntent1,
                @Nullable Bundle options1, PendingIntent pendingIntent2, @Nullable Bundle options2,
                @SplitPosition int splitPosition, float splitRatio, RemoteAnimationAdapter adapter,
                InstanceId instanceId) {
                @Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1,
                PendingIntent pendingIntent2, @Nullable ShortcutInfo shortcutInfo2,
                @Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio,
                RemoteAnimationAdapter adapter, InstanceId instanceId) {
            executeRemoteCallWithTaskPermission(mController, "startIntentsWithLegacyTransition",
                    (controller) ->
                        controller.startIntentsWithLegacyTransition(
                                pendingIntent1, options1, pendingIntent2, options2, splitPosition,
                        controller.startIntentsWithLegacyTransition(pendingIntent1, shortcutInfo1,
                                options1, pendingIntent2, shortcutInfo2, options2, splitPosition,
                                splitRatio, adapter, instanceId)
                    );
        }
+36 −20
Original line number Diff line number Diff line
@@ -692,9 +692,11 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,

    /** Starts a pair of intents using legacy transition. */
    void startIntentsWithLegacyTransition(PendingIntent pendingIntent1, Intent fillInIntent1,
            @Nullable Bundle options1, PendingIntent pendingIntent2, Intent fillInIntent2,
            @Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio,
            RemoteAnimationAdapter adapter, InstanceId instanceId) {
            @Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1,
            @Nullable PendingIntent pendingIntent2, Intent fillInIntent2,
            @Nullable ShortcutInfo shortcutInfo2, @Nullable Bundle options2,
            @SplitPosition int splitPosition, float splitRatio, RemoteAnimationAdapter adapter,
            InstanceId instanceId) {
        final WindowContainerTransaction wct = new WindowContainerTransaction();
        if (options1 == null) options1 = new Bundle();
        if (pendingIntent2 == null) {
@@ -703,15 +705,23 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            activityOptions.update(ActivityOptions.makeRemoteAnimation(adapter));
            options1 = activityOptions.toBundle();
            addActivityOptions(options1, null /* launchTarget */);
            if (shortcutInfo1 != null) {
                wct.startShortcut(mContext.getPackageName(), shortcutInfo1, options1);
            } else {
                wct.sendPendingIntent(pendingIntent1, fillInIntent1, options1);
            }
            mSyncQueue.queue(wct);
            return;
        }

        addActivityOptions(options1, mSideStage);
        if (shortcutInfo1 != null) {
            wct.startShortcut(mContext.getPackageName(), shortcutInfo1, options1);
        } else {
            wct.sendPendingIntent(pendingIntent1, fillInIntent1, options1);
        startWithLegacyTransition(wct, pendingIntent2, fillInIntent2, options2, splitPosition,
                splitRatio, adapter, instanceId);
        }
        startWithLegacyTransition(wct, pendingIntent2, fillInIntent2, shortcutInfo2, options2,
                splitPosition, splitRatio, adapter, instanceId);
    }

    void startIntentAndTaskWithLegacyTransition(PendingIntent pendingIntent, Intent fillInIntent,
@@ -763,18 +773,19 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,

    private void startWithLegacyTransition(WindowContainerTransaction wct,
            @Nullable PendingIntent mainPendingIntent, @Nullable Intent mainFillInIntent,
            @Nullable Bundle mainOptions, @SplitPosition int sidePosition, float splitRatio,
            RemoteAnimationAdapter adapter, InstanceId instanceId) {
            @Nullable ShortcutInfo mainShortcutInfo, @Nullable Bundle mainOptions,
            @SplitPosition int sidePosition, float splitRatio, RemoteAnimationAdapter adapter,
            InstanceId instanceId) {
        startWithLegacyTransition(wct, INVALID_TASK_ID, mainPendingIntent, mainFillInIntent,
                mainOptions, sidePosition, splitRatio, adapter, instanceId);
                mainShortcutInfo, mainOptions, sidePosition, splitRatio, adapter, instanceId);
    }

    private void startWithLegacyTransition(WindowContainerTransaction wct, int mainTaskId,
            @Nullable Bundle mainOptions, @SplitPosition int sidePosition, float splitRatio,
            RemoteAnimationAdapter adapter, InstanceId instanceId) {
        startWithLegacyTransition(wct, mainTaskId, null /* mainPendingIntent */,
                null /* mainFillInIntent */, mainOptions, sidePosition, splitRatio, adapter,
                instanceId);
                null /* mainFillInIntent */, null /* mainShortcutInfo */, mainOptions, sidePosition,
                splitRatio, adapter, instanceId);
    }

    /**
@@ -784,8 +795,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
     */
    private void startWithLegacyTransition(WindowContainerTransaction wct, int mainTaskId,
            @Nullable PendingIntent mainPendingIntent, @Nullable Intent mainFillInIntent,
            @Nullable Bundle mainOptions, @SplitPosition int sidePosition, float splitRatio,
            RemoteAnimationAdapter adapter, InstanceId instanceId) {
            @Nullable ShortcutInfo mainShortcutInfo, @Nullable Bundle options,
            @SplitPosition int sidePosition, float splitRatio, RemoteAnimationAdapter adapter,
            InstanceId instanceId) {
        if (!isSplitScreenVisible()) {
            exitSplitScreen(null /* childrenToTop */, EXIT_REASON_RECREATE_SPLIT);
        }
@@ -809,15 +821,19 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            mMainStage.activate(wct, false /* reparent */);
        }

        if (mainOptions == null) mainOptions = new Bundle();
        addActivityOptions(mainOptions, mMainStage);
        mainOptions = wrapAsSplitRemoteAnimation(adapter, mainOptions);
        if (options == null) options = new Bundle();
        addActivityOptions(options, mMainStage);
        options = wrapAsSplitRemoteAnimation(adapter, options);

        updateWindowBounds(mSplitLayout, wct);
        if (mainTaskId == INVALID_TASK_ID) {
            wct.sendPendingIntent(mainPendingIntent, mainFillInIntent, mainOptions);

        // TODO(b/268008375): Merge APIs to start a split pair into one.
        if (mainTaskId != INVALID_TASK_ID) {
            wct.startTask(mainTaskId, options);
        } else if (mainShortcutInfo != null) {
            wct.startShortcut(mContext.getPackageName(), mainShortcutInfo, options);
        } else {
            wct.startTask(mainTaskId, mainOptions);
            wct.sendPendingIntent(mainPendingIntent, mainFillInIntent, options);
        }

        wct.reorder(mRootTaskInfo.token, true);