[PATCH] Initial support for translatable SEAndroid strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 res/values/strings.xml                           |    5 +++++
 src/com/android/settings/DeviceInfoSettings.java |   14 +++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/res/values/strings.xml b/res/values/strings.xml
index fb70aa2..2d2f028 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3785,5 +3785,10 @@ found in the list of installed apps.</string>
     from their cell phone carrier. The use of the string is similar to the string
     "system_update_settings_list_item_title" in this project. [CHAR LIMIT=25] -->
     <string name="additional_system_update_settings_list_item_title">Additional system updates</string>
+    <!-- SELinux statuses that are displayed if the user has a SE Android enabled
+    device. These are displayed by the settings app in the about section. -->
+    <string name="selinux_status_disabled">"Disabled"</string>
+    <string name="selinux_status_permissive">"Permissive"</string>
+    <string name="selinux_status_enforcing">"Enforcing"</string>
 
 </resources>
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index c2418b6..a8a5510 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -55,6 +55,7 @@ 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";
@@ -77,14 +78,21 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
         setStringSummary(KEY_DEVICE_MODEL, Build.MODEL + getMsvSuffix());
         setStringSummary(KEY_BUILD_NUMBER, Build.DISPLAY);
         findPreference(KEY_KERNEL_VERSION).setSummary(getFormattedKernelVersion());
+
         if (!SELinux.isSELinuxEnabled()) {
-            setStringSummary(KEY_SELINUX_STATUS, "disabled");
+            String status = getResources().getString(R.string.selinux_status_disabled);
+            setStringSummary(KEY_SELINUX_STATUS, status);
         } else if (!SELinux.isSELinuxEnforced()) {
-            setStringSummary(KEY_SELINUX_STATUS, "permissive");
+            String status = getResources().getString(R.string.selinux_status_permissive);
+            setStringSummary(KEY_SELINUX_STATUS, status);
         } else {
-            setStringSummary(KEY_SELINUX_STATUS, "enforcing");
+            String status = getResources().getString(R.string.selinux_status_enforcing);
+            setStringSummary(KEY_SELINUX_STATUS, status);
         }
 
+        // Remove selinux information if property is not present
+        removePreferenceIfPropertyMissing(getPreferenceScreen(), "selinux_status", PROPERTY_SELINUX_STATUS);
+
         // Remove Safety information preference if PROPERTY_URL_SAFETYLEGAL is not set
         removePreferenceIfPropertyMissing(getPreferenceScreen(), "safetylegal",
                 PROPERTY_URL_SAFETYLEGAL);
-- 
1.7.0.4


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.


[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux