blob: 6585e40c67d168393f1c64373a886958841d7835 [file] [log] [blame]
Filip Gruszczynski170192a2015-08-16 17:46:34 -07001package android.view;
2
Mathew Inwoode5ad5982018-08-17 15:07:52 +01003import android.annotation.UnsupportedAppUsage;
Winson Chunga31922f2017-05-24 15:50:06 -07004import android.graphics.GraphicBuffer;
Filip Gruszczynski170192a2015-08-16 17:46:34 -07005import android.graphics.Rect;
6import android.os.Parcel;
7import android.os.Parcelable;
8
9/**
10 * Holds information about how the next app transition animation should be executed.
11 *
12 * This class is intended to be used with IWindowManager.overridePendingAppTransition* methods when
13 * simple arguments are not enough to describe the animation.
14 *
15 * @hide
16 */
17public class AppTransitionAnimationSpec implements Parcelable {
18 public final int taskId;
Winson Chunga31922f2017-05-24 15:50:06 -070019 public final GraphicBuffer buffer;
Filip Gruszczynski170192a2015-08-16 17:46:34 -070020 public final Rect rect;
21
Mathew Inwoode5ad5982018-08-17 15:07:52 +010022 @UnsupportedAppUsage
Winson Chunga31922f2017-05-24 15:50:06 -070023 public AppTransitionAnimationSpec(int taskId, GraphicBuffer buffer, Rect rect) {
Filip Gruszczynski170192a2015-08-16 17:46:34 -070024 this.taskId = taskId;
Filip Gruszczynski170192a2015-08-16 17:46:34 -070025 this.rect = rect;
Winson Chunga31922f2017-05-24 15:50:06 -070026 this.buffer = buffer;
Filip Gruszczynski170192a2015-08-16 17:46:34 -070027 }
28
29 public AppTransitionAnimationSpec(Parcel in) {
30 taskId = in.readInt();
Filip Gruszczynski170192a2015-08-16 17:46:34 -070031 rect = in.readParcelable(null);
Winson Chunga31922f2017-05-24 15:50:06 -070032 buffer = in.readParcelable(null);
Filip Gruszczynski170192a2015-08-16 17:46:34 -070033 }
34
35 @Override
36 public int describeContents() {
37 return 0;
38 }
39
40 @Override
41 public void writeToParcel(Parcel dest, int flags) {
42 dest.writeInt(taskId);
Filip Gruszczynski170192a2015-08-16 17:46:34 -070043 dest.writeParcelable(rect, 0 /* flags */);
Winson Chunga31922f2017-05-24 15:50:06 -070044 dest.writeParcelable(buffer, 0);
Filip Gruszczynski170192a2015-08-16 17:46:34 -070045 }
46
47 public static final Parcelable.Creator<AppTransitionAnimationSpec> CREATOR
48 = new Parcelable.Creator<AppTransitionAnimationSpec>() {
49 public AppTransitionAnimationSpec createFromParcel(Parcel in) {
50 return new AppTransitionAnimationSpec(in);
51 }
52
53 public AppTransitionAnimationSpec[] newArray(int size) {
54 return new AppTransitionAnimationSpec[size];
55 }
56 };
57
58 @Override
59 public String toString() {
Winson Chunga31922f2017-05-24 15:50:06 -070060 return "{taskId: " + taskId + ", buffer: " + buffer + ", rect: " + rect + "}";
Filip Gruszczynski170192a2015-08-16 17:46:34 -070061 }
62}