1 /*
2  * Copyright (C) 2021 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.app.sdksandbox;
18 
19 import android.os.Bundle;
20 import android.os.IBinder;
21 
22 import android.app.sdksandbox.AppOwnedSdkSandboxInterface;
23 import android.app.sdksandbox.ILoadSdkCallback;
24 import android.app.sdksandbox.IRequestSurfacePackageCallback;
25 import android.app.sdksandbox.ISdkSandboxProcessDeathCallback;
26 import android.app.sdksandbox.ISharedPreferencesSyncCallback;
27 import android.app.sdksandbox.SandboxLatencyInfo;
28 import android.app.sdksandbox.SandboxedSdk;
29 import android.app.sdksandbox.SharedPreferencesUpdate;
30 
31 /** @hide */
32 interface ISdkSandboxManager {
33     /**
34     * TODO(b/267994332): Add enum for method calls from SDK for latency metrics
35     * List of methods for which latencies are logged with logLatencyFromSystemServerToApp
36     */
37     const String LOAD_SDK = "LOAD_SDK";
38     const String REQUEST_SURFACE_PACKAGE = "REQUEST_SURFACE_PACKAGE";
39 
addSdkSandboxProcessDeathCallback(in String callingPackageName, in SandboxLatencyInfo sandboxLatencyInfo, in ISdkSandboxProcessDeathCallback callback)40     void addSdkSandboxProcessDeathCallback(in String callingPackageName, in SandboxLatencyInfo sandboxLatencyInfo, in ISdkSandboxProcessDeathCallback callback);
removeSdkSandboxProcessDeathCallback(in String callingPackageName, in SandboxLatencyInfo sandboxLatencyInfo, in ISdkSandboxProcessDeathCallback callback)41     void removeSdkSandboxProcessDeathCallback(in String callingPackageName, in SandboxLatencyInfo sandboxLatencyInfo, in ISdkSandboxProcessDeathCallback callback);
registerAppOwnedSdkSandboxInterface(in String callingPackageName, in AppOwnedSdkSandboxInterface appOwnedSdkSandboxInterface, in SandboxLatencyInfo sandboxLatencyInfo)42     void registerAppOwnedSdkSandboxInterface(in String callingPackageName, in AppOwnedSdkSandboxInterface appOwnedSdkSandboxInterface, in SandboxLatencyInfo sandboxLatencyInfo);
unregisterAppOwnedSdkSandboxInterface(in String callingPackageName, in String name, in SandboxLatencyInfo sandboxLatencyInfo)43     void unregisterAppOwnedSdkSandboxInterface(in String callingPackageName, in String name, in SandboxLatencyInfo sandboxLatencyInfo);
loadSdk(in String callingPackageName, in IBinder appProcessToken, in String sdkName, in SandboxLatencyInfo sandboxLatencyInfo, in Bundle params, in ILoadSdkCallback callback)44     oneway void loadSdk(in String callingPackageName, in IBinder appProcessToken, in String sdkName, in SandboxLatencyInfo sandboxLatencyInfo, in Bundle params, in ILoadSdkCallback callback);
unloadSdk(in String callingPackageName, in String sdkName, in SandboxLatencyInfo sandboxLatencyInfo)45     void unloadSdk(in String callingPackageName, in String sdkName, in SandboxLatencyInfo sandboxLatencyInfo);
46     // TODO(b/242031240): wrap the many input params in one parcelable object
requestSurfacePackage(in String callingPackageName, in String sdkName, in IBinder hostToken, int displayId, int width, int height, in SandboxLatencyInfo sandboxLatencyInfo, in Bundle params, IRequestSurfacePackageCallback callback)47     oneway void requestSurfacePackage(in String callingPackageName, in String sdkName, in IBinder hostToken, int displayId, int width, int height, in SandboxLatencyInfo sandboxLatencyInfo, in Bundle params, IRequestSurfacePackageCallback callback);
getAppOwnedSdkSandboxInterfaces(in String callingPackageName, in SandboxLatencyInfo sandboxLatencyInfo)48     List<AppOwnedSdkSandboxInterface> getAppOwnedSdkSandboxInterfaces(in String callingPackageName, in SandboxLatencyInfo sandboxLatencyInfo);
getSandboxedSdks(in String callingPackageName, in SandboxLatencyInfo sandboxLatencyInfo)49     List<SandboxedSdk> getSandboxedSdks(in String callingPackageName, in SandboxLatencyInfo sandboxLatencyInfo);
syncDataFromClient(in String callingPackageName, in SandboxLatencyInfo sandboxLatencyInfo, in SharedPreferencesUpdate update, in ISharedPreferencesSyncCallback callback)50     oneway void syncDataFromClient(in String callingPackageName, in SandboxLatencyInfo sandboxLatencyInfo, in SharedPreferencesUpdate update, in ISharedPreferencesSyncCallback callback);
isSdkSandboxServiceRunning(in String callingPackageName)51     boolean isSdkSandboxServiceRunning(in String callingPackageName);
stopSdkSandbox(in String callingPackageName)52     void stopSdkSandbox(in String callingPackageName);
logSandboxApiLatency(in SandboxLatencyInfo sandboxLatencyInfo)53     void logSandboxApiLatency(in SandboxLatencyInfo sandboxLatencyInfo);
logSandboxActivityApiLatency(int method, int callResult, int latencyMillis)54     void logSandboxActivityApiLatency(int method, int callResult, int latencyMillis);
55 
56     // TODO(b/282239822): Remove this workaround on Android VIC
getAdServicesManager()57     IBinder getAdServicesManager();
58 }
59