• 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 android.app.sdksandbox.testutils;
18 
19 import android.app.sdksandbox.AppOwnedSdkSandboxInterface;
20 import android.app.sdksandbox.ILoadSdkCallback;
21 import android.app.sdksandbox.IRequestSurfacePackageCallback;
22 import android.app.sdksandbox.ISdkSandboxManager;
23 import android.app.sdksandbox.ISdkSandboxProcessDeathCallback;
24 import android.app.sdksandbox.ISharedPreferencesSyncCallback;
25 import android.app.sdksandbox.SandboxLatencyInfo;
26 import android.app.sdksandbox.SandboxedSdk;
27 import android.app.sdksandbox.SharedPreferencesUpdate;
28 import android.os.Bundle;
29 import android.os.IBinder;
30 import android.os.RemoteException;
31 
32 import java.util.Collections;
33 import java.util.List;
34 
35 /**
36  * A stub implementation for {@link ISdkSandboxManager}.
37  *
38  * <p>Extend and override methods as needed for your tests.
39  */
40 public class StubSdkSandboxManagerService extends ISdkSandboxManager.Stub {
41     private IBinder mAdServicesManager;
42 
43     @Override
registerAppOwnedSdkSandboxInterface( String callingPackageName, AppOwnedSdkSandboxInterface appOwnedSdkSandboxInterface, SandboxLatencyInfo sandboxLatencyInfo)44     public void registerAppOwnedSdkSandboxInterface(
45             String callingPackageName,
46             AppOwnedSdkSandboxInterface appOwnedSdkSandboxInterface,
47             SandboxLatencyInfo sandboxLatencyInfo) {}
48 
49     @Override
unregisterAppOwnedSdkSandboxInterface( String callingPackageName, String name, SandboxLatencyInfo sandboxLatencyInfo)50     public void unregisterAppOwnedSdkSandboxInterface(
51             String callingPackageName, String name, SandboxLatencyInfo sandboxLatencyInfo) {}
52 
53     @Override
loadSdk( String callingPackageName, IBinder clientApplicationThreadBinder, String sdkName, SandboxLatencyInfo sandboxLatencyInfo, Bundle params, ILoadSdkCallback callback)54     public void loadSdk(
55             String callingPackageName,
56             IBinder clientApplicationThreadBinder,
57             String sdkName,
58             SandboxLatencyInfo sandboxLatencyInfo,
59             Bundle params,
60             ILoadSdkCallback callback) {}
61 
62     @Override
unloadSdk( String callingPackageName, String sdkName, SandboxLatencyInfo sandboxLatencyInfo)63     public void unloadSdk(
64             String callingPackageName, String sdkName, SandboxLatencyInfo sandboxLatencyInfo) {}
65 
66     @Override
requestSurfacePackage( String callingPackageName, String sdkName, IBinder hostToken, int displayId, int width, int height, SandboxLatencyInfo sandboxLatencyInfo, Bundle params, IRequestSurfacePackageCallback callback)67     public void requestSurfacePackage(
68             String callingPackageName,
69             String sdkName,
70             IBinder hostToken,
71             int displayId,
72             int width,
73             int height,
74             SandboxLatencyInfo sandboxLatencyInfo,
75             Bundle params,
76             IRequestSurfacePackageCallback callback) {}
77 
78     @Override
getAppOwnedSdkSandboxInterfaces( String callingPackageName, SandboxLatencyInfo sandboxLatencyInfo)79     public List<AppOwnedSdkSandboxInterface> getAppOwnedSdkSandboxInterfaces(
80             String callingPackageName, SandboxLatencyInfo sandboxLatencyInfo) {
81         return Collections.emptyList();
82     }
83 
84     @Override
getSandboxedSdks( String callingPackageName, SandboxLatencyInfo sandboxLatencyInfo)85     public List<SandboxedSdk> getSandboxedSdks(
86             String callingPackageName, SandboxLatencyInfo sandboxLatencyInfo) {
87         return Collections.emptyList();
88     }
89 
90     @Override
isSdkSandboxServiceRunning(String callingPackageName)91     public boolean isSdkSandboxServiceRunning(String callingPackageName) throws RemoteException {
92         return false;
93     }
94 
95     @Override
stopSdkSandbox(String callingPackageName)96     public void stopSdkSandbox(String callingPackageName) throws RemoteException {}
97 
98     @Override
syncDataFromClient( String callingPackageName, SandboxLatencyInfo sandboxLatencyInfo, SharedPreferencesUpdate update, ISharedPreferencesSyncCallback callback)99     public void syncDataFromClient(
100             String callingPackageName,
101             SandboxLatencyInfo sandboxLatencyInfo,
102             SharedPreferencesUpdate update,
103             ISharedPreferencesSyncCallback callback) {}
104 
105     @Override
addSdkSandboxProcessDeathCallback( String callingPackageName, SandboxLatencyInfo sandboxLatencyInfo, ISdkSandboxProcessDeathCallback callback)106     public void addSdkSandboxProcessDeathCallback(
107             String callingPackageName,
108             SandboxLatencyInfo sandboxLatencyInfo,
109             ISdkSandboxProcessDeathCallback callback) {}
110 
111     @Override
removeSdkSandboxProcessDeathCallback( String callingPackageName, SandboxLatencyInfo sandboxLatencyInfo, ISdkSandboxProcessDeathCallback callback)112     public void removeSdkSandboxProcessDeathCallback(
113             String callingPackageName,
114             SandboxLatencyInfo sandboxLatencyInfo,
115             ISdkSandboxProcessDeathCallback callback) {}
116 
117     @Override
logSandboxApiLatency(SandboxLatencyInfo sandboxLatencyInfo)118     public void logSandboxApiLatency(SandboxLatencyInfo sandboxLatencyInfo) {}
119 
120     @Override
logSandboxActivityApiLatency(int method, int callResult, int latencyMillis)121     public void logSandboxActivityApiLatency(int method, int callResult, int latencyMillis) {}
122 
123     @Override
getAdServicesManager()124     public IBinder getAdServicesManager() {
125         return mAdServicesManager;
126     }
127 }
128