Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 1 | package android.view; |
| 2 | |
Artur Satayev | df43959 | 2019-12-10 17:47:53 +0000 | [diff] [blame] | 3 | import android.compat.annotation.UnsupportedAppUsage; |
Winson Chung | a31922f | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 4 | import android.graphics.GraphicBuffer; |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 5 | import android.graphics.Rect; |
| 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; |
Winson Chung | a31922f | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 19 | public final GraphicBuffer buffer; |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 20 | public final Rect rect; |
| 21 | |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 22 | @UnsupportedAppUsage |
Winson Chung | a31922f | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 23 | public AppTransitionAnimationSpec(int taskId, GraphicBuffer buffer, Rect rect) { |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 24 | this.taskId = taskId; |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 25 | this.rect = rect; |
Winson Chung | a31922f | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 26 | this.buffer = buffer; |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | public AppTransitionAnimationSpec(Parcel in) { |
| 30 | taskId = in.readInt(); |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 31 | rect = in.readParcelable(null); |
Winson Chung | a31922f | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 32 | buffer = in.readParcelable(null); |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 33 | } |
| 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 Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 43 | dest.writeParcelable(rect, 0 /* flags */); |
Winson Chung | a31922f | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 44 | dest.writeParcelable(buffer, 0); |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 45 | } |
| 46 | |
Jeff Sharkey | 9e8f83d | 2019-02-28 12:06:45 -0700 | [diff] [blame] | 47 | public static final @android.annotation.NonNull Parcelable.Creator<AppTransitionAnimationSpec> CREATOR |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 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 Chung | a31922f | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 60 | return "{taskId: " + taskId + ", buffer: " + buffer + ", rect: " + rect + "}"; |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 61 | } |
| 62 | } |