Merge "Pass AppOps result for PiP in RemoteAnimationTarget" into sc-v2-dev
This commit is contained in:
@@ -196,6 +196,12 @@ public class RemoteAnimationTarget implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public ActivityManager.RunningTaskInfo taskInfo;
|
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
|
* The {@link android.view.WindowManager.LayoutParams.WindowType} of this window. It's only used
|
||||||
* for non-app window.
|
* for non-app window.
|
||||||
@@ -206,10 +212,11 @@ public class RemoteAnimationTarget implements Parcelable {
|
|||||||
Rect clipRect, Rect contentInsets, int prefixOrderIndex, Point position,
|
Rect clipRect, Rect contentInsets, int prefixOrderIndex, Point position,
|
||||||
Rect localBounds, Rect screenSpaceBounds,
|
Rect localBounds, Rect screenSpaceBounds,
|
||||||
WindowConfiguration windowConfig, boolean isNotInRecents,
|
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,
|
this(taskId, mode, leash, isTranslucent, clipRect, contentInsets, prefixOrderIndex,
|
||||||
position, localBounds, screenSpaceBounds, windowConfig, isNotInRecents, startLeash,
|
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,
|
public RemoteAnimationTarget(int taskId, int mode, SurfaceControl leash, boolean isTranslucent,
|
||||||
@@ -217,7 +224,7 @@ public class RemoteAnimationTarget implements Parcelable {
|
|||||||
Rect localBounds, Rect screenSpaceBounds,
|
Rect localBounds, Rect screenSpaceBounds,
|
||||||
WindowConfiguration windowConfig, boolean isNotInRecents,
|
WindowConfiguration windowConfig, boolean isNotInRecents,
|
||||||
SurfaceControl startLeash, Rect startBounds,
|
SurfaceControl startLeash, Rect startBounds,
|
||||||
ActivityManager.RunningTaskInfo taskInfo,
|
ActivityManager.RunningTaskInfo taskInfo, boolean allowEnterPip,
|
||||||
@WindowManager.LayoutParams.WindowType int windowType) {
|
@WindowManager.LayoutParams.WindowType int windowType) {
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
this.taskId = taskId;
|
this.taskId = taskId;
|
||||||
@@ -235,6 +242,7 @@ public class RemoteAnimationTarget implements Parcelable {
|
|||||||
this.startLeash = startLeash;
|
this.startLeash = startLeash;
|
||||||
this.startBounds = startBounds == null ? null : new Rect(startBounds);
|
this.startBounds = startBounds == null ? null : new Rect(startBounds);
|
||||||
this.taskInfo = taskInfo;
|
this.taskInfo = taskInfo;
|
||||||
|
this.allowEnterPip = allowEnterPip;
|
||||||
this.windowType = windowType;
|
this.windowType = windowType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,6 +263,7 @@ public class RemoteAnimationTarget implements Parcelable {
|
|||||||
startLeash = in.readTypedObject(SurfaceControl.CREATOR);
|
startLeash = in.readTypedObject(SurfaceControl.CREATOR);
|
||||||
startBounds = in.readTypedObject(Rect.CREATOR);
|
startBounds = in.readTypedObject(Rect.CREATOR);
|
||||||
taskInfo = in.readTypedObject(ActivityManager.RunningTaskInfo.CREATOR);
|
taskInfo = in.readTypedObject(ActivityManager.RunningTaskInfo.CREATOR);
|
||||||
|
allowEnterPip = in.readBoolean();
|
||||||
windowType = in.readInt();
|
windowType = in.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,6 +290,7 @@ public class RemoteAnimationTarget implements Parcelable {
|
|||||||
dest.writeTypedObject(startLeash, 0 /* flags */);
|
dest.writeTypedObject(startLeash, 0 /* flags */);
|
||||||
dest.writeTypedObject(startBounds, 0 /* flags */);
|
dest.writeTypedObject(startBounds, 0 /* flags */);
|
||||||
dest.writeTypedObject(taskInfo, 0 /* flags */);
|
dest.writeTypedObject(taskInfo, 0 /* flags */);
|
||||||
|
dest.writeBoolean(allowEnterPip);
|
||||||
dest.writeInt(windowType);
|
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("windowConfiguration="); pw.println(windowConfiguration);
|
||||||
pw.print(prefix); pw.print("leash="); pw.println(leash);
|
pw.print(prefix); pw.print("leash="); pw.println(leash);
|
||||||
pw.print(prefix); pw.print("taskInfo="); pw.println(taskInfo);
|
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);
|
pw.print(prefix); pw.print("windowType="); pw.print(windowType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1125,7 +1125,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
null /* contentInsets */, Integer.MAX_VALUE /* prefixOrderIndex */,
|
null /* contentInsets */, Integer.MAX_VALUE /* prefixOrderIndex */,
|
||||||
new android.graphics.Point(0, 0) /* position */, bounds, bounds,
|
new android.graphics.Point(0, 0) /* position */, bounds, bounds,
|
||||||
new WindowConfiguration(), true, null /* startLeash */, null /* startBounds */,
|
new WindowConfiguration(), true, null /* startLeash */, null /* startBounds */,
|
||||||
null /* taskInfo */, TYPE_DOCK_DIVIDER);
|
null /* taskInfo */, false /* allowEnterPip */, TYPE_DOCK_DIVIDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ public class RemoteAnimationTargetCompat {
|
|||||||
public final boolean isNotInRecents;
|
public final boolean isNotInRecents;
|
||||||
public final Rect contentInsets;
|
public final Rect contentInsets;
|
||||||
public final ActivityManager.RunningTaskInfo taskInfo;
|
public final ActivityManager.RunningTaskInfo taskInfo;
|
||||||
|
public final boolean allowEnterPip;
|
||||||
public final int rotationChange;
|
public final int rotationChange;
|
||||||
public final int windowType;
|
public final int windowType;
|
||||||
|
|
||||||
@@ -88,6 +89,7 @@ public class RemoteAnimationTargetCompat {
|
|||||||
contentInsets = app.contentInsets;
|
contentInsets = app.contentInsets;
|
||||||
activityType = app.windowConfiguration.getActivityType();
|
activityType = app.windowConfiguration.getActivityType();
|
||||||
taskInfo = app.taskInfo;
|
taskInfo = app.taskInfo;
|
||||||
|
allowEnterPip = app.allowEnterPip;
|
||||||
rotationChange = 0;
|
rotationChange = 0;
|
||||||
|
|
||||||
mStartLeash = app.startLeash;
|
mStartLeash = app.startLeash;
|
||||||
@@ -214,6 +216,7 @@ public class RemoteAnimationTargetCompat {
|
|||||||
activityType = ACTIVITY_TYPE_UNDEFINED;
|
activityType = ACTIVITY_TYPE_UNDEFINED;
|
||||||
}
|
}
|
||||||
taskInfo = change.getTaskInfo();
|
taskInfo = change.getTaskInfo();
|
||||||
|
allowEnterPip = false; /* always false in shell-transition case */
|
||||||
mStartLeash = null;
|
mStartLeash = null;
|
||||||
rotationChange = change.getEndRotation() - change.getStartRotation();
|
rotationChange = change.getEndRotation() - change.getStartRotation();
|
||||||
windowType = INVALID_WINDOW_TYPE;
|
windowType = INVALID_WINDOW_TYPE;
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ public class KeyguardService extends Service {
|
|||||||
info.getChanges().size() - i,
|
info.getChanges().size() - i,
|
||||||
new Point(), localBounds, new Rect(change.getEndAbsBounds()),
|
new Point(), localBounds, new Rect(change.getEndAbsBounds()),
|
||||||
windowConfiguration, isNotInRecents, null /* startLeash */,
|
windowConfiguration, isNotInRecents, null /* startLeash */,
|
||||||
change.getStartAbsBounds(), taskInfo));
|
change.getStartAbsBounds(), taskInfo, false /* allowEnterPip */));
|
||||||
}
|
}
|
||||||
return out.toArray(new RemoteAnimationTarget[out.size()]);
|
return out.toArray(new RemoteAnimationTarget[out.size()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() {
|
|||||||
return RemoteAnimationTarget(
|
return RemoteAnimationTarget(
|
||||||
0, RemoteAnimationTarget.MODE_OPENING, SurfaceControl(), false, Rect(), Rect(), 0,
|
0, RemoteAnimationTarget.MODE_OPENING, SurfaceControl(), false, Rect(), Rect(), 0,
|
||||||
Point(), Rect(), bounds, WindowConfiguration(), false, SurfaceControl(), Rect(),
|
Point(), Rect(), bounds, WindowConfiguration(), false, SurfaceControl(), Rect(),
|
||||||
taskInfo
|
taskInfo, false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2826,7 +2826,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
/**
|
/**
|
||||||
* @return Whether AppOps allows this package to enter picture-in-picture.
|
* @return Whether AppOps allows this package to enter picture-in-picture.
|
||||||
*/
|
*/
|
||||||
private boolean checkEnterPictureInPictureAppOpsState() {
|
boolean checkEnterPictureInPictureAppOpsState() {
|
||||||
return mAtmService.getAppOpsManager().checkOpNoThrow(
|
return mAtmService.getAppOpsManager().checkOpNoThrow(
|
||||||
OP_PICTURE_IN_PICTURE, info.applicationInfo.uid, packageName) == MODE_ALLOWED;
|
OP_PICTURE_IN_PICTURE, info.applicationInfo.uid, packageName) == MODE_ALLOWED;
|
||||||
}
|
}
|
||||||
@@ -9075,7 +9075,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
record.mAdapter.mRootTaskBounds, task.getWindowConfiguration(),
|
record.mAdapter.mRootTaskBounds, task.getWindowConfiguration(),
|
||||||
false /*isNotInRecents*/,
|
false /*isNotInRecents*/,
|
||||||
record.mThumbnailAdapter != null ? record.mThumbnailAdapter.mCapturedLeash : null,
|
record.mThumbnailAdapter != null ? record.mThumbnailAdapter.mCapturedLeash : null,
|
||||||
record.mStartBounds, task.getTaskInfo());
|
record.mStartBounds, task.getTaskInfo(), checkEnterPictureInPictureAppOpsState());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class NonAppWindowAnimationAdapter implements AnimationAdapter {
|
|||||||
mTarget = new RemoteAnimationTarget(-1, -1, getLeash(), false,
|
mTarget = new RemoteAnimationTarget(-1, -1, getLeash(), false,
|
||||||
new Rect(), null, mWindowContainer.getPrefixOrderIndex(),
|
new Rect(), null, mWindowContainer.getPrefixOrderIndex(),
|
||||||
mWindowContainer.getLastSurfacePosition(), mWindowContainer.getBounds(), null,
|
mWindowContainer.getLastSurfacePosition(), mWindowContainer.getBounds(), null,
|
||||||
mWindowContainer.getWindowConfiguration(), true, null, null, null,
|
mWindowContainer.getWindowConfiguration(), true, null, null, null, false,
|
||||||
mWindowContainer.getWindowType());
|
mWindowContainer.getWindowType());
|
||||||
return mTarget;
|
return mTarget;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1201,7 +1201,8 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
!topApp.fillsParent(), new Rect(),
|
!topApp.fillsParent(), new Rect(),
|
||||||
insets, mTask.getPrefixOrderIndex(), new Point(mBounds.left, mBounds.top),
|
insets, mTask.getPrefixOrderIndex(), new Point(mBounds.left, mBounds.top),
|
||||||
mLocalBounds, mBounds, mTask.getWindowConfiguration(),
|
mLocalBounds, mBounds, mTask.getWindowConfiguration(),
|
||||||
mIsRecentTaskInvisible, null, null, mTask.getTaskInfo());
|
mIsRecentTaskInvisible, null, null, mTask.getTaskInfo(),
|
||||||
|
topApp.checkEnterPictureInPictureAppOpsState());
|
||||||
return mTarget;
|
return mTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class WallpaperAnimationAdapter implements AnimationAdapter {
|
|||||||
RemoteAnimationTarget createRemoteAnimationTarget() {
|
RemoteAnimationTarget createRemoteAnimationTarget() {
|
||||||
mTarget = new RemoteAnimationTarget(-1, -1, getLeash(), false, null, null,
|
mTarget = new RemoteAnimationTarget(-1, -1, getLeash(), false, null, null,
|
||||||
mWallpaperToken.getPrefixOrderIndex(), new Point(), null, null,
|
mWallpaperToken.getPrefixOrderIndex(), new Point(), null, null,
|
||||||
mWallpaperToken.getWindowConfiguration(), true, null, null, null);
|
mWallpaperToken.getWindowConfiguration(), true, null, null, null, false);
|
||||||
return mTarget;
|
return mTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user