summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/DeviceInfoSettings.java
diff options
context:
space:
mode:
authorWink Saville <wink@google.com>2009-09-26 16:47:18 -0700
committerWink Saville <wink@google.com>2009-09-26 21:10:38 -0700
commita40fb23734cc5d5ac6e69a060cbb488269ad8af3 (patch)
tree5551ed8889c1a50ed001a213ebb987589754d9e1 /src/com/android/settings/DeviceInfoSettings.java
parent9281c929d6e4abf0ddf77d614b2eb57f7528397a (diff)
downloadpackages_apps_Settings-a40fb23734cc5d5ac6e69a060cbb488269ad8af3.tar.gz
packages_apps_Settings-a40fb23734cc5d5ac6e69a060cbb488269ad8af3.tar.bz2
packages_apps_Settings-a40fb23734cc5d5ac6e69a060cbb488269ad8af3.zip
Add Safety information to Settings > About Phone
The Safety information link is stored in a system property, ro.url.safetylegal If the phone has data connection, select "Safety information" menu will open the Safety information link. If there is no data connection for the phone, a message will pop up which ask user to open Safety information link from PC. Change-Id: Ia46e2e868ebcda93138cb9f00c978d8ac827022a
Diffstat (limited to 'src/com/android/settings/DeviceInfoSettings.java')
-rw-r--r--src/com/android/settings/DeviceInfoSettings.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index 7768b7dc7..82b7f2879 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -48,6 +48,7 @@ public class DeviceInfoSettings extends PreferenceActivity {
private static final String KEY_LICENSE = "license";
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";
@Override
protected void onCreate(Bundle icicle) {
@@ -61,6 +62,10 @@ public class DeviceInfoSettings extends PreferenceActivity {
setStringSummary("build_number", Build.DISPLAY);
findPreference("kernel_version").setSummary(getFormattedKernelVersion());
+ // Remove Safety information preference if PROPERTY_URL_SAFETYLEGAL is not set
+ removePreferenceIfPropertyMissing(getPreferenceScreen(), "safetylegal",
+ PROPERTY_URL_SAFETYLEGAL);
+
/*
* Settings is a generic app and should not contain any device-specific
* info.
@@ -85,7 +90,21 @@ public class DeviceInfoSettings extends PreferenceActivity {
Utils.updatePreferenceToSpecificActivityOrRemove(this, parentPreference, KEY_CONTRIBUTORS,
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
}
-
+
+ private void removePreferenceIfPropertyMissing(PreferenceGroup preferenceGroup,
+ String preference, String property ) {
+ if (SystemProperties.get(property).equals(""))
+ {
+ // Property is missing so remove preference from group
+ try {
+ preferenceGroup.removePreference(findPreference(preference));
+ } catch (RuntimeException e) {
+ Log.d(TAG, "Property '" + property + "' missing and no '"
+ + preference + "' preference");
+ }
+ }
+ }
+
private void setStringSummary(String preference, String value) {
try {
findPreference(preference).setSummary(value);