blob: 2eba4e1165427d549f2a3aaf6525bbc241b375b5 [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;
Anonymous Cowardceb1b0b2012-04-24 10:35:16 -070025import android.content.pm.ContainerEncryptionParams;
Dianne Hackborn49237342009-08-27 20:08:01 -070026import android.content.pm.FeatureInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.content.pm.IPackageDataObserver;
Amith Yamasani4b2e9342011-03-31 12:38:53 -070028import android.content.pm.IPackageDeleteObserver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.pm.IPackageInstallObserver;
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -080030import android.content.pm.IPackageMoveObserver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080031import android.content.pm.IPackageStatsObserver;
32import android.content.pm.InstrumentationInfo;
Anonymous Cowardceb1b0b2012-04-24 10:35:16 -070033import android.content.pm.ManifestDigest;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.content.pm.PackageInfo;
35import android.content.pm.PackageManager;
36import android.content.pm.PermissionGroupInfo;
37import android.content.pm.PermissionInfo;
38import android.content.pm.ProviderInfo;
39import android.content.pm.ResolveInfo;
40import android.content.pm.ServiceInfo;
rich cannings706e8ba2012-08-20 13:20:14 -070041import android.content.pm.VerificationParams;
Kenny Root0aaa0d92011-09-12 16:42:55 -070042import android.content.pm.VerifierDeviceIdentity;
Amith Yamasani98edc952012-09-25 14:09:27 -070043import android.content.pm.PackageManager.NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import android.content.res.Resources;
45import android.content.res.XmlResourceParser;
46import android.graphics.drawable.Drawable;
47import android.net.Uri;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048
49import java.util.List;
50
51/**
52 * A mock {@link android.content.pm.PackageManager} class. All methods are non-functional and throw
Amith Yamasani4b2e9342011-03-31 12:38:53 -070053 * {@link java.lang.UnsupportedOperationException}. Override it to provide the operations that you
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054 * need.
55 */
56public class MockPackageManager extends PackageManager {
57
58 @Override
59 public PackageInfo getPackageInfo(String packageName, int flags)
60 throws NameNotFoundException {
61 throw new UnsupportedOperationException();
62 }
63
64 @Override
Dianne Hackborn47096932010-02-11 15:57:09 -080065 public String[] currentToCanonicalPackageNames(String[] names) {
66 throw new UnsupportedOperationException();
67 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -070068
Dianne Hackborn47096932010-02-11 15:57:09 -080069 @Override
70 public String[] canonicalToCurrentPackageNames(String[] names) {
71 throw new UnsupportedOperationException();
72 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -070073
Dianne Hackborn47096932010-02-11 15:57:09 -080074 @Override
Mihai Predaeae850c2009-05-13 10:13:48 +020075 public Intent getLaunchIntentForPackage(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076 throw new UnsupportedOperationException();
77 }
Mihai Predaeae850c2009-05-13 10:13:48 +020078
79 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 public int[] getPackageGids(String packageName) throws NameNotFoundException {
81 throw new UnsupportedOperationException();
82 }
83
84 @Override
85 public PermissionInfo getPermissionInfo(String name, int flags)
86 throws NameNotFoundException {
87 throw new UnsupportedOperationException();
88 }
89
90 @Override
91 public List<PermissionInfo> queryPermissionsByGroup(String group, int flags)
92 throws NameNotFoundException {
93 throw new UnsupportedOperationException();
94 }
95
96 @Override
97 public PermissionGroupInfo getPermissionGroupInfo(String name,
98 int flags) throws NameNotFoundException {
99 throw new UnsupportedOperationException();
100 }
101
102 @Override
103 public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
104 throw new UnsupportedOperationException();
105 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700106
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107 @Override
108 public ApplicationInfo getApplicationInfo(String packageName, int flags)
109 throws NameNotFoundException {
110 throw new UnsupportedOperationException();
111 }
112
113 @Override
114 public ActivityInfo getActivityInfo(ComponentName className, int flags)
115 throws NameNotFoundException {
116 throw new UnsupportedOperationException();
117 }
118
119 @Override
120 public ActivityInfo getReceiverInfo(ComponentName className, int flags)
121 throws NameNotFoundException {
122 throw new UnsupportedOperationException();
123 }
124
125 @Override
126 public ServiceInfo getServiceInfo(ComponentName className, int flags)
127 throws NameNotFoundException {
128 throw new UnsupportedOperationException();
129 }
130
131 @Override
Dianne Hackborn361199b2010-08-30 17:42:07 -0700132 public ProviderInfo getProviderInfo(ComponentName className, int flags)
133 throws NameNotFoundException {
134 throw new UnsupportedOperationException();
135 }
136
137 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800138 public List<PackageInfo> getInstalledPackages(int flags) {
139 throw new UnsupportedOperationException();
140 }
141
Amith Yamasani151ec4c2012-09-07 19:25:16 -0700142 /** @hide */
143 @Override
144 public List<PackageInfo> getInstalledPackages(int flags, int userId) {
145 throw new UnsupportedOperationException();
146 }
147
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800148 @Override
149 public int checkPermission(String permName, String pkgName) {
150 throw new UnsupportedOperationException();
151 }
152
153 @Override
154 public boolean addPermission(PermissionInfo info) {
155 throw new UnsupportedOperationException();
156 }
157
158 @Override
Dianne Hackbornd7c09682010-03-30 10:42:20 -0700159 public boolean addPermissionAsync(PermissionInfo info) {
160 throw new UnsupportedOperationException();
161 }
162
163 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800164 public void removePermission(String name) {
165 throw new UnsupportedOperationException();
166 }
167
Dianne Hackborne639da72012-02-21 15:11:13 -0800168 /** @hide */
169 @Override
170 public void grantPermission(String packageName, String permissionName) {
171 throw new UnsupportedOperationException();
172 }
173
174 /** @hide */
175 @Override
176 public void revokePermission(String packageName, String permissionName) {
177 throw new UnsupportedOperationException();
178 }
179
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800180 @Override
181 public int checkSignatures(String pkg1, String pkg2) {
182 throw new UnsupportedOperationException();
183 }
184
185 @Override
Dianne Hackborn766cbfe2009-08-12 18:33:39 -0700186 public int checkSignatures(int uid1, int uid2) {
187 throw new UnsupportedOperationException();
188 }
189
190 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800191 public String[] getPackagesForUid(int uid) {
192 throw new UnsupportedOperationException();
193 }
194
195 @Override
196 public String getNameForUid(int uid) {
197 throw new UnsupportedOperationException();
198 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700199
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800200 /**
201 * @hide - to match hiding in superclass
202 */
203 @Override
204 public int getUidForSharedUser(String sharedUserName) {
205 throw new UnsupportedOperationException();
206 }
207
208 @Override
209 public List<ApplicationInfo> getInstalledApplications(int flags) {
210 throw new UnsupportedOperationException();
211 }
212
213 @Override
214 public ResolveInfo resolveActivity(Intent intent, int flags) {
215 throw new UnsupportedOperationException();
216 }
217
Svetoslav Ganov58d37b52012-09-18 12:04:19 -0700218 /** @hide */
219 @Override
220 public ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId) {
221 throw new UnsupportedOperationException();
222 }
223
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800224 @Override
225 public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) {
226 throw new UnsupportedOperationException();
227 }
228
Amith Yamasani151ec4c2012-09-07 19:25:16 -0700229 /** @hide */
230 @Override
Svetoslav Ganov58d37b52012-09-18 12:04:19 -0700231 public List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
Amith Yamasani151ec4c2012-09-07 19:25:16 -0700232 int flags, int userId) {
233 throw new UnsupportedOperationException();
234 }
235
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800236 @Override
237 public List<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
238 Intent[] specifics, Intent intent, int flags) {
239 throw new UnsupportedOperationException();
240 }
241
242 @Override
243 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) {
244 throw new UnsupportedOperationException();
245 }
246
Amith Yamasanif203aee2012-08-29 18:41:53 -0700247 /** @hide */
248 @Override
249 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags, int userId) {
250 throw new UnsupportedOperationException();
251 }
252
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800253 @Override
254 public ResolveInfo resolveService(Intent intent, int flags) {
255 throw new UnsupportedOperationException();
256 }
257
258 @Override
259 public List<ResolveInfo> queryIntentServices(Intent intent, int flags) {
260 throw new UnsupportedOperationException();
261 }
262
Svetoslav Ganov58d37b52012-09-18 12:04:19 -0700263 /** @hide */
264 @Override
265 public List<ResolveInfo> queryIntentServicesAsUser(Intent intent, int flags, int userId) {
266 throw new UnsupportedOperationException();
267 }
268
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800269 @Override
270 public ProviderInfo resolveContentProvider(String name, int flags) {
271 throw new UnsupportedOperationException();
272 }
273
274 @Override
275 public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) {
276 throw new UnsupportedOperationException();
277 }
278
279 @Override
280 public InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags)
281 throws NameNotFoundException {
282 throw new UnsupportedOperationException();
283 }
284
285 @Override
286 public List<InstrumentationInfo> queryInstrumentation(
287 String targetPackage, int flags) {
288 throw new UnsupportedOperationException();
289 }
290
291 @Override
292 public Drawable getDrawable(String packageName, int resid, ApplicationInfo appInfo) {
293 throw new UnsupportedOperationException();
294 }
295
296 @Override
297 public Drawable getActivityIcon(ComponentName activityName)
298 throws NameNotFoundException {
299 throw new UnsupportedOperationException();
300 }
301
302 @Override
303 public Drawable getActivityIcon(Intent intent) throws NameNotFoundException {
304 throw new UnsupportedOperationException();
305 }
306
307 @Override
308 public Drawable getDefaultActivityIcon() {
309 throw new UnsupportedOperationException();
310 }
311
312 @Override
313 public Drawable getApplicationIcon(ApplicationInfo info) {
314 throw new UnsupportedOperationException();
315 }
316
317 @Override
318 public Drawable getApplicationIcon(String packageName) throws NameNotFoundException {
319 throw new UnsupportedOperationException();
320 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700321
Adam Powell81cd2e92010-04-21 16:35:18 -0700322 @Override
323 public Drawable getActivityLogo(ComponentName activityName) throws NameNotFoundException {
324 throw new UnsupportedOperationException();
325 }
326
327 @Override
328 public Drawable getActivityLogo(Intent intent) throws NameNotFoundException {
329 throw new UnsupportedOperationException();
330 }
331
332 @Override
333 public Drawable getApplicationLogo(ApplicationInfo info) {
334 throw new UnsupportedOperationException();
335 }
336
337 @Override
338 public Drawable getApplicationLogo(String packageName) throws NameNotFoundException {
339 throw new UnsupportedOperationException();
340 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800341
342 @Override
343 public CharSequence getText(String packageName, int resid, ApplicationInfo appInfo) {
344 throw new UnsupportedOperationException();
345 }
346
347 @Override
348 public XmlResourceParser getXml(String packageName, int resid,
349 ApplicationInfo appInfo) {
350 throw new UnsupportedOperationException();
351 }
352
353 @Override
354 public CharSequence getApplicationLabel(ApplicationInfo info) {
355 throw new UnsupportedOperationException();
356 }
357
358 @Override
359 public Resources getResourcesForActivity(ComponentName activityName)
360 throws NameNotFoundException {
361 throw new UnsupportedOperationException();
362 }
363
364 @Override
365 public Resources getResourcesForApplication(ApplicationInfo app) {
366 throw new UnsupportedOperationException();
367 }
368
369 @Override
370 public Resources getResourcesForApplication(String appPackageName)
371 throws NameNotFoundException {
372 throw new UnsupportedOperationException();
373 }
374
Amith Yamasani98edc952012-09-25 14:09:27 -0700375 /** @hide */
376 @Override
377 public Resources getResourcesForApplicationAsUser(String appPackageName, int userId) {
378 throw new UnsupportedOperationException();
379 }
380
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800381 @Override
382 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
383 throw new UnsupportedOperationException();
384 }
385
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700386 /**
387 * @hide - to match hiding in superclass
388 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800389 @Override
390 public void installPackage(Uri packageURI, IPackageInstallObserver observer,
Jacek Surazski65e13172009-04-28 15:26:38 +0200391 int flags, String installerPackageName) {
392 throw new UnsupportedOperationException();
393 }
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800394
Dianne Hackborn880119b2010-11-18 22:26:40 -0800395 @Override
396 public void setInstallerPackageName(String targetPackage,
397 String installerPackageName) {
398 throw new UnsupportedOperationException();
399 }
400
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800401 /**
402 * @hide - to match hiding in superclass
403 */
404 @Override
405 public void movePackage(String packageName, IPackageMoveObserver observer, int flags) {
406 throw new UnsupportedOperationException();
407 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700408
Jacek Surazski65e13172009-04-28 15:26:38 +0200409 @Override
410 public String getInstallerPackageName(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800411 throw new UnsupportedOperationException();
412 }
413
414 /**
415 * @hide - to match hiding in superclass
416 */
417 @Override
418 public void clearApplicationUserData(
419 String packageName, IPackageDataObserver observer) {
420 throw new UnsupportedOperationException();
421 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700422
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423 /**
424 * @hide - to match hiding in superclass
425 */
426 @Override
427 public void deleteApplicationCacheFiles(
428 String packageName, IPackageDataObserver observer) {
429 throw new UnsupportedOperationException();
430 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700431
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800432 /**
433 * @hide - to match hiding in superclass
434 */
435 @Override
436 public void freeStorageAndNotify(
437 long idealStorageSize, IPackageDataObserver observer) {
438 throw new UnsupportedOperationException();
439 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440
441 /**
442 * @hide - to match hiding in superclass
443 */
444 @Override
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700445 public void freeStorage(
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700446 long idealStorageSize, IntentSender pi) {
447 throw new UnsupportedOperationException();
448 }
449
450 /**
451 * @hide - to match hiding in superclass
452 */
453 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800454 public void deletePackage(
455 String packageName, IPackageDeleteObserver observer, int flags) {
456 throw new UnsupportedOperationException();
457 }
458
459 @Override
460 public void addPackageToPreferred(String packageName) {
461 throw new UnsupportedOperationException();
462 }
463
464 @Override
465 public void removePackageFromPreferred(String packageName) {
466 throw new UnsupportedOperationException();
467 }
468
469 @Override
470 public List<PackageInfo> getPreferredPackages(int flags) {
471 throw new UnsupportedOperationException();
472 }
473
474 @Override
475 public void setComponentEnabledSetting(ComponentName componentName,
476 int newState, int flags) {
477 throw new UnsupportedOperationException();
478 }
479
480 @Override
481 public int getComponentEnabledSetting(ComponentName componentName) {
482 throw new UnsupportedOperationException();
483 }
484
485 @Override
486 public void setApplicationEnabledSetting(String packageName, int newState, int flags) {
487 throw new UnsupportedOperationException();
488 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700489
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800490 @Override
491 public int getApplicationEnabledSetting(String packageName) {
492 throw new UnsupportedOperationException();
493 }
494
495 @Override
496 public void addPreferredActivity(IntentFilter filter,
497 int match, ComponentName[] set, ComponentName activity) {
498 throw new UnsupportedOperationException();
499 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700500
Satish Sampath8dbe6122009-06-02 23:35:54 +0100501 /**
502 * @hide - to match hiding in superclass
503 */
504 @Override
505 public void replacePreferredActivity(IntentFilter filter,
506 int match, ComponentName[] set, ComponentName activity) {
507 throw new UnsupportedOperationException();
508 }
509
510
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800511 @Override
512 public void clearPackagePreferredActivities(String packageName) {
513 throw new UnsupportedOperationException();
514 }
515
516 /**
517 * @hide - to match hiding in superclass
518 */
519 @Override
Dianne Hackborn0c380492012-08-20 17:23:30 -0700520 public void getPackageSizeInfo(String packageName, int userHandle,
521 IPackageStatsObserver observer) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800522 throw new UnsupportedOperationException();
523 }
524
525 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 public int getPreferredActivities(List<IntentFilter> outFilters,
527 List<ComponentName> outActivities, String packageName) {
528 throw new UnsupportedOperationException();
529 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700530
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800531 @Override
532 public String[] getSystemSharedLibraryNames() {
533 throw new UnsupportedOperationException();
534 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700535
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800536 @Override
Dianne Hackborn49237342009-08-27 20:08:01 -0700537 public FeatureInfo[] getSystemAvailableFeatures() {
538 throw new UnsupportedOperationException();
539 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700540
Dianne Hackborn49237342009-08-27 20:08:01 -0700541 @Override
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700542 public boolean hasSystemFeature(String name) {
543 throw new UnsupportedOperationException();
544 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700545
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700546 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800547 public boolean isSafeMode() {
548 throw new UnsupportedOperationException();
549 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700550
551 /**
552 * @hide
553 */
554 @Override
Kenny Root5ab21572011-07-27 11:11:19 -0700555 public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer,
556 int flags, String installerPackageName, Uri verificationURI,
Rich Canningse1d7c712012-08-08 12:46:06 -0700557 ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams) {
Kenny Root5ab21572011-07-27 11:11:19 -0700558 throw new UnsupportedOperationException();
559 }
560
rich cannings706e8ba2012-08-20 13:20:14 -0700561 /**
562 * @hide
563 */
564 @Override
565 public void installPackageWithVerificationAndEncryption(Uri packageURI,
566 IPackageInstallObserver observer, int flags, String installerPackageName,
567 VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
568 throw new UnsupportedOperationException();
569 }
570
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700571 /**
572 * @hide
573 */
574 @Override
575 public int installExistingPackage(String packageName)
576 throws NameNotFoundException {
577 throw new UnsupportedOperationException();
578 }
579
Kenny Root5ab21572011-07-27 11:11:19 -0700580 @Override
Kenny Root3a9b5fb2011-09-20 14:15:38 -0700581 public void verifyPendingInstall(int id, int verificationCode) {
Kenny Root5ab21572011-07-27 11:11:19 -0700582 throw new UnsupportedOperationException();
583 }
Kenny Root0aaa0d92011-09-12 16:42:55 -0700584
rich canningsd9ef3e52012-08-22 14:28:05 -0700585 @Override
586 public void extendVerificationTimeout(int id, int verificationCodeAtTimeout,
587 long millisecondsToDelay) {
588 throw new UnsupportedOperationException();
589 }
590
Kenny Root0aaa0d92011-09-12 16:42:55 -0700591 /**
592 * @hide
593 */
594 @Override
595 public VerifierDeviceIdentity getVerifierDeviceIdentity() {
596 throw new UnsupportedOperationException();
597 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800598}