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 17 package android.adservices.ondevicepersonalization; 18 19 import android.annotation.NonNull; 20 import android.os.Parcelable; 21 22 import com.android.ondevicepersonalization.internal.util.AnnotationValidations; 23 import com.android.ondevicepersonalization.internal.util.DataClass; 24 25 import java.util.Collections; 26 import java.util.Map; 27 28 /** 29 * Parcelable version of {@link InferenceOutput}. 30 * 31 * @hide 32 */ 33 @DataClass(genAidl = false, genBuilder = false) 34 public final class InferenceOutputParcel implements Parcelable { 35 /** 36 * A map mapping output indices to multidimensional arrays of output. For TFLite, this field is 37 * mapped to outputs of runForMultipleInputsOutputs: 38 * https://www.tensorflow.org/lite/api_docs/java/org/tensorflow/lite/InterpreterApi#parameters_9 39 */ 40 @NonNull private Map<Integer, Object> mData = Collections.emptyMap(); 41 42 /** @hide */ InferenceOutputParcel(@onNull InferenceOutput value)43 public InferenceOutputParcel(@NonNull InferenceOutput value) { 44 this(value.getDataOutputs()); 45 } 46 47 // Code below generated by codegen v1.0.23. 48 // 49 // DO NOT MODIFY! 50 // CHECKSTYLE:OFF Generated code 51 // 52 // To regenerate run: 53 // $ codegen 54 // $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/InferenceOutputParcel.java 55 // 56 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 57 // Settings > Editor > Code Style > Formatter Control 58 // @formatter:off 59 60 /** 61 * Creates a new InferenceOutputParcel. 62 * 63 * @param data A map mapping output indices to multidimensional arrays of output. For TFLite, 64 * this field is mapped to outputs of runForMultipleInputsOutputs: 65 * https://www.tensorflow.org/lite/api_docs/java/org/tensorflow/lite/InterpreterApi#parameters_9 66 */ 67 @DataClass.Generated.Member InferenceOutputParcel(@onNull Map<Integer, Object> data)68 public InferenceOutputParcel(@NonNull Map<Integer, Object> data) { 69 this.mData = data; 70 AnnotationValidations.validate(NonNull.class, null, mData); 71 72 // onConstructed(); // You can define this method to get a callback 73 } 74 75 /** 76 * A map mapping output indices to multidimensional arrays of output. For TFLite, this field is 77 * mapped to outputs of runForMultipleInputsOutputs: 78 * https://www.tensorflow.org/lite/api_docs/java/org/tensorflow/lite/InterpreterApi#parameters_9 79 */ 80 @DataClass.Generated.Member getData()81 public @NonNull Map<Integer, Object> getData() { 82 return mData; 83 } 84 85 @Override 86 @DataClass.Generated.Member writeToParcel(@onNull android.os.Parcel dest, int flags)87 public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { 88 // You can override field parcelling by defining methods like: 89 // void parcelFieldName(Parcel dest, int flags) { ... } 90 91 dest.writeMap(mData); 92 } 93 94 @Override 95 @DataClass.Generated.Member describeContents()96 public int describeContents() { 97 return 0; 98 } 99 100 /** @hide */ 101 @SuppressWarnings({"unchecked", "RedundantCast"}) 102 @DataClass.Generated.Member InferenceOutputParcel(@onNull android.os.Parcel in)103 protected InferenceOutputParcel(@NonNull android.os.Parcel in) { 104 // You can override field unparcelling by defining methods like: 105 // static FieldType unparcelFieldName(Parcel in) { ... } 106 107 Map<Integer, Object> data = new java.util.LinkedHashMap<>(); 108 in.readMap(data, Object.class.getClassLoader()); 109 110 this.mData = data; 111 AnnotationValidations.validate(NonNull.class, null, mData); 112 113 // onConstructed(); // You can define this method to get a callback 114 } 115 116 @DataClass.Generated.Member 117 public static final @NonNull Parcelable.Creator<InferenceOutputParcel> CREATOR = 118 new Parcelable.Creator<InferenceOutputParcel>() { 119 @Override 120 public InferenceOutputParcel[] newArray(int size) { 121 return new InferenceOutputParcel[size]; 122 } 123 124 @Override 125 public InferenceOutputParcel createFromParcel(@NonNull android.os.Parcel in) { 126 return new InferenceOutputParcel(in); 127 } 128 }; 129 130 @DataClass.Generated( 131 time = 1706291599206L, 132 codegenVersion = "1.0.23", 133 sourceFile = 134 "packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/InferenceOutputParcel.java", 135 inputSignatures = 136 "private @android.annotation.NonNull java.util.Map<java.lang.Integer,java.lang.Object> mData\nclass InferenceOutputParcel extends java.lang.Object implements [android.os.Parcelable]\n@com.android.ondevicepersonalization.internal.util.DataClass(genAidl=false, genBuilder=false)") 137 @Deprecated __metadata()138 private void __metadata() {} 139 140 // @formatter:on 141 // End of generated code 142 143 } 144