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 @Override | |
104 public List<PackageInfo> getInstalledPackages(int flags) { | |
105 return mWrapped.getInstalledPackages(flags); | |
106 } | |
107 | |
108 @Override | |
109 public Intent getLaunchIntentForPackage(String packageName) { | |
110 return mWrapped.getLaunchIntentForPackage(packageName); | |
111 } | |
112 | |
113 @Override | |
114 public Intent getLeanbackLaunchIntentForPackage(String packageName) { | |
115 return mWrapped.getLeanbackLaunchIntentForPackage(packageName); | |
116 } | |
117 | |
118 @Override | |
119 public int[] getPackageGids(String packageName) throws NameNotFoundException
{ | |
120 return mWrapped.getPackageGids(packageName); | |
121 } | |
122 | |
123 @Override | |
124 public int[] getPackageGids(String packageName, int flags) throws NameNotFou
ndException { | |
125 return mWrapped.getPackageGids(packageName, flags); | |
126 } | |
127 | |
128 @Override | |
129 public PackageInfo getPackageInfo(String packageName, int flags) throws Name
NotFoundException { | |
130 return mWrapped.getPackageInfo(packageName, flags); | |
131 } | |
132 | |
133 @Override | |
134 public int getPackageUid(String packageName, int flags) throws NameNotFoundE
xception { | |
135 return mWrapped.getPackageUid(packageName, flags); | |
136 } | |
137 | |
138 @Override | |
139 public List<PackageInfo> getPackagesHoldingPermissions(String[] permissions,
int flags) { | |
140 return mWrapped.getPackagesHoldingPermissions(permissions, flags); | |
141 } | |
142 | |
143 @Override | |
144 public PermissionGroupInfo getPermissionGroupInfo(String name, int flags) | |
145 throws NameNotFoundException { | |
146 return mWrapped.getPermissionGroupInfo(name, flags); | |
147 } | |
148 | |
149 @Override | |
150 public PermissionInfo getPermissionInfo(String name, int flags) throws NameN
otFoundException { | |
151 return mWrapped.getPermissionInfo(name, flags); | |
152 } | |
153 | |
154 @Override | |
155 public ProviderInfo getProviderInfo(ComponentName component, int flags) | |
156 throws NameNotFoundException { | |
157 return mWrapped.getProviderInfo(component, flags); | |
158 } | |
159 | |
160 @Override | |
161 public ActivityInfo getReceiverInfo(ComponentName component, int flags) | |
162 throws NameNotFoundException { | |
163 return mWrapped.getReceiverInfo(component, flags); | |
164 } | |
165 | |
166 @Override | |
167 public ServiceInfo getServiceInfo(ComponentName component, int flags) | |
168 throws NameNotFoundException { | |
169 return mWrapped.getServiceInfo(component, flags); | |
170 } | |
171 | |
172 @Override | |
173 public boolean isPermissionRevokedByPolicy(String permName, String pkgName)
{ | |
174 return mWrapped.isPermissionRevokedByPolicy(permName, pkgName); | |
175 } | |
176 | |
177 @Override | |
178 public List<PermissionInfo> queryPermissionsByGroup(String group, int flags) | |
179 throws NameNotFoundException { | |
180 return mWrapped.queryPermissionsByGroup(group, flags); | |
181 } | |
182 | |
183 @Override | |
184 public void removePermission(String name) { | |
185 mWrapped.removePermission(name); | |
186 } | |
187 | |
188 @Override | |
189 public String[] getPackagesForUid(int uid) { | |
190 return mWrapped.getPackagesForUid(uid); | |
191 } | |
192 | |
193 @Override | |
194 public String getNameForUid(int uid) { | |
195 return mWrapped.getNameForUid(uid); | |
196 } | |
197 | |
198 @Override | |
199 public List<ApplicationInfo> getInstalledApplications(int flags) { | |
200 return mWrapped.getInstalledApplications(flags); | |
201 } | |
202 | |
203 @Override | |
204 public String[] getSystemSharedLibraryNames() { | |
205 return mWrapped.getSystemSharedLibraryNames(); | |
206 } | |
207 | |
208 @Override | |
209 public FeatureInfo[] getSystemAvailableFeatures() { | |
210 return mWrapped.getSystemAvailableFeatures(); | |
211 } | |
212 | |
213 @Override | |
214 public boolean hasSystemFeature(String name) { | |
215 return mWrapped.hasSystemFeature(name); | |
216 } | |
217 | |
218 @Override | |
219 public boolean hasSystemFeature(String name, int version) { | |
220 return mWrapped.hasSystemFeature(name, version); | |
221 } | |
222 | |
223 @Override | |
224 public ResolveInfo resolveActivity(Intent intent, int flags) { | |
225 return mWrapped.resolveActivity(intent, flags); | |
226 } | |
227 | |
228 @Override | |
229 public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) { | |
230 return mWrapped.queryIntentActivities(intent, flags); | |
231 } | |
232 | |
233 @Override | |
234 public List<ResolveInfo> queryIntentActivityOptions( | |
235 ComponentName caller, Intent[] specifics, Intent intent, int flags)
{ | |
236 return mWrapped.queryIntentActivityOptions(caller, specifics, intent, fl
ags); | |
237 } | |
238 | |
239 @Override | |
240 public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) { | |
241 return mWrapped.queryBroadcastReceivers(intent, flags); | |
242 } | |
243 | |
244 @Override | |
245 public ResolveInfo resolveService(Intent intent, int flags) { | |
246 return mWrapped.resolveService(intent, flags); | |
247 } | |
248 | |
249 @Override | |
250 public List<ResolveInfo> queryIntentServices(Intent intent, int flags) { | |
251 return mWrapped.queryIntentServices(intent, flags); | |
252 } | |
253 | |
254 @Override | |
255 public List<ResolveInfo> queryIntentContentProviders(Intent intent, int flag
s) { | |
256 return mWrapped.queryIntentContentProviders(intent, flags); | |
257 } | |
258 | |
259 @Override | |
260 public ProviderInfo resolveContentProvider(String name, int flags) { | |
261 return mWrapped.resolveContentProvider(name, flags); | |
262 } | |
263 | |
264 @Override | |
265 public List<ProviderInfo> queryContentProviders(String processName, int uid,
int flags) { | |
266 return mWrapped.queryContentProviders(processName, uid, flags); | |
267 } | |
268 | |
269 @Override | |
270 public InstrumentationInfo getInstrumentationInfo(ComponentName className, i
nt flags) | |
271 throws NameNotFoundException { | |
272 return mWrapped.getInstrumentationInfo(className, flags); | |
273 } | |
274 | |
275 @Override | |
276 public List<InstrumentationInfo> queryInstrumentation(String targetPackage,
int flags) { | |
277 return mWrapped.queryInstrumentation(targetPackage, flags); | |
278 } | |
279 | |
280 @Override | |
281 public Drawable getDrawable(String packageName, int resid, ApplicationInfo a
ppInfo) { | |
282 return mWrapped.getDrawable(packageName, resid, appInfo); | |
283 } | |
284 | |
285 @Override | |
286 public Drawable getActivityIcon(ComponentName activityName) throws NameNotFo
undException { | |
287 return mWrapped.getActivityIcon(activityName); | |
288 } | |
289 | |
290 @Override | |
291 public Drawable getActivityIcon(Intent intent) throws NameNotFoundException
{ | |
292 return mWrapped.getActivityIcon(intent); | |
293 } | |
294 | |
295 @Override | |
296 public Drawable getActivityBanner(ComponentName activityName) throws NameNot
FoundException { | |
297 return mWrapped.getActivityBanner(activityName); | |
298 } | |
299 | |
300 @Override | |
301 public Drawable getActivityBanner(Intent intent) throws NameNotFoundExceptio
n { | |
302 return mWrapped.getActivityBanner(intent); | |
303 } | |
304 | |
305 @Override | |
306 public Drawable getDefaultActivityIcon() { | |
307 return mWrapped.getDefaultActivityIcon(); | |
308 } | |
309 | |
310 @Override | |
311 public Drawable getApplicationIcon(ApplicationInfo info) { | |
312 return mWrapped.getApplicationIcon(info); | |
313 } | |
314 | |
315 @Override | |
316 public Drawable getApplicationIcon(String packageName) throws NameNotFoundEx
ception { | |
317 return mWrapped.getApplicationIcon(packageName); | |
318 } | |
319 | |
320 @Override | |
321 public Drawable getApplicationBanner(ApplicationInfo info) { | |
322 return mWrapped.getApplicationBanner(info); | |
323 } | |
324 | |
325 @Override | |
326 public Drawable getApplicationBanner(String packageName) throws NameNotFound
Exception { | |
327 return mWrapped.getApplicationBanner(packageName); | |
328 } | |
329 | |
330 @Override | |
331 public Drawable getActivityLogo(ComponentName activityName) throws NameNotFo
undException { | |
332 return mWrapped.getActivityLogo(activityName); | |
333 } | |
334 | |
335 @Override | |
336 public Drawable getActivityLogo(Intent intent) throws NameNotFoundException
{ | |
337 return mWrapped.getActivityLogo(intent); | |
338 } | |
339 | |
340 @Override | |
341 public Drawable getApplicationLogo(ApplicationInfo info) { | |
342 return mWrapped.getApplicationLogo(info); | |
343 } | |
344 | |
345 @Override | |
346 public Drawable getApplicationLogo(String packageName) throws NameNotFoundEx
ception { | |
347 return mWrapped.getApplicationLogo(packageName); | |
348 } | |
349 | |
350 @Override | |
351 public Drawable getUserBadgedIcon(Drawable icon, UserHandle user) { | |
352 return mWrapped.getUserBadgedIcon(icon, user); | |
353 } | |
354 | |
355 @Override | |
356 public Drawable getUserBadgedDrawableForDensity( | |
357 Drawable drawable, UserHandle user, Rect badgeLocation, int badgeDen
sity) { | |
358 return mWrapped.getUserBadgedDrawableForDensity( | |
359 drawable, user, badgeLocation, badgeDensity); | |
360 } | |
361 | |
362 @Override | |
363 public CharSequence getUserBadgedLabel(CharSequence label, UserHandle user)
{ | |
364 return mWrapped.getUserBadgedLabel(label, user); | |
365 } | |
366 | |
367 @Override | |
368 public CharSequence getText(String packageName, int resid, ApplicationInfo a
ppInfo) { | |
369 return mWrapped.getText(packageName, resid, appInfo); | |
370 } | |
371 | |
372 @Override | |
373 public XmlResourceParser getXml(String packageName, int resid, ApplicationIn
fo appInfo) { | |
374 return mWrapped.getXml(packageName, resid, appInfo); | |
375 } | |
376 | |
377 @Override | |
378 public CharSequence getApplicationLabel(ApplicationInfo info) { | |
379 return mWrapped.getApplicationLabel(info); | |
380 } | |
381 | |
382 @Override | |
383 public Resources getResourcesForActivity(ComponentName activityName) | |
384 throws NameNotFoundException { | |
385 return mWrapped.getResourcesForActivity(activityName); | |
386 } | |
387 | |
388 @Override | |
389 public Resources getResourcesForApplication(ApplicationInfo app) throws Name
NotFoundException { | |
390 return mWrapped.getResourcesForApplication(app); | |
391 } | |
392 | |
393 @Override | |
394 public Resources getResourcesForApplication(String appPackageName) | |
395 throws NameNotFoundException { | |
396 return mWrapped.getResourcesForApplication(appPackageName); | |
397 } | |
398 | |
399 @Override | |
400 public void verifyPendingInstall(int id, int verificationCode) { | |
401 mWrapped.verifyPendingInstall(id, verificationCode); | |
402 } | |
403 | |
404 @Override | |
405 public void extendVerificationTimeout( | |
406 int id, int verificationCodeAtTimeout, long millisecondsToDelay) { | |
407 mWrapped.extendVerificationTimeout(id, verificationCodeAtTimeout, millis
econdsToDelay); | |
408 } | |
409 | |
410 @Override | |
411 public void setInstallerPackageName(String targetPackage, String installerPa
ckageName) { | |
412 mWrapped.setInstallerPackageName(targetPackage, installerPackageName); | |
413 } | |
414 | |
415 @Override | |
416 public String getInstallerPackageName(String packageName) { | |
417 return mWrapped.getInstallerPackageName(packageName); | |
418 } | |
419 | |
420 @Deprecated | |
421 @Override | |
422 public void removePackageFromPreferred(String packageName) { | |
423 mWrapped.removePackageFromPreferred(packageName); | |
424 } | |
425 | |
426 @Override | |
427 public List<PackageInfo> getPreferredPackages(int flags) { | |
428 return mWrapped.getPreferredPackages(flags); | |
429 } | |
430 | |
431 @Override | |
432 public void clearPackagePreferredActivities(String packageName) { | |
433 mWrapped.clearPackagePreferredActivities(packageName); | |
434 } | |
435 | |
436 @Override | |
437 public int getPreferredActivities( | |
438 List<IntentFilter> outFilters, List<ComponentName> outActivities, St
ring packageName) { | |
439 return mWrapped.getPreferredActivities(outFilters, outActivities, packag
eName); | |
440 } | |
441 | |
442 @Override | |
443 public void setComponentEnabledSetting(ComponentName componentName, int newS
tate, int flags) { | |
444 mWrapped.setComponentEnabledSetting(componentName, newState, flags); | |
445 } | |
446 | |
447 @Override | |
448 public int getComponentEnabledSetting(ComponentName componentName) { | |
449 return mWrapped.getComponentEnabledSetting(componentName); | |
450 } | |
451 | |
452 @Override | |
453 public void setApplicationEnabledSetting(String packageName, int newState, i
nt flags) { | |
454 mWrapped.setApplicationEnabledSetting(packageName, newState, flags); | |
455 } | |
456 | |
457 @Override | |
458 public int getApplicationEnabledSetting(String packageName) { | |
459 return mWrapped.getApplicationEnabledSetting(packageName); | |
460 } | |
461 | |
462 @Override | |
463 public boolean isSafeMode() { | |
464 return mWrapped.isSafeMode(); | |
465 } | |
466 | |
467 @Override | |
468 public PackageInstaller getPackageInstaller() { | |
469 return mWrapped.getPackageInstaller(); | |
470 } | |
471 } | |
OLD | NEW |