1 /* 2 * Copyright (C) 2024 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 package android.adservices.ondevicepersonalization; 17 18 import android.annotation.NonNull; 19 import android.os.Parcelable; 20 21 import com.android.ondevicepersonalization.internal.util.AnnotationValidations; 22 import com.android.ondevicepersonalization.internal.util.DataClass; 23 24 /** @hide */ 25 @DataClass(genAidl = false, genBuilder = false) 26 public class ExecuteOptionsParcel implements Parcelable { 27 /** Default value is OUTPUT_TYPE_NULL. */ 28 @ExecuteInIsolatedServiceRequest.OutputSpec.OutputType private final int mOutputType; 29 30 /** Optional. Only set when output option is OUTPUT_TYPE_BEST_VALUE. */ 31 private final int mMaxIntValue; 32 33 public static ExecuteOptionsParcel DEFAULT = new ExecuteOptionsParcel(); 34 35 /** @hide */ ExecuteOptionsParcel(@onNull ExecuteInIsolatedServiceRequest.OutputSpec options)36 public ExecuteOptionsParcel(@NonNull ExecuteInIsolatedServiceRequest.OutputSpec options) { 37 this(options.getOutputType(), options.getMaxIntValue()); 38 } 39 40 /** 41 * Create a default instance of {@link ExecuteOptionsParcel}. 42 * 43 * @hide 44 */ ExecuteOptionsParcel()45 private ExecuteOptionsParcel() { 46 this(ExecuteInIsolatedServiceRequest.OutputSpec.OUTPUT_TYPE_NULL, -1); 47 } 48 49 // Code below generated by codegen v1.0.23. 50 // 51 // DO NOT MODIFY! 52 // CHECKSTYLE:OFF Generated code 53 // 54 // To regenerate run: 55 // $ codegen 56 // $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/ExecuteOptionsParcel.java 57 // 58 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 59 // Settings > Editor > Code Style > Formatter Control 60 // @formatter:off 61 62 /** 63 * Creates a new ExecuteOptionsParcel. 64 * 65 * @param outputType Default value is OUTPUT_TYPE_NULL. 66 * @param maxIntValue Optional. Only set when output option is OUTPUT_TYPE_BEST_VALUE. 67 */ 68 @DataClass.Generated.Member ExecuteOptionsParcel( @xecuteInIsolatedServiceRequest.OutputSpec.OutputType int outputType, int maxIntValue)69 public ExecuteOptionsParcel( 70 @ExecuteInIsolatedServiceRequest.OutputSpec.OutputType int outputType, 71 int maxIntValue) { 72 this.mOutputType = outputType; 73 AnnotationValidations.validate( 74 ExecuteInIsolatedServiceRequest.OutputSpec.OutputType.class, null, mOutputType); 75 this.mMaxIntValue = maxIntValue; 76 77 // onConstructed(); // You can define this method to get a callback 78 } 79 80 /** Default value is OUTPUT_TYPE_NULL. */ 81 @DataClass.Generated.Member getOutputType()82 public @ExecuteInIsolatedServiceRequest.OutputSpec.OutputType int getOutputType() { 83 return mOutputType; 84 } 85 86 /** Optional. Only set when output option is OUTPUT_TYPE_BEST_VALUE. */ 87 @DataClass.Generated.Member getMaxIntValue()88 public int getMaxIntValue() { 89 return mMaxIntValue; 90 } 91 92 @Override 93 @DataClass.Generated.Member writeToParcel(@onNull android.os.Parcel dest, int flags)94 public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { 95 // You can override field parcelling by defining methods like: 96 // void parcelFieldName(Parcel dest, int flags) { ... } 97 98 dest.writeInt(mOutputType); 99 dest.writeInt(mMaxIntValue); 100 } 101 102 @Override 103 @DataClass.Generated.Member describeContents()104 public int describeContents() { 105 return 0; 106 } 107 108 /** @hide */ 109 @SuppressWarnings({"unchecked", "RedundantCast"}) 110 @DataClass.Generated.Member ExecuteOptionsParcel(@onNull android.os.Parcel in)111 protected ExecuteOptionsParcel(@NonNull android.os.Parcel in) { 112 // You can override field unparcelling by defining methods like: 113 // static FieldType unparcelFieldName(Parcel in) { ... } 114 115 int outputType = in.readInt(); 116 int maxIntValue = in.readInt(); 117 118 this.mOutputType = outputType; 119 AnnotationValidations.validate( 120 ExecuteInIsolatedServiceRequest.OutputSpec.OutputType.class, null, mOutputType); 121 this.mMaxIntValue = maxIntValue; 122 123 // onConstructed(); // You can define this method to get a callback 124 } 125 126 @DataClass.Generated.Member 127 public static final @NonNull Parcelable.Creator<ExecuteOptionsParcel> CREATOR = 128 new Parcelable.Creator<ExecuteOptionsParcel>() { 129 @Override 130 public ExecuteOptionsParcel[] newArray(int size) { 131 return new ExecuteOptionsParcel[size]; 132 } 133 134 @Override 135 public ExecuteOptionsParcel createFromParcel(@NonNull android.os.Parcel in) { 136 return new ExecuteOptionsParcel(in); 137 } 138 }; 139 // @formatter:on 140 // End of generated code 141 142 } 143