diff options
-rwxr-xr-x | res/layout/regulatory_info.xml | 26 | ||||
-rw-r--r-- | res/values/cm_strings.xml | 11 | ||||
-rw-r--r-- | res/values/colors.xml | 1 | ||||
-rwxr-xr-x | res/values/config.xml | 15 | ||||
-rw-r--r-- | src/com/android/settings/RegulatoryInfoDisplayActivity.java | 40 | ||||
-rw-r--r-- | src/com/android/settings/deviceinfo/Status.java | 16 |
6 files changed, 90 insertions, 19 deletions
diff --git a/res/layout/regulatory_info.xml b/res/layout/regulatory_info.xml index fd888d9..2af43d8 100755 --- a/res/layout/regulatory_info.xml +++ b/res/layout/regulatory_info.xml @@ -13,15 +13,33 @@ See the License for the specific language governing permissions and limitations under the License. --> -<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="wrap_content" + android:orientation="vertical"> + <TextView + android:id="@+id/sarValues" + android:textColor="@color/regulatory_text_color" + android:textSize="14sp" + android:padding="5dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center"/> + <TextView + android:id="@+id/icCodes" + android:textColor="@color/regulatory_text_color" + android:textSize="14sp" + android:padding="5dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center"/> <ImageView android:id="@+id/regulatoryInfo" android:adjustViewBounds="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:scaleType="centerCrop" - android:src="@drawable/regulatory_info" /> -</ScrollView> + android:src="@drawable/regulatory_info" + android:visibility="gone"/> +</LinearLayout> diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index 4610ca5..eb0860c 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -1061,4 +1061,15 @@ <string name="zen_mode_summary_selected_callers">selected callers</string> <!-- [CHAR LIMIT=50] Like zen_mode_summary_selected_messages, but part of a list, so lower case if needed --> <string name="zen_mode_summary_selected_messages">selected messages</string> + + <!-- About phone settings screen, setting option dialog title to show regulatory information [CHAR LIMIT=25] --> + <string name="regulatory_information_dialog_title">@string/regulatory_information</string> + + <!-- SAR information --> + <string name="maximum_head_level">Head: %1$s W/kg</string> + <string name="maximum_body_level">Body: %1$s W/kg</string> + + <!-- IC Codes --> + <string name="ic_code_model">Model: %1$s</string> + <string name="ic_code_full">IC: %1$s</string> </resources> diff --git a/res/values/colors.xml b/res/values/colors.xml index 4774ab9..40a2fc9 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -79,6 +79,7 @@ <color name="wifi_divider">#ffe0e0e0</color> <color name="sim_noitification">@*android:color/material_deep_teal_500</color> + <color name="regulatory_text_color">#fff</color> <color name="warning">#ff5621</color> <color name="confirm_device_credential_dark_background">#263238</color> diff --git a/res/values/config.xml b/res/values/config.xml index b483b2c..15528ac 100755 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -88,4 +88,19 @@ <!-- Display ro.product.name above Device model --> <bool name="config_displayDeviceName">false</bool> + <!-- SAR Level for a device --> + <!-- Must be overlaid by device --> + <bool name="config_show_sar_enable" translatable="false">false</bool> + <!-- Maximum Specific Absorption Rate for head --> + <string name="sar_head_level" translatable="false"></string> + <!-- Maximum Specific Absorption Rate for body --> + <string name="sar_body_level" translatable="false"></string> + + <!-- IC Code for a device --> + <!-- Must be overlaid by device --> + <bool name="config_show_ic_enable" translatable="false">false</bool> + <!-- IC Code --> + <string name="ic_code" translatable="false"></string> + <string name="ic_model" translatable="false"></string> + </resources> diff --git a/src/com/android/settings/RegulatoryInfoDisplayActivity.java b/src/com/android/settings/RegulatoryInfoDisplayActivity.java index 39776e0..42b0d22 100644 --- a/src/com/android/settings/RegulatoryInfoDisplayActivity.java +++ b/src/com/android/settings/RegulatoryInfoDisplayActivity.java @@ -25,9 +25,12 @@ import android.os.Bundle; import android.os.SystemProperties; import android.text.TextUtils; import android.view.Gravity; +import android.view.LayoutInflater; import android.view.View; +import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import com.android.settings.deviceinfo.Status; /** * {@link Activity} that displays regulatory information for the "Regulatory information" @@ -56,9 +59,11 @@ public class RegulatoryInfoDisplayActivity extends Activity implements } AlertDialog.Builder builder = new AlertDialog.Builder(this) - .setTitle(R.string.regulatory_information) + .setTitle(R.string.regulatory_information_dialog_title) .setOnDismissListener(this); + View view = getLayoutInflater().inflate(R.layout.regulatory_info, null); + boolean regulatoryInfoDrawableExists = false; int resId = getResourceId(); if (resId != 0) { @@ -73,24 +78,29 @@ public class RegulatoryInfoDisplayActivity extends Activity implements } } - CharSequence regulatoryText = resources.getText(R.string.regulatory_info_text); - if (regulatoryInfoDrawableExists) { - View view = getLayoutInflater().inflate(R.layout.regulatory_info, null); ImageView image = (ImageView) view.findViewById(R.id.regulatoryInfo); + image.setVisibility(View.VISIBLE); image.setImageResource(resId); - builder.setView(view); - builder.show(); - } else if (regulatoryText.length() > 0) { - builder.setMessage(regulatoryText); - AlertDialog dialog = builder.show(); - // we have to show the dialog first, or the setGravity() call will throw a NPE - TextView messageText = (TextView) dialog.findViewById(android.R.id.message); - messageText.setGravity(Gravity.CENTER); - } else { - // neither drawable nor text resource exists, finish activity - finish(); } + + String sarValues = Status.getSarValues(getResources()); + TextView sarText = (TextView) view.findViewById(R.id.sarValues); + if (!TextUtils.isEmpty(sarValues)) { + sarText.setVisibility(resources.getBoolean(R.bool.config_show_sar_enable) + ? View.VISIBLE : View.GONE); + sarText.setText(sarValues); + } + + String icCodes = Status.getIcCodes(getResources()); + TextView icCode = (TextView) view.findViewById(R.id.icCodes); + if (!TextUtils.isEmpty(icCodes)) { + icCode.setVisibility(resources.getBoolean(R.bool.config_show_ic_enable) + ? View.VISIBLE : View.GONE); + icCode.setText(icCodes); + } + builder.setView(view); + builder.show(); } private int getResourceId() { diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java index 4125d88..4a7cb48 100644 --- a/src/com/android/settings/deviceinfo/Status.java +++ b/src/com/android/settings/deviceinfo/Status.java @@ -422,4 +422,20 @@ public class Status extends InstrumentedPreferenceActivity { return Build.SERIAL; } } + + public static String getSarValues(Resources res) { + String headLevel = String.format(res.getString(R.string.maximum_head_level, + res.getString(R.string.sar_head_level))); + String bodyLevel = String.format(res.getString(R.string.maximum_body_level, + res.getString(R.string.sar_body_level))); + return headLevel + "\n" + bodyLevel; + } + + public static String getIcCodes(Resources resources) { + String model = String.format(resources.getString(R.string.ic_code_model, + Build.MODEL)); + String icCode = String.format(resources.getString(R.string.ic_code_full, + resources.getString(R.string.ic_code))); + return model + "\n" + icCode; + } } |