Merge "Add safety & regulatory info to "about device"." into nyc-mr1-dev

am: 6c52398695

* commit '6c52398695164aeba6c3ad8ebc8047ffe98805df':
  Add safety & regulatory info to "about device".

Change-Id: I7feb228f842a1697c2e3c56bfb6c1dcb0694c9b5
This commit is contained in:
Andrew Sapperstein
2016-06-03 23:29:53 +00:00
committed by android-build-merger
5 changed files with 29 additions and 13 deletions

View File

@@ -175,14 +175,12 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
// Remove manual entry if none present.
removePreferenceIfBoolFalse(KEY_MANUAL, R.bool.config_show_manual);
// Remove regulatory information if none present.
final Intent intent = new Intent(Settings.ACTION_SHOW_REGULATORY_INFO);
if (getPackageManager().queryIntentActivities(intent, 0).isEmpty()) {
Preference pref = findPreference(KEY_REGULATORY_INFO);
if (pref != null) {
getPreferenceScreen().removePreference(pref);
}
}
// Remove regulatory labels if no activity present to handle intent.
removePreferenceIfActivityMissing(
KEY_REGULATORY_INFO, Settings.ACTION_SHOW_REGULATORY_INFO);
removePreferenceIfActivityMissing(
"safety_info", "android.settings.SHOW_SAFETY_AND_REGULATORY_INFO");
}
@Override
@@ -327,6 +325,16 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
}
}
private void removePreferenceIfActivityMissing(String preferenceKey, String action) {
final Intent intent = new Intent(action);
if (getPackageManager().queryIntentActivities(intent, 0).isEmpty()) {
Preference pref = findPreference(preferenceKey);
if (pref != null) {
getPreferenceScreen().removePreference(pref);
}
}
}
private void removePreferenceIfBoolFalse(String preference, int resId) {
if (!getResources().getBoolean(resId)) {
Preference pref = findPreference(preference);

View File

@@ -56,7 +56,7 @@ public class RegulatoryInfoDisplayActivity extends Activity implements
}
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(R.string.regulatory_information)
.setTitle(R.string.regulatory_labels)
.setOnDismissListener(this);
boolean regulatoryInfoDrawableExists = false;