blob: c8339ed42b813ca5e8088d1ee541c8f508fb8869 [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;
29import android.content.pm.IPackageStatsObserver;
30import android.content.pm.InstrumentationInfo;
31import android.content.pm.PackageInfo;
32import android.content.pm.PackageManager;
Suchi Amalapurapu117818e2010-02-09 03:45:40 -080033import android.content.pm.PackageParser;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.content.pm.PermissionGroupInfo;
35import android.content.pm.PermissionInfo;
36import android.content.pm.ProviderInfo;
37import android.content.pm.ResolveInfo;
38import android.content.pm.ServiceInfo;
39import android.content.pm.PackageManager.NameNotFoundException;
40import android.content.res.Resources;
41import android.content.res.XmlResourceParser;
42import android.graphics.drawable.Drawable;
43import android.net.Uri;
44import android.os.RemoteException;
45
46import java.util.List;
47
48/**
49 * A mock {@link android.content.pm.PackageManager} class. All methods are non-functional and throw
50 * {@link java.lang.UnsupportedOperationException}. Override it to provide the operations that you
51 * need.
52 */
53public class MockPackageManager extends PackageManager {
54
55 @Override
56 public PackageInfo getPackageInfo(String packageName, int flags)
57 throws NameNotFoundException {
58 throw new UnsupportedOperationException();
59 }
60
61 @Override
Mihai Predaeae850c2009-05-13 10:13:48 +020062 public Intent getLaunchIntentForPackage(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063 throw new UnsupportedOperationException();
64 }
Mihai Predaeae850c2009-05-13 10:13:48 +020065
66 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067 public int[] getPackageGids(String packageName) throws NameNotFoundException {
68 throw new UnsupportedOperationException();
69 }
70
71 @Override
72 public PermissionInfo getPermissionInfo(String name, int flags)
73 throws NameNotFoundException {
74 throw new UnsupportedOperationException();
75 }
76
77 @Override
78 public List<PermissionInfo> queryPermissionsByGroup(String group, int flags)
79 throws NameNotFoundException {
80 throw new UnsupportedOperationException();
81 }
82
83 @Override
84 public PermissionGroupInfo getPermissionGroupInfo(String name,
85 int flags) throws NameNotFoundException {
86 throw new UnsupportedOperationException();
87 }
88
89 @Override
90 public List<PermissionGroupInfo> getAllPermissionGroups(int flags) {
91 throw new UnsupportedOperationException();
92 }
93
94 @Override
95 public ApplicationInfo getApplicationInfo(String packageName, int flags)
96 throws NameNotFoundException {
97 throw new UnsupportedOperationException();
98 }
99
100 @Override
101 public ActivityInfo getActivityInfo(ComponentName className, int flags)
102 throws NameNotFoundException {
103 throw new UnsupportedOperationException();
104 }
105
106 @Override
107 public ActivityInfo getReceiverInfo(ComponentName className, int flags)
108 throws NameNotFoundException {
109 throw new UnsupportedOperationException();
110 }
111
112 @Override
113 public ServiceInfo getServiceInfo(ComponentName className, int flags)
114 throws NameNotFoundException {
115 throw new UnsupportedOperationException();
116 }
117
118 @Override
119 public List<PackageInfo> getInstalledPackages(int flags) {
120 throw new UnsupportedOperationException();
121 }
122
123 @Override
124 public int checkPermission(String permName, String pkgName) {
125 throw new UnsupportedOperationException();
126 }
127
128 @Override
129 public boolean addPermission(PermissionInfo info) {
130 throw new UnsupportedOperationException();
131 }
132
133 @Override
134 public void removePermission(String name) {
135 throw new UnsupportedOperationException();
136 }
137
138 @Override
139 public int checkSignatures(String pkg1, String pkg2) {
140 throw new UnsupportedOperationException();
141 }
142
143 @Override
Dianne Hackborn766cbfe2009-08-12 18:33:39 -0700144 public int checkSignatures(int uid1, int uid2) {
145 throw new UnsupportedOperationException();
146 }
147
148 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800149 public String[] getPackagesForUid(int uid) {
150 throw new UnsupportedOperationException();
151 }
152
153 @Override
154 public String getNameForUid(int uid) {
155 throw new UnsupportedOperationException();
156 }
157
158 /**
159 * @hide - to match hiding in superclass
160 */
161 @Override
162 public int getUidForSharedUser(String sharedUserName) {
163 throw new UnsupportedOperationException();
164 }
165
166 @Override
167 public List<ApplicationInfo> getInstalledApplications(int flags) {
168 throw new UnsupportedOperationException();
169 }
170
171 @Override
172 public ResolveInfo resolveActivity(Intent intent, int flags) {
173 throw new UnsupportedOperationException();
174 }
175
176 @Override
177 public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) {
178 throw new UnsupportedOperationException();
179 }
180
181 @Override
182 public List<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
183 Intent[] specifics, Intent intent, int flags) {
184 throw new UnsupportedOperationException();
185 }
186
187 @Override
188 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) {
189 throw new UnsupportedOperationException();
190 }
191
192 @Override
193 public ResolveInfo resolveService(Intent intent, int flags) {
194 throw new UnsupportedOperationException();
195 }
196
197 @Override
198 public List<ResolveInfo> queryIntentServices(Intent intent, int flags) {
199 throw new UnsupportedOperationException();
200 }
201
202 @Override
203 public ProviderInfo resolveContentProvider(String name, int flags) {
204 throw new UnsupportedOperationException();
205 }
206
207 @Override
208 public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) {
209 throw new UnsupportedOperationException();
210 }
211
212 @Override
213 public InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags)
214 throws NameNotFoundException {
215 throw new UnsupportedOperationException();
216 }
217
218 @Override
219 public List<InstrumentationInfo> queryInstrumentation(
220 String targetPackage, int flags) {
221 throw new UnsupportedOperationException();
222 }
223
224 @Override
225 public Drawable getDrawable(String packageName, int resid, ApplicationInfo appInfo) {
226 throw new UnsupportedOperationException();
227 }
228
229 @Override
230 public Drawable getActivityIcon(ComponentName activityName)
231 throws NameNotFoundException {
232 throw new UnsupportedOperationException();
233 }
234
235 @Override
236 public Drawable getActivityIcon(Intent intent) throws NameNotFoundException {
237 throw new UnsupportedOperationException();
238 }
239
240 @Override
241 public Drawable getDefaultActivityIcon() {
242 throw new UnsupportedOperationException();
243 }
244
245 @Override
246 public Drawable getApplicationIcon(ApplicationInfo info) {
247 throw new UnsupportedOperationException();
248 }
249
250 @Override
251 public Drawable getApplicationIcon(String packageName) throws NameNotFoundException {
252 throw new UnsupportedOperationException();
253 }
254
255 @Override
256 public CharSequence getText(String packageName, int resid, ApplicationInfo appInfo) {
257 throw new UnsupportedOperationException();
258 }
259
260 @Override
261 public XmlResourceParser getXml(String packageName, int resid,
262 ApplicationInfo appInfo) {
263 throw new UnsupportedOperationException();
264 }
265
266 @Override
267 public CharSequence getApplicationLabel(ApplicationInfo info) {
268 throw new UnsupportedOperationException();
269 }
270
271 @Override
272 public Resources getResourcesForActivity(ComponentName activityName)
273 throws NameNotFoundException {
274 throw new UnsupportedOperationException();
275 }
276
277 @Override
278 public Resources getResourcesForApplication(ApplicationInfo app) {
279 throw new UnsupportedOperationException();
280 }
281
282 @Override
283 public Resources getResourcesForApplication(String appPackageName)
284 throws NameNotFoundException {
285 throw new UnsupportedOperationException();
286 }
287
288 @Override
289 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
290 throw new UnsupportedOperationException();
291 }
292
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700293 /**
294 * @hide - to match hiding in superclass
295 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800296 @Override
297 public void installPackage(Uri packageURI, IPackageInstallObserver observer,
Jacek Surazski65e13172009-04-28 15:26:38 +0200298 int flags, String installerPackageName) {
299 throw new UnsupportedOperationException();
300 }
301
302 @Override
303 public String getInstallerPackageName(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800304 throw new UnsupportedOperationException();
305 }
306
307 /**
308 * @hide - to match hiding in superclass
309 */
310 @Override
311 public void clearApplicationUserData(
312 String packageName, IPackageDataObserver observer) {
313 throw new UnsupportedOperationException();
314 }
315
316 /**
317 * @hide - to match hiding in superclass
318 */
319 @Override
320 public void deleteApplicationCacheFiles(
321 String packageName, IPackageDataObserver observer) {
322 throw new UnsupportedOperationException();
323 }
324
325 /**
326 * @hide - to match hiding in superclass
327 */
328 @Override
329 public void freeStorageAndNotify(
330 long idealStorageSize, IPackageDataObserver observer) {
331 throw new UnsupportedOperationException();
332 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800333
334 /**
335 * @hide - to match hiding in superclass
336 */
337 @Override
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700338 public void freeStorage(
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700339 long idealStorageSize, IntentSender pi) {
340 throw new UnsupportedOperationException();
341 }
342
343 /**
344 * @hide - to match hiding in superclass
345 */
346 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800347 public void deletePackage(
348 String packageName, IPackageDeleteObserver observer, int flags) {
349 throw new UnsupportedOperationException();
350 }
351
352 @Override
353 public void addPackageToPreferred(String packageName) {
354 throw new UnsupportedOperationException();
355 }
356
357 @Override
358 public void removePackageFromPreferred(String packageName) {
359 throw new UnsupportedOperationException();
360 }
361
362 @Override
363 public List<PackageInfo> getPreferredPackages(int flags) {
364 throw new UnsupportedOperationException();
365 }
366
367 @Override
368 public void setComponentEnabledSetting(ComponentName componentName,
369 int newState, int flags) {
370 throw new UnsupportedOperationException();
371 }
372
373 @Override
374 public int getComponentEnabledSetting(ComponentName componentName) {
375 throw new UnsupportedOperationException();
376 }
377
378 @Override
379 public void setApplicationEnabledSetting(String packageName, int newState, int flags) {
380 throw new UnsupportedOperationException();
381 }
382
383 @Override
384 public int getApplicationEnabledSetting(String packageName) {
385 throw new UnsupportedOperationException();
386 }
387
388 @Override
389 public void addPreferredActivity(IntentFilter filter,
390 int match, ComponentName[] set, ComponentName activity) {
391 throw new UnsupportedOperationException();
392 }
393
Satish Sampath8dbe6122009-06-02 23:35:54 +0100394 /**
395 * @hide - to match hiding in superclass
396 */
397 @Override
398 public void replacePreferredActivity(IntentFilter filter,
399 int match, ComponentName[] set, ComponentName activity) {
400 throw new UnsupportedOperationException();
401 }
402
403
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800404 @Override
405 public void clearPackagePreferredActivities(String packageName) {
406 throw new UnsupportedOperationException();
407 }
408
409 /**
410 * @hide - to match hiding in superclass
411 */
412 @Override
413 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
414 throw new UnsupportedOperationException();
415 }
416
417 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800418 public int getPreferredActivities(List<IntentFilter> outFilters,
419 List<ComponentName> outActivities, String packageName) {
420 throw new UnsupportedOperationException();
421 }
422
423 @Override
424 public String[] getSystemSharedLibraryNames() {
425 throw new UnsupportedOperationException();
426 }
427
428 @Override
Dianne Hackborn49237342009-08-27 20:08:01 -0700429 public FeatureInfo[] getSystemAvailableFeatures() {
430 throw new UnsupportedOperationException();
431 }
432
433 @Override
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700434 public boolean hasSystemFeature(String name) {
435 throw new UnsupportedOperationException();
436 }
437
438 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800439 public boolean isSafeMode() {
440 throw new UnsupportedOperationException();
441 }
Oscar Montemayor539d3c42010-01-29 15:27:00 -0800442
443 /**
444 * @hide
445 */
446 @Override
Suchi Amalapurapu117818e2010-02-09 03:45:40 -0800447 public int recommendAppInstallLocation(PackageParser.Package pkg) {
Oscar Montemayor539d3c42010-01-29 15:27:00 -0800448 throw new UnsupportedOperationException();
449 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800450}