blob: 4964f0394678f4f0e44172319c36b4a7e84dd2a2 [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 }
270
271 @Override
272 public CharSequence getText(String packageName, int resid, ApplicationInfo appInfo) {
273 throw new UnsupportedOperationException();
274 }
275
276 @Override
277 public XmlResourceParser getXml(String packageName, int resid,
278 ApplicationInfo appInfo) {
279 throw new UnsupportedOperationException();
280 }
281
282 @Override
283 public CharSequence getApplicationLabel(ApplicationInfo info) {
284 throw new UnsupportedOperationException();
285 }
286
287 @Override
288 public Resources getResourcesForActivity(ComponentName activityName)
289 throws NameNotFoundException {
290 throw new UnsupportedOperationException();
291 }
292
293 @Override
294 public Resources getResourcesForApplication(ApplicationInfo app) {
295 throw new UnsupportedOperationException();
296 }
297
298 @Override
299 public Resources getResourcesForApplication(String appPackageName)
300 throws NameNotFoundException {
301 throw new UnsupportedOperationException();
302 }
303
304 @Override
305 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
306 throw new UnsupportedOperationException();
307 }
308
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700309 /**
310 * @hide - to match hiding in superclass
311 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800312 @Override
313 public void installPackage(Uri packageURI, IPackageInstallObserver observer,
Jacek Surazski65e13172009-04-28 15:26:38 +0200314 int flags, String installerPackageName) {
315 throw new UnsupportedOperationException();
316 }
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800317
318 /**
319 * @hide - to match hiding in superclass
320 */
321 @Override
322 public void movePackage(String packageName, IPackageMoveObserver observer, int flags) {
323 throw new UnsupportedOperationException();
324 }
Jacek Surazski65e13172009-04-28 15:26:38 +0200325
326 @Override
327 public String getInstallerPackageName(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800328 throw new UnsupportedOperationException();
329 }
330
331 /**
332 * @hide - to match hiding in superclass
333 */
334 @Override
335 public void clearApplicationUserData(
336 String packageName, IPackageDataObserver observer) {
337 throw new UnsupportedOperationException();
338 }
339
340 /**
341 * @hide - to match hiding in superclass
342 */
343 @Override
344 public void deleteApplicationCacheFiles(
345 String packageName, IPackageDataObserver observer) {
346 throw new UnsupportedOperationException();
347 }
348
349 /**
350 * @hide - to match hiding in superclass
351 */
352 @Override
353 public void freeStorageAndNotify(
354 long idealStorageSize, IPackageDataObserver observer) {
355 throw new UnsupportedOperationException();
356 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800357
358 /**
359 * @hide - to match hiding in superclass
360 */
361 @Override
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700362 public void freeStorage(
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700363 long idealStorageSize, IntentSender pi) {
364 throw new UnsupportedOperationException();
365 }
366
367 /**
368 * @hide - to match hiding in superclass
369 */
370 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800371 public void deletePackage(
372 String packageName, IPackageDeleteObserver observer, int flags) {
373 throw new UnsupportedOperationException();
374 }
375
376 @Override
377 public void addPackageToPreferred(String packageName) {
378 throw new UnsupportedOperationException();
379 }
380
381 @Override
382 public void removePackageFromPreferred(String packageName) {
383 throw new UnsupportedOperationException();
384 }
385
386 @Override
387 public List<PackageInfo> getPreferredPackages(int flags) {
388 throw new UnsupportedOperationException();
389 }
390
391 @Override
392 public void setComponentEnabledSetting(ComponentName componentName,
393 int newState, int flags) {
394 throw new UnsupportedOperationException();
395 }
396
397 @Override
398 public int getComponentEnabledSetting(ComponentName componentName) {
399 throw new UnsupportedOperationException();
400 }
401
402 @Override
403 public void setApplicationEnabledSetting(String packageName, int newState, int flags) {
404 throw new UnsupportedOperationException();
405 }
406
407 @Override
408 public int getApplicationEnabledSetting(String packageName) {
409 throw new UnsupportedOperationException();
410 }
411
412 @Override
413 public void addPreferredActivity(IntentFilter filter,
414 int match, ComponentName[] set, ComponentName activity) {
415 throw new UnsupportedOperationException();
416 }
417
Satish Sampath8dbe6122009-06-02 23:35:54 +0100418 /**
419 * @hide - to match hiding in superclass
420 */
421 @Override
422 public void replacePreferredActivity(IntentFilter filter,
423 int match, ComponentName[] set, ComponentName activity) {
424 throw new UnsupportedOperationException();
425 }
426
427
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800428 @Override
429 public void clearPackagePreferredActivities(String packageName) {
430 throw new UnsupportedOperationException();
431 }
432
433 /**
434 * @hide - to match hiding in superclass
435 */
436 @Override
437 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
438 throw new UnsupportedOperationException();
439 }
440
441 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800442 public int getPreferredActivities(List<IntentFilter> outFilters,
443 List<ComponentName> outActivities, String packageName) {
444 throw new UnsupportedOperationException();
445 }
446
447 @Override
448 public String[] getSystemSharedLibraryNames() {
449 throw new UnsupportedOperationException();
450 }
451
452 @Override
Dianne Hackborn49237342009-08-27 20:08:01 -0700453 public FeatureInfo[] getSystemAvailableFeatures() {
454 throw new UnsupportedOperationException();
455 }
456
457 @Override
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700458 public boolean hasSystemFeature(String name) {
459 throw new UnsupportedOperationException();
460 }
461
462 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800463 public boolean isSafeMode() {
464 throw new UnsupportedOperationException();
465 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800466}