blob: 0d20496dd3e502d311efd38c2f374e3373e87835 [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.IPackageDeleteObserver;
27import android.content.pm.IPackageDataObserver;
28import 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;
Suchi Amalapurapu117818e2010-02-09 03:45:40 -080034import android.content.pm.PackageParser;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.content.pm.PermissionGroupInfo;
36import android.content.pm.PermissionInfo;
37import android.content.pm.ProviderInfo;
38import android.content.pm.ResolveInfo;
39import android.content.pm.ServiceInfo;
40import android.content.pm.PackageManager.NameNotFoundException;
41import android.content.res.Resources;
42import android.content.res.XmlResourceParser;
43import android.graphics.drawable.Drawable;
44import android.net.Uri;
45import android.os.RemoteException;
46
47import java.util.List;
48
49/**
50 * A mock {@link android.content.pm.PackageManager} class. All methods are non-functional and throw
51 * {@link java.lang.UnsupportedOperationException}. Override it to provide the operations that you
52 * need.
53 */
54public class MockPackageManager extends PackageManager {
55
56 @Override
57 public PackageInfo getPackageInfo(String packageName, int flags)
58 throws NameNotFoundException {
59 throw new UnsupportedOperationException();
60 }
61
62 @Override
Dianne Hackborn47096932010-02-11 15:57:09 -080063 public String[] currentToCanonicalPackageNames(String[] names) {
64 throw new UnsupportedOperationException();
65 }
66
67 @Override
68 public String[] canonicalToCurrentPackageNames(String[] names) {
69 throw new UnsupportedOperationException();
70 }
71
72 @Override
Mihai Predaeae850c2009-05-13 10:13:48 +020073 public Intent getLaunchIntentForPackage(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 throw new UnsupportedOperationException();
75 }
Mihai Predaeae850c2009-05-13 10:13:48 +020076
77 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 public int[] getPackageGids(String packageName) throws NameNotFoundException {
79 throw new UnsupportedOperationException();
80 }
81
82 @Override
83 public PermissionInfo getPermissionInfo(String name, int flags)
84 throws NameNotFoundException {
85 throw new UnsupportedOperationException();
86 }
87
88 @Override
89 public List<PermissionInfo> queryPermissionsByGroup(String group, int flags)
90 throws NameNotFoundException {
91 throw new UnsupportedOperationException();
92 }
93
94 @Override
95 public PermissionGroupInfo getPermissionGroupInfo(String name,
96 int flags) throws NameNotFoundException {
97 throw new UnsupportedOperationException();
98 }
99
100 @Override
101 public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
102 throw new UnsupportedOperationException();
103 }
104
105 @Override
106 public ApplicationInfo getApplicationInfo(String packageName, int flags)
107 throws NameNotFoundException {
108 throw new UnsupportedOperationException();
109 }
110
111 @Override
112 public ActivityInfo getActivityInfo(ComponentName className, int flags)
113 throws NameNotFoundException {
114 throw new UnsupportedOperationException();
115 }
116
117 @Override
118 public ActivityInfo getReceiverInfo(ComponentName className, int flags)
119 throws NameNotFoundException {
120 throw new UnsupportedOperationException();
121 }
122
123 @Override
124 public ServiceInfo getServiceInfo(ComponentName className, int flags)
125 throws NameNotFoundException {
126 throw new UnsupportedOperationException();
127 }
128
129 @Override
Dianne Hackborn361199b2010-08-30 17:42:07 -0700130 public ProviderInfo getProviderInfo(ComponentName className, int flags)
131 throws NameNotFoundException {
132 throw new UnsupportedOperationException();
133 }
134
135 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800136 public List<PackageInfo> getInstalledPackages(int flags) {
137 throw new UnsupportedOperationException();
138 }
139
140 @Override
141 public int checkPermission(String permName, String pkgName) {
142 throw new UnsupportedOperationException();
143 }
144
145 @Override
146 public boolean addPermission(PermissionInfo info) {
147 throw new UnsupportedOperationException();
148 }
149
150 @Override
Dianne Hackbornd7c09682010-03-30 10:42:20 -0700151 public boolean addPermissionAsync(PermissionInfo info) {
152 throw new UnsupportedOperationException();
153 }
154
155 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800156 public void removePermission(String name) {
157 throw new UnsupportedOperationException();
158 }
159
160 @Override
161 public int checkSignatures(String pkg1, String pkg2) {
162 throw new UnsupportedOperationException();
163 }
164
165 @Override
Dianne Hackborn766cbfe2009-08-12 18:33:39 -0700166 public int checkSignatures(int uid1, int uid2) {
167 throw new UnsupportedOperationException();
168 }
169
170 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800171 public String[] getPackagesForUid(int uid) {
172 throw new UnsupportedOperationException();
173 }
174
175 @Override
176 public String getNameForUid(int uid) {
177 throw new UnsupportedOperationException();
178 }
179
180 /**
181 * @hide - to match hiding in superclass
182 */
183 @Override
184 public int getUidForSharedUser(String sharedUserName) {
185 throw new UnsupportedOperationException();
186 }
187
188 @Override
189 public List<ApplicationInfo> getInstalledApplications(int flags) {
190 throw new UnsupportedOperationException();
191 }
192
193 @Override
194 public ResolveInfo resolveActivity(Intent intent, int flags) {
195 throw new UnsupportedOperationException();
196 }
197
198 @Override
199 public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) {
200 throw new UnsupportedOperationException();
201 }
202
203 @Override
204 public List<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
205 Intent[] specifics, Intent intent, int flags) {
206 throw new UnsupportedOperationException();
207 }
208
209 @Override
210 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) {
211 throw new UnsupportedOperationException();
212 }
213
214 @Override
215 public ResolveInfo resolveService(Intent intent, int flags) {
216 throw new UnsupportedOperationException();
217 }
218
219 @Override
220 public List<ResolveInfo> queryIntentServices(Intent intent, int flags) {
221 throw new UnsupportedOperationException();
222 }
223
224 @Override
225 public ProviderInfo resolveContentProvider(String name, int flags) {
226 throw new UnsupportedOperationException();
227 }
228
229 @Override
230 public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) {
231 throw new UnsupportedOperationException();
232 }
233
234 @Override
235 public InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags)
236 throws NameNotFoundException {
237 throw new UnsupportedOperationException();
238 }
239
240 @Override
241 public List<InstrumentationInfo> queryInstrumentation(
242 String targetPackage, int flags) {
243 throw new UnsupportedOperationException();
244 }
245
246 @Override
247 public Drawable getDrawable(String packageName, int resid, ApplicationInfo appInfo) {
248 throw new UnsupportedOperationException();
249 }
250
251 @Override
252 public Drawable getActivityIcon(ComponentName activityName)
253 throws NameNotFoundException {
254 throw new UnsupportedOperationException();
255 }
256
257 @Override
258 public Drawable getActivityIcon(Intent intent) throws NameNotFoundException {
259 throw new UnsupportedOperationException();
260 }
261
262 @Override
263 public Drawable getDefaultActivityIcon() {
264 throw new UnsupportedOperationException();
265 }
266
267 @Override
268 public Drawable getApplicationIcon(ApplicationInfo info) {
269 throw new UnsupportedOperationException();
270 }
271
272 @Override
273 public Drawable getApplicationIcon(String packageName) throws NameNotFoundException {
274 throw new UnsupportedOperationException();
275 }
Adam Powell81cd2e92010-04-21 16:35:18 -0700276
277 @Override
278 public Drawable getActivityLogo(ComponentName activityName) throws NameNotFoundException {
279 throw new UnsupportedOperationException();
280 }
281
282 @Override
283 public Drawable getActivityLogo(Intent intent) throws NameNotFoundException {
284 throw new UnsupportedOperationException();
285 }
286
287 @Override
288 public Drawable getApplicationLogo(ApplicationInfo info) {
289 throw new UnsupportedOperationException();
290 }
291
292 @Override
293 public Drawable getApplicationLogo(String packageName) throws NameNotFoundException {
294 throw new UnsupportedOperationException();
295 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800296
297 @Override
298 public CharSequence getText(String packageName, int resid, ApplicationInfo appInfo) {
299 throw new UnsupportedOperationException();
300 }
301
302 @Override
303 public XmlResourceParser getXml(String packageName, int resid,
304 ApplicationInfo appInfo) {
305 throw new UnsupportedOperationException();
306 }
307
308 @Override
309 public CharSequence getApplicationLabel(ApplicationInfo info) {
310 throw new UnsupportedOperationException();
311 }
312
313 @Override
314 public Resources getResourcesForActivity(ComponentName activityName)
315 throws NameNotFoundException {
316 throw new UnsupportedOperationException();
317 }
318
319 @Override
320 public Resources getResourcesForApplication(ApplicationInfo app) {
321 throw new UnsupportedOperationException();
322 }
323
324 @Override
325 public Resources getResourcesForApplication(String appPackageName)
326 throws NameNotFoundException {
327 throw new UnsupportedOperationException();
328 }
329
330 @Override
331 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
332 throw new UnsupportedOperationException();
333 }
334
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700335 /**
336 * @hide - to match hiding in superclass
337 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800338 @Override
339 public void installPackage(Uri packageURI, IPackageInstallObserver observer,
Jacek Surazski65e13172009-04-28 15:26:38 +0200340 int flags, String installerPackageName) {
341 throw new UnsupportedOperationException();
342 }
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800343
Dianne Hackborn880119b2010-11-18 22:26:40 -0800344 @Override
345 public void setInstallerPackageName(String targetPackage,
346 String installerPackageName) {
347 throw new UnsupportedOperationException();
348 }
349
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800350 /**
351 * @hide - to match hiding in superclass
352 */
353 @Override
354 public void movePackage(String packageName, IPackageMoveObserver observer, int flags) {
355 throw new UnsupportedOperationException();
356 }
Jacek Surazski65e13172009-04-28 15:26:38 +0200357
358 @Override
359 public String getInstallerPackageName(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800360 throw new UnsupportedOperationException();
361 }
362
363 /**
364 * @hide - to match hiding in superclass
365 */
366 @Override
367 public void clearApplicationUserData(
368 String packageName, IPackageDataObserver observer) {
369 throw new UnsupportedOperationException();
370 }
371
372 /**
373 * @hide - to match hiding in superclass
374 */
375 @Override
376 public void deleteApplicationCacheFiles(
377 String packageName, IPackageDataObserver observer) {
378 throw new UnsupportedOperationException();
379 }
380
381 /**
382 * @hide - to match hiding in superclass
383 */
384 @Override
385 public void freeStorageAndNotify(
386 long idealStorageSize, IPackageDataObserver observer) {
387 throw new UnsupportedOperationException();
388 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800389
390 /**
391 * @hide - to match hiding in superclass
392 */
393 @Override
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700394 public void freeStorage(
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700395 long idealStorageSize, IntentSender pi) {
396 throw new UnsupportedOperationException();
397 }
398
399 /**
400 * @hide - to match hiding in superclass
401 */
402 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800403 public void deletePackage(
404 String packageName, IPackageDeleteObserver observer, int flags) {
405 throw new UnsupportedOperationException();
406 }
407
408 @Override
409 public void addPackageToPreferred(String packageName) {
410 throw new UnsupportedOperationException();
411 }
412
413 @Override
414 public void removePackageFromPreferred(String packageName) {
415 throw new UnsupportedOperationException();
416 }
417
418 @Override
419 public List<PackageInfo> getPreferredPackages(int flags) {
420 throw new UnsupportedOperationException();
421 }
422
423 @Override
424 public void setComponentEnabledSetting(ComponentName componentName,
425 int newState, int flags) {
426 throw new UnsupportedOperationException();
427 }
428
429 @Override
430 public int getComponentEnabledSetting(ComponentName componentName) {
431 throw new UnsupportedOperationException();
432 }
433
434 @Override
435 public void setApplicationEnabledSetting(String packageName, int newState, int flags) {
436 throw new UnsupportedOperationException();
437 }
438
439 @Override
440 public int getApplicationEnabledSetting(String packageName) {
441 throw new UnsupportedOperationException();
442 }
443
444 @Override
445 public void addPreferredActivity(IntentFilter filter,
446 int match, ComponentName[] set, ComponentName activity) {
447 throw new UnsupportedOperationException();
448 }
449
Satish Sampath8dbe6122009-06-02 23:35:54 +0100450 /**
451 * @hide - to match hiding in superclass
452 */
453 @Override
454 public void replacePreferredActivity(IntentFilter filter,
455 int match, ComponentName[] set, ComponentName activity) {
456 throw new UnsupportedOperationException();
457 }
458
459
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800460 @Override
461 public void clearPackagePreferredActivities(String packageName) {
462 throw new UnsupportedOperationException();
463 }
464
465 /**
466 * @hide - to match hiding in superclass
467 */
468 @Override
469 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
470 throw new UnsupportedOperationException();
471 }
472
473 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800474 public int getPreferredActivities(List<IntentFilter> outFilters,
475 List<ComponentName> outActivities, String packageName) {
476 throw new UnsupportedOperationException();
477 }
478
479 @Override
480 public String[] getSystemSharedLibraryNames() {
481 throw new UnsupportedOperationException();
482 }
483
484 @Override
Dianne Hackborn49237342009-08-27 20:08:01 -0700485 public FeatureInfo[] getSystemAvailableFeatures() {
486 throw new UnsupportedOperationException();
487 }
488
489 @Override
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700490 public boolean hasSystemFeature(String name) {
491 throw new UnsupportedOperationException();
492 }
493
494 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 public boolean isSafeMode() {
496 throw new UnsupportedOperationException();
497 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800498}