diff options
| author | Riddle Hsu <riddlehsu@google.com> | 2021-03-03 03:58:07 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-03-03 03:58:07 +0000 |
| commit | 304d3a07ea3a49d015f2cd793fe1b113f189efff (patch) | |
| tree | 2b6b6e8420a46aaf606826fb7f84aac1736af652 /core/java/android | |
| parent | 04faa88ad9667079d085d3b6aff8f454aa653496 (diff) | |
| parent | ec999979a7456a5d698f9a71f21b448ce0d9a661 (diff) | |
Merge "Optimize the Parcel read/write of remote animation" into sc-dev
Diffstat (limited to 'core/java/android')
5 files changed, 37 insertions, 38 deletions
diff --git a/core/java/android/app/PictureInPictureParams.java b/core/java/android/app/PictureInPictureParams.java index ea7eab2a2877..358ce6a83a21 100644 --- a/core/java/android/app/PictureInPictureParams.java +++ b/core/java/android/app/PictureInPictureParams.java @@ -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); } diff --git a/core/java/android/view/AppTransitionAnimationSpec.java b/core/java/android/view/AppTransitionAnimationSpec.java index 877bb5684910..3215f2bc2a50 100644 --- a/core/java/android/view/AppTransitionAnimationSpec.java +++ b/core/java/android/view/AppTransitionAnimationSpec.java @@ -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 diff --git a/core/java/android/view/RemoteAnimationDefinition.java b/core/java/android/view/RemoteAnimationDefinition.java index a5ff19ee3312..ea9799584e20 100644 --- a/core/java/android/view/RemoteAnimationDefinition.java +++ b/core/java/android/view/RemoteAnimationDefinition.java @@ -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); } diff --git a/core/java/android/view/RemoteAnimationTarget.java b/core/java/android/view/RemoteAnimationTarget.java index 258a72cbcab4..b1b670f5e0c9 100644 --- a/core/java/android/view/RemoteAnimationTarget.java +++ b/core/java/android/view/RemoteAnimationTarget.java @@ -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) { diff --git a/core/java/android/window/TaskSnapshot.java b/core/java/android/window/TaskSnapshot.java index dc07e44d4d98..f1e5fb95ea54 100644 --- a/core/java/android/window/TaskSnapshot.java +++ b/core/java/android/window/TaskSnapshot.java @@ -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); |
