blob: cd7ee7609b3487a16ef489f68a736d0fdaeb99c6 [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;
Amith Yamasani4b2e9342011-03-31 12:38:53 -070041import android.content.pm.UserInfo;
rich cannings706e8ba2012-08-20 13:20:14 -070042import android.content.pm.VerificationParams;
Kenny Root0aaa0d92011-09-12 16:42:55 -070043import android.content.pm.VerifierDeviceIdentity;
Dianne Hackborn7767eac2012-08-23 18:25:40 -070044import android.content.pm.PackageManager.NameNotFoundException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import android.content.res.Resources;
46import android.content.res.XmlResourceParser;
47import android.graphics.drawable.Drawable;
48import android.net.Uri;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049
50import java.util.List;
51
52/**
53 * A mock {@link android.content.pm.PackageManager} class. All methods are non-functional and throw
Amith Yamasani4b2e9342011-03-31 12:38:53 -070054 * {@link java.lang.UnsupportedOperationException}. Override it to provide the operations that you
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055 * need.
56 */
57public class MockPackageManager extends PackageManager {
58
59 @Override
60 public PackageInfo getPackageInfo(String packageName, int flags)
61 throws NameNotFoundException {
62 throw new UnsupportedOperationException();
63 }
64
65 @Override
Dianne Hackborn47096932010-02-11 15:57:09 -080066 public String[] currentToCanonicalPackageNames(String[] names) {
67 throw new UnsupportedOperationException();
68 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -070069
Dianne Hackborn47096932010-02-11 15:57:09 -080070 @Override
71 public String[] canonicalToCurrentPackageNames(String[] names) {
72 throw new UnsupportedOperationException();
73 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -070074
Dianne Hackborn47096932010-02-11 15:57:09 -080075 @Override
Mihai Predaeae850c2009-05-13 10:13:48 +020076 public Intent getLaunchIntentForPackage(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 throw new UnsupportedOperationException();
78 }
Mihai Predaeae850c2009-05-13 10:13:48 +020079
80 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081 public int[] getPackageGids(String packageName) throws NameNotFoundException {
82 throw new UnsupportedOperationException();
83 }
84
85 @Override
86 public PermissionInfo getPermissionInfo(String name, int flags)
87 throws NameNotFoundException {
88 throw new UnsupportedOperationException();
89 }
90
91 @Override
92 public List<PermissionInfo> queryPermissionsByGroup(String group, int flags)
93 throws NameNotFoundException {
94 throw new UnsupportedOperationException();
95 }
96
97 @Override
98 public PermissionGroupInfo getPermissionGroupInfo(String name,
99 int flags) throws NameNotFoundException {
100 throw new UnsupportedOperationException();
101 }
102
103 @Override
104 public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
105 throw new UnsupportedOperationException();
106 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700107
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 @Override
109 public ApplicationInfo getApplicationInfo(String packageName, int flags)
110 throws NameNotFoundException {
111 throw new UnsupportedOperationException();
112 }
113
114 @Override
115 public ActivityInfo getActivityInfo(ComponentName className, int flags)
116 throws NameNotFoundException {
117 throw new UnsupportedOperationException();
118 }
119
120 @Override
121 public ActivityInfo getReceiverInfo(ComponentName className, int flags)
122 throws NameNotFoundException {
123 throw new UnsupportedOperationException();
124 }
125
126 @Override
127 public ServiceInfo getServiceInfo(ComponentName className, int flags)
128 throws NameNotFoundException {
129 throw new UnsupportedOperationException();
130 }
131
132 @Override
Dianne Hackborn361199b2010-08-30 17:42:07 -0700133 public ProviderInfo getProviderInfo(ComponentName className, int flags)
134 throws NameNotFoundException {
135 throw new UnsupportedOperationException();
136 }
137
138 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 public List<PackageInfo> getInstalledPackages(int flags) {
140 throw new UnsupportedOperationException();
141 }
142
Amith Yamasani151ec4c2012-09-07 19:25:16 -0700143 /** @hide */
144 @Override
145 public List<PackageInfo> getInstalledPackages(int flags, int userId) {
146 throw new UnsupportedOperationException();
147 }
148
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800149 @Override
150 public int checkPermission(String permName, String pkgName) {
151 throw new UnsupportedOperationException();
152 }
153
154 @Override
155 public boolean addPermission(PermissionInfo info) {
156 throw new UnsupportedOperationException();
157 }
158
159 @Override
Dianne Hackbornd7c09682010-03-30 10:42:20 -0700160 public boolean addPermissionAsync(PermissionInfo info) {
161 throw new UnsupportedOperationException();
162 }
163
164 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165 public void removePermission(String name) {
166 throw new UnsupportedOperationException();
167 }
168
Dianne Hackborne639da72012-02-21 15:11:13 -0800169 /** @hide */
170 @Override
171 public void grantPermission(String packageName, String permissionName) {
172 throw new UnsupportedOperationException();
173 }
174
175 /** @hide */
176 @Override
177 public void revokePermission(String packageName, String permissionName) {
178 throw new UnsupportedOperationException();
179 }
180
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800181 @Override
182 public int checkSignatures(String pkg1, String pkg2) {
183 throw new UnsupportedOperationException();
184 }
185
186 @Override
Dianne Hackborn766cbfe2009-08-12 18:33:39 -0700187 public int checkSignatures(int uid1, int uid2) {
188 throw new UnsupportedOperationException();
189 }
190
191 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800192 public String[] getPackagesForUid(int uid) {
193 throw new UnsupportedOperationException();
194 }
195
196 @Override
197 public String getNameForUid(int uid) {
198 throw new UnsupportedOperationException();
199 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700200
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800201 /**
202 * @hide - to match hiding in superclass
203 */
204 @Override
205 public int getUidForSharedUser(String sharedUserName) {
206 throw new UnsupportedOperationException();
207 }
208
209 @Override
210 public List<ApplicationInfo> getInstalledApplications(int flags) {
211 throw new UnsupportedOperationException();
212 }
213
214 @Override
215 public ResolveInfo resolveActivity(Intent intent, int flags) {
216 throw new UnsupportedOperationException();
217 }
218
219 @Override
220 public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) {
221 throw new UnsupportedOperationException();
222 }
223
Amith Yamasani151ec4c2012-09-07 19:25:16 -0700224 /** @hide */
225 @Override
226 public List<ResolveInfo> queryIntentActivitiesForUser(Intent intent,
227 int flags, int userId) {
228 throw new UnsupportedOperationException();
229 }
230
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800231 @Override
232 public List<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
233 Intent[] specifics, Intent intent, int flags) {
234 throw new UnsupportedOperationException();
235 }
236
237 @Override
238 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) {
239 throw new UnsupportedOperationException();
240 }
241
Amith Yamasanif203aee2012-08-29 18:41:53 -0700242 /** @hide */
243 @Override
244 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags, int userId) {
245 throw new UnsupportedOperationException();
246 }
247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800248 @Override
249 public ResolveInfo resolveService(Intent intent, int flags) {
250 throw new UnsupportedOperationException();
251 }
252
253 @Override
254 public List<ResolveInfo> queryIntentServices(Intent intent, int flags) {
255 throw new UnsupportedOperationException();
256 }
257
258 @Override
259 public ProviderInfo resolveContentProvider(String name, int flags) {
260 throw new UnsupportedOperationException();
261 }
262
263 @Override
264 public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) {
265 throw new UnsupportedOperationException();
266 }
267
268 @Override
269 public InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags)
270 throws NameNotFoundException {
271 throw new UnsupportedOperationException();
272 }
273
274 @Override
275 public List<InstrumentationInfo> queryInstrumentation(
276 String targetPackage, int flags) {
277 throw new UnsupportedOperationException();
278 }
279
280 @Override
281 public Drawable getDrawable(String packageName, int resid, ApplicationInfo appInfo) {
282 throw new UnsupportedOperationException();
283 }
284
285 @Override
286 public Drawable getActivityIcon(ComponentName activityName)
287 throws NameNotFoundException {
288 throw new UnsupportedOperationException();
289 }
290
291 @Override
292 public Drawable getActivityIcon(Intent intent) throws NameNotFoundException {
293 throw new UnsupportedOperationException();
294 }
295
296 @Override
297 public Drawable getDefaultActivityIcon() {
298 throw new UnsupportedOperationException();
299 }
300
301 @Override
302 public Drawable getApplicationIcon(ApplicationInfo info) {
303 throw new UnsupportedOperationException();
304 }
305
306 @Override
307 public Drawable getApplicationIcon(String packageName) throws NameNotFoundException {
308 throw new UnsupportedOperationException();
309 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700310
Adam Powell81cd2e92010-04-21 16:35:18 -0700311 @Override
312 public Drawable getActivityLogo(ComponentName activityName) throws NameNotFoundException {
313 throw new UnsupportedOperationException();
314 }
315
316 @Override
317 public Drawable getActivityLogo(Intent intent) throws NameNotFoundException {
318 throw new UnsupportedOperationException();
319 }
320
321 @Override
322 public Drawable getApplicationLogo(ApplicationInfo info) {
323 throw new UnsupportedOperationException();
324 }
325
326 @Override
327 public Drawable getApplicationLogo(String packageName) throws NameNotFoundException {
328 throw new UnsupportedOperationException();
329 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800330
331 @Override
332 public CharSequence getText(String packageName, int resid, ApplicationInfo appInfo) {
333 throw new UnsupportedOperationException();
334 }
335
336 @Override
337 public XmlResourceParser getXml(String packageName, int resid,
338 ApplicationInfo appInfo) {
339 throw new UnsupportedOperationException();
340 }
341
342 @Override
343 public CharSequence getApplicationLabel(ApplicationInfo info) {
344 throw new UnsupportedOperationException();
345 }
346
347 @Override
348 public Resources getResourcesForActivity(ComponentName activityName)
349 throws NameNotFoundException {
350 throw new UnsupportedOperationException();
351 }
352
353 @Override
354 public Resources getResourcesForApplication(ApplicationInfo app) {
355 throw new UnsupportedOperationException();
356 }
357
358 @Override
359 public Resources getResourcesForApplication(String appPackageName)
360 throws NameNotFoundException {
361 throw new UnsupportedOperationException();
362 }
363
364 @Override
365 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
366 throw new UnsupportedOperationException();
367 }
368
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700369 /**
370 * @hide - to match hiding in superclass
371 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800372 @Override
373 public void installPackage(Uri packageURI, IPackageInstallObserver observer,
Jacek Surazski65e13172009-04-28 15:26:38 +0200374 int flags, String installerPackageName) {
375 throw new UnsupportedOperationException();
376 }
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800377
Dianne Hackborn880119b2010-11-18 22:26:40 -0800378 @Override
379 public void setInstallerPackageName(String targetPackage,
380 String installerPackageName) {
381 throw new UnsupportedOperationException();
382 }
383
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800384 /**
385 * @hide - to match hiding in superclass
386 */
387 @Override
388 public void movePackage(String packageName, IPackageMoveObserver observer, int flags) {
389 throw new UnsupportedOperationException();
390 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700391
Jacek Surazski65e13172009-04-28 15:26:38 +0200392 @Override
393 public String getInstallerPackageName(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800394 throw new UnsupportedOperationException();
395 }
396
397 /**
398 * @hide - to match hiding in superclass
399 */
400 @Override
401 public void clearApplicationUserData(
402 String packageName, IPackageDataObserver observer) {
403 throw new UnsupportedOperationException();
404 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700405
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 /**
407 * @hide - to match hiding in superclass
408 */
409 @Override
410 public void deleteApplicationCacheFiles(
411 String packageName, IPackageDataObserver observer) {
412 throw new UnsupportedOperationException();
413 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700414
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800415 /**
416 * @hide - to match hiding in superclass
417 */
418 @Override
419 public void freeStorageAndNotify(
420 long idealStorageSize, IPackageDataObserver observer) {
421 throw new UnsupportedOperationException();
422 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423
424 /**
425 * @hide - to match hiding in superclass
426 */
427 @Override
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700428 public void freeStorage(
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700429 long idealStorageSize, IntentSender pi) {
430 throw new UnsupportedOperationException();
431 }
432
433 /**
434 * @hide - to match hiding in superclass
435 */
436 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800437 public void deletePackage(
438 String packageName, IPackageDeleteObserver observer, int flags) {
439 throw new UnsupportedOperationException();
440 }
441
442 @Override
443 public void addPackageToPreferred(String packageName) {
444 throw new UnsupportedOperationException();
445 }
446
447 @Override
448 public void removePackageFromPreferred(String packageName) {
449 throw new UnsupportedOperationException();
450 }
451
452 @Override
453 public List<PackageInfo> getPreferredPackages(int flags) {
454 throw new UnsupportedOperationException();
455 }
456
457 @Override
458 public void setComponentEnabledSetting(ComponentName componentName,
459 int newState, int flags) {
460 throw new UnsupportedOperationException();
461 }
462
463 @Override
464 public int getComponentEnabledSetting(ComponentName componentName) {
465 throw new UnsupportedOperationException();
466 }
467
468 @Override
469 public void setApplicationEnabledSetting(String packageName, int newState, int flags) {
470 throw new UnsupportedOperationException();
471 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700472
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800473 @Override
474 public int getApplicationEnabledSetting(String packageName) {
475 throw new UnsupportedOperationException();
476 }
477
478 @Override
479 public void addPreferredActivity(IntentFilter filter,
480 int match, ComponentName[] set, ComponentName activity) {
481 throw new UnsupportedOperationException();
482 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700483
Satish Sampath8dbe6122009-06-02 23:35:54 +0100484 /**
485 * @hide - to match hiding in superclass
486 */
487 @Override
488 public void replacePreferredActivity(IntentFilter filter,
489 int match, ComponentName[] set, ComponentName activity) {
490 throw new UnsupportedOperationException();
491 }
492
493
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 @Override
495 public void clearPackagePreferredActivities(String packageName) {
496 throw new UnsupportedOperationException();
497 }
498
499 /**
500 * @hide - to match hiding in superclass
501 */
502 @Override
Dianne Hackborn0c380492012-08-20 17:23:30 -0700503 public void getPackageSizeInfo(String packageName, int userHandle,
504 IPackageStatsObserver observer) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 throw new UnsupportedOperationException();
506 }
507
508 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800509 public int getPreferredActivities(List<IntentFilter> outFilters,
510 List<ComponentName> outActivities, String packageName) {
511 throw new UnsupportedOperationException();
512 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700513
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800514 @Override
515 public String[] getSystemSharedLibraryNames() {
516 throw new UnsupportedOperationException();
517 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700518
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800519 @Override
Dianne Hackborn49237342009-08-27 20:08:01 -0700520 public FeatureInfo[] getSystemAvailableFeatures() {
521 throw new UnsupportedOperationException();
522 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700523
Dianne Hackborn49237342009-08-27 20:08:01 -0700524 @Override
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700525 public boolean hasSystemFeature(String name) {
526 throw new UnsupportedOperationException();
527 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700528
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700529 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800530 public boolean isSafeMode() {
531 throw new UnsupportedOperationException();
532 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700533
534 /**
535 * @hide
536 */
537 @Override
Kenny Root5ab21572011-07-27 11:11:19 -0700538 public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer,
539 int flags, String installerPackageName, Uri verificationURI,
Rich Canningse1d7c712012-08-08 12:46:06 -0700540 ManifestDigest manifestDigest, ContainerEncryptionParams encryptionParams) {
Kenny Root5ab21572011-07-27 11:11:19 -0700541 throw new UnsupportedOperationException();
542 }
543
rich cannings706e8ba2012-08-20 13:20:14 -0700544 /**
545 * @hide
546 */
547 @Override
548 public void installPackageWithVerificationAndEncryption(Uri packageURI,
549 IPackageInstallObserver observer, int flags, String installerPackageName,
550 VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
551 throw new UnsupportedOperationException();
552 }
553
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700554 /**
555 * @hide
556 */
557 @Override
558 public int installExistingPackage(String packageName)
559 throws NameNotFoundException {
560 throw new UnsupportedOperationException();
561 }
562
Kenny Root5ab21572011-07-27 11:11:19 -0700563 @Override
Kenny Root3a9b5fb2011-09-20 14:15:38 -0700564 public void verifyPendingInstall(int id, int verificationCode) {
Kenny Root5ab21572011-07-27 11:11:19 -0700565 throw new UnsupportedOperationException();
566 }
Kenny Root0aaa0d92011-09-12 16:42:55 -0700567
rich canningsd9ef3e52012-08-22 14:28:05 -0700568 @Override
569 public void extendVerificationTimeout(int id, int verificationCodeAtTimeout,
570 long millisecondsToDelay) {
571 throw new UnsupportedOperationException();
572 }
573
Kenny Root0aaa0d92011-09-12 16:42:55 -0700574 /**
575 * @hide
576 */
577 @Override
578 public VerifierDeviceIdentity getVerifierDeviceIdentity() {
579 throw new UnsupportedOperationException();
580 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800581}