Add optional regulatory info page

Bug 7081675

If R.bools.config_show_regulatory_info is true, then show a "Regulatory
information" item on the "About phone" page. Show a DialogFragment
displaying the regulatory_info drawable if the item is clicked. Add a
1x1 blank regulatory_info drawable for devices that won't show this.

Change-Id: I5823d8969de038becf4911dce893dab5dbb23537
This commit is contained in:
Brian Muramatsu
2012-09-17 23:09:35 -07:00
parent 64c6ee20ba
commit a6dbaea2da
7 changed files with 82 additions and 8 deletions

View File

@@ -49,6 +49,7 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
private static final String KEY_CONTAINER = "container";
private static final String KEY_TEAM = "team";
private static final String KEY_CONTRIBUTORS = "contributors";
private static final String KEY_REGULATORY_INFO = "regulatory_info";
private static final String KEY_TERMS = "terms";
private static final String KEY_LICENSE = "license";
private static final String KEY_COPYRIGHT = "copyright";
@@ -132,11 +133,12 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
// Read platform settings for additional system update setting
boolean isUpdateSettingAvailable =
getResources().getBoolean(R.bool.config_additional_system_update_setting_enable);
if (isUpdateSettingAvailable == false) {
getPreferenceScreen().removePreference(findPreference(KEY_UPDATE_SETTING));
}
removePreferenceIfBoolFalse(KEY_UPDATE_SETTING,
R.bool.config_additional_system_update_setting_enable);
// Remove regulatory information if not enabled.
removePreferenceIfBoolFalse(KEY_REGULATORY_INFO,
R.bool.config_show_regulatory_info);
}
@Override
@@ -160,8 +162,7 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
private void removePreferenceIfPropertyMissing(PreferenceGroup preferenceGroup,
String preference, String property ) {
if (SystemProperties.get(property).equals(""))
{
if (SystemProperties.get(property).equals("")) {
// Property is missing so remove preference from group
try {
preferenceGroup.removePreference(findPreference(preference));
@@ -172,6 +173,12 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
}
}
private void removePreferenceIfBoolFalse(String preference, int resId) {
if (!getResources().getBoolean(resId)) {
getPreferenceScreen().removePreference(findPreference(preference));
}
}
private void setStringSummary(String preference, String value) {
try {
findPreference(preference).setSummary(value);