Merge "Add optional regulatory info page" into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a6c1b346ae
BIN
res/drawable/regulatory_info.png
Normal file
BIN
res/drawable/regulatory_info.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 159 B |
19
res/layout/regulatory_info.xml
Executable file
19
res/layout/regulatory_info.xml
Executable 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"/>
|
@@ -32,4 +32,7 @@
|
|||||||
|
|
||||||
<!-- Whether User management screen is available -->
|
<!-- Whether User management screen is available -->
|
||||||
<bool name="enable_user_management">false</bool>
|
<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>
|
</resources>
|
||||||
|
@@ -2237,6 +2237,8 @@
|
|||||||
<string name="legal_information">Legal information</string>
|
<string name="legal_information">Legal information</string>
|
||||||
<!-- About phone settings screen, setting option name to see a list of contributors -->
|
<!-- About phone settings screen, setting option name to see a list of contributors -->
|
||||||
<string name="contributors_title">Contributors</string>
|
<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 />
|
<!-- 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 -->
|
<!-- About phone settings screen, setting option name to see copyright-related info -->
|
||||||
<string name="copyright_title">Copyright</string>
|
<string name="copyright_title">Copyright</string>
|
||||||
|
@@ -89,6 +89,10 @@
|
|||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<Preference android:key="regulatory_info"
|
||||||
|
android:title="@string/regulatory_information"
|
||||||
|
android:fragment="com.android.settings.RegulatoryInfoFragment"/>
|
||||||
|
|
||||||
<!-- Device hardware model -->
|
<!-- Device hardware model -->
|
||||||
<Preference android:key="device_model"
|
<Preference android:key="device_model"
|
||||||
style="?android:preferenceInformationStyle"
|
style="?android:preferenceInformationStyle"
|
||||||
@@ -106,7 +110,7 @@
|
|||||||
style="?android:preferenceInformationStyle"
|
style="?android:preferenceInformationStyle"
|
||||||
android:title="@string/fcc_equipment_id"
|
android:title="@string/fcc_equipment_id"
|
||||||
android:summary="@string/device_info_default"/>
|
android:summary="@string/device_info_default"/>
|
||||||
|
|
||||||
<!-- Device Baseband version -->
|
<!-- Device Baseband version -->
|
||||||
<Preference android:key="baseband_version"
|
<Preference android:key="baseband_version"
|
||||||
style="?android:preferenceInformationStyle"
|
style="?android:preferenceInformationStyle"
|
||||||
|
@@ -49,6 +49,7 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
|
|||||||
private static final String KEY_CONTAINER = "container";
|
private static final String KEY_CONTAINER = "container";
|
||||||
private static final String KEY_TEAM = "team";
|
private static final String KEY_TEAM = "team";
|
||||||
private static final String KEY_CONTRIBUTORS = "contributors";
|
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_TERMS = "terms";
|
||||||
private static final String KEY_LICENSE = "license";
|
private static final String KEY_LICENSE = "license";
|
||||||
private static final String KEY_COPYRIGHT = "copyright";
|
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);
|
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
|
||||||
|
|
||||||
// Read platform settings for additional system update setting
|
// Read platform settings for additional system update setting
|
||||||
boolean isUpdateSettingAvailable =
|
removePreferenceIfBoolFalse(KEY_UPDATE_SETTING,
|
||||||
getResources().getBoolean(R.bool.config_additional_system_update_setting_enable);
|
R.bool.config_additional_system_update_setting_enable);
|
||||||
if (isUpdateSettingAvailable == false) {
|
|
||||||
getPreferenceScreen().removePreference(findPreference(KEY_UPDATE_SETTING));
|
// Remove regulatory information if not enabled.
|
||||||
}
|
removePreferenceIfBoolFalse(KEY_REGULATORY_INFO,
|
||||||
|
R.bool.config_show_regulatory_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -160,8 +162,7 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
|
|||||||
|
|
||||||
private void removePreferenceIfPropertyMissing(PreferenceGroup preferenceGroup,
|
private void removePreferenceIfPropertyMissing(PreferenceGroup preferenceGroup,
|
||||||
String preference, String property ) {
|
String preference, String property ) {
|
||||||
if (SystemProperties.get(property).equals(""))
|
if (SystemProperties.get(property).equals("")) {
|
||||||
{
|
|
||||||
// Property is missing so remove preference from group
|
// Property is missing so remove preference from group
|
||||||
try {
|
try {
|
||||||
preferenceGroup.removePreference(findPreference(preference));
|
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) {
|
private void setStringSummary(String preference, String value) {
|
||||||
try {
|
try {
|
||||||
findPreference(preference).setSummary(value);
|
findPreference(preference).setSummary(value);
|
||||||
|
39
src/com/android/settings/RegulatoryInfoFragment.java
Normal file
39
src/com/android/settings/RegulatoryInfoFragment.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user