• 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.libraries.plugin.internal;
18 
19 import com.android.ondevicepersonalization.libraries.plugin.Plugin;
20 
21 import com.google.common.collect.ImmutableList;
22 import com.google.common.collect.ImmutableSet;
23 
24 import org.checkerframework.checker.nullness.qual.Nullable;
25 
26 /** Interface used to load Plugins. */
27 public interface PluginLoader {
28     /**
29      * Returns an instance of the plugin.
30      *
31      * @param className The class name of the plugin
32      * @param pluginCode contains FileDescriptors with the plugin apks to be loaded
33      * @param classLoader The plugin container's class loader to be isolated and managed
34      * @param containerClassesAllowlist Classes allowed to be loaded outside plugin's class loader.
35      *     These are usually classes that are accessed inside and outside the sandbox.
36      * @param containerPackagesAllowlist Packages allowed to be loaded outside plugin's class
37      *     loader.
38      */
loadPlugin( String className, ImmutableList<PluginCode> pluginCode, ClassLoader classLoader, ImmutableSet<String> containerClassesAllowlist, ImmutableSet<String> containerPackagesAllowlist)39     @Nullable Plugin loadPlugin(
40             String className,
41             ImmutableList<PluginCode> pluginCode,
42             ClassLoader classLoader,
43             ImmutableSet<String> containerClassesAllowlist,
44             ImmutableSet<String> containerPackagesAllowlist);
45 }
46