• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 com.android.ondevicepersonalization.services.process;
18 
19 
20 import android.adservices.ondevicepersonalization.aidl.IIsolatedService;
21 import android.annotation.NonNull;
22 import android.annotation.Nullable;
23 import android.content.ComponentName;
24 
25 import com.android.federatedcompute.internal.util.AbstractServiceBinder;
26 import com.android.ondevicepersonalization.libraries.plugin.PluginController;
27 
28 import java.util.Objects;
29 
30 /** Wraps an instance of a loaded isolated service */
31 public class IsolatedServiceInfo {
32     private final long mStartTimeMillis;
33     @NonNull private final ComponentName mComponentName;
34     @Nullable private final PluginController mPluginController;
35     @Nullable private final AbstractServiceBinder<IIsolatedService> mIsolatedServiceBinder;
36 
IsolatedServiceInfo( long startTimeMillis, @NonNull ComponentName componentName, @NonNull PluginController pluginController)37     IsolatedServiceInfo(
38             long startTimeMillis,
39             @NonNull ComponentName componentName,
40             @NonNull PluginController pluginController) {
41         this(startTimeMillis, componentName, pluginController, /* isolatedServiceBinder= */ null);
42     }
43 
IsolatedServiceInfo( long startTimeMillis, @NonNull ComponentName componentName, @NonNull AbstractServiceBinder<IIsolatedService> isolatedServiceBinder)44     IsolatedServiceInfo(
45             long startTimeMillis,
46             @NonNull ComponentName componentName,
47             @NonNull AbstractServiceBinder<IIsolatedService> isolatedServiceBinder) {
48         this(startTimeMillis, componentName, /* pluginController= */ null, isolatedServiceBinder);
49     }
50 
IsolatedServiceInfo( long startTimeMillis, @NonNull ComponentName componentName, @Nullable PluginController pluginController, @Nullable AbstractServiceBinder<IIsolatedService> isolatedServiceBinder)51     private IsolatedServiceInfo(
52             long startTimeMillis,
53             @NonNull ComponentName componentName,
54             @Nullable PluginController pluginController,
55             @Nullable AbstractServiceBinder<IIsolatedService> isolatedServiceBinder) {
56         mStartTimeMillis = startTimeMillis;
57         mComponentName = Objects.requireNonNull(componentName);
58         mPluginController = pluginController;
59         mIsolatedServiceBinder = isolatedServiceBinder;
60     }
61 
getPluginController()62     PluginController getPluginController() {
63         return mPluginController;
64     }
65 
getIsolatedServiceBinder()66     AbstractServiceBinder<IIsolatedService> getIsolatedServiceBinder() {
67         return mIsolatedServiceBinder;
68     }
69 
70     /** Returns the service start time. */
getStartTimeMillis()71     public long getStartTimeMillis() {
72         return mStartTimeMillis;
73     }
74 
75     /** Returns the ComponentName to be loaded. */
getComponentName()76     @NonNull public ComponentName getComponentName() {
77         return mComponentName;
78     }
79 }
80