Java Code Examples for android.content.pm.PackageManagerInternal#canAccessComponent()
The following examples show how to use
android.content.pm.PackageManagerInternal#canAccessComponent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Searchables.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
private ArrayList<ResolveInfo> createFilterdResolveInfoList(List<ResolveInfo> list) { if (list == null) { return null; } final ArrayList<ResolveInfo> resultList = new ArrayList<>(list.size()); final PackageManagerInternal pm = LocalServices.getService(PackageManagerInternal.class); final int callingUid = Binder.getCallingUid(); final int callingUserId = UserHandle.getCallingUserId(); for (ResolveInfo info : list) { if (pm.canAccessComponent( callingUid, info.activityInfo.getComponentName(), callingUserId)) { resultList.add(info); } } return resultList; }
Example 2
Source File: Searchables.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private ArrayList<SearchableInfo> createFilterdSearchableInfoList(List<SearchableInfo> list) { if (list == null) { return null; } final ArrayList<SearchableInfo> resultList = new ArrayList<>(list.size()); final PackageManagerInternal pm = LocalServices.getService(PackageManagerInternal.class); final int callingUid = Binder.getCallingUid(); final int callingUserId = UserHandle.getCallingUserId(); for (SearchableInfo info : list) { if (pm.canAccessComponent(callingUid, info.getSearchActivity(), callingUserId)) { resultList.add(info); } } return resultList; }
Example 3
Source File: Searchables.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Gets the name of the global search activity. */ public synchronized ComponentName getGlobalSearchActivity() { final PackageManagerInternal pm = LocalServices.getService(PackageManagerInternal.class); final int callingUid = Binder.getCallingUid(); final int callingUserId = UserHandle.getCallingUserId(); if (mCurrentGlobalSearchActivity != null && pm.canAccessComponent(callingUid, mCurrentGlobalSearchActivity, callingUserId)) { return mCurrentGlobalSearchActivity; } return null; }
Example 4
Source File: Searchables.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Gets the name of the web search activity. */ public synchronized ComponentName getWebSearchActivity() { final PackageManagerInternal pm = LocalServices.getService(PackageManagerInternal.class); final int callingUid = Binder.getCallingUid(); final int callingUserId = UserHandle.getCallingUserId(); if (mWebSearchActivity != null && pm.canAccessComponent(callingUid, mWebSearchActivity, callingUserId)) { return mWebSearchActivity; } return null; }