Merge "Abbreviate permission labels less aggressively" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
af76df93e3
@@ -21,6 +21,7 @@ import android.content.Context;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageItemInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.content.pm.PermissionGroupInfo;
|
import android.content.pm.PermissionGroupInfo;
|
||||||
@@ -590,7 +591,8 @@ public class AppSecurityPermissions {
|
|||||||
private void addPermToList(List<MyPermissionInfo> permList,
|
private void addPermToList(List<MyPermissionInfo> permList,
|
||||||
MyPermissionInfo pInfo) {
|
MyPermissionInfo pInfo) {
|
||||||
if (pInfo.mLabel == null) {
|
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);
|
int idx = Collections.binarySearch(permList, pInfo, mPermComparator);
|
||||||
if(localLOGV) Log.i(TAG, "idx="+idx+", list.size="+permList.size());
|
if(localLOGV) Log.i(TAG, "idx="+idx+", list.size="+permList.size());
|
||||||
@@ -611,7 +613,9 @@ public class AppSecurityPermissions {
|
|||||||
}
|
}
|
||||||
MyPermissionGroupInfo group = mPermGroups.get(pInfo.group);
|
MyPermissionGroupInfo group = mPermGroups.get(pInfo.group);
|
||||||
if (group != null) {
|
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);
|
addPermToList(group.mAllPermissions, pInfo);
|
||||||
if (pInfo.mNew) {
|
if (pInfo.mNew) {
|
||||||
addPermToList(group.mNewPermissions, pInfo);
|
addPermToList(group.mNewPermissions, pInfo);
|
||||||
@@ -622,14 +626,18 @@ public class AppSecurityPermissions {
|
|||||||
|
|
||||||
for (MyPermissionGroupInfo pgrp : mPermGroups.values()) {
|
for (MyPermissionGroupInfo pgrp : mPermGroups.values()) {
|
||||||
if (pgrp.labelRes != 0 || pgrp.nonLocalizedLabel != null) {
|
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 {
|
} else {
|
||||||
ApplicationInfo app;
|
ApplicationInfo app;
|
||||||
try {
|
try {
|
||||||
app = mPm.getApplicationInfo(pgrp.packageName, 0);
|
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) {
|
} 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);
|
mPermGroupsList.add(pgrp);
|
||||||
|
|||||||
Reference in New Issue
Block a user