1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.window;
18 
19 import android.annotation.NonNull;
20 import android.annotation.Nullable;
21 import android.app.IApplicationThread;
22 import android.os.IBinder;
23 import android.os.Parcelable;
24 
25 import com.android.internal.util.DataClass;
26 
27 /**
28  * Represents a remote transition animation and information required to run it (eg. the app thread
29  * that needs to be boosted).
30  * @hide
31  */
32 @DataClass(genToString = true, genSetters = true, genAidl = true)
33 public class RemoteTransition implements Parcelable {
34 
35     /** The actual remote-transition interface used to run the transition animation. */
36     private @NonNull IRemoteTransition mRemoteTransition;
37 
38     /** The application thread that will be running the remote transition. */
39     private @Nullable IApplicationThread mAppThread;
40 
41     /** Constructs with no app thread (animation runs in shell). */
RemoteTransition(@onNull IRemoteTransition remoteTransition)42     public RemoteTransition(@NonNull IRemoteTransition remoteTransition) {
43         this(remoteTransition, null /* appThread */);
44     }
45 
46     /** Get the IBinder associated with the underlying IRemoteTransition. */
asBinder()47     public @Nullable IBinder asBinder() {
48         return mRemoteTransition.asBinder();
49     }
50 
51 
52 
53     // Code below generated by codegen v1.0.23.
54     //
55     // DO NOT MODIFY!
56     // CHECKSTYLE:OFF Generated code
57     //
58     // To regenerate run:
59     // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/window/RemoteTransition.java
60     //
61     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
62     //   Settings > Editor > Code Style > Formatter Control
63     //@formatter:off
64 
65 
66     /**
67      * Creates a new RemoteTransition.
68      *
69      * @param remoteTransition
70      *   The actual remote-transition interface used to run the transition animation.
71      * @param appThread
72      *   The application thread that will be running the remote transition.
73      */
74     @DataClass.Generated.Member
RemoteTransition( @onNull IRemoteTransition remoteTransition, @Nullable IApplicationThread appThread)75     public RemoteTransition(
76             @NonNull IRemoteTransition remoteTransition,
77             @Nullable IApplicationThread appThread) {
78         this.mRemoteTransition = remoteTransition;
79         com.android.internal.util.AnnotationValidations.validate(
80                 NonNull.class, null, mRemoteTransition);
81         this.mAppThread = appThread;
82 
83         // onConstructed(); // You can define this method to get a callback
84     }
85 
86     /**
87      * The actual remote-transition interface used to run the transition animation.
88      */
89     @DataClass.Generated.Member
getRemoteTransition()90     public @NonNull IRemoteTransition getRemoteTransition() {
91         return mRemoteTransition;
92     }
93 
94     /**
95      * The application thread that will be running the remote transition.
96      */
97     @DataClass.Generated.Member
getAppThread()98     public @Nullable IApplicationThread getAppThread() {
99         return mAppThread;
100     }
101 
102     /**
103      * The actual remote-transition interface used to run the transition animation.
104      */
105     @DataClass.Generated.Member
setRemoteTransition(@onNull IRemoteTransition value)106     public @NonNull RemoteTransition setRemoteTransition(@NonNull IRemoteTransition value) {
107         mRemoteTransition = value;
108         com.android.internal.util.AnnotationValidations.validate(
109                 NonNull.class, null, mRemoteTransition);
110         return this;
111     }
112 
113     /**
114      * The application thread that will be running the remote transition.
115      */
116     @DataClass.Generated.Member
setAppThread(@onNull IApplicationThread value)117     public @NonNull RemoteTransition setAppThread(@NonNull IApplicationThread value) {
118         mAppThread = value;
119         return this;
120     }
121 
122     @Override
123     @DataClass.Generated.Member
toString()124     public String toString() {
125         // You can override field toString logic by defining methods like:
126         // String fieldNameToString() { ... }
127 
128         return "RemoteTransition { " +
129                 "remoteTransition = " + mRemoteTransition + ", " +
130                 "appThread = " + mAppThread +
131         " }";
132     }
133 
134     @Override
135     @DataClass.Generated.Member
writeToParcel(@onNull android.os.Parcel dest, int flags)136     public void writeToParcel(@NonNull android.os.Parcel dest, int flags) {
137         // You can override field parcelling by defining methods like:
138         // void parcelFieldName(Parcel dest, int flags) { ... }
139 
140         byte flg = 0;
141         if (mAppThread != null) flg |= 0x2;
142         dest.writeByte(flg);
143         dest.writeStrongInterface(mRemoteTransition);
144         if (mAppThread != null) dest.writeStrongInterface(mAppThread);
145     }
146 
147     @Override
148     @DataClass.Generated.Member
describeContents()149     public int describeContents() { return 0; }
150 
151     /** @hide */
152     @SuppressWarnings({"unchecked", "RedundantCast"})
153     @DataClass.Generated.Member
RemoteTransition(@onNull android.os.Parcel in)154     protected RemoteTransition(@NonNull android.os.Parcel in) {
155         // You can override field unparcelling by defining methods like:
156         // static FieldType unparcelFieldName(Parcel in) { ... }
157 
158         byte flg = in.readByte();
159         IRemoteTransition remoteTransition = IRemoteTransition.Stub.asInterface(in.readStrongBinder());
160         IApplicationThread appThread = (flg & 0x2) == 0 ? null : IApplicationThread.Stub.asInterface(in.readStrongBinder());
161 
162         this.mRemoteTransition = remoteTransition;
163         com.android.internal.util.AnnotationValidations.validate(
164                 NonNull.class, null, mRemoteTransition);
165         this.mAppThread = appThread;
166 
167         // onConstructed(); // You can define this method to get a callback
168     }
169 
170     @DataClass.Generated.Member
171     public static final @NonNull Parcelable.Creator<RemoteTransition> CREATOR
172             = new Parcelable.Creator<RemoteTransition>() {
173         @Override
174         public RemoteTransition[] newArray(int size) {
175             return new RemoteTransition[size];
176         }
177 
178         @Override
179         public RemoteTransition createFromParcel(@NonNull android.os.Parcel in) {
180             return new RemoteTransition(in);
181         }
182     };
183 
184     @DataClass.Generated(
185             time = 1630690027011L,
186             codegenVersion = "1.0.23",
187             sourceFile = "frameworks/base/core/java/android/window/RemoteTransition.java",
188             inputSignatures = "private @android.annotation.NonNull android.window.IRemoteTransition mRemoteTransition\nprivate @android.annotation.Nullable android.app.IApplicationThread mAppThread\npublic @android.annotation.Nullable android.os.IBinder asBinder()\nclass RemoteTransition extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genSetters=true, genAidl=true)")
189     @Deprecated
__metadata()190     private void __metadata() {}
191 
192 
193     //@formatter:on
194     // End of generated code
195 
196 }
197