Robert Craig  committed 0f3b428

Force locked ops to always be in the off position.

Locked ops from an eops.xml policy should be conveyed
to the user in some manner. For now, simply force
the switch of all locked ops to be in the off position.
The user will be able to move the switch to the on
position but have the switch quickly moved back to the
off position. This code is simply a placeholder for
now til an alternate solution can be achieved. Notice,
at no time are any of the locked ops actually switched

  • Participants
  • Parent commits b501899

Comments (0)

Files changed (1)

File src/com/android/seandroid_admin/appops/

                         entry.getTimeText(res, true));
-                Switch sw = (Switch)view.findViewById(;
+                final Switch sw = (Switch)view.findViewById(;
                 final int switchOp = AppOpsManager.opToSwitch(firstOp.getOp());
                 sw.setChecked(mAppOps.checkOp(switchOp, entry.getPackageOps().getUid(),
                         entry.getPackageOps().getPackageName()) == AppOpsManager.MODE_ALLOWED);
                         mAppOps.setMode(switchOp, entry.getPackageOps().getUid(),
                                 entry.getPackageOps().getPackageName(), isChecked
                                 ? AppOpsManager.MODE_ALLOWED : AppOpsManager.MODE_IGNORED);
+                        // XXX: decide on a better way to display a locked op. for now just
+                        // force those locked ops to switch back off.
+                        if (isChecked && mAppOps.checkOp(switchOp, entry.getPackageOps().getUid(),
+                                             entry.getPackageOps().getPackageName()) != AppOpsManager.MODE_ALLOWED) {
+                            sw.setChecked(false);
+                        }