Merge "Optimize the Parcel read/write of remote animation" into sc-dev
This commit is contained in:
@@ -202,7 +202,7 @@ public final class PictureInPictureParams implements Parcelable {
|
||||
}
|
||||
if (in.readInt() != 0) {
|
||||
mUserActions = new ArrayList<>();
|
||||
in.readParcelableList(mUserActions, RemoteAction.class.getClassLoader());
|
||||
in.readTypedList(mUserActions, RemoteAction.CREATOR);
|
||||
}
|
||||
if (in.readInt() != 0) {
|
||||
mSourceRectHint = Rect.CREATOR.createFromParcel(in);
|
||||
@@ -386,7 +386,7 @@ public final class PictureInPictureParams implements Parcelable {
|
||||
}
|
||||
if (mUserActions != null) {
|
||||
out.writeInt(1);
|
||||
out.writeParcelableList(mUserActions, 0);
|
||||
out.writeTypedList(mUserActions, 0);
|
||||
} else {
|
||||
out.writeInt(0);
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ public class AppTransitionAnimationSpec implements Parcelable {
|
||||
|
||||
public AppTransitionAnimationSpec(Parcel in) {
|
||||
taskId = in.readInt();
|
||||
rect = in.readParcelable(null);
|
||||
buffer = in.readParcelable(null);
|
||||
rect = in.readTypedObject(Rect.CREATOR);
|
||||
buffer = in.readTypedObject(HardwareBuffer.CREATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,8 +40,8 @@ public class AppTransitionAnimationSpec implements Parcelable {
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(taskId);
|
||||
dest.writeParcelable(rect, 0 /* flags */);
|
||||
dest.writeParcelable(buffer, 0);
|
||||
dest.writeTypedObject(rect, 0 /* flags */);
|
||||
dest.writeTypedObject(buffer, 0 /* flags */);
|
||||
}
|
||||
|
||||
public static final @android.annotation.NonNull Parcelable.Creator<AppTransitionAnimationSpec> CREATOR
|
||||
|
||||
@@ -184,13 +184,13 @@ public class RemoteAnimationDefinition implements Parcelable {
|
||||
}
|
||||
|
||||
private RemoteAnimationAdapterEntry(Parcel in) {
|
||||
adapter = in.readParcelable(RemoteAnimationAdapter.class.getClassLoader());
|
||||
adapter = in.readTypedObject(RemoteAnimationAdapter.CREATOR);
|
||||
activityTypeFilter = in.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeParcelable(adapter, flags);
|
||||
dest.writeTypedObject(adapter, flags);
|
||||
dest.writeInt(activityTypeFilter);
|
||||
}
|
||||
|
||||
|
||||
@@ -222,20 +222,20 @@ public class RemoteAnimationTarget implements Parcelable {
|
||||
public RemoteAnimationTarget(Parcel in) {
|
||||
taskId = in.readInt();
|
||||
mode = in.readInt();
|
||||
leash = in.readParcelable(null);
|
||||
leash = in.readTypedObject(SurfaceControl.CREATOR);
|
||||
isTranslucent = in.readBoolean();
|
||||
clipRect = in.readParcelable(null);
|
||||
contentInsets = in.readParcelable(null);
|
||||
clipRect = in.readTypedObject(Rect.CREATOR);
|
||||
contentInsets = in.readTypedObject(Rect.CREATOR);
|
||||
prefixOrderIndex = in.readInt();
|
||||
position = in.readParcelable(null);
|
||||
localBounds = in.readParcelable(null);
|
||||
sourceContainerBounds = in.readParcelable(null);
|
||||
screenSpaceBounds = in.readParcelable(null);
|
||||
windowConfiguration = in.readParcelable(null);
|
||||
position = in.readTypedObject(Point.CREATOR);
|
||||
localBounds = in.readTypedObject(Rect.CREATOR);
|
||||
sourceContainerBounds = in.readTypedObject(Rect.CREATOR);
|
||||
screenSpaceBounds = in.readTypedObject(Rect.CREATOR);
|
||||
windowConfiguration = in.readTypedObject(WindowConfiguration.CREATOR);
|
||||
isNotInRecents = in.readBoolean();
|
||||
startLeash = in.readParcelable(null);
|
||||
startBounds = in.readParcelable(null);
|
||||
pictureInPictureParams = in.readParcelable(null);
|
||||
startLeash = in.readTypedObject(SurfaceControl.CREATOR);
|
||||
startBounds = in.readTypedObject(Rect.CREATOR);
|
||||
pictureInPictureParams = in.readTypedObject(PictureInPictureParams.CREATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -247,20 +247,20 @@ public class RemoteAnimationTarget implements Parcelable {
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(taskId);
|
||||
dest.writeInt(mode);
|
||||
dest.writeParcelable(leash, 0 /* flags */);
|
||||
dest.writeTypedObject(leash, 0 /* flags */);
|
||||
dest.writeBoolean(isTranslucent);
|
||||
dest.writeParcelable(clipRect, 0 /* flags */);
|
||||
dest.writeParcelable(contentInsets, 0 /* flags */);
|
||||
dest.writeTypedObject(clipRect, 0 /* flags */);
|
||||
dest.writeTypedObject(contentInsets, 0 /* flags */);
|
||||
dest.writeInt(prefixOrderIndex);
|
||||
dest.writeParcelable(position, 0 /* flags */);
|
||||
dest.writeParcelable(localBounds, 0 /* flags */);
|
||||
dest.writeParcelable(sourceContainerBounds, 0 /* flags */);
|
||||
dest.writeParcelable(screenSpaceBounds, 0 /* flags */);
|
||||
dest.writeParcelable(windowConfiguration, 0 /* flags */);
|
||||
dest.writeTypedObject(position, 0 /* flags */);
|
||||
dest.writeTypedObject(localBounds, 0 /* flags */);
|
||||
dest.writeTypedObject(sourceContainerBounds, 0 /* flags */);
|
||||
dest.writeTypedObject(screenSpaceBounds, 0 /* flags */);
|
||||
dest.writeTypedObject(windowConfiguration, 0 /* flags */);
|
||||
dest.writeBoolean(isNotInRecents);
|
||||
dest.writeParcelable(startLeash, 0 /* flags */);
|
||||
dest.writeParcelable(startBounds, 0 /* flags */);
|
||||
dest.writeParcelable(pictureInPictureParams, 0 /* flags */);
|
||||
dest.writeTypedObject(startLeash, 0 /* flags */);
|
||||
dest.writeTypedObject(startBounds, 0 /* flags */);
|
||||
dest.writeTypedObject(pictureInPictureParams, 0 /* flags */);
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw, String prefix) {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class TaskSnapshot implements Parcelable {
|
||||
private final int mOrientation;
|
||||
/** See {@link android.view.Surface.Rotation} */
|
||||
@Surface.Rotation
|
||||
private int mRotation;
|
||||
private final int mRotation;
|
||||
/** The size of the snapshot before scaling */
|
||||
private final Point mTaskSize;
|
||||
private final Rect mContentInsets;
|
||||
@@ -90,15 +90,15 @@ public class TaskSnapshot implements Parcelable {
|
||||
private TaskSnapshot(Parcel source) {
|
||||
mId = source.readLong();
|
||||
mTopActivityComponent = ComponentName.readFromParcel(source);
|
||||
mSnapshot = source.readParcelable(null /* classLoader */);
|
||||
mSnapshot = source.readTypedObject(HardwareBuffer.CREATOR);
|
||||
int colorSpaceId = source.readInt();
|
||||
mColorSpace = colorSpaceId >= 0 && colorSpaceId < ColorSpace.Named.values().length
|
||||
? ColorSpace.get(ColorSpace.Named.values()[colorSpaceId])
|
||||
: ColorSpace.get(ColorSpace.Named.SRGB);
|
||||
mOrientation = source.readInt();
|
||||
mRotation = source.readInt();
|
||||
mTaskSize = source.readParcelable(null /* classLoader */);
|
||||
mContentInsets = source.readParcelable(null /* classLoader */);
|
||||
mTaskSize = source.readTypedObject(Point.CREATOR);
|
||||
mContentInsets = source.readTypedObject(Rect.CREATOR);
|
||||
mIsLowResolution = source.readBoolean();
|
||||
mIsRealSnapshot = source.readBoolean();
|
||||
mWindowingMode = source.readInt();
|
||||
@@ -235,13 +235,12 @@ public class TaskSnapshot implements Parcelable {
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeLong(mId);
|
||||
ComponentName.writeToParcel(mTopActivityComponent, dest);
|
||||
dest.writeParcelable(mSnapshot != null && !mSnapshot.isClosed() ? mSnapshot : null,
|
||||
0);
|
||||
dest.writeTypedObject(mSnapshot != null && !mSnapshot.isClosed() ? mSnapshot : null, 0);
|
||||
dest.writeInt(mColorSpace.getId());
|
||||
dest.writeInt(mOrientation);
|
||||
dest.writeInt(mRotation);
|
||||
dest.writeParcelable(mTaskSize, 0);
|
||||
dest.writeParcelable(mContentInsets, 0);
|
||||
dest.writeTypedObject(mTaskSize, 0);
|
||||
dest.writeTypedObject(mContentInsets, 0);
|
||||
dest.writeBoolean(mIsLowResolution);
|
||||
dest.writeBoolean(mIsRealSnapshot);
|
||||
dest.writeInt(mWindowingMode);
|
||||
|
||||
Reference in New Issue
Block a user