blob: 501c21974e82c0d36bee12361db485f6346f74a0 [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;
Amith Yamasani4b2e9342011-03-31 12:38:53 -070039import android.content.pm.UserInfo;
Kenny Root5ab21572011-07-27 11:11:19 -070040import android.content.pm.ManifestDigest;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.content.res.Resources;
42import android.content.res.XmlResourceParser;
43import android.graphics.drawable.Drawable;
44import android.net.Uri;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045
46import java.util.List;
47
48/**
49 * A mock {@link android.content.pm.PackageManager} class. All methods are non-functional and throw
Amith Yamasani4b2e9342011-03-31 12:38:53 -070050 * {@link java.lang.UnsupportedOperationException}. Override it to provide the operations that you
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051 * need.
52 */
53public class MockPackageManager extends PackageManager {
54
55 @Override
56 public PackageInfo getPackageInfo(String packageName, int flags)
57 throws NameNotFoundException {
58 throw new UnsupportedOperationException();
59 }
60
61 @Override
Dianne Hackborn47096932010-02-11 15:57:09 -080062 public String[] currentToCanonicalPackageNames(String[] names) {
63 throw new UnsupportedOperationException();
64 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -070065
Dianne Hackborn47096932010-02-11 15:57:09 -080066 @Override
67 public String[] canonicalToCurrentPackageNames(String[] names) {
68 throw new UnsupportedOperationException();
69 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -070070
Dianne Hackborn47096932010-02-11 15:57:09 -080071 @Override
Mihai Predaeae850c2009-05-13 10:13:48 +020072 public Intent getLaunchIntentForPackage(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 throw new UnsupportedOperationException();
74 }
Mihai Predaeae850c2009-05-13 10:13:48 +020075
76 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080077 public int[] getPackageGids(String packageName) throws NameNotFoundException {
78 throw new UnsupportedOperationException();
79 }
80
81 @Override
82 public PermissionInfo getPermissionInfo(String name, int flags)
83 throws NameNotFoundException {
84 throw new UnsupportedOperationException();
85 }
86
87 @Override
88 public List<PermissionInfo> queryPermissionsByGroup(String group, int flags)
89 throws NameNotFoundException {
90 throw new UnsupportedOperationException();
91 }
92
93 @Override
94 public PermissionGroupInfo getPermissionGroupInfo(String name,
95 int flags) throws NameNotFoundException {
96 throw new UnsupportedOperationException();
97 }
98
99 @Override
100 public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
101 throw new UnsupportedOperationException();
102 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700103
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800104 @Override
105 public ApplicationInfo getApplicationInfo(String packageName, int flags)
106 throws NameNotFoundException {
107 throw new UnsupportedOperationException();
108 }
109
110 @Override
111 public ActivityInfo getActivityInfo(ComponentName className, int flags)
112 throws NameNotFoundException {
113 throw new UnsupportedOperationException();
114 }
115
116 @Override
117 public ActivityInfo getReceiverInfo(ComponentName className, int flags)
118 throws NameNotFoundException {
119 throw new UnsupportedOperationException();
120 }
121
122 @Override
123 public ServiceInfo getServiceInfo(ComponentName className, int flags)
124 throws NameNotFoundException {
125 throw new UnsupportedOperationException();
126 }
127
128 @Override
Dianne Hackborn361199b2010-08-30 17:42:07 -0700129 public ProviderInfo getProviderInfo(ComponentName className, int flags)
130 throws NameNotFoundException {
131 throw new UnsupportedOperationException();
132 }
133
134 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 public List<PackageInfo> getInstalledPackages(int flags) {
136 throw new UnsupportedOperationException();
137 }
138
139 @Override
140 public int checkPermission(String permName, String pkgName) {
141 throw new UnsupportedOperationException();
142 }
143
144 @Override
145 public boolean addPermission(PermissionInfo info) {
146 throw new UnsupportedOperationException();
147 }
148
149 @Override
Dianne Hackbornd7c09682010-03-30 10:42:20 -0700150 public boolean addPermissionAsync(PermissionInfo info) {
151 throw new UnsupportedOperationException();
152 }
153
154 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155 public void removePermission(String name) {
156 throw new UnsupportedOperationException();
157 }
158
159 @Override
160 public int checkSignatures(String pkg1, String pkg2) {
161 throw new UnsupportedOperationException();
162 }
163
164 @Override
Dianne Hackborn766cbfe2009-08-12 18:33:39 -0700165 public int checkSignatures(int uid1, int uid2) {
166 throw new UnsupportedOperationException();
167 }
168
169 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800170 public String[] getPackagesForUid(int uid) {
171 throw new UnsupportedOperationException();
172 }
173
174 @Override
175 public String getNameForUid(int uid) {
176 throw new UnsupportedOperationException();
177 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700178
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800179 /**
180 * @hide - to match hiding in superclass
181 */
182 @Override
183 public int getUidForSharedUser(String sharedUserName) {
184 throw new UnsupportedOperationException();
185 }
186
187 @Override
188 public List<ApplicationInfo> getInstalledApplications(int flags) {
189 throw new UnsupportedOperationException();
190 }
191
192 @Override
193 public ResolveInfo resolveActivity(Intent intent, int flags) {
194 throw new UnsupportedOperationException();
195 }
196
197 @Override
198 public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) {
199 throw new UnsupportedOperationException();
200 }
201
202 @Override
203 public List<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
204 Intent[] specifics, Intent intent, int flags) {
205 throw new UnsupportedOperationException();
206 }
207
208 @Override
209 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) {
210 throw new UnsupportedOperationException();
211 }
212
213 @Override
214 public ResolveInfo resolveService(Intent intent, int flags) {
215 throw new UnsupportedOperationException();
216 }
217
218 @Override
219 public List<ResolveInfo> queryIntentServices(Intent intent, int flags) {
220 throw new UnsupportedOperationException();
221 }
222
223 @Override
224 public ProviderInfo resolveContentProvider(String name, int flags) {
225 throw new UnsupportedOperationException();
226 }
227
228 @Override
229 public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) {
230 throw new UnsupportedOperationException();
231 }
232
233 @Override
234 public InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags)
235 throws NameNotFoundException {
236 throw new UnsupportedOperationException();
237 }
238
239 @Override
240 public List<InstrumentationInfo> queryInstrumentation(
241 String targetPackage, int flags) {
242 throw new UnsupportedOperationException();
243 }
244
245 @Override
246 public Drawable getDrawable(String packageName, int resid, ApplicationInfo appInfo) {
247 throw new UnsupportedOperationException();
248 }
249
250 @Override
251 public Drawable getActivityIcon(ComponentName activityName)
252 throws NameNotFoundException {
253 throw new UnsupportedOperationException();
254 }
255
256 @Override
257 public Drawable getActivityIcon(Intent intent) throws NameNotFoundException {
258 throw new UnsupportedOperationException();
259 }
260
261 @Override
262 public Drawable getDefaultActivityIcon() {
263 throw new UnsupportedOperationException();
264 }
265
266 @Override
267 public Drawable getApplicationIcon(ApplicationInfo info) {
268 throw new UnsupportedOperationException();
269 }
270
271 @Override
272 public Drawable getApplicationIcon(String packageName) throws NameNotFoundException {
273 throw new UnsupportedOperationException();
274 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700275
Adam Powell81cd2e92010-04-21 16:35:18 -0700276 @Override
277 public Drawable getActivityLogo(ComponentName activityName) throws NameNotFoundException {
278 throw new UnsupportedOperationException();
279 }
280
281 @Override
282 public Drawable getActivityLogo(Intent intent) throws NameNotFoundException {
283 throw new UnsupportedOperationException();
284 }
285
286 @Override
287 public Drawable getApplicationLogo(ApplicationInfo info) {
288 throw new UnsupportedOperationException();
289 }
290
291 @Override
292 public Drawable getApplicationLogo(String packageName) throws NameNotFoundException {
293 throw new UnsupportedOperationException();
294 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800295
296 @Override
297 public CharSequence getText(String packageName, int resid, ApplicationInfo appInfo) {
298 throw new UnsupportedOperationException();
299 }
300
301 @Override
302 public XmlResourceParser getXml(String packageName, int resid,
303 ApplicationInfo appInfo) {
304 throw new UnsupportedOperationException();
305 }
306
307 @Override
308 public CharSequence getApplicationLabel(ApplicationInfo info) {
309 throw new UnsupportedOperationException();
310 }
311
312 @Override
313 public Resources getResourcesForActivity(ComponentName activityName)
314 throws NameNotFoundException {
315 throw new UnsupportedOperationException();
316 }
317
318 @Override
319 public Resources getResourcesForApplication(ApplicationInfo app) {
320 throw new UnsupportedOperationException();
321 }
322
323 @Override
324 public Resources getResourcesForApplication(String appPackageName)
325 throws NameNotFoundException {
326 throw new UnsupportedOperationException();
327 }
328
329 @Override
330 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
331 throw new UnsupportedOperationException();
332 }
333
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700334 /**
335 * @hide - to match hiding in superclass
336 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800337 @Override
338 public void installPackage(Uri packageURI, IPackageInstallObserver observer,
Jacek Surazski65e13172009-04-28 15:26:38 +0200339 int flags, String installerPackageName) {
340 throw new UnsupportedOperationException();
341 }
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800342
Dianne Hackborn880119b2010-11-18 22:26:40 -0800343 @Override
344 public void setInstallerPackageName(String targetPackage,
345 String installerPackageName) {
346 throw new UnsupportedOperationException();
347 }
348
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800349 /**
350 * @hide - to match hiding in superclass
351 */
352 @Override
353 public void movePackage(String packageName, IPackageMoveObserver observer, int flags) {
354 throw new UnsupportedOperationException();
355 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700356
Jacek Surazski65e13172009-04-28 15:26:38 +0200357 @Override
358 public String getInstallerPackageName(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800359 throw new UnsupportedOperationException();
360 }
361
362 /**
363 * @hide - to match hiding in superclass
364 */
365 @Override
366 public void clearApplicationUserData(
367 String packageName, IPackageDataObserver observer) {
368 throw new UnsupportedOperationException();
369 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700370
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800371 /**
372 * @hide - to match hiding in superclass
373 */
374 @Override
375 public void deleteApplicationCacheFiles(
376 String packageName, IPackageDataObserver observer) {
377 throw new UnsupportedOperationException();
378 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700379
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800380 /**
381 * @hide - to match hiding in superclass
382 */
383 @Override
384 public void freeStorageAndNotify(
385 long idealStorageSize, IPackageDataObserver observer) {
386 throw new UnsupportedOperationException();
387 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800388
389 /**
390 * @hide - to match hiding in superclass
391 */
392 @Override
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700393 public void freeStorage(
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700394 long idealStorageSize, IntentSender pi) {
395 throw new UnsupportedOperationException();
396 }
397
398 /**
399 * @hide - to match hiding in superclass
400 */
401 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800402 public void deletePackage(
403 String packageName, IPackageDeleteObserver observer, int flags) {
404 throw new UnsupportedOperationException();
405 }
406
407 @Override
408 public void addPackageToPreferred(String packageName) {
409 throw new UnsupportedOperationException();
410 }
411
412 @Override
413 public void removePackageFromPreferred(String packageName) {
414 throw new UnsupportedOperationException();
415 }
416
417 @Override
418 public List<PackageInfo> getPreferredPackages(int flags) {
419 throw new UnsupportedOperationException();
420 }
421
422 @Override
423 public void setComponentEnabledSetting(ComponentName componentName,
424 int newState, int flags) {
425 throw new UnsupportedOperationException();
426 }
427
428 @Override
429 public int getComponentEnabledSetting(ComponentName componentName) {
430 throw new UnsupportedOperationException();
431 }
432
433 @Override
434 public void setApplicationEnabledSetting(String packageName, int newState, int flags) {
435 throw new UnsupportedOperationException();
436 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700437
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800438 @Override
439 public int getApplicationEnabledSetting(String packageName) {
440 throw new UnsupportedOperationException();
441 }
442
443 @Override
444 public void addPreferredActivity(IntentFilter filter,
445 int match, ComponentName[] set, ComponentName activity) {
446 throw new UnsupportedOperationException();
447 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700448
Satish Sampath8dbe6122009-06-02 23:35:54 +0100449 /**
450 * @hide - to match hiding in superclass
451 */
452 @Override
453 public void replacePreferredActivity(IntentFilter filter,
454 int match, ComponentName[] set, ComponentName activity) {
455 throw new UnsupportedOperationException();
456 }
457
458
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800459 @Override
460 public void clearPackagePreferredActivities(String packageName) {
461 throw new UnsupportedOperationException();
462 }
463
464 /**
465 * @hide - to match hiding in superclass
466 */
467 @Override
468 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
469 throw new UnsupportedOperationException();
470 }
471
472 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800473 public int getPreferredActivities(List<IntentFilter> outFilters,
474 List<ComponentName> outActivities, String packageName) {
475 throw new UnsupportedOperationException();
476 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700477
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800478 @Override
479 public String[] getSystemSharedLibraryNames() {
480 throw new UnsupportedOperationException();
481 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700482
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800483 @Override
Dianne Hackborn49237342009-08-27 20:08:01 -0700484 public FeatureInfo[] getSystemAvailableFeatures() {
485 throw new UnsupportedOperationException();
486 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700487
Dianne Hackborn49237342009-08-27 20:08:01 -0700488 @Override
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700489 public boolean hasSystemFeature(String name) {
490 throw new UnsupportedOperationException();
491 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700492
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700493 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800494 public boolean isSafeMode() {
495 throw new UnsupportedOperationException();
496 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700497
498 /**
499 * @hide
500 */
501 @Override
502 public UserInfo createUser(String name, int flags) {
503 throw new UnsupportedOperationException();
504 }
505
506 /**
507 * @hide
508 */
509 @Override
510 public List<UserInfo> getUsers() {
511 throw new UnsupportedOperationException();
512 }
513
514 /**
515 * @hide
516 */
517 @Override
518 public boolean removeUser(int id) {
519 throw new UnsupportedOperationException();
520 }
521
522 /**
523 * @hide
524 */
525 @Override
526 public void updateUserName(int id, String name) {
527 throw new UnsupportedOperationException();
528 }
529
530 /**
531 * @hide
532 */
533 @Override
534 public void updateUserFlags(int id, int flags) {
535 throw new UnsupportedOperationException();
536 }
Kenny Root5ab21572011-07-27 11:11:19 -0700537
538 /**
539 * @hide
540 */
541 @Override
542 public void installPackageWithVerification(Uri packageURI, IPackageInstallObserver observer,
543 int flags, String installerPackageName, Uri verificationURI,
544 ManifestDigest manifestDigest) {
545 throw new UnsupportedOperationException();
546 }
547
548 /**
549 * @hide
550 */
551 @Override
552 public void verifyPendingInstall(int id, boolean verified, String failureMessage) {
553 throw new UnsupportedOperationException();
554 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800555}