OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package org.chromium.base.test; | |
6 | |
7 import android.content.ComponentName; | |
8 import android.content.Intent; | |
9 import android.content.IntentFilter; | |
10 import android.content.pm.ActivityInfo; | |
11 import android.content.pm.ApplicationInfo; | |
12 import android.content.pm.FeatureInfo; | |
13 import android.content.pm.InstrumentationInfo; | |
14 import android.content.pm.PackageInfo; | |
15 import android.content.pm.PackageInstaller; | |
16 import android.content.pm.PackageManager; | |
17 import android.content.pm.PermissionGroupInfo; | |
18 import android.content.pm.PermissionInfo; | |
19 import android.content.pm.ProviderInfo; | |
20 import android.content.pm.ResolveInfo; | |
21 import android.content.pm.ServiceInfo; | |
22 import android.content.res.Resources; | |
23 import android.content.res.XmlResourceParser; | |
24 import android.graphics.Rect; | |
25 import android.graphics.drawable.Drawable; | |
26 import android.os.UserHandle; | |
27 | |
28 import java.util.List; | |
29 | |
30 class PackageManagerWrapper extends PackageManager { | |
31 private PackageManager mWrapped; | |
32 | |
33 PackageManagerWrapper(PackageManager wrapped) { | |
34 super(); | |
35 mWrapped = wrapped; | |
36 } | |
37 | |
38 @Override | |
39 @Deprecated | |
40 public void addPackageToPreferred(String packageName) { | |
41 mWrapped.addPackageToPreferred(packageName); | |
42 } | |
43 | |
44 @Override | |
45 public boolean addPermission(PermissionInfo info) { | |
46 return mWrapped.addPermission(info); | |
47 } | |
48 | |
49 @Override | |
50 public boolean addPermissionAsync(PermissionInfo info) { | |
51 return mWrapped.addPermissionAsync(info); | |
52 } | |
53 | |
54 @Override | |
55 @Deprecated | |
56 public void addPreferredActivity( | |
57 IntentFilter filter, int match, ComponentName[] set, ComponentName a ctivity) { | |
58 mWrapped.addPreferredActivity(filter, match, set, activity); | |
59 } | |
60 | |
61 @Override | |
62 public String[] canonicalToCurrentPackageNames(String[] names) { | |
63 return mWrapped.canonicalToCurrentPackageNames(names); | |
64 } | |
65 | |
66 @Override | |
67 public int checkPermission(String permName, String pkgName) { | |
68 return mWrapped.checkPermission(permName, pkgName); | |
69 } | |
70 | |
71 @Override | |
72 public int checkSignatures(String pkg1, String pkg2) { | |
73 return mWrapped.checkSignatures(pkg1, pkg2); | |
74 } | |
75 | |
76 @Override | |
77 public int checkSignatures(int uid1, int uid2) { | |
78 return mWrapped.checkSignatures(uid1, uid2); | |
79 } | |
80 | |
81 @Override | |
82 public String[] currentToCanonicalPackageNames(String[] names) { | |
83 return mWrapped.currentToCanonicalPackageNames(names); | |
84 } | |
85 | |
86 @Override | |
87 public ActivityInfo getActivityInfo(ComponentName component, int flags) | |
88 throws NameNotFoundException { | |
89 return mWrapped.getActivityInfo(component, flags); | |
90 } | |
91 | |
92 @Override | |
93 public List<PermissionGroupInfo> getAllPermissionGroups(int flags) { | |
94 return mWrapped.getAllPermissionGroups(flags); | |
95 } | |
96 | |
97 @Override | |
98 public ApplicationInfo getApplicationInfo(String packageName, int flags) | |
99 throws NameNotFoundException { | |
100 return mWrapped.getApplicationInfo(packageName, flags); | |
101 } | |
102 | |
103 /* | |
104 @Override | |
agrieve
2017/04/23 01:47:52
Delete these?
jbudorick
2017/04/24 15:04:59
Hm, missed a couple.
Done.
| |
105 public ApplicationInfo getApplicationInfoAsUser(String packageName, | |
106 int flags, int userId) throws NameNotFoundException { | |
107 return mWrapped.getApplicationInfoAsUser(packageName, flags, userId); | |
108 } | |
109 */ | |
110 | |
111 @Override | |
112 public List<PackageInfo> getInstalledPackages(int flags) { | |
113 return mWrapped.getInstalledPackages(flags); | |
114 } | |
115 | |
116 /* | |
117 @Override | |
118 public List<PackageInfo> getInstalledPackagesAsUser(int flags, int userId) { | |
119 return mWrapped.getInstalledPackagesAsUser(flags, userId); | |
120 } | |
121 */ | |
122 | |
123 @Override | |
124 public Intent getLaunchIntentForPackage(String packageName) { | |
125 return mWrapped.getLaunchIntentForPackage(packageName); | |
126 } | |
127 | |
128 @Override | |
129 public Intent getLeanbackLaunchIntentForPackage(String packageName) { | |
130 return mWrapped.getLeanbackLaunchIntentForPackage(packageName); | |
131 } | |
132 | |
133 @Override | |
134 public int[] getPackageGids(String packageName) throws NameNotFoundException { | |
135 return mWrapped.getPackageGids(packageName); | |
136 } | |
137 | |
138 @Override | |
139 public int[] getPackageGids(String packageName, int flags) throws NameNotFou ndException { | |
140 return mWrapped.getPackageGids(packageName, flags); | |
141 } | |
142 | |
143 @Override | |
144 public PackageInfo getPackageInfo(String packageName, int flags) throws Name NotFoundException { | |
145 return mWrapped.getPackageInfo(packageName, flags); | |
146 } | |
147 | |
148 @Override | |
149 public int getPackageUid(String packageName, int flags) throws NameNotFoundE xception { | |
150 return mWrapped.getPackageUid(packageName, flags); | |
151 } | |
152 | |
153 @Override | |
154 public List<PackageInfo> getPackagesHoldingPermissions(String[] permissions, int flags) { | |
155 return mWrapped.getPackagesHoldingPermissions(permissions, flags); | |
156 } | |
157 | |
158 @Override | |
159 public PermissionGroupInfo getPermissionGroupInfo(String name, int flags) | |
160 throws NameNotFoundException { | |
161 return mWrapped.getPermissionGroupInfo(name, flags); | |
162 } | |
163 | |
164 @Override | |
165 public PermissionInfo getPermissionInfo(String name, int flags) throws NameN otFoundException { | |
166 return mWrapped.getPermissionInfo(name, flags); | |
167 } | |
168 | |
169 @Override | |
170 public ProviderInfo getProviderInfo(ComponentName component, int flags) | |
171 throws NameNotFoundException { | |
172 return mWrapped.getProviderInfo(component, flags); | |
173 } | |
174 | |
175 @Override | |
176 public ActivityInfo getReceiverInfo(ComponentName component, int flags) | |
177 throws NameNotFoundException { | |
178 return mWrapped.getReceiverInfo(component, flags); | |
179 } | |
180 | |
181 @Override | |
182 public ServiceInfo getServiceInfo(ComponentName component, int flags) | |
183 throws NameNotFoundException { | |
184 return mWrapped.getServiceInfo(component, flags); | |
185 } | |
186 | |
187 @Override | |
188 public boolean isPermissionRevokedByPolicy(String permName, String pkgName) { | |
189 return mWrapped.isPermissionRevokedByPolicy(permName, pkgName); | |
190 } | |
191 | |
192 @Override | |
193 public List<PermissionInfo> queryPermissionsByGroup(String group, int flags) | |
194 throws NameNotFoundException { | |
195 return mWrapped.queryPermissionsByGroup(group, flags); | |
196 } | |
197 | |
198 @Override | |
199 public void removePermission(String name) { | |
200 mWrapped.removePermission(name); | |
201 } | |
202 | |
203 @Override | |
204 public String[] getPackagesForUid(int uid) { | |
205 return mWrapped.getPackagesForUid(uid); | |
206 } | |
207 | |
208 @Override | |
209 public String getNameForUid(int uid) { | |
210 return mWrapped.getNameForUid(uid); | |
211 } | |
212 | |
213 @Override | |
214 public List<ApplicationInfo> getInstalledApplications(int flags) { | |
215 return mWrapped.getInstalledApplications(flags); | |
216 } | |
217 | |
218 @Override | |
219 public String[] getSystemSharedLibraryNames() { | |
220 return mWrapped.getSystemSharedLibraryNames(); | |
221 } | |
222 | |
223 @Override | |
224 public FeatureInfo[] getSystemAvailableFeatures() { | |
225 return mWrapped.getSystemAvailableFeatures(); | |
226 } | |
227 | |
228 @Override | |
229 public boolean hasSystemFeature(String name) { | |
230 return mWrapped.hasSystemFeature(name); | |
231 } | |
232 | |
233 @Override | |
234 public boolean hasSystemFeature(String name, int version) { | |
235 return mWrapped.hasSystemFeature(name, version); | |
236 } | |
237 | |
238 @Override | |
239 public ResolveInfo resolveActivity(Intent intent, int flags) { | |
240 return mWrapped.resolveActivity(intent, flags); | |
241 } | |
242 | |
243 @Override | |
244 public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) { | |
245 return mWrapped.queryIntentActivities(intent, flags); | |
246 } | |
247 | |
248 @Override | |
249 public List<ResolveInfo> queryIntentActivityOptions( | |
250 ComponentName caller, Intent[] specifics, Intent intent, int flags) { | |
251 return mWrapped.queryIntentActivityOptions(caller, specifics, intent, fl ags); | |
252 } | |
253 | |
254 @Override | |
255 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) { | |
256 return mWrapped.queryBroadcastReceivers(intent, flags); | |
257 } | |
258 | |
259 @Override | |
260 public ResolveInfo resolveService(Intent intent, int flags) { | |
261 return mWrapped.resolveService(intent, flags); | |
262 } | |
263 | |
264 @Override | |
265 public List<ResolveInfo> queryIntentServices(Intent intent, int flags) { | |
266 return mWrapped.queryIntentServices(intent, flags); | |
267 } | |
268 | |
269 @Override | |
270 public List<ResolveInfo> queryIntentContentProviders(Intent intent, int flag s) { | |
271 return mWrapped.queryIntentContentProviders(intent, flags); | |
272 } | |
273 | |
274 @Override | |
275 public ProviderInfo resolveContentProvider(String name, int flags) { | |
276 return mWrapped.resolveContentProvider(name, flags); | |
277 } | |
278 | |
279 @Override | |
280 public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) { | |
281 return mWrapped.queryContentProviders(processName, uid, flags); | |
282 } | |
283 | |
284 @Override | |
285 public InstrumentationInfo getInstrumentationInfo(ComponentName className, i nt flags) | |
286 throws NameNotFoundException { | |
287 return mWrapped.getInstrumentationInfo(className, flags); | |
288 } | |
289 | |
290 @Override | |
291 public List<InstrumentationInfo> queryInstrumentation(String targetPackage, int flags) { | |
292 return mWrapped.queryInstrumentation(targetPackage, flags); | |
293 } | |
294 | |
295 @Override | |
296 public Drawable getDrawable(String packageName, int resid, ApplicationInfo a ppInfo) { | |
297 return mWrapped.getDrawable(packageName, resid, appInfo); | |
298 } | |
299 | |
300 @Override | |
301 public Drawable getActivityIcon(ComponentName activityName) throws NameNotFo undException { | |
302 return mWrapped.getActivityIcon(activityName); | |
303 } | |
304 | |
305 @Override | |
306 public Drawable getActivityIcon(Intent intent) throws NameNotFoundException { | |
307 return mWrapped.getActivityIcon(intent); | |
308 } | |
309 | |
310 @Override | |
311 public Drawable getActivityBanner(ComponentName activityName) throws NameNot FoundException { | |
312 return mWrapped.getActivityBanner(activityName); | |
313 } | |
314 | |
315 @Override | |
316 public Drawable getActivityBanner(Intent intent) throws NameNotFoundExceptio n { | |
317 return mWrapped.getActivityBanner(intent); | |
318 } | |
319 | |
320 @Override | |
321 public Drawable getDefaultActivityIcon() { | |
322 return mWrapped.getDefaultActivityIcon(); | |
323 } | |
324 | |
325 @Override | |
326 public Drawable getApplicationIcon(ApplicationInfo info) { | |
327 return mWrapped.getApplicationIcon(info); | |
328 } | |
329 | |
330 @Override | |
331 public Drawable getApplicationIcon(String packageName) throws NameNotFoundEx ception { | |
332 return mWrapped.getApplicationIcon(packageName); | |
333 } | |
334 | |
335 @Override | |
336 public Drawable getApplicationBanner(ApplicationInfo info) { | |
337 return mWrapped.getApplicationBanner(info); | |
338 } | |
339 | |
340 @Override | |
341 public Drawable getApplicationBanner(String packageName) throws NameNotFound Exception { | |
342 return mWrapped.getApplicationBanner(packageName); | |
343 } | |
344 | |
345 @Override | |
346 public Drawable getActivityLogo(ComponentName activityName) throws NameNotFo undException { | |
347 return mWrapped.getActivityLogo(activityName); | |
348 } | |
349 | |
350 @Override | |
351 public Drawable getActivityLogo(Intent intent) throws NameNotFoundException { | |
352 return mWrapped.getActivityLogo(intent); | |
353 } | |
354 | |
355 @Override | |
356 public Drawable getApplicationLogo(ApplicationInfo info) { | |
357 return mWrapped.getApplicationLogo(info); | |
358 } | |
359 | |
360 @Override | |
361 public Drawable getApplicationLogo(String packageName) throws NameNotFoundEx ception { | |
362 return mWrapped.getApplicationLogo(packageName); | |
363 } | |
364 | |
365 @Override | |
366 public Drawable getUserBadgedIcon(Drawable icon, UserHandle user) { | |
367 return mWrapped.getUserBadgedIcon(icon, user); | |
368 } | |
369 | |
370 @Override | |
371 public Drawable getUserBadgedDrawableForDensity( | |
372 Drawable drawable, UserHandle user, Rect badgeLocation, int badgeDen sity) { | |
373 return mWrapped.getUserBadgedDrawableForDensity( | |
374 drawable, user, badgeLocation, badgeDensity); | |
375 } | |
376 | |
377 @Override | |
378 public CharSequence getUserBadgedLabel(CharSequence label, UserHandle user) { | |
379 return mWrapped.getUserBadgedLabel(label, user); | |
380 } | |
381 | |
382 @Override | |
383 public CharSequence getText(String packageName, int resid, ApplicationInfo a ppInfo) { | |
384 return mWrapped.getText(packageName, resid, appInfo); | |
385 } | |
386 | |
387 @Override | |
388 public XmlResourceParser getXml(String packageName, int resid, ApplicationIn fo appInfo) { | |
389 return mWrapped.getXml(packageName, resid, appInfo); | |
390 } | |
391 | |
392 @Override | |
393 public CharSequence getApplicationLabel(ApplicationInfo info) { | |
394 return mWrapped.getApplicationLabel(info); | |
395 } | |
396 | |
397 @Override | |
398 public Resources getResourcesForActivity(ComponentName activityName) | |
399 throws NameNotFoundException { | |
400 return mWrapped.getResourcesForActivity(activityName); | |
401 } | |
402 | |
403 @Override | |
404 public Resources getResourcesForApplication(ApplicationInfo app) throws Name NotFoundException { | |
405 return mWrapped.getResourcesForApplication(app); | |
406 } | |
407 | |
408 @Override | |
409 public Resources getResourcesForApplication(String appPackageName) | |
410 throws NameNotFoundException { | |
411 return mWrapped.getResourcesForApplication(appPackageName); | |
412 } | |
413 | |
414 @Override | |
415 public void verifyPendingInstall(int id, int verificationCode) { | |
416 mWrapped.verifyPendingInstall(id, verificationCode); | |
417 } | |
418 | |
419 @Override | |
420 public void extendVerificationTimeout( | |
421 int id, int verificationCodeAtTimeout, long millisecondsToDelay) { | |
422 mWrapped.extendVerificationTimeout(id, verificationCodeAtTimeout, millis econdsToDelay); | |
423 } | |
424 | |
425 @Override | |
426 public void setInstallerPackageName(String targetPackage, String installerPa ckageName) { | |
427 mWrapped.setInstallerPackageName(targetPackage, installerPackageName); | |
428 } | |
429 | |
430 @Override | |
431 public String getInstallerPackageName(String packageName) { | |
432 return mWrapped.getInstallerPackageName(packageName); | |
433 } | |
434 | |
435 @Deprecated | |
436 @Override | |
437 public void removePackageFromPreferred(String packageName) { | |
438 mWrapped.removePackageFromPreferred(packageName); | |
439 } | |
440 | |
441 @Override | |
442 public List<PackageInfo> getPreferredPackages(int flags) { | |
443 return mWrapped.getPreferredPackages(flags); | |
444 } | |
445 | |
446 @Override | |
447 public void clearPackagePreferredActivities(String packageName) { | |
448 mWrapped.clearPackagePreferredActivities(packageName); | |
449 } | |
450 | |
451 @Override | |
452 public int getPreferredActivities( | |
453 List<IntentFilter> outFilters, List<ComponentName> outActivities, St ring packageName) { | |
454 return mWrapped.getPreferredActivities(outFilters, outActivities, packag eName); | |
455 } | |
456 | |
457 @Override | |
458 public void setComponentEnabledSetting(ComponentName componentName, int newS tate, int flags) { | |
459 mWrapped.setComponentEnabledSetting(componentName, newState, flags); | |
460 } | |
461 | |
462 @Override | |
463 public int getComponentEnabledSetting(ComponentName componentName) { | |
464 return mWrapped.getComponentEnabledSetting(componentName); | |
465 } | |
466 | |
467 @Override | |
468 public void setApplicationEnabledSetting(String packageName, int newState, i nt flags) { | |
469 mWrapped.setApplicationEnabledSetting(packageName, newState, flags); | |
470 } | |
471 | |
472 @Override | |
473 public int getApplicationEnabledSetting(String packageName) { | |
474 return mWrapped.getApplicationEnabledSetting(packageName); | |
475 } | |
476 | |
477 @Override | |
478 public boolean isSafeMode() { | |
479 return mWrapped.isSafeMode(); | |
480 } | |
481 | |
482 @Override | |
483 public PackageInstaller getPackageInstaller() { | |
484 return mWrapped.getPackageInstaller(); | |
485 } | |
486 } | |
OLD | NEW |