+ private void updateRootAccessOptions() {
+ String value = SystemProperties.get(ROOT_ACCESS_PROPERTY, "1");
+ mRootAccess.setValue(value);
+ mRootAccess.setSummary(getResources()
+ .getStringArray(R.array.root_access_entries)[Integer.valueOf(value)]);
+ }
+
+ private void writeRootAccessOptions(Object newValue) {
+ String oldValue = SystemProperties.get(ROOT_ACCESS_PROPERTY, "1");
+ SystemProperties.set(ROOT_ACCESS_PROPERTY, newValue.toString());
+ if (Integer.valueOf(newValue.toString()) < 2 && !oldValue.equals(newValue)
+ && "1".equals(SystemProperties.get("service.adb.root", "0"))) {
+ SystemProperties.set("service.adb.root", "0");
+ Settings.Secure.putInt(getActivity().getContentResolver(),
+ Settings.Secure.ADB_ENABLED, 0);
+ Settings.Secure.putInt(getActivity().getContentResolver(),
+ Settings.Secure.ADB_ENABLED, 1);
+ }
+ updateRootAccessOptions();
+ }
+
+ private void resetRootAccessOptions() {
+ String oldValue = SystemProperties.get(ROOT_ACCESS_PROPERTY, "1");
+ SystemProperties.set(ROOT_ACCESS_PROPERTY, "1");
+ if (!oldValue.equals("1") && "1".equals(SystemProperties.get("service.adb.root", "0"))) {
+ SystemProperties.set("service.adb.root", "0");
+ Settings.Secure.putInt(getActivity().getContentResolver(),
+ Settings.Secure.ADB_ENABLED, 0);
+ Settings.Secure.putInt(getActivity().getContentResolver(),
+ Settings.Secure.ADB_ENABLED, 1);
+ }
+ updateRootAccessOptions();
+ }
+