1 package android.view;
2 
3 import android.compat.annotation.UnsupportedAppUsage;
4 import android.graphics.Rect;
5 import android.hardware.HardwareBuffer;
6 import android.os.Parcel;
7 import 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  */
17 public class AppTransitionAnimationSpec implements Parcelable {
18     public final int taskId;
19     public final HardwareBuffer buffer;
20     public final Rect rect;
21 
22     @UnsupportedAppUsage
AppTransitionAnimationSpec(int taskId, HardwareBuffer buffer, Rect rect)23     public AppTransitionAnimationSpec(int taskId, HardwareBuffer buffer, Rect rect) {
24         this.taskId = taskId;
25         this.rect = rect;
26         this.buffer = buffer;
27     }
28 
AppTransitionAnimationSpec(Parcel in)29     public AppTransitionAnimationSpec(Parcel in) {
30         taskId = in.readInt();
31         rect = in.readTypedObject(Rect.CREATOR);
32         buffer = in.readTypedObject(HardwareBuffer.CREATOR);
33     }
34 
35     @Override
describeContents()36     public int describeContents() {
37         return 0;
38     }
39 
40     @Override
writeToParcel(Parcel dest, int flags)41     public void writeToParcel(Parcel dest, int flags) {
42         dest.writeInt(taskId);
43         dest.writeTypedObject(rect, 0 /* flags */);
44         dest.writeTypedObject(buffer, 0 /* flags */);
45     }
46 
47     public static final @android.annotation.NonNull 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
toString()59     public String toString() {
60         return "{taskId: " + taskId + ", buffer: " + buffer + ", rect: " + rect + "}";
61     }
62 }
63