Merge "Fix bugs with null AppOp permissions."

This commit is contained in:
Daniel Sandler
2013-02-01 14:43:38 +00:00
committed by Android (Google) Code Review
2 changed files with 41 additions and 37 deletions

View File

@@ -123,6 +123,7 @@ public class AppOpsDetails extends Fragment {
mOperationsSection, false);
mOperationsSection.addView(view);
String perm = AppOpsManager.opToPermission(op.getOp());
if (perm != null) {
try {
PermissionInfo pi = mPm.getPermissionInfo(perm, 0);
if (pi.group != null && !lastPermGroup.equals(pi.group)) {
@@ -135,6 +136,7 @@ public class AppOpsDetails extends Fragment {
}
} catch (NameNotFoundException e) {
}
}
((TextView)view.findViewById(R.id.op_name)).setText(mState.getLabelText(op));
((TextView)view.findViewById(R.id.op_time)).setText(mState.getTimeText(op));
Switch sw = (Switch)view.findViewById(R.id.switchWidget);

View File

@@ -359,7 +359,7 @@ public class AppOpsState {
ArrayList<Integer> permOps = new ArrayList<Integer>();
for (int i=0; i<tpl.ops.length; i++) {
String perm = AppOpsManager.opToPermission(tpl.ops[i]);
if (!perms.contains(perm)) {
if (perm != null && !perms.contains(perm)) {
perms.add(perm);
permOps.add(tpl.ops[i]);
}
@@ -408,6 +408,7 @@ public class AppOpsState {
}
List<AppOpsManager.OpEntry> dummyOps = null;
AppOpsManager.PackageOps pkgOps = null;
if (appInfo.requestedPermissions != null) {
for (int j=0; j<appInfo.requestedPermissions.length; j++) {
if (appInfo.requestedPermissionsFlags != null) {
if ((appInfo.requestedPermissionsFlags[j]
@@ -441,6 +442,7 @@ public class AppOpsState {
}
}
}
}
// Sort the list.
Collections.sort(entries, APP_OP_COMPARATOR);