1 /* 2 * Copyright (C) 2022 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.adservices.ondevicepersonalization; 18 19 import android.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.os.Parcelable; 22 23 import com.android.ondevicepersonalization.internal.util.AnnotationValidations; 24 import com.android.ondevicepersonalization.internal.util.ByteArrayParceledSlice; 25 import com.android.ondevicepersonalization.internal.util.DataClass; 26 27 /** 28 * Parcelable version of {@link ExecuteInput}. 29 * @hide 30 */ 31 @DataClass(genAidl = false, genHiddenBuilder = true) 32 public final class ExecuteInputParcel implements Parcelable { 33 /** 34 * The package name of the calling app. 35 */ 36 @NonNull String mAppPackageName = ""; 37 38 /** 39 * Serialized app params. 40 * @hide 41 */ 42 @Nullable ByteArrayParceledSlice mSerializedAppParams = null; 43 44 45 46 // Code below generated by codegen v1.0.23. 47 // 48 // DO NOT MODIFY! 49 // CHECKSTYLE:OFF Generated code 50 // 51 // To regenerate run: 52 // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/ExecuteInputParcel.java 53 // 54 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 55 // Settings > Editor > Code Style > Formatter Control 56 //@formatter:off 57 58 59 @DataClass.Generated.Member ExecuteInputParcel( @onNull String appPackageName, @Nullable ByteArrayParceledSlice serializedAppParams)60 /* package-private */ ExecuteInputParcel( 61 @NonNull String appPackageName, 62 @Nullable ByteArrayParceledSlice serializedAppParams) { 63 this.mAppPackageName = appPackageName; 64 AnnotationValidations.validate( 65 NonNull.class, null, mAppPackageName); 66 this.mSerializedAppParams = serializedAppParams; 67 68 // onConstructed(); // You can define this method to get a callback 69 } 70 71 /** 72 * The package name of the calling app. 73 */ 74 @DataClass.Generated.Member getAppPackageName()75 public @NonNull String getAppPackageName() { 76 return mAppPackageName; 77 } 78 79 /** 80 * Serialized app params. 81 * 82 * @hide 83 */ 84 @DataClass.Generated.Member getSerializedAppParams()85 public @Nullable ByteArrayParceledSlice getSerializedAppParams() { 86 return mSerializedAppParams; 87 } 88 89 @Override 90 @DataClass.Generated.Member writeToParcel(@onNull android.os.Parcel dest, int flags)91 public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { 92 // You can override field parcelling by defining methods like: 93 // void parcelFieldName(Parcel dest, int flags) { ... } 94 95 byte flg = 0; 96 if (mSerializedAppParams != null) flg |= 0x2; 97 dest.writeByte(flg); 98 dest.writeString(mAppPackageName); 99 if (mSerializedAppParams != null) dest.writeTypedObject(mSerializedAppParams, flags); 100 } 101 102 @Override 103 @DataClass.Generated.Member describeContents()104 public int describeContents() { return 0; } 105 106 /** @hide */ 107 @SuppressWarnings({"unchecked", "RedundantCast"}) 108 @DataClass.Generated.Member ExecuteInputParcel(@onNull android.os.Parcel in)109 /* package-private */ ExecuteInputParcel(@NonNull android.os.Parcel in) { 110 // You can override field unparcelling by defining methods like: 111 // static FieldType unparcelFieldName(Parcel in) { ... } 112 113 byte flg = in.readByte(); 114 String appPackageName = in.readString(); 115 ByteArrayParceledSlice serializedAppParams = (flg & 0x2) == 0 ? null : (ByteArrayParceledSlice) in.readTypedObject(ByteArrayParceledSlice.CREATOR); 116 117 this.mAppPackageName = appPackageName; 118 AnnotationValidations.validate( 119 NonNull.class, null, mAppPackageName); 120 this.mSerializedAppParams = serializedAppParams; 121 122 // onConstructed(); // You can define this method to get a callback 123 } 124 125 @DataClass.Generated.Member 126 public static final @NonNull Parcelable.Creator<ExecuteInputParcel> CREATOR 127 = new Parcelable.Creator<ExecuteInputParcel>() { 128 @Override 129 public ExecuteInputParcel[] newArray(int size) { 130 return new ExecuteInputParcel[size]; 131 } 132 133 @Override 134 public ExecuteInputParcel createFromParcel(@NonNull android.os.Parcel in) { 135 return new ExecuteInputParcel(in); 136 } 137 }; 138 139 /** 140 * A builder for {@link ExecuteInputParcel} 141 * @hide 142 */ 143 @SuppressWarnings("WeakerAccess") 144 @DataClass.Generated.Member 145 public static final class Builder { 146 147 private @NonNull String mAppPackageName; 148 private @Nullable ByteArrayParceledSlice mSerializedAppParams; 149 150 private long mBuilderFieldsSet = 0L; 151 Builder()152 public Builder() { 153 } 154 155 /** 156 * The package name of the calling app. 157 */ 158 @DataClass.Generated.Member setAppPackageName(@onNull String value)159 public @NonNull Builder setAppPackageName(@NonNull String value) { 160 checkNotUsed(); 161 mBuilderFieldsSet |= 0x1; 162 mAppPackageName = value; 163 return this; 164 } 165 166 /** 167 * Serialized app params. 168 * 169 * @hide 170 */ 171 @DataClass.Generated.Member setSerializedAppParams(@onNull ByteArrayParceledSlice value)172 public @NonNull Builder setSerializedAppParams(@NonNull ByteArrayParceledSlice value) { 173 checkNotUsed(); 174 mBuilderFieldsSet |= 0x2; 175 mSerializedAppParams = value; 176 return this; 177 } 178 179 /** Builds the instance. This builder should not be touched after calling this! */ build()180 public @NonNull ExecuteInputParcel build() { 181 checkNotUsed(); 182 mBuilderFieldsSet |= 0x4; // Mark builder used 183 184 if ((mBuilderFieldsSet & 0x1) == 0) { 185 mAppPackageName = ""; 186 } 187 if ((mBuilderFieldsSet & 0x2) == 0) { 188 mSerializedAppParams = null; 189 } 190 ExecuteInputParcel o = new ExecuteInputParcel( 191 mAppPackageName, 192 mSerializedAppParams); 193 return o; 194 } 195 checkNotUsed()196 private void checkNotUsed() { 197 if ((mBuilderFieldsSet & 0x4) != 0) { 198 throw new IllegalStateException( 199 "This Builder should not be reused. Use a new Builder instance instead"); 200 } 201 } 202 } 203 204 @DataClass.Generated( 205 time = 1708120245903L, 206 codegenVersion = "1.0.23", 207 sourceFile = "packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/ExecuteInputParcel.java", 208 inputSignatures = " @android.annotation.NonNull java.lang.String mAppPackageName\n @android.annotation.Nullable com.android.ondevicepersonalization.internal.util.ByteArrayParceledSlice mSerializedAppParams\nclass ExecuteInputParcel extends java.lang.Object implements [android.os.Parcelable]\n@com.android.ondevicepersonalization.internal.util.DataClass(genAidl=false, genHiddenBuilder=true)") 209 @Deprecated __metadata()210 private void __metadata() {} 211 212 213 //@formatter:on 214 // End of generated code 215 216 } 217