Add support for SE Android to the Settings app.
Display SELinux status (disabled, permissive, enforcing) under About phone. Change-Id: I69529fb7a3adfe31eccb16d79740fc4952ff5e68
This commit is contained in:
committed by
William Roberts
parent
9ad4a89877
commit
b4e84f34e0
@@ -23,6 +23,7 @@ import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.SELinux;
|
||||
import android.os.SystemClock;
|
||||
import android.os.SystemProperties;
|
||||
import android.preference.Preference;
|
||||
@@ -53,9 +54,11 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
|
||||
private static final String KEY_COPYRIGHT = "copyright";
|
||||
private static final String KEY_SYSTEM_UPDATE_SETTINGS = "system_update_settings";
|
||||
private static final String PROPERTY_URL_SAFETYLEGAL = "ro.url.safetylegal";
|
||||
private static final String PROPERTY_SELINUX_STATUS = "ro.build.selinux";
|
||||
private static final String KEY_KERNEL_VERSION = "kernel_version";
|
||||
private static final String KEY_BUILD_NUMBER = "build_number";
|
||||
private static final String KEY_DEVICE_MODEL = "device_model";
|
||||
private static final String KEY_SELINUX_STATUS = "selinux_status";
|
||||
private static final String KEY_BASEBAND_VERSION = "baseband_version";
|
||||
private static final String KEY_FIRMWARE_VERSION = "firmware_version";
|
||||
private static final String KEY_UPDATE_SETTING = "additional_system_update_settings";
|
||||
@@ -75,6 +78,18 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
|
||||
setStringSummary(KEY_BUILD_NUMBER, Build.DISPLAY);
|
||||
findPreference(KEY_KERNEL_VERSION).setSummary(getFormattedKernelVersion());
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// Remove selinux information if property is not present
|
||||
removePreferenceIfPropertyMissing(getPreferenceScreen(), KEY_SELINUX_STATUS,
|
||||
PROPERTY_SELINUX_STATUS);
|
||||
|
||||
// Remove Safety information preference if PROPERTY_URL_SAFETYLEGAL is not set
|
||||
removePreferenceIfPropertyMissing(getPreferenceScreen(), "safetylegal",
|
||||
PROPERTY_URL_SAFETYLEGAL);
|
||||
|
Reference in New Issue
Block a user