List of usage examples for android.content.pm PackageManager getPermissionGroupInfo
public abstract PermissionGroupInfo getPermissionGroupInfo(String name, @PermissionGroupInfoFlags int flags) throws NameNotFoundException;
From source file:org.microg.tools.selfcheck.PermissionCheckGroup.java
private void doPermissionCheck(Context context, ResultCollector collector, final String permission) { PackageManager pm = context.getPackageManager(); try {// w w w . ja va 2s . c o m PermissionInfo info = pm.getPermissionInfo(permission, 0); PermissionGroupInfo groupInfo = info.group != null ? pm.getPermissionGroupInfo(info.group, 0) : null; CharSequence permLabel = info.loadLabel(pm); CharSequence groupLabel = groupInfo != null ? groupInfo.loadLabel(pm) : permLabel; collector.addResult(context.getString(R.string.self_check_name_permission, permLabel), context.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED ? Positive : Negative, context.getString(R.string.self_check_resolution_permission, groupLabel), new SelfCheckGroup.CheckResolver() { @Override public void tryResolve(Fragment fragment) { fragment.requestPermissions(new String[] { permission }, 0); } }); } catch (PackageManager.NameNotFoundException e) { Log.w(TAG, e); } }