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 /** A name for this that can be used for debugging. */ 42 private @Nullable String mDebugName; 43 44 /** Constructs with no app thread (animation runs in shell). */ RemoteTransition(@onNull IRemoteTransition remoteTransition)45 public RemoteTransition(@NonNull IRemoteTransition remoteTransition) { 46 this(remoteTransition, null /* appThread */, null /* debugName */); 47 } 48 49 /** Constructs with no app thread (animation runs in shell). */ RemoteTransition(@onNull IRemoteTransition remoteTransition, @Nullable String debugName)50 public RemoteTransition(@NonNull IRemoteTransition remoteTransition, 51 @Nullable String debugName) { 52 this(remoteTransition, null /* appThread */, debugName); 53 } 54 55 /** Get the IBinder associated with the underlying IRemoteTransition. */ asBinder()56 public @Nullable IBinder asBinder() { 57 return mRemoteTransition.asBinder(); 58 } 59 60 61 62 // Code below generated by codegen v1.0.23. 63 // 64 // DO NOT MODIFY! 65 // CHECKSTYLE:OFF Generated code 66 // 67 // To regenerate run: 68 // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/window/RemoteTransition.java 69 // 70 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 71 // Settings > Editor > Code Style > Formatter Control 72 //@formatter:off 73 74 75 /** 76 * Creates a new RemoteTransition. 77 * 78 * @param remoteTransition 79 * The actual remote-transition interface used to run the transition animation. 80 * @param appThread 81 * The application thread that will be running the remote transition. 82 * @param debugName 83 * A name for this that can be used for debugging. 84 */ 85 @DataClass.Generated.Member RemoteTransition( @onNull IRemoteTransition remoteTransition, @Nullable IApplicationThread appThread, @Nullable String debugName)86 public RemoteTransition( 87 @NonNull IRemoteTransition remoteTransition, 88 @Nullable IApplicationThread appThread, 89 @Nullable String debugName) { 90 this.mRemoteTransition = remoteTransition; 91 com.android.internal.util.AnnotationValidations.validate( 92 NonNull.class, null, mRemoteTransition); 93 this.mAppThread = appThread; 94 this.mDebugName = debugName; 95 96 // onConstructed(); // You can define this method to get a callback 97 } 98 99 /** 100 * The actual remote-transition interface used to run the transition animation. 101 */ 102 @DataClass.Generated.Member getRemoteTransition()103 public @NonNull IRemoteTransition getRemoteTransition() { 104 return mRemoteTransition; 105 } 106 107 /** 108 * The application thread that will be running the remote transition. 109 */ 110 @DataClass.Generated.Member getAppThread()111 public @Nullable IApplicationThread getAppThread() { 112 return mAppThread; 113 } 114 115 /** 116 * A name for this that can be used for debugging. 117 */ 118 @DataClass.Generated.Member getDebugName()119 public @Nullable String getDebugName() { 120 return mDebugName; 121 } 122 123 /** 124 * The actual remote-transition interface used to run the transition animation. 125 */ 126 @DataClass.Generated.Member setRemoteTransition(@onNull IRemoteTransition value)127 public @NonNull RemoteTransition setRemoteTransition(@NonNull IRemoteTransition value) { 128 mRemoteTransition = value; 129 com.android.internal.util.AnnotationValidations.validate( 130 NonNull.class, null, mRemoteTransition); 131 return this; 132 } 133 134 /** 135 * The application thread that will be running the remote transition. 136 */ 137 @DataClass.Generated.Member setAppThread(@onNull IApplicationThread value)138 public @NonNull RemoteTransition setAppThread(@NonNull IApplicationThread value) { 139 mAppThread = value; 140 return this; 141 } 142 143 /** 144 * A name for this that can be used for debugging. 145 */ 146 @DataClass.Generated.Member setDebugName(@onNull String value)147 public @NonNull RemoteTransition setDebugName(@NonNull String value) { 148 mDebugName = value; 149 return this; 150 } 151 152 @Override 153 @DataClass.Generated.Member toString()154 public String toString() { 155 // You can override field toString logic by defining methods like: 156 // String fieldNameToString() { ... } 157 158 return "RemoteTransition { " + 159 "remoteTransition = " + mRemoteTransition + ", " + 160 "appThread = " + mAppThread + ", " + 161 "debugName = " + mDebugName + 162 " }"; 163 } 164 165 @Override 166 @DataClass.Generated.Member writeToParcel(@onNull android.os.Parcel dest, int flags)167 public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { 168 // You can override field parcelling by defining methods like: 169 // void parcelFieldName(Parcel dest, int flags) { ... } 170 171 byte flg = 0; 172 if (mAppThread != null) flg |= 0x2; 173 if (mDebugName != null) flg |= 0x4; 174 dest.writeByte(flg); 175 dest.writeStrongInterface(mRemoteTransition); 176 if (mAppThread != null) dest.writeStrongInterface(mAppThread); 177 if (mDebugName != null) dest.writeString(mDebugName); 178 } 179 180 @Override 181 @DataClass.Generated.Member describeContents()182 public int describeContents() { return 0; } 183 184 /** @hide */ 185 @SuppressWarnings({"unchecked", "RedundantCast"}) 186 @DataClass.Generated.Member RemoteTransition(@onNull android.os.Parcel in)187 protected RemoteTransition(@NonNull android.os.Parcel in) { 188 // You can override field unparcelling by defining methods like: 189 // static FieldType unparcelFieldName(Parcel in) { ... } 190 191 byte flg = in.readByte(); 192 IRemoteTransition remoteTransition = IRemoteTransition.Stub.asInterface(in.readStrongBinder()); 193 IApplicationThread appThread = (flg & 0x2) == 0 ? null : IApplicationThread.Stub.asInterface(in.readStrongBinder()); 194 String debugName = (flg & 0x4) == 0 ? null : in.readString(); 195 196 this.mRemoteTransition = remoteTransition; 197 com.android.internal.util.AnnotationValidations.validate( 198 NonNull.class, null, mRemoteTransition); 199 this.mAppThread = appThread; 200 this.mDebugName = debugName; 201 202 // onConstructed(); // You can define this method to get a callback 203 } 204 205 @DataClass.Generated.Member 206 public static final @NonNull Parcelable.Creator<RemoteTransition> CREATOR 207 = new Parcelable.Creator<RemoteTransition>() { 208 @Override 209 public RemoteTransition[] newArray(int size) { 210 return new RemoteTransition[size]; 211 } 212 213 @Override 214 public RemoteTransition createFromParcel(@NonNull android.os.Parcel in) { 215 return new RemoteTransition(in); 216 } 217 }; 218 219 @DataClass.Generated( 220 time = 1678926409863L, 221 codegenVersion = "1.0.23", 222 sourceFile = "frameworks/base/core/java/android/window/RemoteTransition.java", 223 inputSignatures = "private @android.annotation.NonNull android.window.IRemoteTransition mRemoteTransition\nprivate @android.annotation.Nullable android.app.IApplicationThread mAppThread\nprivate @android.annotation.Nullable java.lang.String mDebugName\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)") 224 @Deprecated __metadata()225 private void __metadata() {} 226 227 228 //@formatter:on 229 // End of generated code 230 231 } 232