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.DataClass; 25 26 import java.util.Collections; 27 import java.util.List; 28 29 /** 30 * Parcelable version of {@link ExecuteOutput}. 31 * @hide 32 */ 33 @DataClass(genAidl = false, genBuilder = false) 34 public final class ExecuteOutputParcel implements Parcelable { 35 /** 36 * Persistent data to be written to the REQUESTS table after 37 * {@link IsolatedWorker#onExecute(ExecuteInput, android.os.OutcomeReceiver)} 38 * completes. If null, no persistent data will be written. 39 */ 40 @Nullable private RequestLogRecord mRequestLogRecord = null; 41 42 /** 43 * A {@link RenderingConfig} object that contains information about the content to be rendered 44 * in the client app view. Can be null if no content is to be rendered. 45 */ 46 @Nullable private RenderingConfig mRenderingConfig = null; 47 48 /** 49 * A list of {@link EventLogRecord}. Writes events to the EVENTS table and associates 50 * them with requests with the specified corresponding {@link RequestLogRecord} from 51 * {@link EventLogRecord#getRequestLogRecord()}. 52 * If the event does not contain a {@link RequestLogRecord} emitted by this package, the 53 * EventLogRecord is not written. 54 * 55 */ 56 @DataClass.PluralOf("eventLogRecord") 57 @NonNull private List<EventLogRecord> mEventLogRecords = Collections.emptyList(); 58 59 /** 60 * A byte array returned by an {@link IsolatedService} to a calling app. The contents of 61 * this array is returned to the caller of 62 * {@link OnDevicePersonalizationManager#execute(ComponentName, PersistableBundle, java.util.concurrent.Executor, OutcomeReceiver)} 63 * if the (calling app package, isolated service package) pair is present in an allow list 64 * that permits data to be returned to the caller. 65 * 66 * @hide 67 */ 68 @Nullable private byte[] mOutputData = null; 69 70 /** @hide */ ExecuteOutputParcel(@onNull ExecuteOutput value)71 public ExecuteOutputParcel(@NonNull ExecuteOutput value) { 72 this(value.getRequestLogRecord(), value.getRenderingConfig(), value.getEventLogRecords(), 73 value.getOutputData()); 74 } 75 76 77 78 // Code below generated by codegen v1.0.23. 79 // 80 // DO NOT MODIFY! 81 // CHECKSTYLE:OFF Generated code 82 // 83 // To regenerate run: 84 // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/ExecuteOutputParcel.java 85 // 86 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 87 // Settings > Editor > Code Style > Formatter Control 88 //@formatter:off 89 90 91 /** 92 * Creates a new ExecuteOutputParcel. 93 * 94 * @param requestLogRecord 95 * Persistent data to be written to the REQUESTS table after 96 * {@link IsolatedWorker#onExecute(ExecuteInput, android.os.OutcomeReceiver)} 97 * completes. If null, no persistent data will be written. 98 * @param renderingConfig 99 * A {@link RenderingConfig} object that contains information about the content to be rendered 100 * in the client app view. Can be null if no content is to be rendered. 101 * @param eventLogRecords 102 * A list of {@link EventLogRecord}. Writes events to the EVENTS table and associates 103 * them with requests with the specified corresponding {@link RequestLogRecord} from 104 * {@link EventLogRecord#getRequestLogRecord()}. 105 * If the event does not contain a {@link RequestLogRecord} emitted by this package, the 106 * EventLogRecord is not written. 107 * @param outputData 108 * A byte array returned by an {@link IsolatedService} to a calling app. The contents of 109 * this array is returned to the caller of 110 * {@link OnDevicePersonalizationManager#execute(ComponentName, PersistableBundle, java.util.concurrent.Executor, OutcomeReceiver)} 111 * if the (calling app package, isolated service package) pair is present in an allow list 112 * that permits data to be returned to the caller. 113 */ 114 @DataClass.Generated.Member ExecuteOutputParcel( @ullable RequestLogRecord requestLogRecord, @Nullable RenderingConfig renderingConfig, @NonNull List<EventLogRecord> eventLogRecords, @Nullable byte[] outputData)115 public ExecuteOutputParcel( 116 @Nullable RequestLogRecord requestLogRecord, 117 @Nullable RenderingConfig renderingConfig, 118 @NonNull List<EventLogRecord> eventLogRecords, 119 @Nullable byte[] outputData) { 120 this.mRequestLogRecord = requestLogRecord; 121 this.mRenderingConfig = renderingConfig; 122 this.mEventLogRecords = eventLogRecords; 123 AnnotationValidations.validate( 124 NonNull.class, null, mEventLogRecords); 125 this.mOutputData = outputData; 126 127 // onConstructed(); // You can define this method to get a callback 128 } 129 130 /** 131 * Persistent data to be written to the REQUESTS table after 132 * {@link IsolatedWorker#onExecute(ExecuteInput, android.os.OutcomeReceiver)} 133 * completes. If null, no persistent data will be written. 134 */ 135 @DataClass.Generated.Member getRequestLogRecord()136 public @Nullable RequestLogRecord getRequestLogRecord() { 137 return mRequestLogRecord; 138 } 139 140 /** 141 * A {@link RenderingConfig} object that contains information about the content to be rendered 142 * in the client app view. Can be null if no content is to be rendered. 143 */ 144 @DataClass.Generated.Member getRenderingConfig()145 public @Nullable RenderingConfig getRenderingConfig() { 146 return mRenderingConfig; 147 } 148 149 /** 150 * A list of {@link EventLogRecord}. Writes events to the EVENTS table and associates 151 * them with requests with the specified corresponding {@link RequestLogRecord} from 152 * {@link EventLogRecord#getRequestLogRecord()}. 153 * If the event does not contain a {@link RequestLogRecord} emitted by this package, the 154 * EventLogRecord is not written. 155 */ 156 @DataClass.Generated.Member getEventLogRecords()157 public @NonNull List<EventLogRecord> getEventLogRecords() { 158 return mEventLogRecords; 159 } 160 161 /** 162 * A byte array returned by an {@link IsolatedService} to a calling app. The contents of 163 * this array is returned to the caller of 164 * {@link OnDevicePersonalizationManager#execute(ComponentName, PersistableBundle, java.util.concurrent.Executor, OutcomeReceiver)} 165 * if the (calling app package, isolated service package) pair is present in an allow list 166 * that permits data to be returned to the caller. 167 * 168 * @hide 169 */ 170 @DataClass.Generated.Member getOutputData()171 public @Nullable byte[] getOutputData() { 172 return mOutputData; 173 } 174 175 @Override 176 @DataClass.Generated.Member writeToParcel(@onNull android.os.Parcel dest, int flags)177 public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { 178 // You can override field parcelling by defining methods like: 179 // void parcelFieldName(Parcel dest, int flags) { ... } 180 181 byte flg = 0; 182 if (mRequestLogRecord != null) flg |= 0x1; 183 if (mRenderingConfig != null) flg |= 0x2; 184 dest.writeByte(flg); 185 if (mRequestLogRecord != null) dest.writeTypedObject(mRequestLogRecord, flags); 186 if (mRenderingConfig != null) dest.writeTypedObject(mRenderingConfig, flags); 187 dest.writeParcelableList(mEventLogRecords, flags); 188 dest.writeByteArray(mOutputData); 189 } 190 191 @Override 192 @DataClass.Generated.Member describeContents()193 public int describeContents() { return 0; } 194 195 /** @hide */ 196 @SuppressWarnings({"unchecked", "RedundantCast"}) 197 @DataClass.Generated.Member ExecuteOutputParcel(@onNull android.os.Parcel in)198 /* package-private */ ExecuteOutputParcel(@NonNull android.os.Parcel in) { 199 // You can override field unparcelling by defining methods like: 200 // static FieldType unparcelFieldName(Parcel in) { ... } 201 202 byte flg = in.readByte(); 203 RequestLogRecord requestLogRecord = (flg & 0x1) == 0 ? null : (RequestLogRecord) in.readTypedObject(RequestLogRecord.CREATOR); 204 RenderingConfig renderingConfig = (flg & 0x2) == 0 ? null : (RenderingConfig) in.readTypedObject(RenderingConfig.CREATOR); 205 List<EventLogRecord> eventLogRecords = new java.util.ArrayList<>(); 206 in.readParcelableList(eventLogRecords, EventLogRecord.class.getClassLoader()); 207 byte[] outputData = in.createByteArray(); 208 209 this.mRequestLogRecord = requestLogRecord; 210 this.mRenderingConfig = renderingConfig; 211 this.mEventLogRecords = eventLogRecords; 212 AnnotationValidations.validate( 213 NonNull.class, null, mEventLogRecords); 214 this.mOutputData = outputData; 215 216 // onConstructed(); // You can define this method to get a callback 217 } 218 219 @DataClass.Generated.Member 220 public static final @NonNull Parcelable.Creator<ExecuteOutputParcel> CREATOR 221 = new Parcelable.Creator<ExecuteOutputParcel>() { 222 @Override 223 public ExecuteOutputParcel[] newArray(int size) { 224 return new ExecuteOutputParcel[size]; 225 } 226 227 @Override 228 public ExecuteOutputParcel createFromParcel(@NonNull android.os.Parcel in) { 229 return new ExecuteOutputParcel(in); 230 } 231 }; 232 233 @DataClass.Generated( 234 time = 1706684633171L, 235 codegenVersion = "1.0.23", 236 sourceFile = "packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/ExecuteOutputParcel.java", 237 inputSignatures = "private @android.annotation.Nullable android.adservices.ondevicepersonalization.RequestLogRecord mRequestLogRecord\nprivate @android.annotation.Nullable android.adservices.ondevicepersonalization.RenderingConfig mRenderingConfig\nprivate @com.android.ondevicepersonalization.internal.util.DataClass.PluralOf(\"eventLogRecord\") @android.annotation.NonNull java.util.List<android.adservices.ondevicepersonalization.EventLogRecord> mEventLogRecords\nprivate @android.annotation.Nullable byte[] mOutputData\nclass ExecuteOutputParcel extends java.lang.Object implements [android.os.Parcelable]\n@com.android.ondevicepersonalization.internal.util.DataClass(genAidl=false, genBuilder=false)") 238 @Deprecated __metadata()239 private void __metadata() {} 240 241 242 //@formatter:on 243 // End of generated code 244 245 } 246