blob: 4a50c5dac7197e18b1a3c3801fbe400b9cbe88f1 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2008 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
17package android.test.mock;
18
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080019import android.content.ComponentName;
20import android.content.Intent;
21import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070022import android.content.IntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.pm.ActivityInfo;
24import android.content.pm.ApplicationInfo;
25import android.content.pm.IPackageDeleteObserver;
26import android.content.pm.IPackageDataObserver;
27import android.content.pm.IPackageInstallObserver;
28import android.content.pm.IPackageStatsObserver;
29import android.content.pm.InstrumentationInfo;
30import android.content.pm.PackageInfo;
31import android.content.pm.PackageManager;
32import android.content.pm.PermissionGroupInfo;
33import android.content.pm.PermissionInfo;
34import android.content.pm.ProviderInfo;
35import android.content.pm.ResolveInfo;
36import android.content.pm.ServiceInfo;
37import android.content.pm.PackageManager.NameNotFoundException;
38import android.content.res.Resources;
39import android.content.res.XmlResourceParser;
40import android.graphics.drawable.Drawable;
41import android.net.Uri;
42import android.os.RemoteException;
43
44import java.util.List;
45
46/**
47 * A mock {@link android.content.pm.PackageManager} class. All methods are non-functional and throw
48 * {@link java.lang.UnsupportedOperationException}. Override it to provide the operations that you
49 * need.
50 */
51public class MockPackageManager extends PackageManager {
52
53 @Override
54 public PackageInfo getPackageInfo(String packageName, int flags)
55 throws NameNotFoundException {
56 throw new UnsupportedOperationException();
57 }
58
59 @Override
Mihai Predaeae850c2009-05-13 10:13:48 +020060 public Intent getLaunchIntentForPackage(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061 throw new UnsupportedOperationException();
62 }
Mihai Predaeae850c2009-05-13 10:13:48 +020063
64 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065 public int[] getPackageGids(String packageName) throws NameNotFoundException {
66 throw new UnsupportedOperationException();
67 }
68
69 @Override
70 public PermissionInfo getPermissionInfo(String name, int flags)
71 throws NameNotFoundException {
72 throw new UnsupportedOperationException();
73 }
74
75 @Override
76 public List<PermissionInfo> queryPermissionsByGroup(String group, int flags)
77 throws NameNotFoundException {
78 throw new UnsupportedOperationException();
79 }
80
81 @Override
82 public PermissionGroupInfo getPermissionGroupInfo(String name,
83 int flags) throws NameNotFoundException {
84 throw new UnsupportedOperationException();
85 }
86
87 @Override
88 public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
89 throw new UnsupportedOperationException();
90 }
91
92 @Override
93 public ApplicationInfo getApplicationInfo(String packageName, int flags)
94 throws NameNotFoundException {
95 throw new UnsupportedOperationException();
96 }
97
98 @Override
99 public ActivityInfo getActivityInfo(ComponentName className, int flags)
100 throws NameNotFoundException {
101 throw new UnsupportedOperationException();
102 }
103
104 @Override
105 public ActivityInfo getReceiverInfo(ComponentName className, int flags)
106 throws NameNotFoundException {
107 throw new UnsupportedOperationException();
108 }
109
110 @Override
111 public ServiceInfo getServiceInfo(ComponentName className, int flags)
112 throws NameNotFoundException {
113 throw new UnsupportedOperationException();
114 }
115
116 @Override
117 public List<PackageInfo> getInstalledPackages(int flags) {
118 throw new UnsupportedOperationException();
119 }
120
121 @Override
122 public int checkPermission(String permName, String pkgName) {
123 throw new UnsupportedOperationException();
124 }
125
126 @Override
127 public boolean addPermission(PermissionInfo info) {
128 throw new UnsupportedOperationException();
129 }
130
131 @Override
132 public void removePermission(String name) {
133 throw new UnsupportedOperationException();
134 }
135
136 @Override
137 public int checkSignatures(String pkg1, String pkg2) {
138 throw new UnsupportedOperationException();
139 }
140
141 @Override
Dianne Hackborn766cbfe2009-08-12 18:33:39 -0700142 public int checkSignatures(int uid1, int uid2) {
143 throw new UnsupportedOperationException();
144 }
145
146 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800147 public String[] getPackagesForUid(int uid) {
148 throw new UnsupportedOperationException();
149 }
150
151 @Override
152 public String getNameForUid(int uid) {
153 throw new UnsupportedOperationException();
154 }
155
156 /**
157 * @hide - to match hiding in superclass
158 */
159 @Override
160 public int getUidForSharedUser(String sharedUserName) {
161 throw new UnsupportedOperationException();
162 }
163
164 @Override
165 public List<ApplicationInfo> getInstalledApplications(int flags) {
166 throw new UnsupportedOperationException();
167 }
168
169 @Override
170 public ResolveInfo resolveActivity(Intent intent, int flags) {
171 throw new UnsupportedOperationException();
172 }
173
174 @Override
175 public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) {
176 throw new UnsupportedOperationException();
177 }
178
179 @Override
180 public List<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
181 Intent[] specifics, Intent intent, int flags) {
182 throw new UnsupportedOperationException();
183 }
184
185 @Override
186 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) {
187 throw new UnsupportedOperationException();
188 }
189
190 @Override
191 public ResolveInfo resolveService(Intent intent, int flags) {
192 throw new UnsupportedOperationException();
193 }
194
195 @Override
196 public List<ResolveInfo> queryIntentServices(Intent intent, int flags) {
197 throw new UnsupportedOperationException();
198 }
199
200 @Override
201 public ProviderInfo resolveContentProvider(String name, int flags) {
202 throw new UnsupportedOperationException();
203 }
204
205 @Override
206 public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) {
207 throw new UnsupportedOperationException();
208 }
209
210 @Override
211 public InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags)
212 throws NameNotFoundException {
213 throw new UnsupportedOperationException();
214 }
215
216 @Override
217 public List<InstrumentationInfo> queryInstrumentation(
218 String targetPackage, int flags) {
219 throw new UnsupportedOperationException();
220 }
221
222 @Override
223 public Drawable getDrawable(String packageName, int resid, ApplicationInfo appInfo) {
224 throw new UnsupportedOperationException();
225 }
226
227 @Override
228 public Drawable getActivityIcon(ComponentName activityName)
229 throws NameNotFoundException {
230 throw new UnsupportedOperationException();
231 }
232
233 @Override
234 public Drawable getActivityIcon(Intent intent) throws NameNotFoundException {
235 throw new UnsupportedOperationException();
236 }
237
238 @Override
239 public Drawable getDefaultActivityIcon() {
240 throw new UnsupportedOperationException();
241 }
242
243 @Override
244 public Drawable getApplicationIcon(ApplicationInfo info) {
245 throw new UnsupportedOperationException();
246 }
247
248 @Override
249 public Drawable getApplicationIcon(String packageName) throws NameNotFoundException {
250 throw new UnsupportedOperationException();
251 }
252
253 @Override
254 public CharSequence getText(String packageName, int resid, ApplicationInfo appInfo) {
255 throw new UnsupportedOperationException();
256 }
257
258 @Override
259 public XmlResourceParser getXml(String packageName, int resid,
260 ApplicationInfo appInfo) {
261 throw new UnsupportedOperationException();
262 }
263
264 @Override
265 public CharSequence getApplicationLabel(ApplicationInfo info) {
266 throw new UnsupportedOperationException();
267 }
268
269 @Override
270 public Resources getResourcesForActivity(ComponentName activityName)
271 throws NameNotFoundException {
272 throw new UnsupportedOperationException();
273 }
274
275 @Override
276 public Resources getResourcesForApplication(ApplicationInfo app) {
277 throw new UnsupportedOperationException();
278 }
279
280 @Override
281 public Resources getResourcesForApplication(String appPackageName)
282 throws NameNotFoundException {
283 throw new UnsupportedOperationException();
284 }
285
286 @Override
287 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
288 throw new UnsupportedOperationException();
289 }
290
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700291 /**
292 * @hide - to match hiding in superclass
293 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800294 @Override
295 public void installPackage(Uri packageURI, IPackageInstallObserver observer,
Jacek Surazski65e13172009-04-28 15:26:38 +0200296 int flags, String installerPackageName) {
297 throw new UnsupportedOperationException();
298 }
299
300 @Override
301 public String getInstallerPackageName(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800302 throw new UnsupportedOperationException();
303 }
304
305 /**
306 * @hide - to match hiding in superclass
307 */
308 @Override
309 public void clearApplicationUserData(
310 String packageName, IPackageDataObserver observer) {
311 throw new UnsupportedOperationException();
312 }
313
314 /**
315 * @hide - to match hiding in superclass
316 */
317 @Override
318 public void deleteApplicationCacheFiles(
319 String packageName, IPackageDataObserver observer) {
320 throw new UnsupportedOperationException();
321 }
322
323 /**
324 * @hide - to match hiding in superclass
325 */
326 @Override
327 public void freeStorageAndNotify(
328 long idealStorageSize, IPackageDataObserver observer) {
329 throw new UnsupportedOperationException();
330 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800331
332 /**
333 * @hide - to match hiding in superclass
334 */
335 @Override
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700336 public void freeStorage(
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700337 long idealStorageSize, IntentSender pi) {
338 throw new UnsupportedOperationException();
339 }
340
341 /**
342 * @hide - to match hiding in superclass
343 */
344 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800345 public void deletePackage(
346 String packageName, IPackageDeleteObserver observer, int flags) {
347 throw new UnsupportedOperationException();
348 }
349
350 @Override
351 public void addPackageToPreferred(String packageName) {
352 throw new UnsupportedOperationException();
353 }
354
355 @Override
356 public void removePackageFromPreferred(String packageName) {
357 throw new UnsupportedOperationException();
358 }
359
360 @Override
361 public List<PackageInfo> getPreferredPackages(int flags) {
362 throw new UnsupportedOperationException();
363 }
364
365 @Override
366 public void setComponentEnabledSetting(ComponentName componentName,
367 int newState, int flags) {
368 throw new UnsupportedOperationException();
369 }
370
371 @Override
372 public int getComponentEnabledSetting(ComponentName componentName) {
373 throw new UnsupportedOperationException();
374 }
375
376 @Override
377 public void setApplicationEnabledSetting(String packageName, int newState, int flags) {
378 throw new UnsupportedOperationException();
379 }
380
381 @Override
382 public int getApplicationEnabledSetting(String packageName) {
383 throw new UnsupportedOperationException();
384 }
385
386 @Override
387 public void addPreferredActivity(IntentFilter filter,
388 int match, ComponentName[] set, ComponentName activity) {
389 throw new UnsupportedOperationException();
390 }
391
Satish Sampath8dbe6122009-06-02 23:35:54 +0100392 /**
393 * @hide - to match hiding in superclass
394 */
395 @Override
396 public void replacePreferredActivity(IntentFilter filter,
397 int match, ComponentName[] set, ComponentName activity) {
398 throw new UnsupportedOperationException();
399 }
400
401
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800402 @Override
403 public void clearPackagePreferredActivities(String packageName) {
404 throw new UnsupportedOperationException();
405 }
406
407 /**
408 * @hide - to match hiding in superclass
409 */
410 @Override
411 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
412 throw new UnsupportedOperationException();
413 }
414
415 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800416 public int getPreferredActivities(List<IntentFilter> outFilters,
417 List<ComponentName> outActivities, String packageName) {
418 throw new UnsupportedOperationException();
419 }
420
421 @Override
422 public String[] getSystemSharedLibraryNames() {
423 throw new UnsupportedOperationException();
424 }
425
426 @Override
427 public boolean isSafeMode() {
428 throw new UnsupportedOperationException();
429 }
430}