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

View File

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