summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Philip P. Moltmann <moltmann@google.com> 2018-06-15 17:18:52 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-06-15 17:18:52 +0000
commitaf76df93e31c9e36fc3706c62b7a8b7df683a1a5 (patch)
tree04051ff700ac1793deec388ede7afce7c61e9273
parent1250cd140767231a92919d94a0173b3d0bd9a730 (diff)
parent004e489a251d6adf94922368e98a730185642123 (diff)
Merge "Abbreviate permission labels less aggressively" into pi-dev
-rw-r--r--core/java/android/widget/AppSecurityPermissions.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/core/java/android/widget/AppSecurityPermissions.java b/core/java/android/widget/AppSecurityPermissions.java
index 6df76fa2e09a..e6f948f2d969 100644
--- a/core/java/android/widget/AppSecurityPermissions.java
+++ b/core/java/android/widget/AppSecurityPermissions.java
@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
+import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PermissionGroupInfo;
@@ -590,7 +591,8 @@ public class AppSecurityPermissions {
private void addPermToList(List<MyPermissionInfo> permList,
MyPermissionInfo pInfo) {
if (pInfo.mLabel == null) {
- pInfo.mLabel = pInfo.loadLabel(mPm);
+ pInfo.mLabel = pInfo.loadSafeLabel(mPm, 20000, PackageItemInfo.SAFE_LABEL_FLAG_TRIM
+ | PackageItemInfo.SAFE_LABEL_FLAG_FIRST_LINE);
}
int idx = Collections.binarySearch(permList, pInfo, mPermComparator);
if(localLOGV) Log.i(TAG, "idx="+idx+", list.size="+permList.size());
@@ -611,7 +613,9 @@ public class AppSecurityPermissions {
}
MyPermissionGroupInfo group = mPermGroups.get(pInfo.group);
if (group != null) {
- pInfo.mLabel = pInfo.loadLabel(mPm);
+ pInfo.mLabel = pInfo.loadSafeLabel(mPm, 20000,
+ PackageItemInfo.SAFE_LABEL_FLAG_TRIM
+ | PackageItemInfo.SAFE_LABEL_FLAG_FIRST_LINE);
addPermToList(group.mAllPermissions, pInfo);
if (pInfo.mNew) {
addPermToList(group.mNewPermissions, pInfo);
@@ -622,14 +626,18 @@ public class AppSecurityPermissions {
for (MyPermissionGroupInfo pgrp : mPermGroups.values()) {
if (pgrp.labelRes != 0 || pgrp.nonLocalizedLabel != null) {
- pgrp.mLabel = pgrp.loadLabel(mPm);
+ pgrp.mLabel = pgrp.loadSafeLabel(mPm, 20000, PackageItemInfo.SAFE_LABEL_FLAG_TRIM
+ | PackageItemInfo.SAFE_LABEL_FLAG_FIRST_LINE);
} else {
ApplicationInfo app;
try {
app = mPm.getApplicationInfo(pgrp.packageName, 0);
- pgrp.mLabel = app.loadLabel(mPm);
+ pgrp.mLabel = app.loadSafeLabel(mPm, 20000, PackageItemInfo.SAFE_LABEL_FLAG_TRIM
+ | PackageItemInfo.SAFE_LABEL_FLAG_FIRST_LINE);
} catch (NameNotFoundException e) {
- pgrp.mLabel = pgrp.loadLabel(mPm);
+ pgrp.mLabel = pgrp.loadSafeLabel(mPm, 20000,
+ PackageItemInfo.SAFE_LABEL_FLAG_TRIM
+ | PackageItemInfo.SAFE_LABEL_FLAG_FIRST_LINE);
}
}
mPermGroupsList.add(pgrp);