blob: 86a5fb761355dea3fb843b75ce269b3fbceee1c1 [file] [log] [blame]
Filip Gruszczynski170192a2015-08-16 17:46:34 -07001package android.view;
2
Winson Chunga31922f2017-05-24 15:50:06 -07003import android.graphics.GraphicBuffer;
Filip Gruszczynski170192a2015-08-16 17:46:34 -07004import android.graphics.Rect;
5import android.os.Parcel;
6import android.os.Parcelable;
7
8/**
9 * Holds information about how the next app transition animation should be executed.
10 *
11 * This class is intended to be used with IWindowManager.overridePendingAppTransition* methods when
12 * simple arguments are not enough to describe the animation.
13 *
14 * @hide
15 */
16public class AppTransitionAnimationSpec implements Parcelable {
17 public final int taskId;
Winson Chunga31922f2017-05-24 15:50:06 -070018 public final GraphicBuffer buffer;
Filip Gruszczynski170192a2015-08-16 17:46:34 -070019 public final Rect rect;
20
Winson Chunga31922f2017-05-24 15:50:06 -070021 public AppTransitionAnimationSpec(int taskId, GraphicBuffer buffer, Rect rect) {
Filip Gruszczynski170192a2015-08-16 17:46:34 -070022 this.taskId = taskId;
Filip Gruszczynski170192a2015-08-16 17:46:34 -070023 this.rect = rect;
Winson Chunga31922f2017-05-24 15:50:06 -070024 this.buffer = buffer;
Filip Gruszczynski170192a2015-08-16 17:46:34 -070025 }
26
27 public AppTransitionAnimationSpec(Parcel in) {
28 taskId = in.readInt();
Filip Gruszczynski170192a2015-08-16 17:46:34 -070029 rect = in.readParcelable(null);
Winson Chunga31922f2017-05-24 15:50:06 -070030 buffer = in.readParcelable(null);
Filip Gruszczynski170192a2015-08-16 17:46:34 -070031 }
32
33 @Override
34 public int describeContents() {
35 return 0;
36 }
37
38 @Override
39 public void writeToParcel(Parcel dest, int flags) {
40 dest.writeInt(taskId);
Filip Gruszczynski170192a2015-08-16 17:46:34 -070041 dest.writeParcelable(rect, 0 /* flags */);
Winson Chunga31922f2017-05-24 15:50:06 -070042 dest.writeParcelable(buffer, 0);
Filip Gruszczynski170192a2015-08-16 17:46:34 -070043 }
44
45 public static final Parcelable.Creator<AppTransitionAnimationSpec> CREATOR
46 = new Parcelable.Creator<AppTransitionAnimationSpec>() {
47 public AppTransitionAnimationSpec createFromParcel(Parcel in) {
48 return new AppTransitionAnimationSpec(in);
49 }
50
51 public AppTransitionAnimationSpec[] newArray(int size) {
52 return new AppTransitionAnimationSpec[size];
53 }
54 };
55
56 @Override
57 public String toString() {
Winson Chunga31922f2017-05-24 15:50:06 -070058 return "{taskId: " + taskId + ", buffer: " + buffer + ", rect: " + rect + "}";
Filip Gruszczynski170192a2015-08-16 17:46:34 -070059 }
60}