blob: d84f1e5f958aa8db6775e0a145ff1e52c4c7d812 [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;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.content.res.Resources;
41import android.content.res.XmlResourceParser;
42import android.graphics.drawable.Drawable;
43import android.net.Uri;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044
45import java.util.List;
46
47/**
48 * A mock {@link android.content.pm.PackageManager} class. All methods are non-functional and throw
Amith Yamasani4b2e9342011-03-31 12:38:53 -070049 * {@link java.lang.UnsupportedOperationException}. Override it to provide the operations that you
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050 * need.
51 */
52public class MockPackageManager extends PackageManager {
53
54 @Override
55 public PackageInfo getPackageInfo(String packageName, int flags)
56 throws NameNotFoundException {
57 throw new UnsupportedOperationException();
58 }
59
60 @Override
Dianne Hackborn47096932010-02-11 15:57:09 -080061 public String[] currentToCanonicalPackageNames(String[] names) {
62 throw new UnsupportedOperationException();
63 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -070064
Dianne Hackborn47096932010-02-11 15:57:09 -080065 @Override
66 public String[] canonicalToCurrentPackageNames(String[] names) {
67 throw new UnsupportedOperationException();
68 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -070069
Dianne Hackborn47096932010-02-11 15:57:09 -080070 @Override
Mihai Predaeae850c2009-05-13 10:13:48 +020071 public Intent getLaunchIntentForPackage(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072 throw new UnsupportedOperationException();
73 }
Mihai Predaeae850c2009-05-13 10:13:48 +020074
75 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076 public int[] getPackageGids(String packageName) throws NameNotFoundException {
77 throw new UnsupportedOperationException();
78 }
79
80 @Override
81 public PermissionInfo getPermissionInfo(String name, int flags)
82 throws NameNotFoundException {
83 throw new UnsupportedOperationException();
84 }
85
86 @Override
87 public List<PermissionInfo> queryPermissionsByGroup(String group, int flags)
88 throws NameNotFoundException {
89 throw new UnsupportedOperationException();
90 }
91
92 @Override
93 public PermissionGroupInfo getPermissionGroupInfo(String name,
94 int flags) throws NameNotFoundException {
95 throw new UnsupportedOperationException();
96 }
97
98 @Override
99 public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
100 throw new UnsupportedOperationException();
101 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700102
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800103 @Override
104 public ApplicationInfo getApplicationInfo(String packageName, int flags)
105 throws NameNotFoundException {
106 throw new UnsupportedOperationException();
107 }
108
109 @Override
110 public ActivityInfo getActivityInfo(ComponentName className, int flags)
111 throws NameNotFoundException {
112 throw new UnsupportedOperationException();
113 }
114
115 @Override
116 public ActivityInfo getReceiverInfo(ComponentName className, int flags)
117 throws NameNotFoundException {
118 throw new UnsupportedOperationException();
119 }
120
121 @Override
122 public ServiceInfo getServiceInfo(ComponentName className, int flags)
123 throws NameNotFoundException {
124 throw new UnsupportedOperationException();
125 }
126
127 @Override
Dianne Hackborn361199b2010-08-30 17:42:07 -0700128 public ProviderInfo getProviderInfo(ComponentName className, int flags)
129 throws NameNotFoundException {
130 throw new UnsupportedOperationException();
131 }
132
133 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 public List<PackageInfo> getInstalledPackages(int flags) {
135 throw new UnsupportedOperationException();
136 }
137
138 @Override
139 public int checkPermission(String permName, String pkgName) {
140 throw new UnsupportedOperationException();
141 }
142
143 @Override
144 public boolean addPermission(PermissionInfo info) {
145 throw new UnsupportedOperationException();
146 }
147
148 @Override
Dianne Hackbornd7c09682010-03-30 10:42:20 -0700149 public boolean addPermissionAsync(PermissionInfo info) {
150 throw new UnsupportedOperationException();
151 }
152
153 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800154 public void removePermission(String name) {
155 throw new UnsupportedOperationException();
156 }
157
158 @Override
159 public int checkSignatures(String pkg1, String pkg2) {
160 throw new UnsupportedOperationException();
161 }
162
163 @Override
Dianne Hackborn766cbfe2009-08-12 18:33:39 -0700164 public int checkSignatures(int uid1, int uid2) {
165 throw new UnsupportedOperationException();
166 }
167
168 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800169 public String[] getPackagesForUid(int uid) {
170 throw new UnsupportedOperationException();
171 }
172
173 @Override
174 public String getNameForUid(int uid) {
175 throw new UnsupportedOperationException();
176 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700177
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800178 /**
179 * @hide - to match hiding in superclass
180 */
181 @Override
182 public int getUidForSharedUser(String sharedUserName) {
183 throw new UnsupportedOperationException();
184 }
185
186 @Override
187 public List<ApplicationInfo> getInstalledApplications(int flags) {
188 throw new UnsupportedOperationException();
189 }
190
191 @Override
192 public ResolveInfo resolveActivity(Intent intent, int flags) {
193 throw new UnsupportedOperationException();
194 }
195
196 @Override
197 public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) {
198 throw new UnsupportedOperationException();
199 }
200
201 @Override
202 public List<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
203 Intent[] specifics, Intent intent, int flags) {
204 throw new UnsupportedOperationException();
205 }
206
207 @Override
208 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) {
209 throw new UnsupportedOperationException();
210 }
211
212 @Override
213 public ResolveInfo resolveService(Intent intent, int flags) {
214 throw new UnsupportedOperationException();
215 }
216
217 @Override
218 public List<ResolveInfo> queryIntentServices(Intent intent, int flags) {
219 throw new UnsupportedOperationException();
220 }
221
222 @Override
223 public ProviderInfo resolveContentProvider(String name, int flags) {
224 throw new UnsupportedOperationException();
225 }
226
227 @Override
228 public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) {
229 throw new UnsupportedOperationException();
230 }
231
232 @Override
233 public InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags)
234 throws NameNotFoundException {
235 throw new UnsupportedOperationException();
236 }
237
238 @Override
239 public List<InstrumentationInfo> queryInstrumentation(
240 String targetPackage, int flags) {
241 throw new UnsupportedOperationException();
242 }
243
244 @Override
245 public Drawable getDrawable(String packageName, int resid, ApplicationInfo appInfo) {
246 throw new UnsupportedOperationException();
247 }
248
249 @Override
250 public Drawable getActivityIcon(ComponentName activityName)
251 throws NameNotFoundException {
252 throw new UnsupportedOperationException();
253 }
254
255 @Override
256 public Drawable getActivityIcon(Intent intent) throws NameNotFoundException {
257 throw new UnsupportedOperationException();
258 }
259
260 @Override
261 public Drawable getDefaultActivityIcon() {
262 throw new UnsupportedOperationException();
263 }
264
265 @Override
266 public Drawable getApplicationIcon(ApplicationInfo info) {
267 throw new UnsupportedOperationException();
268 }
269
270 @Override
271 public Drawable getApplicationIcon(String packageName) throws NameNotFoundException {
272 throw new UnsupportedOperationException();
273 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700274
Adam Powell81cd2e92010-04-21 16:35:18 -0700275 @Override
276 public Drawable getActivityLogo(ComponentName activityName) throws NameNotFoundException {
277 throw new UnsupportedOperationException();
278 }
279
280 @Override
281 public Drawable getActivityLogo(Intent intent) throws NameNotFoundException {
282 throw new UnsupportedOperationException();
283 }
284
285 @Override
286 public Drawable getApplicationLogo(ApplicationInfo info) {
287 throw new UnsupportedOperationException();
288 }
289
290 @Override
291 public Drawable getApplicationLogo(String packageName) throws NameNotFoundException {
292 throw new UnsupportedOperationException();
293 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800294
295 @Override
296 public CharSequence getText(String packageName, int resid, ApplicationInfo appInfo) {
297 throw new UnsupportedOperationException();
298 }
299
300 @Override
301 public XmlResourceParser getXml(String packageName, int resid,
302 ApplicationInfo appInfo) {
303 throw new UnsupportedOperationException();
304 }
305
306 @Override
307 public CharSequence getApplicationLabel(ApplicationInfo info) {
308 throw new UnsupportedOperationException();
309 }
310
311 @Override
312 public Resources getResourcesForActivity(ComponentName activityName)
313 throws NameNotFoundException {
314 throw new UnsupportedOperationException();
315 }
316
317 @Override
318 public Resources getResourcesForApplication(ApplicationInfo app) {
319 throw new UnsupportedOperationException();
320 }
321
322 @Override
323 public Resources getResourcesForApplication(String appPackageName)
324 throws NameNotFoundException {
325 throw new UnsupportedOperationException();
326 }
327
328 @Override
329 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
330 throw new UnsupportedOperationException();
331 }
332
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700333 /**
334 * @hide - to match hiding in superclass
335 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800336 @Override
337 public void installPackage(Uri packageURI, IPackageInstallObserver observer,
Jacek Surazski65e13172009-04-28 15:26:38 +0200338 int flags, String installerPackageName) {
339 throw new UnsupportedOperationException();
340 }
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800341
Dianne Hackborn880119b2010-11-18 22:26:40 -0800342 @Override
343 public void setInstallerPackageName(String targetPackage,
344 String installerPackageName) {
345 throw new UnsupportedOperationException();
346 }
347
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800348 /**
349 * @hide - to match hiding in superclass
350 */
351 @Override
352 public void movePackage(String packageName, IPackageMoveObserver observer, int flags) {
353 throw new UnsupportedOperationException();
354 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700355
Jacek Surazski65e13172009-04-28 15:26:38 +0200356 @Override
357 public String getInstallerPackageName(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800358 throw new UnsupportedOperationException();
359 }
360
361 /**
362 * @hide - to match hiding in superclass
363 */
364 @Override
365 public void clearApplicationUserData(
366 String packageName, IPackageDataObserver observer) {
367 throw new UnsupportedOperationException();
368 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700369
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800370 /**
371 * @hide - to match hiding in superclass
372 */
373 @Override
374 public void deleteApplicationCacheFiles(
375 String packageName, IPackageDataObserver observer) {
376 throw new UnsupportedOperationException();
377 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700378
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800379 /**
380 * @hide - to match hiding in superclass
381 */
382 @Override
383 public void freeStorageAndNotify(
384 long idealStorageSize, IPackageDataObserver observer) {
385 throw new UnsupportedOperationException();
386 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387
388 /**
389 * @hide - to match hiding in superclass
390 */
391 @Override
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700392 public void freeStorage(
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700393 long idealStorageSize, IntentSender pi) {
394 throw new UnsupportedOperationException();
395 }
396
397 /**
398 * @hide - to match hiding in superclass
399 */
400 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800401 public void deletePackage(
402 String packageName, IPackageDeleteObserver observer, int flags) {
403 throw new UnsupportedOperationException();
404 }
405
406 @Override
407 public void addPackageToPreferred(String packageName) {
408 throw new UnsupportedOperationException();
409 }
410
411 @Override
412 public void removePackageFromPreferred(String packageName) {
413 throw new UnsupportedOperationException();
414 }
415
416 @Override
417 public List<PackageInfo> getPreferredPackages(int flags) {
418 throw new UnsupportedOperationException();
419 }
420
421 @Override
422 public void setComponentEnabledSetting(ComponentName componentName,
423 int newState, int flags) {
424 throw new UnsupportedOperationException();
425 }
426
427 @Override
428 public int getComponentEnabledSetting(ComponentName componentName) {
429 throw new UnsupportedOperationException();
430 }
431
432 @Override
433 public void setApplicationEnabledSetting(String packageName, int newState, int flags) {
434 throw new UnsupportedOperationException();
435 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700436
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800437 @Override
438 public int getApplicationEnabledSetting(String packageName) {
439 throw new UnsupportedOperationException();
440 }
441
442 @Override
443 public void addPreferredActivity(IntentFilter filter,
444 int match, ComponentName[] set, ComponentName activity) {
445 throw new UnsupportedOperationException();
446 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700447
Satish Sampath8dbe6122009-06-02 23:35:54 +0100448 /**
449 * @hide - to match hiding in superclass
450 */
451 @Override
452 public void replacePreferredActivity(IntentFilter filter,
453 int match, ComponentName[] set, ComponentName activity) {
454 throw new UnsupportedOperationException();
455 }
456
457
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800458 @Override
459 public void clearPackagePreferredActivities(String packageName) {
460 throw new UnsupportedOperationException();
461 }
462
463 /**
464 * @hide - to match hiding in superclass
465 */
466 @Override
467 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
468 throw new UnsupportedOperationException();
469 }
470
471 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800472 public int getPreferredActivities(List<IntentFilter> outFilters,
473 List<ComponentName> outActivities, String packageName) {
474 throw new UnsupportedOperationException();
475 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700476
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800477 @Override
478 public String[] getSystemSharedLibraryNames() {
479 throw new UnsupportedOperationException();
480 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700481
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800482 @Override
Dianne Hackborn49237342009-08-27 20:08:01 -0700483 public FeatureInfo[] getSystemAvailableFeatures() {
484 throw new UnsupportedOperationException();
485 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700486
Dianne Hackborn49237342009-08-27 20:08:01 -0700487 @Override
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700488 public boolean hasSystemFeature(String name) {
489 throw new UnsupportedOperationException();
490 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700491
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700492 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800493 public boolean isSafeMode() {
494 throw new UnsupportedOperationException();
495 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -0700496
497 /**
498 * @hide
499 */
500 @Override
501 public UserInfo createUser(String name, int flags) {
502 throw new UnsupportedOperationException();
503 }
504
505 /**
506 * @hide
507 */
508 @Override
509 public List<UserInfo> getUsers() {
510 throw new UnsupportedOperationException();
511 }
512
513 /**
514 * @hide
515 */
516 @Override
517 public boolean removeUser(int id) {
518 throw new UnsupportedOperationException();
519 }
520
521 /**
522 * @hide
523 */
524 @Override
525 public void updateUserName(int id, String name) {
526 throw new UnsupportedOperationException();
527 }
528
529 /**
530 * @hide
531 */
532 @Override
533 public void updateUserFlags(int id, int flags) {
534 throw new UnsupportedOperationException();
535 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800536}