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

Commit 1520689a authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Fix broken transition when caceling enter split screen" into tm-qpr-dev

parents 6115f2ec 7119861f
Loading
Loading
Loading
Loading
+3 −14
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.wm.shell.splitscreen;

import static android.app.ActivityManager.START_SUCCESS;
import static android.app.ActivityManager.START_TASK_TO_FRONT;
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NO_USER_ACTION;
import static android.view.Display.DEFAULT_DISPLAY;
@@ -535,17 +536,11 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
                fillInIntent.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
                ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, "Adding MULTIPLE_TASK");
            } else {
                try {
                    adapter.getRunner().onAnimationCancelled(false /* isKeyguardOccluded */);
                    ActivityTaskManager.getService().startActivityFromRecents(taskId, options2);
                } catch (RemoteException e) {
                    Slog.e(TAG, "Error starting remote animation", e);
                }
                taskId = INVALID_TASK_ID;
                ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN,
                        "Cancel entering split as not supporting multi-instances");
                Toast.makeText(mContext, R.string.dock_multi_instances_not_supported_text,
                        Toast.LENGTH_SHORT).show();
                return;
            }
        }
        mStageCoordinator.startIntentAndTaskWithLegacyTransition(pendingIntent, fillInIntent,
@@ -586,17 +581,11 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
                fillInIntent2.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
                ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, "Adding MULTIPLE_TASK");
            } else {
                try {
                    adapter.getRunner().onAnimationCancelled(false /* isKeyguardOccluded */);
                    pendingIntent1.send();
                } catch (RemoteException | PendingIntent.CanceledException e) {
                    Slog.e(TAG, "Error starting remote animation", e);
                }
                pendingIntent2 = null;
                ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN,
                        "Cancel entering split as not supporting multi-instances");
                Toast.makeText(mContext, R.string.dock_multi_instances_not_supported_text,
                        Toast.LENGTH_SHORT).show();
                return;
            }
        }
        mStageCoordinator.startIntentsWithLegacyTransition(pendingIntent1, fillInIntent1, options1,
+22 −2
Original line number Diff line number Diff line
@@ -629,9 +629,19 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            RemoteAnimationAdapter adapter, InstanceId instanceId) {
        final WindowContainerTransaction wct = new WindowContainerTransaction();
        if (options1 == null) options1 = new Bundle();
        addActivityOptions(options1, mSideStage);
        if (pendingIntent2 == null) {
            // Launching a solo task.
            ActivityOptions activityOptions = ActivityOptions.fromBundle(options1);
            activityOptions.update(ActivityOptions.makeRemoteAnimation(adapter));
            options1 = activityOptions.toBundle();
            addActivityOptions(options1, null /* launchTarget */);
            wct.sendPendingIntent(pendingIntent1, fillInIntent1, options1);
            mSyncQueue.queue(wct);
            return;
        }

        addActivityOptions(options1, mSideStage);
        wct.sendPendingIntent(pendingIntent1, fillInIntent1, options1);
        startWithLegacyTransition(wct, pendingIntent2, fillInIntent2, options2, splitPosition,
                splitRatio, adapter, instanceId);
    }
@@ -666,9 +676,19 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
            InstanceId instanceId) {
        final WindowContainerTransaction wct = new WindowContainerTransaction();
        if (options1 == null) options1 = new Bundle();
        addActivityOptions(options1, mSideStage);
        if (taskId == INVALID_TASK_ID) {
            // Launching a solo task.
            ActivityOptions activityOptions = ActivityOptions.fromBundle(options1);
            activityOptions.update(ActivityOptions.makeRemoteAnimation(adapter));
            options1 = activityOptions.toBundle();
            addActivityOptions(options1, null /* launchTarget */);
            wct.startShortcut(mContext.getPackageName(), shortcutInfo, options1);
            mSyncQueue.queue(wct);
            return;
        }

        addActivityOptions(options1, mSideStage);
        wct.startShortcut(mContext.getPackageName(), shortcutInfo, options1);
        startWithLegacyTransition(wct, taskId, options2, splitPosition, splitRatio, adapter,
                instanceId);
    }