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

Commit 6f562371 authored by Evan Rosky's avatar Evan Rosky Committed by Android (Google) Code Review
Browse files

Merge changes I710805c8,Ie26d634b into sc-v2-dev

* changes:
  Create a LegacyTransitions to manage combined WCT + remoteanimation
  Aggregate stage-split operations into WCT
parents 276df102 6139cf51
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -646,4 +646,9 @@ public abstract class ActivityManagerInternal {
     */
    @Nullable
    public abstract List<Integer> getIsolatedProcesses(int uid);

    /** @see ActivityManagerService#sendIntentSender */
    public abstract int sendIntentSender(IIntentSender target, IBinder allowlistToken, int code,
            Intent intent, String resolvedType,
            IIntentReceiver finishedReceiver, String requiredPermission, Bundle options);
}
+12 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.window;
import android.view.SurfaceControl;

import android.os.IBinder;
import android.view.RemoteAnimationAdapter;
import android.window.IDisplayAreaOrganizerController;
import android.window.ITaskFragmentOrganizerController;
import android.window.ITaskOrganizerController;
@@ -60,6 +61,17 @@ interface IWindowOrganizerController {
    IBinder startTransition(int type, in @nullable IBinder transitionToken,
            in @nullable WindowContainerTransaction t);

    /**
     * Starts a legacy transition.
     * @param type The transition type.
     * @param adapter The animation to use.
     * @param syncCallback A sync callback for the contents of `t`
     * @param t Operations that are part of the transition.
     * @return sync-id or -1 if this no-op'd because a transition is already running.
     */
    int startLegacyTransition(int type, in RemoteAnimationAdapter adapter,
            in IWindowContainerTransactionCallback syncCallback, in WindowContainerTransaction t);

    /**
     * Finishes a transition. This must be called for all created transitions.
     * @param transitionToken Which transition to finish
+40 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.window;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.TestApi;
import android.app.PendingIntent;
import android.app.WindowConfiguration;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@@ -388,6 +389,24 @@ public final class WindowContainerTransaction implements Parcelable {
        return this;
    }

    /**
     * Sends a pending intent in sync.
     * @param sender The PendingIntent sender.
     * @param intent The fillIn intent to patch over the sender's base intent.
     * @param options bundle containing ActivityOptions for the task's top activity.
     * @hide
     */
    @NonNull
    public WindowContainerTransaction sendPendingIntent(PendingIntent sender, Intent intent,
            @Nullable Bundle options) {
        mHierarchyOps.add(new HierarchyOp.Builder(HierarchyOp.HIERARCHY_OP_TYPE_PENDING_INTENT)
                .setLaunchOptions(options)
                .setPendingIntent(sender)
                .setActivityIntent(intent)
                .build());
        return this;
    }

    /**
     * Creates a new TaskFragment with the given options.
     * @param taskFragmentOptions the options used to create the TaskFragment.
@@ -886,6 +905,7 @@ public final class WindowContainerTransaction implements Parcelable {
        public static final int HIERARCHY_OP_TYPE_START_ACTIVITY_IN_TASK_FRAGMENT = 9;
        public static final int HIERARCHY_OP_TYPE_REPARENT_ACTIVITY_TO_TASK_FRAGMENT = 10;
        public static final int HIERARCHY_OP_TYPE_REPARENT_CHILDREN = 11;
        public static final int HIERARCHY_OP_TYPE_PENDING_INTENT = 12;

        // The following key(s) are for use with mLaunchOptions:
        // When launching a task (eg. from recents), this is the taskId to be launched.
@@ -920,6 +940,9 @@ public final class WindowContainerTransaction implements Parcelable {
        @Nullable
        private TaskFragmentCreationParams mTaskFragmentCreationOptions;

        @Nullable
        private PendingIntent mPendingIntent;

        public static HierarchyOp createForReparent(
                @NonNull IBinder container, @Nullable IBinder reparent, boolean toTop) {
            return new HierarchyOp.Builder(HIERARCHY_OP_TYPE_REPARENT)
@@ -998,6 +1021,7 @@ public final class WindowContainerTransaction implements Parcelable {
            mLaunchOptions = copy.mLaunchOptions;
            mActivityIntent = copy.mActivityIntent;
            mTaskFragmentCreationOptions = copy.mTaskFragmentCreationOptions;
            mPendingIntent = copy.mPendingIntent;
        }

        protected HierarchyOp(Parcel in) {
@@ -1010,6 +1034,7 @@ public final class WindowContainerTransaction implements Parcelable {
            mLaunchOptions = in.readBundle();
            mActivityIntent = in.readTypedObject(Intent.CREATOR);
            mTaskFragmentCreationOptions = in.readTypedObject(TaskFragmentCreationParams.CREATOR);
            mPendingIntent = in.readTypedObject(PendingIntent.CREATOR);
        }

        public int getType() {
@@ -1062,6 +1087,11 @@ public final class WindowContainerTransaction implements Parcelable {
            return mTaskFragmentCreationOptions;
        }

        @Nullable
        public PendingIntent getPendingIntent() {
            return mPendingIntent;
        }

        @Override
        public String toString() {
            switch (mType) {
@@ -1117,6 +1147,7 @@ public final class WindowContainerTransaction implements Parcelable {
            dest.writeBundle(mLaunchOptions);
            dest.writeTypedObject(mActivityIntent, flags);
            dest.writeTypedObject(mTaskFragmentCreationOptions, flags);
            dest.writeTypedObject(mPendingIntent, flags);
        }

        @Override
@@ -1163,6 +1194,9 @@ public final class WindowContainerTransaction implements Parcelable {
            @Nullable
            private TaskFragmentCreationParams mTaskFragmentCreationOptions;

            @Nullable
            private PendingIntent mPendingIntent;

            Builder(int type) {
                mType = type;
            }
@@ -1202,6 +1236,11 @@ public final class WindowContainerTransaction implements Parcelable {
                return this;
            }

            Builder setPendingIntent(@Nullable PendingIntent sender) {
                mPendingIntent = sender;
                return this;
            }

            Builder setTaskFragmentCreationOptions(
                    @Nullable TaskFragmentCreationParams taskFragmentCreationOptions) {
                mTaskFragmentCreationOptions = taskFragmentCreationOptions;
@@ -1221,6 +1260,7 @@ public final class WindowContainerTransaction implements Parcelable {
                hierarchyOp.mToTop = mToTop;
                hierarchyOp.mLaunchOptions = mLaunchOptions;
                hierarchyOp.mActivityIntent = mActivityIntent;
                hierarchyOp.mPendingIntent = mPendingIntent;
                hierarchyOp.mTaskFragmentCreationOptions = mTaskFragmentCreationOptions;

                return hierarchyOp;
+22 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.app.ActivityTaskManager;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Singleton;
import android.view.RemoteAnimationAdapter;

/**
 * Base class for organizing specific types of windows like Tasks and DisplayAreas
@@ -124,6 +125,27 @@ public class WindowOrganizer {
        }
    }

    /**
     * Start a legacy transition.
     * @param type The type of the transition. This is ignored if a transitionToken is provided.
     * @param adapter An existing transition to start. If null, a new transition is created.
     * @param t The set of window operations that are part of this transition.
     * @return true on success, false if a transition was already running.
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
    @NonNull
    public int startLegacyTransition(int type, @NonNull RemoteAnimationAdapter adapter,
            @NonNull WindowContainerTransactionCallback syncCallback,
            @NonNull WindowContainerTransaction t) {
        try {
            return getWindowOrganizerController().startLegacyTransition(
                    type, adapter, syncCallback.mInterface, t);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Register an ITransitionPlayer to handle transition animations.
     * @hide
+7 −3
Original line number Diff line number Diff line
@@ -187,6 +187,7 @@ class AppPair implements ShellTaskOrganizer.TaskListener, SplitLayout.SplitLayou
                    .setPosition(mTaskLeash2, mTaskInfo2.positionInParent.x,
                            mTaskInfo2.positionInParent.y)
                    .setPosition(dividerLeash, dividerBounds.left, dividerBounds.top)
                    .show(dividerLeash)
                    .show(mRootTaskLeash)
                    .show(mTaskLeash1)
                    .show(mTaskLeash2);
@@ -212,10 +213,13 @@ class AppPair implements ShellTaskOrganizer.TaskListener, SplitLayout.SplitLayou
            }
            mRootTaskInfo = taskInfo;

            if (mSplitLayout != null
                    && mSplitLayout.updateConfiguration(mRootTaskInfo.configuration)) {
            if (mSplitLayout != null) {
                if (mSplitLayout.updateConfiguration(mRootTaskInfo.configuration)) {
                    onBoundsChanged(mSplitLayout);
                }
                // updateConfiguration re-inits the dividerbar, so show it now
                mSyncQueue.runInSync(t -> t.show(mSplitLayout.getDividerLeash()));
            }
        } else if (taskInfo.taskId == getTaskId1()) {
            mTaskInfo1 = taskInfo;
        } else if (taskInfo.taskId == getTaskId2()) {
Loading