summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/settings/DeviceInfoSettings.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index 3f8aca3..23fa672 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -102,6 +102,7 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
String status = getResources().getString(R.string.selinux_status_permissive);
setStringSummary(KEY_SELINUX_STATUS, status);
}
+ findPreference(KEY_SELINUX_STATUS).setEnabled(true);
// Remove selinux information if property is not present
removePreferenceIfPropertyMissing(getPreferenceScreen(), KEY_SELINUX_STATUS,
@@ -252,6 +253,22 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
Log.e(LOG_TAG, "Unable to start activity " + intent.toString());
}
}
+ } else if (preference.getKey().equals(KEY_SELINUX_STATUS)) {
+ System.arraycopy(mHits, 1, mHits, 0, mHits.length-1);
+ mHits[mHits.length-1] = SystemClock.uptimeMillis();
+ if (mHits[0] >= (SystemClock.uptimeMillis()-500)) {
+ SELinux.setSELinuxEnforce(!SELinux.isSELinuxEnforced());
+ if (!SELinux.isSELinuxEnabled()) {
+ String status = getResources().getString(R.string.selinux_status_disabled);
+ setStringSummary(KEY_SELINUX_STATUS, status);
+ } else if (!SELinux.isSELinuxEnforced()) {
+ String status = getResources().getString(R.string.selinux_status_permissive);
+ setStringSummary(KEY_SELINUX_STATUS, status);
+ } else if (SELinux.isSELinuxEnforced()) {
+ String status = getResources().getString(R.string.selinux_status_enforcing);
+ setStringSummary(KEY_SELINUX_STATUS, status);
+ }
+ }
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}