1 /*
2  * Copyright (C) 2023 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 com.android.ondevicepersonalization.services.request;
18 
19 import android.adservices.ondevicepersonalization.RenderingConfig;
20 import android.adservices.ondevicepersonalization.RequestLogRecord;
21 
22 import com.android.ondevicepersonalization.services.util.ParcelWrapper;
23 
24 import java.io.Serializable;
25 
26 /**
27  * A Serializable wrapper for the data used internally for rendering.
28  */
29 public class SlotWrapper implements Serializable {
30     private ParcelWrapper<RequestLogRecord> mWrappedLogRecord;
31     private ParcelWrapper<RenderingConfig> mWrappedRenderingConfig;
32     private String mServicePackageName;
33     private long mQueryId;
34 
SlotWrapper( RequestLogRecord logInfo, RenderingConfig renderingConfig, String servicePackageName, long queryId)35     public SlotWrapper(
36             RequestLogRecord logInfo, RenderingConfig renderingConfig,
37             String servicePackageName, long queryId) {
38         mWrappedLogRecord = new ParcelWrapper<>(logInfo);
39         mWrappedRenderingConfig = new ParcelWrapper<>(renderingConfig);
40         mServicePackageName = servicePackageName;
41         mQueryId = queryId;
42     }
43 
getLogRecord()44     RequestLogRecord getLogRecord() {
45         return mWrappedLogRecord.get(RequestLogRecord.CREATOR);
46     }
47 
getRenderingConfig()48     RenderingConfig getRenderingConfig() {
49         return mWrappedRenderingConfig.get(RenderingConfig.CREATOR);
50     }
51 
getServicePackageName()52     String getServicePackageName() {
53         return mServicePackageName;
54     }
55 
getQueryId()56     long getQueryId() {
57         return mQueryId;
58     }
59 }
60