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
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user