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

Commit 530d3e49 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Pass PictureInPictureParams in TaskInfo."

parents 43456733 f6690d1c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -247,6 +247,14 @@ public final class PictureInPictureParams implements Parcelable {
        return mSourceRectHint != null && !mSourceRectHint.isEmpty();
    }

    /**
     * @return True if no parameters are set
     * @hide
     */
    public boolean empty() {
        return !hasSourceBoundsHint() && !hasSetActions() && !hasSetAspectRatio();
    }

    @Override
    public int describeContents() {
        return 0;
+18 −1
Original line number Diff line number Diff line
@@ -148,6 +148,13 @@ public class TaskInfo {
    @NonNull
    public IWindowContainer token;

    /**
     * The PictureInPictureParams for the Task, if set.
     * @hide
     */
    @Nullable
    public PictureInPictureParams pictureInPictureParams;

    /**
     * The activity type of the top activity in this task.
     * @hide
@@ -209,6 +216,9 @@ public class TaskInfo {
        configuration.readFromParcel(source);
        token = IWindowContainer.Stub.asInterface(source.readStrongBinder());
        topActivityType = source.readInt();
        pictureInPictureParams = source.readInt() != 0
            ? PictureInPictureParams.CREATOR.createFromParcel(source)
            : null;
    }

    /**
@@ -246,6 +256,12 @@ public class TaskInfo {
        configuration.writeToParcel(dest, flags);
        dest.writeStrongInterface(token);
        dest.writeInt(topActivityType);
        if (pictureInPictureParams == null) {
            dest.writeInt(0);
        } else {
            dest.writeInt(1);
            pictureInPictureParams.writeToParcel(dest, flags);
        }
    }

    @Override
@@ -261,6 +277,7 @@ public class TaskInfo {
                + " supportsSplitScreenMultiWindow=" + supportsSplitScreenMultiWindow
                + " resizeMode=" + resizeMode
                + " token=" + token
                + " topActivityType=" + topActivityType;
                + " topActivityType=" + topActivityType
                + " pictureInPictureParams=" + pictureInPictureParams;
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -7692,4 +7692,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }
        win.getAnimationFrames(outFrame, outInsets, outStableInsets, outSurfaceInsets);
    }

    void setPictureInPictureParams(PictureInPictureParams p) {
        pictureInPictureArgs.copyOnlySet(p);
        getTask().getRootTask().setPictureInPictureParams(p);
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -4153,7 +4153,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                            return;
                        }
                        // Only update the saved args from the args that are set
                        r.pictureInPictureArgs.copyOnlySet(params);
                        r.setPictureInPictureParams(params);
                        final float aspectRatio = r.pictureInPictureArgs.getAspectRatio();
                        final List<RemoteAction> actions = r.pictureInPictureArgs.getActions();
                        // Adjust the source bounds by the insets for the transition down
@@ -4201,7 +4201,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                        "setPictureInPictureParams", token, params);

                // Only update the saved args from the args that are set
                r.pictureInPictureArgs.copyOnlySet(params);
                r.setPictureInPictureParams(params);
                if (r.inPinnedWindowingMode()) {
                    // If the activity is already in picture-in-picture, update the pinned stack now
                    // if it is not already expanding to fullscreen. Otherwise, the arguments will
+18 −0
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ import android.app.ActivityManager.TaskSnapshot;
import android.app.ActivityOptions;
import android.app.ActivityTaskManager;
import android.app.AppGlobals;
import android.app.PictureInPictureParams;
import android.app.TaskInfo;
import android.app.WindowConfiguration;
import android.content.ComponentName;
@@ -461,6 +462,11 @@ class Task extends WindowContainer<WindowContainer> {
     */
    ITaskOrganizer mTaskOrganizer;

    /**
     * Last Picture-in-Picture params applicable to the task. Updated when the app
     * enters Picture-in-Picture or when setPictureInPictureParams is called.
     */
    PictureInPictureParams mPictureInPictureParams = new PictureInPictureParams.Builder().build();

    /**
     * Don't use constructor directly. Use {@link #create(ActivityTaskManagerService, int,
@@ -3217,6 +3223,12 @@ class Task extends WindowContainer<WindowContainer> {
        //                    order changes.
        final Task top = getTopMostTask();
        info.resizeMode = top != null ? top.mResizeMode : mResizeMode;

        if (mPictureInPictureParams.empty()) {
            info.pictureInPictureParams = null;
        } else {
            info.pictureInPictureParams = mPictureInPictureParams;
        }
    }

    /**
@@ -3947,4 +3959,10 @@ class Task extends WindowContainer<WindowContainer> {
    void onWindowFocusChanged(boolean hasFocus) {
        updateShadowsRadius(hasFocus, getPendingTransaction());
    }

    void setPictureInPictureParams(PictureInPictureParams p) {
        mPictureInPictureParams.copyOnlySet(p);
        mAtmService.mTaskOrganizerController.dispatchTaskInfoChanged(
                this, true /* force */);
    }
}
Loading