blob: 3e77b9b296c4df832156d3bbe8077ec5a750f261 [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
130 public List<PackageInfo> getInstalledPackages(int flags) {
131 throw new UnsupportedOperationException();
132 }
133
134 @Override
135 public int checkPermission(String permName, String pkgName) {
136 throw new UnsupportedOperationException();
137 }
138
139 @Override
140 public boolean addPermission(PermissionInfo info) {
141 throw new UnsupportedOperationException();
142 }
143
144 @Override
Dianne Hackbornd7c09682010-03-30 10:42:20 -0700145 public boolean addPermissionAsync(PermissionInfo info) {
146 throw new UnsupportedOperationException();
147 }
148
149 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800150 public void removePermission(String name) {
151 throw new UnsupportedOperationException();
152 }
153
154 @Override
155 public int checkSignatures(String pkg1, String pkg2) {
156 throw new UnsupportedOperationException();
157 }
158
159 @Override
Dianne Hackborn766cbfe2009-08-12 18:33:39 -0700160 public int checkSignatures(int uid1, int uid2) {
161 throw new UnsupportedOperationException();
162 }
163
164 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165 public String[] getPackagesForUid(int uid) {
166 throw new UnsupportedOperationException();
167 }
168
169 @Override
170 public String getNameForUid(int uid) {
171 throw new UnsupportedOperationException();
172 }
173
174 /**
175 * @hide - to match hiding in superclass
176 */
177 @Override
178 public int getUidForSharedUser(String sharedUserName) {
179 throw new UnsupportedOperationException();
180 }
181
182 @Override
183 public List<ApplicationInfo> getInstalledApplications(int flags) {
184 throw new UnsupportedOperationException();
185 }
186
187 @Override
188 public ResolveInfo resolveActivity(Intent intent, int flags) {
189 throw new UnsupportedOperationException();
190 }
191
192 @Override
193 public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) {
194 throw new UnsupportedOperationException();
195 }
196
197 @Override
198 public List<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
199 Intent[] specifics, Intent intent, int flags) {
200 throw new UnsupportedOperationException();
201 }
202
203 @Override
204 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) {
205 throw new UnsupportedOperationException();
206 }
207
208 @Override
209 public ResolveInfo resolveService(Intent intent, int flags) {
210 throw new UnsupportedOperationException();
211 }
212
213 @Override
214 public List<ResolveInfo> queryIntentServices(Intent intent, int flags) {
215 throw new UnsupportedOperationException();
216 }
217
218 @Override
219 public ProviderInfo resolveContentProvider(String name, int flags) {
220 throw new UnsupportedOperationException();
221 }
222
223 @Override
224 public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) {
225 throw new UnsupportedOperationException();
226 }
227
228 @Override
229 public InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags)
230 throws NameNotFoundException {
231 throw new UnsupportedOperationException();
232 }
233
234 @Override
235 public List<InstrumentationInfo> queryInstrumentation(
236 String targetPackage, int flags) {
237 throw new UnsupportedOperationException();
238 }
239
240 @Override
241 public Drawable getDrawable(String packageName, int resid, ApplicationInfo appInfo) {
242 throw new UnsupportedOperationException();
243 }
244
245 @Override
246 public Drawable getActivityIcon(ComponentName activityName)
247 throws NameNotFoundException {
248 throw new UnsupportedOperationException();
249 }
250
251 @Override
252 public Drawable getActivityIcon(Intent intent) throws NameNotFoundException {
253 throw new UnsupportedOperationException();
254 }
255
256 @Override
257 public Drawable getDefaultActivityIcon() {
258 throw new UnsupportedOperationException();
259 }
260
261 @Override
262 public Drawable getApplicationIcon(ApplicationInfo info) {
263 throw new UnsupportedOperationException();
264 }
265
266 @Override
267 public Drawable getApplicationIcon(String packageName) throws NameNotFoundException {
268 throw new UnsupportedOperationException();
269 }
Adam Powell81cd2e92010-04-21 16:35:18 -0700270
271 @Override
272 public Drawable getActivityLogo(ComponentName activityName) throws NameNotFoundException {
273 throw new UnsupportedOperationException();
274 }
275
276 @Override
277 public Drawable getActivityLogo(Intent intent) throws NameNotFoundException {
278 throw new UnsupportedOperationException();
279 }
280
281 @Override
282 public Drawable getApplicationLogo(ApplicationInfo info) {
283 throw new UnsupportedOperationException();
284 }
285
286 @Override
287 public Drawable getApplicationLogo(String packageName) throws NameNotFoundException {
288 throw new UnsupportedOperationException();
289 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800290
291 @Override
292 public CharSequence getText(String packageName, int resid, ApplicationInfo appInfo) {
293 throw new UnsupportedOperationException();
294 }
295
296 @Override
297 public XmlResourceParser getXml(String packageName, int resid,
298 ApplicationInfo appInfo) {
299 throw new UnsupportedOperationException();
300 }
301
302 @Override
303 public CharSequence getApplicationLabel(ApplicationInfo info) {
304 throw new UnsupportedOperationException();
305 }
306
307 @Override
308 public Resources getResourcesForActivity(ComponentName activityName)
309 throws NameNotFoundException {
310 throw new UnsupportedOperationException();
311 }
312
313 @Override
314 public Resources getResourcesForApplication(ApplicationInfo app) {
315 throw new UnsupportedOperationException();
316 }
317
318 @Override
319 public Resources getResourcesForApplication(String appPackageName)
320 throws NameNotFoundException {
321 throw new UnsupportedOperationException();
322 }
323
324 @Override
325 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
326 throw new UnsupportedOperationException();
327 }
328
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700329 /**
330 * @hide - to match hiding in superclass
331 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800332 @Override
333 public void installPackage(Uri packageURI, IPackageInstallObserver observer,
Jacek Surazski65e13172009-04-28 15:26:38 +0200334 int flags, String installerPackageName) {
335 throw new UnsupportedOperationException();
336 }
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800337
338 /**
339 * @hide - to match hiding in superclass
340 */
341 @Override
342 public void movePackage(String packageName, IPackageMoveObserver observer, int flags) {
343 throw new UnsupportedOperationException();
344 }
Jacek Surazski65e13172009-04-28 15:26:38 +0200345
346 @Override
347 public String getInstallerPackageName(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800348 throw new UnsupportedOperationException();
349 }
350
351 /**
352 * @hide - to match hiding in superclass
353 */
354 @Override
355 public void clearApplicationUserData(
356 String packageName, IPackageDataObserver observer) {
357 throw new UnsupportedOperationException();
358 }
359
360 /**
361 * @hide - to match hiding in superclass
362 */
363 @Override
364 public void deleteApplicationCacheFiles(
365 String packageName, IPackageDataObserver observer) {
366 throw new UnsupportedOperationException();
367 }
368
369 /**
370 * @hide - to match hiding in superclass
371 */
372 @Override
373 public void freeStorageAndNotify(
374 long idealStorageSize, IPackageDataObserver observer) {
375 throw new UnsupportedOperationException();
376 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800377
378 /**
379 * @hide - to match hiding in superclass
380 */
381 @Override
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700382 public void freeStorage(
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700383 long idealStorageSize, IntentSender pi) {
384 throw new UnsupportedOperationException();
385 }
386
387 /**
388 * @hide - to match hiding in superclass
389 */
390 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800391 public void deletePackage(
392 String packageName, IPackageDeleteObserver observer, int flags) {
393 throw new UnsupportedOperationException();
394 }
395
396 @Override
397 public void addPackageToPreferred(String packageName) {
398 throw new UnsupportedOperationException();
399 }
400
401 @Override
402 public void removePackageFromPreferred(String packageName) {
403 throw new UnsupportedOperationException();
404 }
405
406 @Override
407 public List<PackageInfo> getPreferredPackages(int flags) {
408 throw new UnsupportedOperationException();
409 }
410
411 @Override
412 public void setComponentEnabledSetting(ComponentName componentName,
413 int newState, int flags) {
414 throw new UnsupportedOperationException();
415 }
416
417 @Override
418 public int getComponentEnabledSetting(ComponentName componentName) {
419 throw new UnsupportedOperationException();
420 }
421
422 @Override
423 public void setApplicationEnabledSetting(String packageName, int newState, int flags) {
424 throw new UnsupportedOperationException();
425 }
426
427 @Override
428 public int getApplicationEnabledSetting(String packageName) {
429 throw new UnsupportedOperationException();
430 }
431
432 @Override
433 public void addPreferredActivity(IntentFilter filter,
434 int match, ComponentName[] set, ComponentName activity) {
435 throw new UnsupportedOperationException();
436 }
437
Satish Sampath8dbe6122009-06-02 23:35:54 +0100438 /**
439 * @hide - to match hiding in superclass
440 */
441 @Override
442 public void replacePreferredActivity(IntentFilter filter,
443 int match, ComponentName[] set, ComponentName activity) {
444 throw new UnsupportedOperationException();
445 }
446
447
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800448 @Override
449 public void clearPackagePreferredActivities(String packageName) {
450 throw new UnsupportedOperationException();
451 }
452
453 /**
454 * @hide - to match hiding in superclass
455 */
456 @Override
457 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
458 throw new UnsupportedOperationException();
459 }
460
461 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800462 public int getPreferredActivities(List<IntentFilter> outFilters,
463 List<ComponentName> outActivities, String packageName) {
464 throw new UnsupportedOperationException();
465 }
466
467 @Override
468 public String[] getSystemSharedLibraryNames() {
469 throw new UnsupportedOperationException();
470 }
471
472 @Override
Dianne Hackborn49237342009-08-27 20:08:01 -0700473 public FeatureInfo[] getSystemAvailableFeatures() {
474 throw new UnsupportedOperationException();
475 }
476
477 @Override
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700478 public boolean hasSystemFeature(String name) {
479 throw new UnsupportedOperationException();
480 }
481
482 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800483 public boolean isSafeMode() {
484 throw new UnsupportedOperationException();
485 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800486}