Commits

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
on.

  • Participants
  • Parent commits b501899

Comments (0)

Files changed (1)

File src/com/android/seandroid_admin/appops/AppOpsDetails.java

                         entry.getSwitchText(mState));
                 ((TextView)view.findViewById(R.id.op_time)).setText(
                         entry.getTimeText(res, true));
-                Switch sw = (Switch)view.findViewById(R.id.switchWidget);
+                final Switch sw = (Switch)view.findViewById(R.id.switchWidget);
                 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);
+                        }
                     }
                 });
             }