List of usage examples for android.content.pm PermissionInfo loadDescription
public CharSequence loadDescription(PackageManager pm)
From source file:com.github.michalbednarski.intentslab.PermissionInfoFragment.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true);/*w ww .j a va2 s . c o m*/ // Get system services mPm = getActivity().getApplicationContext().getPackageManager(); final String permissionName = getArguments().getString(ARG_PERMISSION_NAME); // Get information about permission itself FormattedTextBuilder headerText = new FormattedTextBuilder(); headerText.appendGlobalHeader(permissionName); try { final PermissionInfo permissionInfo = mPm.getPermissionInfo(permissionName, 0); headerText.appendGlobalHeader(String.valueOf(permissionInfo.loadLabel(mPm))); headerText.appendValue(getString(R.string.description), String.valueOf(permissionInfo.loadDescription(mPm))); try { if (permissionInfo.group != null) { headerText.appendValue(getString(R.string.permission_group_name), permissionInfo.group); final PermissionGroupInfo permissionGroupInfo = mPm.getPermissionGroupInfo(permissionInfo.group, 0); headerText.appendValueNoNewLine(getString(R.string.permission_group_label), String.valueOf(permissionGroupInfo.loadLabel(mPm))); headerText.appendValueNoNewLine(getString(R.string.permission_group_description), String.valueOf(permissionGroupInfo.loadDescription(mPm))); } } catch (PackageManager.NameNotFoundException ignored) { } headerText.appendValue(getString(R.string.permission_protection_level), protectionLevelToString(permissionInfo.protectionLevel)); mDefinedBy = mPm.getPackageInfo(permissionInfo.packageName, 0); } catch (PackageManager.NameNotFoundException e) { // Undeclared permission e.printStackTrace(); } mDetailsText = headerText.getText(); (new ScanUsingAppsTask()).execute(permissionName); }