summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-07-18 16:49:59 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2013-07-18 16:49:59 -0700
commitdd7ce06a478210cb8181b00c59d6773f27264af4 (patch)
treef8f0cc4fb710384d1f3e3f386285060eb023704e
parent1d0cc231bf09d46f7f6fdd7d69e036fb458b410a (diff)
parent22bf8e8dac582e327b18ccc196406e73fabadede (diff)
downloadpackages_apps_settings-dd7ce06a478210cb8181b00c59d6773f27264af4.zip
packages_apps_settings-dd7ce06a478210cb8181b00c59d6773f27264af4.tar.gz
packages_apps_settings-dd7ce06a478210cb8181b00c59d6773f27264af4.tar.bz2
Merge "Add a quick SELinux mode toggle" into cm-10.1
-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);
}