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