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

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

Merge "Fix first drag to split not working" into sc-v2-dev am: b96a5795

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

Change-Id: Ibd3e9b6795744fee80fa643c111121eea46c381a
parents 28bcedef b96a5795
Loading
Loading
Loading
Loading
+12 −24
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import static android.view.RemoteAnimationTarget.MODE_OPENING;
import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission;
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_BOTTOM_OR_RIGHT;
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_TOP_OR_LEFT;
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_MAIN;

import android.app.ActivityManager;
import android.app.ActivityTaskManager;
@@ -76,6 +75,7 @@ import java.util.concurrent.Executor;
 * {@link SplitScreen}.
 * @see StageCoordinator
 */
// TODO(b/198577848): Implement split screen flicker test to consolidate CUJ of split screen.
public class SplitScreenController implements DragAndDropPolicy.Starter,
        RemoteCallable<SplitScreenController> {
    private static final String TAG = SplitScreenController.class.getSimpleName();
@@ -241,48 +241,36 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
    private void startIntentLegacy(PendingIntent intent, Intent fillInIntent,
            @SplitScreen.StageType int stage, @SplitPosition int position,
            @Nullable Bundle options) {
        final boolean wasInSplit = isSplitScreenVisible();

        LegacyTransitions.ILegacyTransition transition = new LegacyTransitions.ILegacyTransition() {
            @Override
            public void onAnimationStart(int transit, RemoteAnimationTarget[] apps,
                    RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps,
                    IRemoteAnimationFinishedCallback finishedCallback,
                    SurfaceControl.Transaction t) {
                boolean cancelled = apps == null || apps.length == 0;
                mStageCoordinator.updateSurfaceBounds(null /* layout */, t);
                if (cancelled) {
                    if (!wasInSplit) {
                        final WindowContainerTransaction undoWct = new WindowContainerTransaction();
                        mStageCoordinator.prepareExitSplitScreen(STAGE_TYPE_MAIN, undoWct);
                        mSyncQueue.queue(undoWct);
                        mSyncQueue.runInSync(undoT -> {
                            // looks weird, but we want undoT to execute after t but still want the
                            // rest of the syncQueue runnables to aggregate.
                            t.merge(undoT);
                            undoT.merge(t);
                        });
                        return;
                    }
                } else {

                if (apps != null) {
                    for (int i = 0; i < apps.length; ++i) {
                        if (apps[i].mode == MODE_OPENING) {
                            t.show(apps[i].leash);
                        }
                    }
                }
                RemoteAnimationTarget divider = mStageCoordinator.getDividerBarLegacyTarget();

                final RemoteAnimationTarget divider = mStageCoordinator.getDividerBarLegacyTarget();
                if (divider.leash != null) {
                    t.show(divider.leash);
                }

                t.apply();
                if (cancelled) return;
                if (finishedCallback != null) {
                    try {
                        finishedCallback.onAnimationFinished();
                    } catch (RemoteException e) {
                        Slog.e(TAG, "Error finishing legacy transition: ", e);
                    }
                }
            }
        };
        WindowContainerTransaction wct = new WindowContainerTransaction();
        options = mStageCoordinator.resolveStartStage(stage, position, options, wct);
+1 −11
Original line number Diff line number Diff line
@@ -275,8 +275,6 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                syncId = startSyncWithOrganizer(callback);
                applyTransaction(t, syncId, null /* transition */, caller);
                setSyncReady(syncId);
                mService.mRootWindowContainer.getDisplayContent(DEFAULT_DISPLAY)
                        .executeAppTransition();
            }
        } finally {
            Binder.restoreCallingIdentity(ident);
@@ -653,18 +651,10 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                    options = activityOptions.toBundle();
                }

                int res = mService.mAmInternal.sendIntentSender(hop.getPendingIntent().getTarget(),
                mService.mAmInternal.sendIntentSender(hop.getPendingIntent().getTarget(),
                        hop.getPendingIntent().getWhitelistToken(), 0 /* code */,
                        hop.getActivityIntent(), resolvedType, null /* finishReceiver */,
                        null /* requiredPermission */, options);
                if (res != ActivityManager.START_SUCCESS
                        && res != ActivityManager.START_TASK_TO_FRONT) {
                    if (!mTransitionController.isShellTransitionsEnabled()) {
                        final DisplayContent dc =
                                mService.mRootWindowContainer.getDisplayContent(DEFAULT_DISPLAY);
                        dc.cancelAppTransition();
                    }
                }
                break;
            case HIERARCHY_OP_TYPE_CREATE_TASK_FRAGMENT:
                final TaskFragmentCreationParams taskFragmentCreationOptions =