Merge "Add optional regulatory info page" into jb-mr1-dev

This commit is contained in:
Brian Muramatsu
2012-09-18 14:59:35 -07:00
committed by Android (Google) Code Review
7 changed files with 82 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

19
res/layout/regulatory_info.xml Executable file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2012 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/regulatory_info"/>

View File

@@ -32,4 +32,7 @@
<!-- Whether User management screen is available -->
<bool name="enable_user_management">false</bool>
<!-- Whether to show a preference item for regulatory information in About phone -->
<bool name="config_show_regulatory_info">false</bool>
</resources>

View File

@@ -2237,6 +2237,8 @@
<string name="legal_information">Legal information</string>
<!-- About phone settings screen, setting option name to see a list of contributors -->
<string name="contributors_title">Contributors</string>
<!-- About phone settings screen, setting option name to show regulatory information [CHAR LIMIT=25] -->
<string name="regulatory_information">Regulatory information</string>
<!-- Note: this may be replaced by a more-specific title of the activity that will get launched --> <skip />
<!-- About phone settings screen, setting option name to see copyright-related info -->
<string name="copyright_title">Copyright</string>

View File

@@ -89,6 +89,10 @@
</PreferenceScreen>
-->
<Preference android:key="regulatory_info"
android:title="@string/regulatory_information"
android:fragment="com.android.settings.RegulatoryInfoFragment"/>
<!-- Device hardware model -->
<Preference android:key="device_model"
style="?android:preferenceInformationStyle"
@@ -106,7 +110,7 @@
style="?android:preferenceInformationStyle"
android:title="@string/fcc_equipment_id"
android:summary="@string/device_info_default"/>
<!-- Device Baseband version -->
<Preference android:key="baseband_version"
style="?android:preferenceInformationStyle"

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);

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings;
import android.app.DialogFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.android.settings.R;
/**
* {@link DialogFragment} that displays regulatory information.
* "About phone" will show a preference that displays this fragment when
* clicked if R.bool.config_show_regulatory_info is true.
*/
public class RegulatoryInfoFragment extends DialogFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.regulatory_info, container, false);
}
}