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

Commit c9a7c24e authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Pass AppOps result for PiP in RemoteAnimationTarget

This result will be used by Launcher when deciding if we should start
the auto-enter-pip transition.

Video: http://recall/-/aaaaaabFQoRHlzixHdtY/c9raN4jiaNqbiV7DF4YTJ6
Bug: 194272108
Test: try auto-enter-pip with permission disabled
Change-Id: Iea3a45fd68b54d74e7d5da91b63684c206a0132e
parent eced4b32
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -196,6 +196,12 @@ public class RemoteAnimationTarget implements Parcelable {
     */
    public ActivityManager.RunningTaskInfo taskInfo;

    /**
     * {@code true} if picture-in-picture permission is granted in {@link android.app.AppOpsManager}
     */
    @UnsupportedAppUsage
    public boolean allowEnterPip;

    /**
     * The {@link android.view.WindowManager.LayoutParams.WindowType} of this window. It's only used
     * for non-app window.
@@ -206,10 +212,11 @@ public class RemoteAnimationTarget implements Parcelable {
            Rect clipRect, Rect contentInsets, int prefixOrderIndex, Point position,
            Rect localBounds, Rect screenSpaceBounds,
            WindowConfiguration windowConfig, boolean isNotInRecents,
            SurfaceControl startLeash, Rect startBounds, ActivityManager.RunningTaskInfo taskInfo) {
            SurfaceControl startLeash, Rect startBounds, ActivityManager.RunningTaskInfo taskInfo,
            boolean allowEnterPip) {
        this(taskId, mode, leash, isTranslucent, clipRect, contentInsets, prefixOrderIndex,
                position, localBounds, screenSpaceBounds, windowConfig, isNotInRecents, startLeash,
                startBounds, taskInfo, INVALID_WINDOW_TYPE);
                startBounds, taskInfo, allowEnterPip, INVALID_WINDOW_TYPE);
    }

    public RemoteAnimationTarget(int taskId, int mode, SurfaceControl leash, boolean isTranslucent,
@@ -217,7 +224,7 @@ public class RemoteAnimationTarget implements Parcelable {
            Rect localBounds, Rect screenSpaceBounds,
            WindowConfiguration windowConfig, boolean isNotInRecents,
            SurfaceControl startLeash, Rect startBounds,
            ActivityManager.RunningTaskInfo taskInfo,
            ActivityManager.RunningTaskInfo taskInfo, boolean allowEnterPip,
            @WindowManager.LayoutParams.WindowType int windowType) {
        this.mode = mode;
        this.taskId = taskId;
@@ -235,6 +242,7 @@ public class RemoteAnimationTarget implements Parcelable {
        this.startLeash = startLeash;
        this.startBounds = startBounds == null ? null : new Rect(startBounds);
        this.taskInfo = taskInfo;
        this.allowEnterPip = allowEnterPip;
        this.windowType = windowType;
    }

@@ -255,6 +263,7 @@ public class RemoteAnimationTarget implements Parcelable {
        startLeash = in.readTypedObject(SurfaceControl.CREATOR);
        startBounds = in.readTypedObject(Rect.CREATOR);
        taskInfo = in.readTypedObject(ActivityManager.RunningTaskInfo.CREATOR);
        allowEnterPip = in.readBoolean();
        windowType = in.readInt();
    }

@@ -281,6 +290,7 @@ public class RemoteAnimationTarget implements Parcelable {
        dest.writeTypedObject(startLeash, 0 /* flags */);
        dest.writeTypedObject(startBounds, 0 /* flags */);
        dest.writeTypedObject(taskInfo, 0 /* flags */);
        dest.writeBoolean(allowEnterPip);
        dest.writeInt(windowType);
    }

@@ -299,6 +309,7 @@ public class RemoteAnimationTarget implements Parcelable {
        pw.print(prefix); pw.print("windowConfiguration="); pw.println(windowConfiguration);
        pw.print(prefix); pw.print("leash="); pw.println(leash);
        pw.print(prefix); pw.print("taskInfo="); pw.println(taskInfo);
        pw.print(prefix); pw.print("allowEnterPip="); pw.println(allowEnterPip);
        pw.print(prefix); pw.print("windowType="); pw.print(windowType);
    }

+1 −1
Original line number Diff line number Diff line
@@ -1125,7 +1125,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                null /* contentInsets */, Integer.MAX_VALUE /* prefixOrderIndex */,
                new android.graphics.Point(0, 0) /* position */, bounds, bounds,
                new WindowConfiguration(), true, null /* startLeash */, null /* startBounds */,
                null /* taskInfo */, TYPE_DOCK_DIVIDER);
                null /* taskInfo */, false /* allowEnterPip */, TYPE_DOCK_DIVIDER);
    }

    @Override
+3 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ public class RemoteAnimationTargetCompat {
    public final boolean isNotInRecents;
    public final Rect contentInsets;
    public final ActivityManager.RunningTaskInfo taskInfo;
    public final boolean allowEnterPip;
    public final int rotationChange;
    public final int windowType;

@@ -88,6 +89,7 @@ public class RemoteAnimationTargetCompat {
        contentInsets = app.contentInsets;
        activityType = app.windowConfiguration.getActivityType();
        taskInfo = app.taskInfo;
        allowEnterPip = app.allowEnterPip;
        rotationChange = 0;

        mStartLeash = app.startLeash;
@@ -214,6 +216,7 @@ public class RemoteAnimationTargetCompat {
            activityType = ACTIVITY_TYPE_UNDEFINED;
        }
        taskInfo = change.getTaskInfo();
        allowEnterPip = false; /* always false in shell-transition case */
        mStartLeash = null;
        rotationChange = change.getEndRotation() - change.getStartRotation();
        windowType = INVALID_WINDOW_TYPE;
+1 −1
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ public class KeyguardService extends Service {
                    info.getChanges().size() - i,
                    new Point(), localBounds, new Rect(change.getEndAbsBounds()),
                    windowConfiguration, isNotInRecents, null /* startLeash */,
                    change.getStartAbsBounds(), taskInfo));
                    change.getStartAbsBounds(), taskInfo, false /* allowEnterPip */));
        }
        return out.toArray(new RemoteAnimationTarget[out.size()]);
    }
+1 −1
Original line number Diff line number Diff line
@@ -196,7 +196,7 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() {
        return RemoteAnimationTarget(
                0, RemoteAnimationTarget.MODE_OPENING, SurfaceControl(), false, Rect(), Rect(), 0,
                Point(), Rect(), bounds, WindowConfiguration(), false, SurfaceControl(), Rect(),
                taskInfo
                taskInfo, false
        )
    }
}
Loading