blob: 2ccc9bb50d1b50cd0c2c37fda08b09d53815507f [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
145 public void removePermission(String name) {
146 throw new UnsupportedOperationException();
147 }
148
149 @Override
150 public int checkSignatures(String pkg1, String pkg2) {
151 throw new UnsupportedOperationException();
152 }
153
154 @Override
Dianne Hackborn766cbfe2009-08-12 18:33:39 -0700155 public int checkSignatures(int uid1, int uid2) {
156 throw new UnsupportedOperationException();
157 }
158
159 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800160 public String[] getPackagesForUid(int uid) {
161 throw new UnsupportedOperationException();
162 }
163
164 @Override
165 public String getNameForUid(int uid) {
166 throw new UnsupportedOperationException();
167 }
168
169 /**
170 * @hide - to match hiding in superclass
171 */
172 @Override
173 public int getUidForSharedUser(String sharedUserName) {
174 throw new UnsupportedOperationException();
175 }
176
177 @Override
178 public List<ApplicationInfo> getInstalledApplications(int flags) {
179 throw new UnsupportedOperationException();
180 }
181
182 @Override
183 public ResolveInfo resolveActivity(Intent intent, int flags) {
184 throw new UnsupportedOperationException();
185 }
186
187 @Override
188 public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) {
189 throw new UnsupportedOperationException();
190 }
191
192 @Override
193 public List<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
194 Intent[] specifics, Intent intent, int flags) {
195 throw new UnsupportedOperationException();
196 }
197
198 @Override
199 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) {
200 throw new UnsupportedOperationException();
201 }
202
203 @Override
204 public ResolveInfo resolveService(Intent intent, int flags) {
205 throw new UnsupportedOperationException();
206 }
207
208 @Override
209 public List<ResolveInfo> queryIntentServices(Intent intent, int flags) {
210 throw new UnsupportedOperationException();
211 }
212
213 @Override
214 public ProviderInfo resolveContentProvider(String name, int flags) {
215 throw new UnsupportedOperationException();
216 }
217
218 @Override
219 public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) {
220 throw new UnsupportedOperationException();
221 }
222
223 @Override
224 public InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags)
225 throws NameNotFoundException {
226 throw new UnsupportedOperationException();
227 }
228
229 @Override
230 public List<InstrumentationInfo> queryInstrumentation(
231 String targetPackage, int flags) {
232 throw new UnsupportedOperationException();
233 }
234
235 @Override
236 public Drawable getDrawable(String packageName, int resid, ApplicationInfo appInfo) {
237 throw new UnsupportedOperationException();
238 }
239
240 @Override
241 public Drawable getActivityIcon(ComponentName activityName)
242 throws NameNotFoundException {
243 throw new UnsupportedOperationException();
244 }
245
246 @Override
247 public Drawable getActivityIcon(Intent intent) throws NameNotFoundException {
248 throw new UnsupportedOperationException();
249 }
250
251 @Override
252 public Drawable getDefaultActivityIcon() {
253 throw new UnsupportedOperationException();
254 }
255
256 @Override
257 public Drawable getApplicationIcon(ApplicationInfo info) {
258 throw new UnsupportedOperationException();
259 }
260
261 @Override
262 public Drawable getApplicationIcon(String packageName) throws NameNotFoundException {
263 throw new UnsupportedOperationException();
264 }
265
266 @Override
267 public CharSequence getText(String packageName, int resid, ApplicationInfo appInfo) {
268 throw new UnsupportedOperationException();
269 }
270
271 @Override
272 public XmlResourceParser getXml(String packageName, int resid,
273 ApplicationInfo appInfo) {
274 throw new UnsupportedOperationException();
275 }
276
277 @Override
278 public CharSequence getApplicationLabel(ApplicationInfo info) {
279 throw new UnsupportedOperationException();
280 }
281
282 @Override
283 public Resources getResourcesForActivity(ComponentName activityName)
284 throws NameNotFoundException {
285 throw new UnsupportedOperationException();
286 }
287
288 @Override
289 public Resources getResourcesForApplication(ApplicationInfo app) {
290 throw new UnsupportedOperationException();
291 }
292
293 @Override
294 public Resources getResourcesForApplication(String appPackageName)
295 throws NameNotFoundException {
296 throw new UnsupportedOperationException();
297 }
298
299 @Override
300 public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
301 throw new UnsupportedOperationException();
302 }
303
Dianne Hackbornade3eca2009-05-11 18:54:45 -0700304 /**
305 * @hide - to match hiding in superclass
306 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800307 @Override
308 public void installPackage(Uri packageURI, IPackageInstallObserver observer,
Jacek Surazski65e13172009-04-28 15:26:38 +0200309 int flags, String installerPackageName) {
310 throw new UnsupportedOperationException();
311 }
Suchi Amalapurapu8946dd32010-02-19 09:19:34 -0800312
313 /**
314 * @hide - to match hiding in superclass
315 */
316 @Override
317 public void movePackage(String packageName, IPackageMoveObserver observer, int flags) {
318 throw new UnsupportedOperationException();
319 }
Jacek Surazski65e13172009-04-28 15:26:38 +0200320
321 @Override
322 public String getInstallerPackageName(String packageName) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800323 throw new UnsupportedOperationException();
324 }
325
326 /**
327 * @hide - to match hiding in superclass
328 */
329 @Override
330 public void clearApplicationUserData(
331 String packageName, IPackageDataObserver observer) {
332 throw new UnsupportedOperationException();
333 }
334
335 /**
336 * @hide - to match hiding in superclass
337 */
338 @Override
339 public void deleteApplicationCacheFiles(
340 String packageName, IPackageDataObserver observer) {
341 throw new UnsupportedOperationException();
342 }
343
344 /**
345 * @hide - to match hiding in superclass
346 */
347 @Override
348 public void freeStorageAndNotify(
349 long idealStorageSize, IPackageDataObserver observer) {
350 throw new UnsupportedOperationException();
351 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800352
353 /**
354 * @hide - to match hiding in superclass
355 */
356 @Override
Suchi Amalapurapubc806f62009-06-17 15:18:19 -0700357 public void freeStorage(
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -0700358 long idealStorageSize, IntentSender pi) {
359 throw new UnsupportedOperationException();
360 }
361
362 /**
363 * @hide - to match hiding in superclass
364 */
365 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800366 public void deletePackage(
367 String packageName, IPackageDeleteObserver observer, int flags) {
368 throw new UnsupportedOperationException();
369 }
370
371 @Override
372 public void addPackageToPreferred(String packageName) {
373 throw new UnsupportedOperationException();
374 }
375
376 @Override
377 public void removePackageFromPreferred(String packageName) {
378 throw new UnsupportedOperationException();
379 }
380
381 @Override
382 public List<PackageInfo> getPreferredPackages(int flags) {
383 throw new UnsupportedOperationException();
384 }
385
386 @Override
387 public void setComponentEnabledSetting(ComponentName componentName,
388 int newState, int flags) {
389 throw new UnsupportedOperationException();
390 }
391
392 @Override
393 public int getComponentEnabledSetting(ComponentName componentName) {
394 throw new UnsupportedOperationException();
395 }
396
397 @Override
398 public void setApplicationEnabledSetting(String packageName, int newState, int flags) {
399 throw new UnsupportedOperationException();
400 }
401
402 @Override
403 public int getApplicationEnabledSetting(String packageName) {
404 throw new UnsupportedOperationException();
405 }
406
407 @Override
408 public void addPreferredActivity(IntentFilter filter,
409 int match, ComponentName[] set, ComponentName activity) {
410 throw new UnsupportedOperationException();
411 }
412
Satish Sampath8dbe6122009-06-02 23:35:54 +0100413 /**
414 * @hide - to match hiding in superclass
415 */
416 @Override
417 public void replacePreferredActivity(IntentFilter filter,
418 int match, ComponentName[] set, ComponentName activity) {
419 throw new UnsupportedOperationException();
420 }
421
422
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423 @Override
424 public void clearPackagePreferredActivities(String packageName) {
425 throw new UnsupportedOperationException();
426 }
427
428 /**
429 * @hide - to match hiding in superclass
430 */
431 @Override
432 public void getPackageSizeInfo(String packageName, IPackageStatsObserver observer) {
433 throw new UnsupportedOperationException();
434 }
435
436 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800437 public int getPreferredActivities(List<IntentFilter> outFilters,
438 List<ComponentName> outActivities, String packageName) {
439 throw new UnsupportedOperationException();
440 }
441
442 @Override
443 public String[] getSystemSharedLibraryNames() {
444 throw new UnsupportedOperationException();
445 }
446
447 @Override
Dianne Hackborn49237342009-08-27 20:08:01 -0700448 public FeatureInfo[] getSystemAvailableFeatures() {
449 throw new UnsupportedOperationException();
450 }
451
452 @Override
Dianne Hackborn039c68e2009-09-26 16:39:23 -0700453 public boolean hasSystemFeature(String name) {
454 throw new UnsupportedOperationException();
455 }
456
457 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800458 public boolean isSafeMode() {
459 throw new UnsupportedOperationException();
460 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800461}