blob: 5610134f0c442d7d638494a59211e6f9949f2a17 [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;
Dianne Hackborn49237342009-08-27 20:08:01 -070025import android.content.pm.FeatureInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.IPackageDataObserver;
Amith Yamasani4b2e9342011-03-31 12:38:53 -070027import android.content.pm.IPackageDeleteObserver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.pm.IPackageInstallObserver;
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -080029import android.content.pm.IPackageMoveObserver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.IPackageStatsObserver;
31import android.content.pm.InstrumentationInfo;
32import android.content.pm.PackageInfo;
33import android.content.pm.PackageManager;
34import android.content.pm.PermissionGroupInfo;
35import android.content.pm.PermissionInfo;
36import android.content.pm.ProviderInfo;
37import android.content.pm.ResolveInfo;
38import android.content.pm.ServiceInfo;
Kenny Root05ca4c92011-09-15 10:36:25 -070039import android.content.pm.Signature;
Amith Yamasani4b2e9342011-03-31 12:38:53 -070040import android.content.pm.UserInfo;
Kenny Root5ab21572011-07-27 11:11:19 -070041import android.content.pm.ManifestDigest;
Kenny Root0aaa0d92011-09-12 16:42:55 -070042import android.content.pm.VerifierDeviceIdentity;
Kenny Root05ca4c92011-09-15 10:36:25 -070043import android.content.pm.VerifierInfo;
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;
Amith Yamasani13593602012-03-22 16:16:17 -070048import android.os.RemoteException;
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
143 @Override
144 public int checkPermission(String permName, String pkgName) {
145 throw new UnsupportedOperationException();
146 }
147
148 @Override
149 public boolean addPermission(PermissionInfo info) {
150 throw new UnsupportedOperationException();
151 }
152
153 @Override
Dianne Hackbornd7c09682010-03-30 10:42:20 -0700154 public boolean addPermissionAsync(PermissionInfo info) {
155 throw new UnsupportedOperationException();
156 }
157
158 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800159 public void removePermission(String name) {
160 throw new UnsupportedOperationException();
161 }
162
Dianne Hackborne639da72012-02-21 15:11:13 -0800163 /** @hide */
164 @Override
165 public void grantPermission(String packageName, String permissionName) {
166 throw new UnsupportedOperationException();
167 }
168
169 /** @hide */
170 @Override
171 public void revokePermission(String packageName, String permissionName) {
172 throw new UnsupportedOperationException();
173 }
174
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800175 @Override
176 public int checkSignatures(String pkg1, String pkg2) {
177 throw new UnsupportedOperationException();
178 }
179
180 @Override
Dianne Hackborn766cbfe2009-08-12 18:33:39 -0700181 public int checkSignatures(int uid1, int uid2) {
182 throw new UnsupportedOperationException();
183 }
184
185 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800186 public String[] getPackagesForUid(int uid) {
187 throw new UnsupportedOperationException();
188 }
189
190 @Override
191 public String getNameForUid(int uid) {
192 throw new UnsupportedOperationException();
193 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700194
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800195 /**
196 * @hide - to match hiding in superclass
197 */
198 @Override
199 public int getUidForSharedUser(String sharedUserName) {
200 throw new UnsupportedOperationException();
201 }
202
203 @Override
204 public List<ApplicationInfo> getInstalledApplications(int flags) {
205 throw new UnsupportedOperationException();
206 }
207
208 @Override
209 public ResolveInfo resolveActivity(Intent intent, int flags) {
210 throw new UnsupportedOperationException();
211 }
212
213 @Override
214 public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) {
215 throw new UnsupportedOperationException();
216 }
217
218 @Override
219 public List<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
220 Intent[] specifics, Intent intent, int flags) {
221 throw new UnsupportedOperationException();
222 }
223
224 @Override
225 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) {
226 throw new UnsupportedOperationException();
227 }
228
229 @Override
230 public ResolveInfo resolveService(Intent intent, int flags) {
231 throw new UnsupportedOperationException();
232 }
233
234 @Override
235 public List<ResolveInfo> queryIntentServices(Intent intent, int flags) {
236 throw new UnsupportedOperationException();
237 }
238
239 @Override
240 public ProviderInfo resolveContentProvider(String name, int flags) {
241 throw new UnsupportedOperationException();
242 }
243
244 @Override
245 public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) {
246 throw new UnsupportedOperationException();
247 }
248
249 @Override
250 public InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags)
251 throws NameNotFoundException {
252 throw new UnsupportedOperationException();
253 }
254
255 @Override
256 public List<InstrumentationInfo> queryInstrumentation(
257 String targetPackage, int flags) {
258 throw new UnsupportedOperationException();
259 }
260
261 @Override
262 public Drawable getDrawable(String packageName, int resid, ApplicationInfo appInfo) {
263 throw new UnsupportedOperationException();
264 }
265
266 @Override
267 public Drawable getActivityIcon(ComponentName activityName)
268 throws NameNotFoundException {
269 throw new UnsupportedOperationException();
270 }
271
272 @Override
273 public Drawable getActivityIcon(Intent intent) throws NameNotFoundException {
274 throw new UnsupportedOperationException();
275 }
276
277 @Override
278 public Drawable getDefaultActivityIcon() {
279 throw new UnsupportedOperationException();
280 }
281
282 @Override
283 public Drawable getApplicationIcon(ApplicationInfo info) {
284 throw new UnsupportedOperationException();
285 }
286
287 @Override
288 public Drawable getApplicationIcon(String packageName) throws NameNotFoundException {
289 throw new UnsupportedOperationException();
290 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700291
Adam Powell81cd2e92010-04-21 16:35:18 -0700292 @Override
293 public Drawable getActivityLogo(ComponentName activityName) throws NameNotFoundException {
294 throw new UnsupportedOperationException();
295 }
296
297 @Override
298 public Drawable getActivityLogo(Intent intent) throws NameNotFoundException {
299 throw new UnsupportedOperationException();
300 }
301
302 @Override
303 public Drawable getApplicationLogo(ApplicationInfo info) {
304 throw new UnsupportedOperationException();
305 }
306
307 @Override
308 public Drawable getApplicationLogo(String packageName) throws NameNotFoundException {
309 throw new UnsupportedOperationException();
310 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800311
312 @Override
313 public CharSequence getText(String packageName, int resid, ApplicationInfo appInfo) {
314 throw new UnsupportedOperationException();
315 }
316
317 @Override
318 public XmlResourceParser getXml(String packageName, int resid,
319 ApplicationInfo appInfo) {
320 throw new UnsupportedOperationException();
321 }
322
323 @Override
324 public CharSequence getApplicationLabel(ApplicationInfo info) {
325 throw new UnsupportedOperationException();
326 }
327
328 @Override
329 public Resources getResourcesForActivity(ComponentName activityName)
330 throws NameNotFoundException {
331 throw new UnsupportedOperationException();
332 }
333
334 @Override
335 public Resources getResourcesForApplication(ApplicationInfo app) {
336 throw new UnsupportedOperationException();
337 }
338
339 @Override
340 public Resources getResourcesForApplication(String appPackageName)
341 throws NameNotFoundException {
342 throw new UnsupportedOperationException();
343 }
344
345 @Override
346 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
347 throw new UnsupportedOperationException();
348 }
349
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700350 /**
351 * @hide - to match hiding in superclass
352 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800353 @Override
354 public void installPackage(Uri packageURI, IPackageInstallObserver observer,
Jacek Surazski65e13172009-04-28 15:26:38 +0200355 int flags, String installerPackageName) {
356 throw new UnsupportedOperationException();
357 }
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800358
Dianne Hackborn880119b2010-11-18 22:26:40 -0800359 @Override
360 public void setInstallerPackageName(String targetPackage,
361 String installerPackageName) {
362 throw new UnsupportedOperationException();
363 }
364
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800365 /**
366 * @hide - to match hiding in superclass
367 */
368 @Override
369 public void movePackage(String packageName, IPackageMoveObserver observer, int flags) {
370 throw new UnsupportedOperationException();
371 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700372
Jacek Surazski65e13172009-04-28 15:26:38 +0200373 @Override
374 public String getInstallerPackageName(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800375 throw new UnsupportedOperationException();
376 }
377
378 /**
379 * @hide - to match hiding in superclass
380 */
381 @Override
382 public void clearApplicationUserData(
383 String packageName, IPackageDataObserver observer) {
384 throw new UnsupportedOperationException();
385 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700386
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 /**
388 * @hide - to match hiding in superclass
389 */
390 @Override
391 public void deleteApplicationCacheFiles(
392 String packageName, IPackageDataObserver observer) {
393 throw new UnsupportedOperationException();
394 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700395
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800396 /**
397 * @hide - to match hiding in superclass
398 */
399 @Override
400 public void freeStorageAndNotify(
401 long idealStorageSize, IPackageDataObserver observer) {
402 throw new UnsupportedOperationException();
403 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800404
405 /**
406 * @hide - to match hiding in superclass
407 */
408 @Override
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700409 public void freeStorage(
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700410 long idealStorageSize, IntentSender pi) {
411 throw new UnsupportedOperationException();
412 }
413
414 /**
415 * @hide - to match hiding in superclass
416 */
417 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800418 public void deletePackage(
419 String packageName, IPackageDeleteObserver observer, int flags) {
420 throw new UnsupportedOperationException();
421 }
422
423 @Override
424 public void addPackageToPreferred(String packageName) {
425 throw new UnsupportedOperationException();
426 }
427
428 @Override
429 public void removePackageFromPreferred(String packageName) {
430 throw new UnsupportedOperationException();
431 }
432
433 @Override
434 public List<PackageInfo> getPreferredPackages(int flags) {
435 throw new UnsupportedOperationException();
436 }
437
438 @Override
439 public void setComponentEnabledSetting(ComponentName componentName,
440 int newState, int flags) {
441 throw new UnsupportedOperationException();
442 }
443
444 @Override
445 public int getComponentEnabledSetting(ComponentName componentName) {
446 throw new UnsupportedOperationException();
447 }
448
449 @Override
450 public void setApplicationEnabledSetting(String packageName, int newState, int flags) {
451 throw new UnsupportedOperationException();
452 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700453
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800454 @Override
455 public int getApplicationEnabledSetting(String packageName) {
456 throw new UnsupportedOperationException();
457 }
458
459 @Override
460 public void addPreferredActivity(IntentFilter filter,
461 int match, ComponentName[] set, ComponentName activity) {
462 throw new UnsupportedOperationException();
463 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700464
Satish Sampath8dbe6122009-06-02 23:35:54 +0100465 /**
466 * @hide - to match hiding in superclass
467 */
468 @Override
469 public void replacePreferredActivity(IntentFilter filter,
470 int match, ComponentName[] set, ComponentName activity) {
471 throw new UnsupportedOperationException();
472 }
473
474
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800475 @Override
476 public void clearPackagePreferredActivities(String packageName) {
477 throw new UnsupportedOperationException();
478 }
479
480 /**
481 * @hide - to match hiding in superclass
482 */
483 @Override
484 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
485 throw new UnsupportedOperationException();
486 }
487
488 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800489 public int getPreferredActivities(List<IntentFilter> outFilters,
490 List<ComponentName> outActivities, String packageName) {
491 throw new UnsupportedOperationException();
492 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700493
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 @Override
495 public String[] getSystemSharedLibraryNames() {
496 throw new UnsupportedOperationException();
497 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700498
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 @Override
Dianne Hackborn49237342009-08-27 20:08:01 -0700500 public FeatureInfo[] getSystemAvailableFeatures() {
501 throw new UnsupportedOperationException();
502 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700503
Dianne Hackborn49237342009-08-27 20:08:01 -0700504 @Override
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700505 public boolean hasSystemFeature(String name) {
506 throw new UnsupportedOperationException();
507 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700508
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700509 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800510 public boolean isSafeMode() {
511 throw new UnsupportedOperationException();
512 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700513
514 /**
515 * @hide
516 */
517 @Override
518 public UserInfo createUser(String name, int flags) {
519 throw new UnsupportedOperationException();
520 }
521
522 /**
523 * @hide
524 */
525 @Override
526 public List<UserInfo> getUsers() {
527 throw new UnsupportedOperationException();
528 }
529
530 /**
531 * @hide
532 */
533 @Override
Amith Yamasani13593602012-03-22 16:16:17 -0700534 public UserInfo getUser(int userId) {
535 throw new UnsupportedOperationException();
536 }
537
538 /**
539 * @hide
540 */
541 @Override
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700542 public boolean removeUser(int id) {
543 throw new UnsupportedOperationException();
544 }
545
546 /**
547 * @hide
548 */
549 @Override
550 public void updateUserName(int id, String name) {
551 throw new UnsupportedOperationException();
552 }
553
554 /**
555 * @hide
556 */
557 @Override
558 public void updateUserFlags(int id, int flags) {
559 throw new UnsupportedOperationException();
560 }
Kenny Root5ab21572011-07-27 11:11:19 -0700561
562 /**
563 * @hide
564 */
565 @Override
566 public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer,
567 int flags, String installerPackageName, Uri verificationURI,
568 ManifestDigest manifestDigest) {
569 throw new UnsupportedOperationException();
570 }
571
Kenny Root5ab21572011-07-27 11:11:19 -0700572 @Override
Kenny Root3a9b5fb2011-09-20 14:15:38 -0700573 public void verifyPendingInstall(int id, int verificationCode) {
Kenny Root5ab21572011-07-27 11:11:19 -0700574 throw new UnsupportedOperationException();
575 }
Kenny Root0aaa0d92011-09-12 16:42:55 -0700576
577 /**
578 * @hide
579 */
580 @Override
581 public VerifierDeviceIdentity getVerifierDeviceIdentity() {
582 throw new UnsupportedOperationException();
583 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800584}