blob: c5d45f5c2914d337189309ab66e1dd49dbb67a4b [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
344 /**
345 * @hide - to match hiding in superclass
346 */
347 @Override
348 public void movePackage(String packageName, IPackageMoveObserver observer, int flags) {
349 throw new UnsupportedOperationException();
350 }
Jacek Surazski65e13172009-04-28 15:26:38 +0200351
352 @Override
353 public String getInstallerPackageName(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 throw new UnsupportedOperationException();
355 }
356
357 /**
358 * @hide - to match hiding in superclass
359 */
360 @Override
361 public void clearApplicationUserData(
362 String packageName, IPackageDataObserver observer) {
363 throw new UnsupportedOperationException();
364 }
365
366 /**
367 * @hide - to match hiding in superclass
368 */
369 @Override
370 public void deleteApplicationCacheFiles(
371 String packageName, IPackageDataObserver observer) {
372 throw new UnsupportedOperationException();
373 }
374
375 /**
376 * @hide - to match hiding in superclass
377 */
378 @Override
379 public void freeStorageAndNotify(
380 long idealStorageSize, IPackageDataObserver observer) {
381 throw new UnsupportedOperationException();
382 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800383
384 /**
385 * @hide - to match hiding in superclass
386 */
387 @Override
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700388 public void freeStorage(
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700389 long idealStorageSize, IntentSender pi) {
390 throw new UnsupportedOperationException();
391 }
392
393 /**
394 * @hide - to match hiding in superclass
395 */
396 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800397 public void deletePackage(
398 String packageName, IPackageDeleteObserver observer, int flags) {
399 throw new UnsupportedOperationException();
400 }
401
402 @Override
403 public void addPackageToPreferred(String packageName) {
404 throw new UnsupportedOperationException();
405 }
406
407 @Override
408 public void removePackageFromPreferred(String packageName) {
409 throw new UnsupportedOperationException();
410 }
411
412 @Override
413 public List<PackageInfo> getPreferredPackages(int flags) {
414 throw new UnsupportedOperationException();
415 }
416
417 @Override
418 public void setComponentEnabledSetting(ComponentName componentName,
419 int newState, int flags) {
420 throw new UnsupportedOperationException();
421 }
422
423 @Override
424 public int getComponentEnabledSetting(ComponentName componentName) {
425 throw new UnsupportedOperationException();
426 }
427
428 @Override
429 public void setApplicationEnabledSetting(String packageName, int newState, int flags) {
430 throw new UnsupportedOperationException();
431 }
432
433 @Override
434 public int getApplicationEnabledSetting(String packageName) {
435 throw new UnsupportedOperationException();
436 }
437
438 @Override
439 public void addPreferredActivity(IntentFilter filter,
440 int match, ComponentName[] set, ComponentName activity) {
441 throw new UnsupportedOperationException();
442 }
443
Satish Sampath8dbe6122009-06-02 23:35:54 +0100444 /**
445 * @hide - to match hiding in superclass
446 */
447 @Override
448 public void replacePreferredActivity(IntentFilter filter,
449 int match, ComponentName[] set, ComponentName activity) {
450 throw new UnsupportedOperationException();
451 }
452
453
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800454 @Override
455 public void clearPackagePreferredActivities(String packageName) {
456 throw new UnsupportedOperationException();
457 }
458
459 /**
460 * @hide - to match hiding in superclass
461 */
462 @Override
463 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
464 throw new UnsupportedOperationException();
465 }
466
467 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800468 public int getPreferredActivities(List<IntentFilter> outFilters,
469 List<ComponentName> outActivities, String packageName) {
470 throw new UnsupportedOperationException();
471 }
472
473 @Override
474 public String[] getSystemSharedLibraryNames() {
475 throw new UnsupportedOperationException();
476 }
477
478 @Override
Dianne Hackborn49237342009-08-27 20:08:01 -0700479 public FeatureInfo[] getSystemAvailableFeatures() {
480 throw new UnsupportedOperationException();
481 }
482
483 @Override
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700484 public boolean hasSystemFeature(String name) {
485 throw new UnsupportedOperationException();
486 }
487
488 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800489 public boolean isSafeMode() {
490 throw new UnsupportedOperationException();
491 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800492}