1package android.view;
2
3import android.graphics.GraphicBuffer;
4import 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;
18    public final GraphicBuffer buffer;
19    public final Rect rect;
20
21    public AppTransitionAnimationSpec(int taskId, GraphicBuffer buffer, Rect rect) {
22        this.taskId = taskId;
23        this.rect = rect;
24        this.buffer = buffer;
25    }
26
27    public AppTransitionAnimationSpec(Parcel in) {
28        taskId = in.readInt();
29        rect = in.readParcelable(null);
30        buffer = in.readParcelable(null);
31    }
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);
41        dest.writeParcelable(rect, 0 /* flags */);
42        dest.writeParcelable(buffer, 0);
43    }
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() {
58        return "{taskId: " + taskId + ", buffer: " + buffer + ", rect: " + rect + "}";
59    }
60}
61