blob: 351c771ca1d95a3a5ef89308f43e51476a41fe96 [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;
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
142 @Override
143 public int checkPermission(String permName, String pkgName) {
144 throw new UnsupportedOperationException();
145 }
146
147 @Override
148 public boolean addPermission(PermissionInfo info) {
149 throw new UnsupportedOperationException();
150 }
151
152 @Override
Dianne Hackbornd7c09682010-03-30 10:42:20 -0700153 public boolean addPermissionAsync(PermissionInfo info) {
154 throw new UnsupportedOperationException();
155 }
156
157 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800158 public void removePermission(String name) {
159 throw new UnsupportedOperationException();
160 }
161
Dianne Hackborne639da72012-02-21 15:11:13 -0800162 /** @hide */
163 @Override
164 public void grantPermission(String packageName, String permissionName) {
165 throw new UnsupportedOperationException();
166 }
167
168 /** @hide */
169 @Override
170 public void revokePermission(String packageName, String permissionName) {
171 throw new UnsupportedOperationException();
172 }
173
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800174 @Override
175 public int checkSignatures(String pkg1, String pkg2) {
176 throw new UnsupportedOperationException();
177 }
178
179 @Override
Dianne Hackborn766cbfe2009-08-12 18:33:39 -0700180 public int checkSignatures(int uid1, int uid2) {
181 throw new UnsupportedOperationException();
182 }
183
184 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800185 public String[] getPackagesForUid(int uid) {
186 throw new UnsupportedOperationException();
187 }
188
189 @Override
190 public String getNameForUid(int uid) {
191 throw new UnsupportedOperationException();
192 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700193
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800194 /**
195 * @hide - to match hiding in superclass
196 */
197 @Override
198 public int getUidForSharedUser(String sharedUserName) {
199 throw new UnsupportedOperationException();
200 }
201
202 @Override
203 public List<ApplicationInfo> getInstalledApplications(int flags) {
204 throw new UnsupportedOperationException();
205 }
206
207 @Override
208 public ResolveInfo resolveActivity(Intent intent, int flags) {
209 throw new UnsupportedOperationException();
210 }
211
212 @Override
213 public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) {
214 throw new UnsupportedOperationException();
215 }
216
217 @Override
218 public List<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
219 Intent[] specifics, Intent intent, int flags) {
220 throw new UnsupportedOperationException();
221 }
222
223 @Override
224 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) {
225 throw new UnsupportedOperationException();
226 }
227
228 @Override
229 public ResolveInfo resolveService(Intent intent, int flags) {
230 throw new UnsupportedOperationException();
231 }
232
233 @Override
234 public List<ResolveInfo> queryIntentServices(Intent intent, int flags) {
235 throw new UnsupportedOperationException();
236 }
237
238 @Override
239 public ProviderInfo resolveContentProvider(String name, int flags) {
240 throw new UnsupportedOperationException();
241 }
242
243 @Override
244 public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) {
245 throw new UnsupportedOperationException();
246 }
247
248 @Override
249 public InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags)
250 throws NameNotFoundException {
251 throw new UnsupportedOperationException();
252 }
253
254 @Override
255 public List<InstrumentationInfo> queryInstrumentation(
256 String targetPackage, int flags) {
257 throw new UnsupportedOperationException();
258 }
259
260 @Override
261 public Drawable getDrawable(String packageName, int resid, ApplicationInfo appInfo) {
262 throw new UnsupportedOperationException();
263 }
264
265 @Override
266 public Drawable getActivityIcon(ComponentName activityName)
267 throws NameNotFoundException {
268 throw new UnsupportedOperationException();
269 }
270
271 @Override
272 public Drawable getActivityIcon(Intent intent) throws NameNotFoundException {
273 throw new UnsupportedOperationException();
274 }
275
276 @Override
277 public Drawable getDefaultActivityIcon() {
278 throw new UnsupportedOperationException();
279 }
280
281 @Override
282 public Drawable getApplicationIcon(ApplicationInfo info) {
283 throw new UnsupportedOperationException();
284 }
285
286 @Override
287 public Drawable getApplicationIcon(String packageName) throws NameNotFoundException {
288 throw new UnsupportedOperationException();
289 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700290
Adam Powell81cd2e92010-04-21 16:35:18 -0700291 @Override
292 public Drawable getActivityLogo(ComponentName activityName) throws NameNotFoundException {
293 throw new UnsupportedOperationException();
294 }
295
296 @Override
297 public Drawable getActivityLogo(Intent intent) throws NameNotFoundException {
298 throw new UnsupportedOperationException();
299 }
300
301 @Override
302 public Drawable getApplicationLogo(ApplicationInfo info) {
303 throw new UnsupportedOperationException();
304 }
305
306 @Override
307 public Drawable getApplicationLogo(String packageName) throws NameNotFoundException {
308 throw new UnsupportedOperationException();
309 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800310
311 @Override
312 public CharSequence getText(String packageName, int resid, ApplicationInfo appInfo) {
313 throw new UnsupportedOperationException();
314 }
315
316 @Override
317 public XmlResourceParser getXml(String packageName, int resid,
318 ApplicationInfo appInfo) {
319 throw new UnsupportedOperationException();
320 }
321
322 @Override
323 public CharSequence getApplicationLabel(ApplicationInfo info) {
324 throw new UnsupportedOperationException();
325 }
326
327 @Override
328 public Resources getResourcesForActivity(ComponentName activityName)
329 throws NameNotFoundException {
330 throw new UnsupportedOperationException();
331 }
332
333 @Override
334 public Resources getResourcesForApplication(ApplicationInfo app) {
335 throw new UnsupportedOperationException();
336 }
337
338 @Override
339 public Resources getResourcesForApplication(String appPackageName)
340 throws NameNotFoundException {
341 throw new UnsupportedOperationException();
342 }
343
344 @Override
345 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
346 throw new UnsupportedOperationException();
347 }
348
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700349 /**
350 * @hide - to match hiding in superclass
351 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800352 @Override
353 public void installPackage(Uri packageURI, IPackageInstallObserver observer,
Jacek Surazski65e13172009-04-28 15:26:38 +0200354 int flags, String installerPackageName) {
355 throw new UnsupportedOperationException();
356 }
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800357
Dianne Hackborn880119b2010-11-18 22:26:40 -0800358 @Override
359 public void setInstallerPackageName(String targetPackage,
360 String installerPackageName) {
361 throw new UnsupportedOperationException();
362 }
363
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800364 /**
365 * @hide - to match hiding in superclass
366 */
367 @Override
368 public void movePackage(String packageName, IPackageMoveObserver observer, int flags) {
369 throw new UnsupportedOperationException();
370 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700371
Jacek Surazski65e13172009-04-28 15:26:38 +0200372 @Override
373 public String getInstallerPackageName(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800374 throw new UnsupportedOperationException();
375 }
376
377 /**
378 * @hide - to match hiding in superclass
379 */
380 @Override
381 public void clearApplicationUserData(
382 String packageName, IPackageDataObserver observer) {
383 throw new UnsupportedOperationException();
384 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700385
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 /**
387 * @hide - to match hiding in superclass
388 */
389 @Override
390 public void deleteApplicationCacheFiles(
391 String packageName, IPackageDataObserver observer) {
392 throw new UnsupportedOperationException();
393 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700394
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800395 /**
396 * @hide - to match hiding in superclass
397 */
398 @Override
399 public void freeStorageAndNotify(
400 long idealStorageSize, IPackageDataObserver observer) {
401 throw new UnsupportedOperationException();
402 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800403
404 /**
405 * @hide - to match hiding in superclass
406 */
407 @Override
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700408 public void freeStorage(
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700409 long idealStorageSize, IntentSender pi) {
410 throw new UnsupportedOperationException();
411 }
412
413 /**
414 * @hide - to match hiding in superclass
415 */
416 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800417 public void deletePackage(
418 String packageName, IPackageDeleteObserver observer, int flags) {
419 throw new UnsupportedOperationException();
420 }
421
422 @Override
423 public void addPackageToPreferred(String packageName) {
424 throw new UnsupportedOperationException();
425 }
426
427 @Override
428 public void removePackageFromPreferred(String packageName) {
429 throw new UnsupportedOperationException();
430 }
431
432 @Override
433 public List<PackageInfo> getPreferredPackages(int flags) {
434 throw new UnsupportedOperationException();
435 }
436
437 @Override
438 public void setComponentEnabledSetting(ComponentName componentName,
439 int newState, int flags) {
440 throw new UnsupportedOperationException();
441 }
442
443 @Override
444 public int getComponentEnabledSetting(ComponentName componentName) {
445 throw new UnsupportedOperationException();
446 }
447
448 @Override
449 public void setApplicationEnabledSetting(String packageName, int newState, int flags) {
450 throw new UnsupportedOperationException();
451 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700452
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800453 @Override
454 public int getApplicationEnabledSetting(String packageName) {
455 throw new UnsupportedOperationException();
456 }
457
458 @Override
459 public void addPreferredActivity(IntentFilter filter,
460 int match, ComponentName[] set, ComponentName activity) {
461 throw new UnsupportedOperationException();
462 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700463
Satish Sampath8dbe6122009-06-02 23:35:54 +0100464 /**
465 * @hide - to match hiding in superclass
466 */
467 @Override
468 public void replacePreferredActivity(IntentFilter filter,
469 int match, ComponentName[] set, ComponentName activity) {
470 throw new UnsupportedOperationException();
471 }
472
473
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800474 @Override
475 public void clearPackagePreferredActivities(String packageName) {
476 throw new UnsupportedOperationException();
477 }
478
479 /**
480 * @hide - to match hiding in superclass
481 */
482 @Override
483 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
484 throw new UnsupportedOperationException();
485 }
486
487 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800488 public int getPreferredActivities(List<IntentFilter> outFilters,
489 List<ComponentName> outActivities, String packageName) {
490 throw new UnsupportedOperationException();
491 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700492
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800493 @Override
494 public String[] getSystemSharedLibraryNames() {
495 throw new UnsupportedOperationException();
496 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700497
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498 @Override
Dianne Hackborn49237342009-08-27 20:08:01 -0700499 public FeatureInfo[] getSystemAvailableFeatures() {
500 throw new UnsupportedOperationException();
501 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700502
Dianne Hackborn49237342009-08-27 20:08:01 -0700503 @Override
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700504 public boolean hasSystemFeature(String name) {
505 throw new UnsupportedOperationException();
506 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700507
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700508 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800509 public boolean isSafeMode() {
510 throw new UnsupportedOperationException();
511 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700512
513 /**
514 * @hide
515 */
516 @Override
517 public UserInfo createUser(String name, int flags) {
518 throw new UnsupportedOperationException();
519 }
520
521 /**
522 * @hide
523 */
524 @Override
525 public List<UserInfo> getUsers() {
526 throw new UnsupportedOperationException();
527 }
528
529 /**
530 * @hide
531 */
532 @Override
533 public boolean removeUser(int id) {
534 throw new UnsupportedOperationException();
535 }
536
537 /**
538 * @hide
539 */
540 @Override
541 public void updateUserName(int id, String name) {
542 throw new UnsupportedOperationException();
543 }
544
545 /**
546 * @hide
547 */
548 @Override
549 public void updateUserFlags(int id, int flags) {
550 throw new UnsupportedOperationException();
551 }
Kenny Root5ab21572011-07-27 11:11:19 -0700552
553 /**
554 * @hide
555 */
556 @Override
557 public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer,
558 int flags, String installerPackageName, Uri verificationURI,
559 ManifestDigest manifestDigest) {
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
568 /**
569 * @hide
570 */
571 @Override
572 public VerifierDeviceIdentity getVerifierDeviceIdentity() {
573 throw new UnsupportedOperationException();
574 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800575}