@Override public List<PermissionInfo> queryPermissionsByGroup(String group, int flags) throws RemoteException { waitForReadyInner(); try { enforcePluginFileExists(); List<PermissionInfo> list = new ArrayList<PermissionInfo>(); if (shouldNotBlockOtherInfo()) { for (PluginPackageParser pluginPackageParser : mPluginCache.values()) { List<PermissionInfo> permissionInfos = pluginPackageParser.getPermissions(); for (PermissionInfo permissionInfo : permissionInfos) { if (TextUtils.equals(permissionInfo.group, group) && !list.contains(permissionInfo)) { list.add(permissionInfo); } } } } else { List<String> pkgs = mActivityManagerService.getPackageNamesByPid(Binder.getCallingPid()); for (PluginPackageParser pluginPackageParser : mPluginCache.values()) { List<PermissionInfo> permissionInfos = pluginPackageParser.getPermissions(); for (PermissionInfo permissionInfo : permissionInfos) { if (pkgs.contains(permissionInfo.packageName) && TextUtils.equals(permissionInfo.group, group) && !list.contains(permissionInfo)) { list.add(permissionInfo); } } } } return list; } catch (Exception e) { handleException(e); } return null; }
@Override public PermissionInfo getPermissionInfo(String name, int flags) throws RemoteException { waitForReadyInner(); try { enforcePluginFileExists(); if (shouldNotBlockOtherInfo()) { for (PluginPackageParser pluginPackageParser : mPluginCache.values()) { List<PermissionInfo> permissionInfos = pluginPackageParser.getPermissions(); for (PermissionInfo permissionInfo : permissionInfos) { if (TextUtils.equals(permissionInfo.name, name)) { return permissionInfo; } } } } else { List<String> pkgs = mActivityManagerService.getPackageNamesByPid(Binder.getCallingPid()); for (PluginPackageParser pluginPackageParser : mPluginCache.values()) { List<PermissionInfo> permissionInfos = pluginPackageParser.getPermissions(); for (PermissionInfo permissionInfo : permissionInfos) { if (TextUtils.equals(permissionInfo.name, name) && pkgs.contains(permissionInfo.packageName)) { return permissionInfo; } } } } } catch (Exception e) { handleException(e); } return null; }