Merge "Update package name for PictureAndPictureSettings"
diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index cbcdf48..6fa2042 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -2,6 +2,18 @@
<issues format="4">
<issue
+ id="LintError"
+ severity="Error"
+ message="No `.class` files were found in project ".", so none of the classfile based checks could be run. Does the project need to be built first?"
+ category="Lint"
+ priority="10"
+ summary="Lint Failure"
+ explanation="This issue type represents a problem running lint itself. Examples include failure to find bytecode for source files (which means certain detectors could not be run), parsing errors in lint configuration files, etc.
These errors are not errors in your own code, but they are shown to make it clear that some checks were not completed.">
+ <location
+ file="."/>
+ </issue>
+
+ <issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
@@ -93,7 +105,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/layout-land/choose_lock_pattern.xml"
- line="152"
+ line="160"
column="17"/>
</issue>
@@ -1085,7 +1097,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/layout-land/confirm_lock_pattern_internal.xml"
- line="110"
+ line="111"
column="17"/>
</issue>
@@ -1289,6 +1301,134 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <item android:color="#19263238" android:offset="0.0"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_color_inversion.xml"
+ line="17"
+ column="23"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <item android:color="#00212121" android:offset="1.0"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_color_inversion.xml"
+ line="18"
+ column="23"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <item android:color="#19FFFFFF" android:offset="0.0"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_color_inversion.xml"
+ line="32"
+ column="23"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <item android:color="#00FFFFFF" android:offset="1.0"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_color_inversion.xml"
+ line="33"
+ column="23"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <item android:color="#19263238" android:offset="0.0"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_daltonizer.xml"
+ line="16"
+ column="27"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <item android:color="#00212121" android:offset="1.0"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_daltonizer.xml"
+ line="17"
+ column="27"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <item android:color="#19FFFFFF" android:offset="0.0"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_daltonizer.xml"
+ line="36"
+ column="23"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" <item android:color="#00FFFFFF" android:offset="1.0"/>"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/drawable/ic_daltonizer.xml"
+ line="37"
+ column="23"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:tint="@color/wifi_details_icon_color">"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
@@ -1869,7 +2009,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/layout/settings_main_dashboard.xml"
- line="29"
+ line="30"
column="9"/>
</issue>
@@ -1933,7 +2073,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rXC/strings.xml"
- line="2335"
+ line="2333"
column="168"/>
</issue>
@@ -1949,7 +2089,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rAU/strings.xml"
- line="2341"
+ line="2334"
column="64"/>
</issue>
@@ -1965,7 +2105,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rCA/strings.xml"
- line="2341"
+ line="2334"
column="64"/>
</issue>
@@ -1981,7 +2121,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rGB/strings.xml"
- line="2341"
+ line="2334"
column="64"/>
</issue>
@@ -1997,7 +2137,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rIN/strings.xml"
- line="2341"
+ line="2334"
column="64"/>
</issue>
@@ -2013,7 +2153,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/strings.xml"
- line="5501"
+ line="5512"
column="36"/>
</issue>
@@ -2029,7 +2169,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="245"
+ line="246"
column="41"/>
</issue>
@@ -2045,7 +2185,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="364"
+ line="366"
column="42"/>
</issue>
@@ -2061,7 +2201,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="441"
+ line="443"
column="44"/>
</issue>
@@ -2077,7 +2217,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="447"
+ line="449"
column="44"/>
</issue>
@@ -2093,7 +2233,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="448"
+ line="450"
column="44"/>
</issue>
@@ -2109,7 +2249,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
- line="471"
+ line="473"
column="41"/>
</issue>
diff --git a/res/drawable/ic_color_inversion.xml b/res/drawable/ic_color_inversion.xml
new file mode 100644
index 0000000..aa59f5a
--- /dev/null
+++ b/res/drawable/ic_color_inversion.xml
@@ -0,0 +1,52 @@
+<!--
+ Copyright 2017 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.
+-->
+<vector android:height="192dp" android:viewportHeight="192.0"
+ android:viewportWidth="192.0" android:width="192dp"
+ xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="#546E7A" android:pathData="M37.2,173.6l-28.5,-90c-1.7,-5.8 0.3,-12 5,-15.6l73.6,-57.1c5.2,-4 12.5,-4 17.6,0.1L178.6,70c4.6,3.7 6.5,9.9 4.8,15.6l-28.5,88.2c-1.9,6.1 -7.4,10.2 -13.7,10.2H50.8C44.5,183.9 39,179.7 37.2,173.6z"/>
+ <path android:fillAlpha="0.2" android:fillColor="#263238"
+ android:pathData="M183.3,84.5l-28.5,88.2c-1.8,6.1 -7.4,10.2 -13.7,10.2H50.9c-6.3,0 -11.9,-4.2 -13.7,-10.3l-28.5,-90C8.2,81.4 8,80.1 8,78.9c-0.1,1.6 0.1,3.1 0.6,4.7l28.5,90c1.8,6.1 7.4,10.3 13.7,10.3h90.3c6.3,0 11.8,-4.1 13.7,-10.2l28.5,-88.2c0.5,-1.6 0.7,-3.2 0.6,-4.7C183.9,82 183.7,83.3 183.3,84.5z" android:strokeAlpha="0.2"/>
+ <path android:fillAlpha="0.2" android:fillColor="#FFFFFF"
+ android:pathData="M13.6,69l73.6,-57.1c5.2,-4 12.5,-4 17.6,0.1l73.8,58.9c3.4,2.7 5.3,6.7 5.4,10.8c0.2,-4.5 -1.8,-8.9 -5.4,-11.8L104.8,11c-5.2,-4.1 -12.4,-4.1 -17.6,-0.1L13.5,68C9.8,70.9 7.8,75.4 8,80C8.1,75.8 10.1,71.7 13.6,69z" android:strokeAlpha="0.2"/>
+ <path android:fillAlpha="0.2" android:fillColor="#FFFFFF"
+ android:pathData="M53.1,129.9l5,-4.8l-13.9,-13.3c0,0.8 -0.1,1.5 -0.2,2.3c-0.4,22.3 17.2,40.2 39.9,41.7l0.1,-5.3C70.2,149.5 58.6,141.4 53.1,129.9z" android:strokeAlpha="0.2"/>
+ <path android:fillAlpha="0.2" android:fillColor="#FFFFFF"
+ android:pathData="M108.7,51.8l-0.1,5.3c13.6,1 25,9.2 30.4,20.7l-4.9,4.8l13.6,13.3c0.1,-0.8 0.2,-1.5 0.2,-2.3C148.3,71.2 131,53.2 108.7,51.8z" android:strokeAlpha="0.2"/>
+ <path android:pathData="M154.9,173.7l13.7,-41.7l-49.5,-49.6l-18.6,-7.2l-19.6,3.1L65.9,98.6L74,128l55.9,55.9h11.2C147.5,183.9 153.1,179.8 154.9,173.7z">
+ <aapt:attr name="android:fillColor">
+ <gradient android:endX="139.008" android:endY="147.6131"
+ android:startX="98.1033" android:startY="106.7084" android:type="linear">
+ <item android:color="#19263238" android:offset="0.0"/>
+ <item android:color="#00212121" android:offset="1.0"/>
+ </gradient>
+ </aapt:attr>
+ </path>
+ <path android:fillAlpha="0.1" android:fillColor="#FF000000"
+ android:pathData="M70.3,104.5c0,0.2 0,0.3 0,0.5c0.3,-13.9 11.6,-25.1 25.6,-25.1v-1C81.8,78.9 70.3,90.4 70.3,104.5z" android:strokeAlpha="0.1"/>
+ <path android:fillAlpha="0.1" android:fillColor="#FF000000"
+ android:pathData="M95.9,136.5c-17.5,0 -31.7,-14 -32,-31.5c0,0.2 0,0.3 0,0.5c0,17.7 14.3,32 32,32c17.7,0 32,-14.3 32,-32c0,-0.2 0,-0.3 0,-0.5C127.6,122.5 113.4,136.5 95.9,136.5z" android:strokeAlpha="0.1"/>
+ <path android:fillColor="#FFFFFF" android:pathData="M95.9,72.5c-17.7,0 -32,14.3 -32,32c0,17.7 14.3,32 32,32c17.7,0 32,-14.3 32,-32S113.6,72.5 95.9,72.5zM70.3,104.5c0,-14.1 11.5,-25.6 25.6,-25.6v51.2C81.8,130.1 70.3,118.6 70.3,104.5z"/>
+ <path android:pathData="M37.1,173.6l-28.5,-90c-1.7,-5.8 0.3,-12 5,-15.6l73.5,-57.1c5.2,-4 12.5,-4 17.6,0.1l73.8,58.9c4.6,3.7 6.5,9.9 4.8,15.6l-28.5,88.2c-1.8,6.1 -7.4,10.2 -13.7,10.2H50.8C44.5,183.9 38.9,179.7 37.1,173.6z">
+ <aapt:attr name="android:fillColor">
+ <gradient android:centerX="21.9873"
+ android:centerY="23.7751"
+ android:gradientRadius="158.0384" android:type="radial">
+ <item android:color="#19FFFFFF" android:offset="0.0"/>
+ <item android:color="#00FFFFFF" android:offset="1.0"/>
+ </gradient>
+ </aapt:attr>
+ </path>
+</vector>
diff --git a/res/drawable/ic_daltonizer.xml b/res/drawable/ic_daltonizer.xml
new file mode 100644
index 0000000..04e397d
--- /dev/null
+++ b/res/drawable/ic_daltonizer.xml
@@ -0,0 +1,56 @@
+<!--
+ Copyright 2017 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.
+-->
+<vector android:height="192dp" android:viewportHeight="192.0"
+ android:viewportWidth="192.0" android:width="192dp"
+ xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="#00BCD4" android:pathData="M37.1,173.5l-28.5,-90c-1.7,-5.8 0.3,-12 5,-15.6l73.6,-57.1c5.2,-4 12.5,-4 17.6,0.1l73.8,58.9c4.6,3.7 6.5,9.9 4.8,15.6l-28.5,88.2c-1.9,6.1 -7.4,10.2 -13.7,10.2H50.8C44.5,183.8 39,179.6 37.1,173.5z"/>
+ <path android:fillAlpha="0.2" android:fillColor="#263238"
+ android:pathData="M183.3,84.3l-28.5,88.2c-1.8,6.1 -7.4,10.2 -13.7,10.2H50.8c-6.3,0 -11.9,-4.2 -13.7,-10.3l-28.5,-90C8.2,81.2 8,79.9 8,78.7c-0.1,1.6 0.1,3.1 0.6,4.7l28.5,90c1.8,6.1 7.4,10.3 13.7,10.3h90.3c6.3,0 11.8,-4.1 13.7,-10.2l28.5,-88.2c0.5,-1.6 0.7,-3.2 0.6,-4.7C183.9,81.8 183.7,83.2 183.3,84.3z" android:strokeAlpha="0.2"/>
+ <path android:fillAlpha="0.2" android:fillColor="#FFFFFF"
+ android:pathData="M13.5,68.8l73.6,-57.1c5.2,-4 12.5,-4 17.6,0.1l73.8,58.9c3.4,2.7 5.3,6.7 5.4,10.8c0.2,-4.5 -1.8,-8.9 -5.4,-11.8l-73.8,-58.9c-5.2,-4.1 -12.4,-4.1 -17.6,-0.1L13.5,67.8c-3.7,2.9 -5.7,7.4 -5.5,12C8.1,75.6 10.1,71.5 13.5,68.8z" android:strokeAlpha="0.2"/>
+ <group>
+ <clip-path android:pathData="M37.1,173.5l-28.5,-90c-1.7,-5.8 0.3,-12 5,-15.6l73.6,-57.1c5.2,-4 12.5,-4 17.6,0.1l73.8,58.9c4.6,3.7 6.5,9.9 4.8,15.6l-28.5,88.2c-1.9,6.1 -7.4,10.2 -13.7,10.2H50.8C44.5,183.8 39,179.6 37.1,173.5z M 0,0"/>
+ <path android:pathData="M131.3,74.7L105,79.3l-5,-0.2l-3.8,2.4l-30.8,34.4L60.5,136l47.8,47.8 h32.9c6.3,0,11.8,-4.1,13.7,-10.2l18.4,-56.9L131.3,74.7z">
+ <aapt:attr name="android:fillColor">
+ <gradient android:endX="151.1709"
+ android:endY="160.5809" android:startX="91.7117"
+ android:startY="101.1217" android:type="linear">
+ <item android:color="#19263238" android:offset="0.0"/>
+ <item android:color="#00212121" android:offset="1.0"/>
+ </gradient>
+ </aapt:attr>
+ </path>
+ </group>
+ <path android:fillAlpha="0.1" android:fillColor="#263238"
+ android:pathData="M79.5,136l-18.9,0l1,1l18.9,0l35.6,-35.6l-1,-1z" android:strokeAlpha="0.1"/>
+ <path android:fillAlpha="0.1" android:fillColor="#263238"
+ android:pathData="M68.59,120.37l32.17,-32.17l0.99,0.99l-32.17,32.17z" android:strokeAlpha="0.1"/>
+ <path android:fillAlpha="0.1" android:fillColor="#263238"
+ android:pathData="M132.3,75.6l-1,-1c1.6,1.6 1.6,4.1 0,5.7l-12.4,12.4l1,1l12.4,-12.4C133.8,79.7 133.8,77.2 132.3,75.6z" android:strokeAlpha="0.1"/>
+ <path android:fillAlpha="0.1" android:fillColor="#263238"
+ android:pathData="M120.75,106.06l5.66,-5.66l0.99,0.99l-5.66,5.66z" android:strokeAlpha="0.1"/>
+ <path android:fillColor="#0097A7" android:pathData="M68.56,120.37l32.17,-32.17l7.64,7.64l-32.17,32.17z"/>
+ <path android:fillColor="#FFFFFF" android:pathData="M131.3,74.6l-9.3,-9.3c-1.6,-1.6 -4.1,-1.6 -5.6,0l-12.4,12.4l-7.7,-7.6l-5.6,5.6l5.7,5.7L60.6,117v19h19l35.6,-35.6l5.7,5.7l5.6,-5.6l-7.7,-7.7l12.4,-12.4C132.8,78.7 132.8,76.2 131.3,74.6zM76.2,128l-7.7,-7.7l32.2,-32.2l7.7,7.7L76.2,128z"/>
+ <path android:pathData="M37.1,173.5l-28.5,-90c-1.7,-5.8 0.3,-12 5,-15.6l73.5,-57.1c5.2,-4 12.5,-4 17.6,0.1l73.8,58.9c4.6,3.7 6.5,9.9 4.8,15.6l-28.5,88.2c-1.8,6.1 -7.4,10.2 -13.7,10.2H50.8C44.5,183.8 38.9,179.6 37.1,173.5z">
+ <aapt:attr name="android:fillColor">
+ <gradient android:centerX="21.977" android:centerY="23.6809"
+ android:gradientRadius="158.0384" android:type="radial">
+ <item android:color="#19FFFFFF" android:offset="0.0"/>
+ <item android:color="#00FFFFFF" android:offset="1.0"/>
+ </gradient>
+ </aapt:attr>
+ </path>
+</vector>
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 7728a07..d7d2e02 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -118,12 +118,14 @@
<Preference
android:fragment="com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment"
android:key="daltonizer_preference_screen"
- android:title="@string/accessibility_display_daltonizer_preference_title" />
+ android:title="@string/accessibility_display_daltonizer_preference_title"
+ android:icon="@drawable/ic_daltonizer"/>
<SwitchPreference
android:key="toggle_inversion_preference"
android:title="@string/accessibility_display_inversion_preference_title"
android:summary="@string/accessibility_display_inversion_preference_subtitle"
- android:persistent="false" />
+ android:persistent="false"
+ android:icon="@drawable/ic_color_inversion"/>
</PreferenceCategory>
</PreferenceScreen>
diff --git a/res/xml/device_info_settings.xml b/res/xml/device_info_settings.xml
deleted file mode 100644
index af1fb70..0000000
--- a/res/xml/device_info_settings.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
--->
-
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- android:key="device_info_pref_screen"
- android:title="@string/about_settings">
-
- <!-- Device status - launches activity -->
- <Preference android:key="status_info"
- android:title="@string/device_status"
- android:summary="@string/device_status_summary"
- android:fragment="com.android.settings.deviceinfo.Status"/>
-
- <!-- Manual -->
- <Preference
- android:key="manual"
- android:title="@string/manual">
- <intent android:action="android.settings.SHOW_MANUAL" />
- </Preference>
-
- <!-- Legal Information -->
- <Preference
- android:key="legal_container"
- android:title="@string/legal_information"
- android:fragment="com.android.settings.LegalSettings" />
-
- <Preference
- android:key="regulatory_info"
- android:title="@string/regulatory_labels">
- <intent android:action="android.settings.SHOW_REGULATORY_INFO" />
- </Preference>
-
- <Preference
- android:key="safety_info"
- android:title="@string/safety_and_regulatory_info">
- <intent android:action="android.settings.SHOW_SAFETY_AND_REGULATORY_INFO" />
- </Preference>
-
- <!-- Feedback on the device -->
- <Preference android:key="device_feedback"
- android:title="@string/device_feedback" />
-
- <!-- Device hardware model -->
- <Preference
- android:key="device_model"
- android:title="@string/model_info"
- android:summary="@string/summary_placeholder"/>
-
- <!-- Device firmware version -->
- <Preference android:key="firmware_version"
- android:title="@string/firmware_version"
- android:summary="@string/summary_placeholder"/>
-
- <!-- Security patch level -->
- <Preference android:key="security_patch"
- android:title="@string/security_patch"
- android:summary="@string/summary_placeholder">
- <intent android:action="android.intent.action.VIEW"
- android:data="https://source.android.com/security/bulletin/" />
- </Preference>
-
- <!-- Device FCC equipment id -->
- <Preference
- android:key="fcc_equipment_id"
- android:title="@string/fcc_equipment_id"
- android:summary="@string/summary_placeholder"/>
-
- <!-- Device Baseband version -->
- <Preference
- android:key="baseband_version"
- android:title="@string/baseband_version"
- android:summary="@string/summary_placeholder"/>
-
- <!-- Device Kernel version -->
- <Preference
- android:key="kernel_version"
- android:title="@string/kernel_version"
- android:summary="@string/summary_placeholder"/>
-
- <!-- Detailed build version -->
- <Preference
- android:key="build_number"
- android:title="@string/build_number"
- android:summary="@string/summary_placeholder"/>
-
-</PreferenceScreen>
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index 74ce5d0..7e32e5e 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -16,36 +16,29 @@
package com.android.settings;
-import static com.android.settings.core.FeatureFlags.DEVICE_INFO_V2;
-
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.provider.SearchIndexableResource;
-import android.telephony.TelephonyManager;
-import android.util.FeatureFlagUtils;
import android.support.annotation.VisibleForTesting;
+import android.telephony.TelephonyManager;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
-import com.android.settings.deviceinfo.BasebandVersionPreferenceController;
import com.android.settings.deviceinfo.BluetoothAddressPreferenceController;
import com.android.settings.deviceinfo.BuildNumberPreferenceController;
import com.android.settings.deviceinfo.DeviceModelPreferenceController;
import com.android.settings.deviceinfo.FccEquipmentIdPreferenceController;
import com.android.settings.deviceinfo.FeedbackPreferenceController;
-import com.android.settings.deviceinfo.FirmwareVersionPreferenceController;
import com.android.settings.deviceinfo.ImsStatusPreferenceController;
import com.android.settings.deviceinfo.IpAddressPreferenceController;
-import com.android.settings.deviceinfo.KernelVersionPreferenceController;
import com.android.settings.deviceinfo.ManualPreferenceController;
import com.android.settings.deviceinfo.PhoneNumberPreferenceController;
import com.android.settings.deviceinfo.RegulatoryInfoPreferenceController;
import com.android.settings.deviceinfo.SafetyInfoPreferenceController;
-import com.android.settings.deviceinfo.SecurityPatchPreferenceController;
import com.android.settings.deviceinfo.WifiMacAddressPreferenceController;
import com.android.settings.deviceinfo.firmwareversion.FirmwareVersionPreferenceControllerV2;
import com.android.settings.deviceinfo.imei.ImeiInfoPreferenceControllerV2;
@@ -84,21 +77,19 @@
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
final Bundle arguments = getArguments();
- if (FeatureFlagUtils.isEnabled(getContext(), DEVICE_INFO_V2)) {
- // Do not override initial expand children count if we come from
- // search (EXTRA_FRAGMENT_ARG_KEY is set) - we need to display every if entry point
- // is search.
- if (arguments == null
- || !arguments.containsKey(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY)) {
+ // Do not override initial expand children count if we come from
+ // search (EXTRA_FRAGMENT_ARG_KEY is set) - we need to display every if entry point
+ // is search.
+ if (arguments == null
+ || !arguments.containsKey(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY)) {
- // Increase the number of children when the device contains more than 1 sim.
- final TelephonyManager telephonyManager = (TelephonyManager) getSystemService(
- Context.TELEPHONY_SERVICE);
- final int numberOfChildren = Math.max(SIM_PREFERENCES_COUNT,
- SIM_PREFERENCES_COUNT * telephonyManager.getPhoneCount())
- + NON_SIM_PREFERENCES_COUNT;
- getPreferenceScreen().setInitialExpandedChildrenCount(numberOfChildren);
- }
+ // Increase the number of children when the device contains more than 1 sim.
+ final TelephonyManager telephonyManager = (TelephonyManager) getSystemService(
+ Context.TELEPHONY_SERVICE);
+ final int numberOfChildren = Math.max(SIM_PREFERENCES_COUNT,
+ SIM_PREFERENCES_COUNT * telephonyManager.getPhoneCount())
+ + NON_SIM_PREFERENCES_COUNT;
+ getPreferenceScreen().setInitialExpandedChildrenCount(numberOfChildren);
}
}
@@ -119,8 +110,7 @@
@Override
protected int getPreferenceScreenResId() {
- return FeatureFlagUtils.isEnabled(getContext(), DEVICE_INFO_V2)
- ? R.xml.device_info_settings_v2 : R.xml.device_info_settings;
+ return R.xml.device_info_settings_v2;
}
@Override
@@ -156,57 +146,23 @@
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Activity activity, Fragment fragment, Lifecycle lifecycle) {
- if (FeatureFlagUtils.isEnabled(context, DEVICE_INFO_V2)) {
- final List<AbstractPreferenceController> controllers = new ArrayList<>();
- // Device name
-
- controllers.add(new PhoneNumberPreferenceController(context));
-
- controllers.add(new SimStatusPreferenceControllerV2(context, fragment));
-
- controllers.add(new DeviceModelPreferenceController(context, fragment));
-
- controllers.add(new ImeiInfoPreferenceControllerV2(context, fragment));
-
- controllers.add(new FirmwareVersionPreferenceControllerV2(context, fragment));
-
- controllers.add(new ImsStatusPreferenceController(context, lifecycle));
-
- controllers.add(new IpAddressPreferenceController(context, lifecycle));
-
- controllers.add(new WifiMacAddressPreferenceController(context, lifecycle));
-
- controllers.add(new BluetoothAddressPreferenceController(context, lifecycle));
-
- controllers.add(new RegulatoryInfoPreferenceController(context));
-
- controllers.add(new SafetyInfoPreferenceController(context));
-
- controllers.add(new ManualPreferenceController(context));
-
- controllers.add(new FeedbackPreferenceController(fragment, context));
-
- controllers.add(new FccEquipmentIdPreferenceController(context));
-
- controllers.add(
- new BuildNumberPreferenceController(context, activity, fragment, lifecycle));
-
- return controllers;
- }
-
final List<AbstractPreferenceController> controllers = new ArrayList<>();
- controllers.add(
- new BuildNumberPreferenceController(context, activity, fragment, lifecycle));
+ controllers.add(new PhoneNumberPreferenceController(context));
+ controllers.add(new SimStatusPreferenceControllerV2(context, fragment));
+ controllers.add(new DeviceModelPreferenceController(context, fragment));
+ controllers.add(new ImeiInfoPreferenceControllerV2(context, fragment));
+ controllers.add(new FirmwareVersionPreferenceControllerV2(context, fragment));
+ controllers.add(new ImsStatusPreferenceController(context, lifecycle));
+ controllers.add(new IpAddressPreferenceController(context, lifecycle));
+ controllers.add(new WifiMacAddressPreferenceController(context, lifecycle));
+ controllers.add(new BluetoothAddressPreferenceController(context, lifecycle));
+ controllers.add(new RegulatoryInfoPreferenceController(context));
+ controllers.add(new SafetyInfoPreferenceController(context));
controllers.add(new ManualPreferenceController(context));
controllers.add(new FeedbackPreferenceController(fragment, context));
- controllers.add(new KernelVersionPreferenceController(context));
- controllers.add(new BasebandVersionPreferenceController(context));
- controllers.add(new FirmwareVersionPreferenceController(context, lifecycle));
- controllers.add(new RegulatoryInfoPreferenceController(context));
- controllers.add(new DeviceModelPreferenceController(context, fragment));
- controllers.add(new SecurityPatchPreferenceController(context));
controllers.add(new FccEquipmentIdPreferenceController(context));
- controllers.add(new SafetyInfoPreferenceController(context));
+ controllers.add(
+ new BuildNumberPreferenceController(context, activity, fragment, lifecycle));
return controllers;
}
@@ -220,8 +176,7 @@
public List<SearchIndexableResource> getXmlResourcesToIndex(
Context context, boolean enabled) {
final SearchIndexableResource sir = new SearchIndexableResource(context);
- sir.xmlResId = FeatureFlagUtils.isEnabled(context, DEVICE_INFO_V2)
- ? R.xml.device_info_settings_v2 : R.xml.device_info_settings;
+ sir.xmlResId = R.xml.device_info_settings_v2;
return Arrays.asList(sir);
}
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index ff0f59f..9314952 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -148,9 +148,6 @@
public static class ApnEditorActivity extends SettingsActivity { /* empty */ }
public static class ChooseAccountActivity extends SettingsActivity { /* empty */ }
public static class IccLockSettingsActivity extends SettingsActivity { /* empty */ }
- public static class ImeiInformationActivity extends SettingsActivity { /* empty */ }
- public static class SimStatusActivity extends SettingsActivity { /* empty */ }
- public static class StatusActivity extends SettingsActivity { /* empty */ }
public static class TestingSettingsActivity extends SettingsActivity { /* empty */ }
public static class WifiAPITestActivity extends SettingsActivity { /* empty */ }
public static class WifiInfoActivity extends SettingsActivity { /* empty */ }
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 0611b09..2161415 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -42,6 +42,7 @@
import android.view.KeyEvent;
import android.view.accessibility.AccessibilityManager;
+import com.android.internal.accessibility.AccessibilityShortcutController;
import com.android.internal.content.PackageMonitor;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.view.RotationPolicy;
@@ -57,6 +58,7 @@
import com.android.settingslib.accessibility.AccessibilityUtils;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -172,13 +174,7 @@
}
};
- private final SettingsContentObserver mSettingsContentObserver =
- new SettingsContentObserver(mHandler) {
- @Override
- public void onChange(boolean selfChange, Uri uri) {
- updateServicePreferences();
- }
- };
+ private final SettingsContentObserver mSettingsContentObserver;
private final RotationPolicyListener mRotationPolicyListener = new RotationPolicyListener() {
@Override
@@ -224,6 +220,22 @@
.getBoolean(com.android.internal.R.bool.config_setColorTransformAccelerated);
}
+ public AccessibilitySettings() {
+ // Observe changes to anything that the shortcut can toggle, so we can reflect updates
+ final Collection<AccessibilityShortcutController.ToggleableFrameworkFeatureInfo> features =
+ AccessibilityShortcutController.getFrameworkShortcutFeaturesMap().values();
+ final List<String> shortcutFeatureKeys = new ArrayList<>(features.size());
+ for (AccessibilityShortcutController.ToggleableFrameworkFeatureInfo feature : features) {
+ shortcutFeatureKeys.add(feature.getSettingKey());
+ }
+ mSettingsContentObserver = new SettingsContentObserver(mHandler, shortcutFeatureKeys) {
+ @Override
+ public void onChange(boolean selfChange, Uri uri) {
+ updateAllPreferences();
+ }
+ };
+ }
+
@Override
public int getMetricsCategory() {
return MetricsEvent.ACCESSIBILITY;
diff --git a/src/com/android/settings/accessibility/SettingsContentObserver.java b/src/com/android/settings/accessibility/SettingsContentObserver.java
index c3baec5..de67f6c 100644
--- a/src/com/android/settings/accessibility/SettingsContentObserver.java
+++ b/src/com/android/settings/accessibility/SettingsContentObserver.java
@@ -22,16 +22,28 @@
import android.os.Handler;
import android.provider.Settings;
+import java.util.ArrayList;
+import java.util.List;
+
abstract class SettingsContentObserver extends ContentObserver {
+ private final List<String> mKeysToObserve = new ArrayList<>(2);
+
public SettingsContentObserver(Handler handler) {
super(handler);
+ mKeysToObserve.add(Settings.Secure.ACCESSIBILITY_ENABLED);
+ mKeysToObserve.add(Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
+ }
+
+ public SettingsContentObserver(Handler handler, List<String> keysToObserve) {
+ this(handler);
+ mKeysToObserve.addAll(keysToObserve);
}
public void register(ContentResolver contentResolver) {
- contentResolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.ACCESSIBILITY_ENABLED), false, this);
- contentResolver.registerContentObserver(Settings.Secure.getUriFor(
- Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES), false, this);
+ for (int i = 0; i < mKeysToObserve.size(); i++) {
+ contentResolver.registerContentObserver(
+ Settings.Secure.getUriFor(mKeysToObserve.get(i)), false, this);
+ }
}
public void unregister(ContentResolver contentResolver) {
diff --git a/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java b/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java
index e0c41be..52c1a0d 100644
--- a/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java
+++ b/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java
@@ -16,6 +16,8 @@
package com.android.settings.accessibility;
import static android.content.DialogInterface.BUTTON_POSITIVE;
+import static com.android.internal.accessibility.AccessibilityShortcutController.COLOR_INVERSION_COMPONENT_NAME;
+import static com.android.internal.accessibility.AccessibilityShortcutController.DALTONIZER_COMPONENT_NAME;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.Activity;
@@ -85,9 +87,16 @@
Map<ComponentName, ToggleableFrameworkFeatureInfo> frameworkFeatureInfoMap =
AccessibilityShortcutController.getFrameworkShortcutFeaturesMap();
for (ComponentName componentName : frameworkFeatureInfoMap.keySet()) {
- // Lookup icon
+ final int iconId;
+ if (componentName.equals(COLOR_INVERSION_COMPONENT_NAME)) {
+ iconId = R.drawable.ic_color_inversion;
+ } else if (componentName.equals(DALTONIZER_COMPONENT_NAME)) {
+ iconId = R.drawable.ic_daltonizer;
+ } else {
+ iconId = R.drawable.empty_icon;
+ }
candidates.add(new FrameworkCandidateInfo(frameworkFeatureInfoMap.get(componentName),
- R.drawable.empty_icon, componentName.flattenToString()));
+ iconId, componentName.flattenToString()));
}
for (int i = 0; i < numInstalledServices; i++) {
final AccessibilityServiceInfo installedServiceInfo = installedServices.get(i);
diff --git a/src/com/android/settings/core/FeatureFlags.java b/src/com/android/settings/core/FeatureFlags.java
index 9ceef47..4371b4a 100644
--- a/src/com/android/settings/core/FeatureFlags.java
+++ b/src/com/android/settings/core/FeatureFlags.java
@@ -20,7 +20,6 @@
* This class keeps track of all feature flags in Settings.
*/
public class FeatureFlags {
- public static final String DEVICE_INFO_V2 = "device_info_v2";
public static final String SEARCH_V2 = "settings_search_v2";
public static final String SUGGESTIONS_V2 = "new_settings_suggestion";
public static final String APP_INFO_V2 = "settings_app_info_v2";
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index ecef57e..acb20d5 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -65,12 +65,9 @@
import com.android.settings.datausage.DataUsageSummary;
import com.android.settings.deletionhelper.AutomaticStorageManagerSettings;
import com.android.settings.development.DevelopmentSettingsDashboardFragment;
-import com.android.settings.deviceinfo.ImeiInformation;
import com.android.settings.deviceinfo.PrivateVolumeForget;
import com.android.settings.deviceinfo.PrivateVolumeSettings;
import com.android.settings.deviceinfo.PublicVolumeSettings;
-import com.android.settings.deviceinfo.SimStatus;
-import com.android.settings.deviceinfo.Status;
import com.android.settings.deviceinfo.StorageDashboardFragment;
import com.android.settings.deviceinfo.StorageSettings;
import com.android.settings.display.NightDisplaySettings;
@@ -235,9 +232,6 @@
ManagedProfileSettings.class.getName(),
ChooseAccountActivity.class.getName(),
IccLockSettings.class.getName(),
- ImeiInformation.class.getName(),
- SimStatus.class.getName(),
- Status.class.getName(),
TestingSettings.class.getName(),
WifiAPITest.class.getName(),
WifiInfo.class.getName(),
diff --git a/src/com/android/settings/deviceinfo/BasebandVersionPreferenceController.java b/src/com/android/settings/deviceinfo/BasebandVersionPreferenceController.java
deleted file mode 100644
index 06ed872..0000000
--- a/src/com/android/settings/deviceinfo/BasebandVersionPreferenceController.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2017 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.deviceinfo;
-
-import android.content.Context;
-import android.os.SystemProperties;
-import android.support.v7.preference.Preference;
-
-import com.android.settings.R;
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settings.deviceinfo.firmwareversion.BasebandVersionDialogController;
-import com.android.settingslib.Utils;
-import com.android.settingslib.core.AbstractPreferenceController;
-
-/**
- * deprecated in favor of {@link BasebandVersionDialogController}
- */
-@Deprecated
-public class BasebandVersionPreferenceController extends AbstractPreferenceController implements
- PreferenceControllerMixin {
-
- private static final String BASEBAND_PROPERTY = "gsm.version.baseband";
- private static final String KEY_BASEBAND_VERSION = "baseband_version";
-
- public BasebandVersionPreferenceController(Context context) {
- super(context);
- }
-
- @Override
- public boolean isAvailable() {
- return !Utils.isWifiOnly(mContext);
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY_BASEBAND_VERSION;
- }
-
- @Override
- public void updateState(Preference preference) {
- super.updateState(preference);
- preference.setSummary(SystemProperties.get(BASEBAND_PROPERTY,
- mContext.getResources().getString(R.string.device_info_default)));
- }
-}
diff --git a/src/com/android/settings/deviceinfo/BatteryInfoPreferenceController.java b/src/com/android/settings/deviceinfo/BatteryInfoPreferenceController.java
deleted file mode 100644
index b5c12f7..0000000
--- a/src/com/android/settings/deviceinfo/BatteryInfoPreferenceController.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2017 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.deviceinfo;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.support.annotation.VisibleForTesting;
-import android.support.v7.preference.Preference;
-import android.support.v7.preference.PreferenceScreen;
-
-import com.android.settings.Utils;
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settings.fuelgauge.PowerUsageSummary;
-import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnStart;
-import com.android.settingslib.core.lifecycle.events.OnStop;
-
-/**
- * Deprecated in About Phone V2
- * Information in this preference is available in {@link PowerUsageSummary}
- */
-@Deprecated
-public class BatteryInfoPreferenceController extends AbstractPreferenceController
- implements PreferenceControllerMixin, LifecycleObserver, OnStart, OnStop {
-
- @VisibleForTesting
- static final IntentFilter BATTERY_INFO_RECEIVER_INTENT_FILTER =
- new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
- @VisibleForTesting
- static final String KEY_BATTERY_STATUS = "battery_status";
- @VisibleForTesting
- static final String KEY_BATTERY_LEVEL = "battery_level";
-
- @VisibleForTesting
- BroadcastReceiver mBatteryInfoReceiver;
- private Preference mBatteryStatus;
- private Preference mBatteryLevel;
-
-
- public BatteryInfoPreferenceController(Context context, Lifecycle lifecycle) {
- super(context);
- mBatteryInfoReceiver = new BatteryInfoReceiver(context);
- if (lifecycle != null) {
- lifecycle.addObserver(this);
- }
- }
-
- @Override
- public boolean isAvailable() {
- return true;
- }
-
- @Override
- public String getPreferenceKey() {
- return null;
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
- mBatteryLevel = screen.findPreference(KEY_BATTERY_LEVEL);
- mBatteryStatus = screen.findPreference(KEY_BATTERY_STATUS);
- }
-
- @Override
- public void onStart() {
- mContext.registerReceiver(mBatteryInfoReceiver, BATTERY_INFO_RECEIVER_INTENT_FILTER);
- }
-
- @Override
- public void onStop() {
- mContext.unregisterReceiver(mBatteryInfoReceiver);
- }
-
- private class BatteryInfoReceiver extends BroadcastReceiver {
-
- private final Context mContext;
-
- public BatteryInfoReceiver(Context context) {
- mContext = context;
- }
-
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- if (Intent.ACTION_BATTERY_CHANGED.equals(action)) {
- mBatteryLevel.setSummary(Utils.getBatteryPercentage(intent));
- mBatteryStatus.setSummary(Utils.getBatteryStatus(mContext.getResources(), intent));
- }
- }
- }
-}
diff --git a/src/com/android/settings/deviceinfo/DeviceModelPreferenceController.java b/src/com/android/settings/deviceinfo/DeviceModelPreferenceController.java
index 7934ad7..ee069da 100644
--- a/src/com/android/settings/deviceinfo/DeviceModelPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/DeviceModelPreferenceController.java
@@ -21,10 +21,8 @@
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
-import android.util.FeatureFlagUtils;
import com.android.settings.R;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.DeviceInfoUtils;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -51,12 +49,8 @@
super.displayPreference(screen);
final Preference pref = screen.findPreference(KEY_DEVICE_MODEL);
if (pref != null) {
- if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.DEVICE_INFO_V2)) {
- pref.setSummary(mContext.getResources().getString(R.string.model_summary,
- getDeviceModel()));
- } else {
- pref.setSummary(getDeviceModel());
- }
+ pref.setSummary(mContext.getResources().getString(R.string.model_summary,
+ getDeviceModel()));
}
}
diff --git a/src/com/android/settings/deviceinfo/FirmwareVersionPreferenceController.java b/src/com/android/settings/deviceinfo/FirmwareVersionPreferenceController.java
deleted file mode 100644
index 8c9a2f1..0000000
--- a/src/com/android/settings/deviceinfo/FirmwareVersionPreferenceController.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2017 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.deviceinfo;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Build;
-import android.os.SystemClock;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.support.v7.preference.Preference;
-import android.support.v7.preference.PreferenceScreen;
-import android.text.TextUtils;
-import android.util.Log;
-
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settings.deviceinfo.firmwareversion.FirmwareVersionPreferenceControllerV2;
-import com.android.settingslib.RestrictedLockUtils;
-import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnResume;
-
-/**
- * deprecated in favor of {@link FirmwareVersionPreferenceControllerV2}
- */
-@Deprecated
-public class FirmwareVersionPreferenceController extends AbstractPreferenceController implements
- PreferenceControllerMixin, LifecycleObserver, OnResume {
-
- private static final String TAG = "FirmwareVersionPref";
- private static final String KEY_FIRMWARE_VERSION = "firmware_version";
-
- private final UserManager mUserManager;
-
- private RestrictedLockUtils.EnforcedAdmin mFunDisallowedAdmin;
- private boolean mFunDisallowedBySystem;
-
- private long[] mHits = new long[3];
-
- public FirmwareVersionPreferenceController(Context context, Lifecycle lifecycle) {
- super(context);
- mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
- if (lifecycle != null) {
- lifecycle.addObserver(this);
- }
- }
-
- @Override
- public boolean isAvailable() {
- return true;
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
- final Preference pref = screen.findPreference(KEY_FIRMWARE_VERSION);
- if (pref != null) {
- pref.setSummary(Build.VERSION.RELEASE);
- }
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY_FIRMWARE_VERSION;
- }
-
- @Override
- public void onResume() {
- mFunDisallowedAdmin = RestrictedLockUtils.checkIfRestrictionEnforced(
- mContext, UserManager.DISALLOW_FUN, UserHandle.myUserId());
- mFunDisallowedBySystem = RestrictedLockUtils.hasBaseUserRestriction(
- mContext, UserManager.DISALLOW_FUN, UserHandle.myUserId());
- }
-
- @Override
- public boolean handlePreferenceTreeClick(Preference preference) {
- if (!TextUtils.equals(preference.getKey(), KEY_FIRMWARE_VERSION)) {
- return false;
- }
- System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1);
- mHits[mHits.length - 1] = SystemClock.uptimeMillis();
- if (mHits[0] >= (SystemClock.uptimeMillis() - 500)) {
- if (mUserManager.hasUserRestriction(UserManager.DISALLOW_FUN)) {
- if (mFunDisallowedAdmin != null && !mFunDisallowedBySystem) {
- RestrictedLockUtils.sendShowAdminSupportDetailsIntent(mContext,
- mFunDisallowedAdmin);
- }
- Log.d(TAG, "Sorry, no fun for you!");
- return false;
- }
-
- final Intent intent = new Intent(Intent.ACTION_MAIN)
- .setClassName(
- "android", com.android.internal.app.PlatLogoActivity.class.getName());
- try {
- mContext.startActivity(intent);
- return true;
- } catch (Exception e) {
- Log.e(TAG, "Unable to start activity " + intent.toString());
- }
- }
- return false;
- }
-}
diff --git a/src/com/android/settings/deviceinfo/HardwareInfoDialogFragment.java b/src/com/android/settings/deviceinfo/HardwareInfoDialogFragment.java
index 26f1ac2..6169b44 100644
--- a/src/com/android/settings/deviceinfo/HardwareInfoDialogFragment.java
+++ b/src/com/android/settings/deviceinfo/HardwareInfoDialogFragment.java
@@ -23,14 +23,12 @@
import android.os.SystemProperties;
import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
-import android.util.FeatureFlagUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
public class HardwareInfoDialogFragment extends InstrumentedDialogFragment {
@@ -59,12 +57,7 @@
DeviceModelPreferenceController.getDeviceModel());
// Serial number
- if (FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.DEVICE_INFO_V2)) {
- setText(content, R.id.serial_number_label, R.id.serial_number_value, getSerialNumber());
- } else {
- content.findViewById(R.id.serial_number_label).setVisibility(View.GONE);
- content.findViewById(R.id.serial_number_value).setVisibility(View.GONE);
- }
+ setText(content, R.id.serial_number_label, R.id.serial_number_value, getSerialNumber());
// Hardware rev
setText(content, R.id.hardware_rev_label, R.id.hardware_rev_value,
diff --git a/src/com/android/settings/deviceinfo/ImeiInfoPreferenceController.java b/src/com/android/settings/deviceinfo/ImeiInfoPreferenceController.java
deleted file mode 100644
index 456dbfc..0000000
--- a/src/com/android/settings/deviceinfo/ImeiInfoPreferenceController.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2017 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.deviceinfo;
-
-import android.content.Context;
-
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settings.deviceinfo.imei.ImeiInfoPreferenceControllerV2;
-import com.android.settingslib.deviceinfo.AbstractSimStatusImeiInfoPreferenceController;
-
-/**
- * deprecated in favour of {@link ImeiInfoPreferenceControllerV2}
- */
-@Deprecated
-public class ImeiInfoPreferenceController extends AbstractSimStatusImeiInfoPreferenceController
- implements PreferenceControllerMixin {
-
- private static final String KEY_IMEI_INFO = "imei_info";
-
- public ImeiInfoPreferenceController(Context context) {
- super(context);
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY_IMEI_INFO;
- }
-}
diff --git a/src/com/android/settings/deviceinfo/ImeiInformation.java b/src/com/android/settings/deviceinfo/ImeiInformation.java
deleted file mode 100644
index 9f38f1b..0000000
--- a/src/com/android/settings/deviceinfo/ImeiInformation.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2014 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.deviceinfo;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.support.v7.preference.Preference;
-import android.support.v7.preference.PreferenceScreen;
-import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
-import android.text.Spannable;
-import android.text.SpannableStringBuilder;
-import android.text.Spanned;
-import android.text.TextUtils;
-
-import android.text.style.TtsSpan;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneConstants;
-import com.android.internal.telephony.PhoneFactory;
-import com.android.settings.R;
-import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.deviceinfo.imei.ImeiInfoPreferenceControllerV2;
-
-/**
- * deprecated in favor of {@link ImeiInfoPreferenceControllerV2}
- */
-@Deprecated
-public class ImeiInformation extends SettingsPreferenceFragment {
-
- private static final String KEY_PRL_VERSION = "prl_version";
- private static final String KEY_MIN_NUMBER = "min_number";
- private static final String KEY_MEID_NUMBER = "meid_number";
- private static final String KEY_ICC_ID = "icc_id";
- private static final String KEY_IMEI = "imei";
- private static final String KEY_IMEI_SV = "imei_sv";
-
- private SubscriptionManager mSubscriptionManager;
- private boolean isMultiSIM = false;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mSubscriptionManager = SubscriptionManager.from(getContext());
- final TelephonyManager telephonyManager =
- (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
- initPreferenceScreen(telephonyManager.getSimCount());
- }
-
- // Since there are multiple phone for dsds, therefore need to show information for different
- // phones.
- private void initPreferenceScreen(int slotCount) {
- isMultiSIM = (slotCount > 1);
- for (int slotId = 0; slotId < slotCount; slotId ++) {
- addPreferencesFromResource(R.xml.device_info_phone_status);
- setPreferenceValue(slotId);
- setNewKey(slotId);
- }
- }
-
- private void setPreferenceValue(int phoneId) {
- final Phone phone = PhoneFactory.getPhone(phoneId);
-
- if (phone != null) {
- if (phone.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
- setSummaryText(KEY_MEID_NUMBER, phone.getMeid());
- setSummaryText(KEY_MIN_NUMBER, phone.getCdmaMin());
-
- if (getResources().getBoolean(R.bool.config_msid_enable)) {
- findPreference(KEY_MIN_NUMBER).setTitle(R.string.status_msid_number);
- }
-
- setSummaryText(KEY_PRL_VERSION, phone.getCdmaPrlVersion());
-
- if (phone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE) {
- // Show ICC ID and IMEI for LTE device
- setSummaryText(KEY_ICC_ID, phone.getIccSerialNumber());
- setSummaryTextAsDigit(KEY_IMEI, phone.getImei());
- setSummaryTextAsDigit(KEY_IMEI_SV, phone.getDeviceSvn());
- } else {
- // device is not GSM/UMTS, do not display GSM/UMTS features
- // check Null in case no specified preference in overlay xml
- removePreferenceFromScreen(KEY_IMEI_SV);
- removePreferenceFromScreen(KEY_IMEI);
- removePreferenceFromScreen(KEY_ICC_ID);
- }
- } else {
- setSummaryTextAsDigit(KEY_IMEI, phone.getImei());
- setSummaryTextAsDigit(KEY_IMEI_SV, phone.getDeviceSvn());
- // device is not CDMA, do not display CDMA features
- // check Null in case no specified preference in overlay xml
- removePreferenceFromScreen(KEY_PRL_VERSION);
- removePreferenceFromScreen(KEY_MEID_NUMBER);
- removePreferenceFromScreen(KEY_MIN_NUMBER);
- removePreferenceFromScreen(KEY_ICC_ID);
- }
- }
- }
-
- // Modify the preference key with prefix "_", so new added information preference can be set
- // related phone information.
- private void setNewKey(int slotId) {
- final PreferenceScreen prefScreen = getPreferenceScreen();
- final int count = prefScreen.getPreferenceCount();
- for (int i = 0; i < count; i++) {
- Preference pref = prefScreen.getPreference(i);
- String key = pref.getKey();
- if (!key.startsWith("_")){
- key = "_" + key + String.valueOf(slotId);
- pref.setKey(key);
- updateTitle(pref, slotId);
- }
- }
- }
-
- private void updateTitle(Preference pref, int slotId) {
- if (pref != null) {
- String title = pref.getTitle().toString();
- if (isMultiSIM) {
- // Slot starts from 1, slotId starts from 0 so plus 1
- title += " " + getResources().getString(R.string.slot_number, slotId + 1);
- }
- pref.setTitle(title);
- }
- }
-
- private void setSummaryText(String key, String text) {
- setSummaryText(key, text, false /* forceDigit */);
- }
-
- private void setSummaryTextAsDigit(String key, String text) {
- setSummaryText(key, text, true /* forceDigit */);
- }
-
- private void setSummaryText(String key, CharSequence text, boolean forceDigit) {
- final Preference preference = findPreference(key);
-
- if (TextUtils.isEmpty(text)) {
- text = getResources().getString(R.string.device_info_default);
- } else if (forceDigit && TextUtils.isDigitsOnly(text)) {
- final Spannable spannable = new SpannableStringBuilder(text);
- final TtsSpan span = new TtsSpan.DigitsBuilder(text.toString()).build();
- spannable.setSpan(span, 0, spannable.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
- text = spannable;
- }
-
- if (preference != null) {
- preference.setSummary(text);
- }
- }
-
- /**
- * Removes the specified preference, if it exists.
- * @param key the key for the Preference item
- */
- private void removePreferenceFromScreen(String key) {
- final Preference preference = findPreference(key);
- if (preference != null) {
- getPreferenceScreen().removePreference(preference);
- }
- }
-
- @Override
- public int getMetricsCategory() {
- return MetricsEvent.DEVICEINFO_IMEI_INFORMATION;
- }
-}
diff --git a/src/com/android/settings/deviceinfo/SecurityPatchPreferenceController.java b/src/com/android/settings/deviceinfo/SecurityPatchPreferenceController.java
deleted file mode 100644
index 9b0120e..0000000
--- a/src/com/android/settings/deviceinfo/SecurityPatchPreferenceController.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2017 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.deviceinfo;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.support.v7.preference.Preference;
-import android.support.v7.preference.PreferenceScreen;
-import android.text.TextUtils;
-import android.util.Log;
-
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settings.deviceinfo.firmwareversion.SecurityPatchLevelDialogController;
-import com.android.settingslib.DeviceInfoUtils;
-import com.android.settingslib.core.AbstractPreferenceController;
-
-/**
- * deprecated in favor of {@link SecurityPatchLevelDialogController}
- */
-@Deprecated
-public class SecurityPatchPreferenceController extends AbstractPreferenceController implements
- PreferenceControllerMixin {
-
- private static final String KEY_SECURITY_PATCH = "security_patch";
- private static final String TAG = "SecurityPatchPref";
-
- private final String mPatch;
- private final PackageManager mPackageManager;
-
- public SecurityPatchPreferenceController(Context context) {
- super(context);
- mPackageManager = mContext.getPackageManager();
- mPatch = DeviceInfoUtils.getSecurityPatch();
- }
-
- @Override
- public boolean isAvailable() {
- return !TextUtils.isEmpty(mPatch);
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY_SECURITY_PATCH;
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
- final Preference pref = screen.findPreference(KEY_SECURITY_PATCH);
- if (pref != null) {
- pref.setSummary(mPatch);
- }
- }
-
- @Override
- public boolean handlePreferenceTreeClick(Preference preference) {
- if (!TextUtils.equals(preference.getKey(), KEY_SECURITY_PATCH)) {
- return false;
- }
- if (mPackageManager.queryIntentActivities(preference.getIntent(), 0).isEmpty()) {
- // Don't send out the intent to stop crash
- Log.w(TAG, "Stop click action on " + KEY_SECURITY_PATCH + ": "
- + "queryIntentActivities() returns empty");
- return true;
- }
- return false;
- }
-}
diff --git a/src/com/android/settings/deviceinfo/SerialNumberPreferenceController.java b/src/com/android/settings/deviceinfo/SerialNumberPreferenceController.java
deleted file mode 100644
index e466bbf..0000000
--- a/src/com/android/settings/deviceinfo/SerialNumberPreferenceController.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2016 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.deviceinfo;
-
-import android.content.Context;
-import android.os.Build;
-
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.deviceinfo.AbstractSerialNumberPreferenceController;
-
-/**
- * Preference controller for displaying device serial number. Wraps {@link Build#getSerial()}.
- *
- * deprecated because this preference is no longer used in About Phone V2
- */
-@Deprecated
-public class SerialNumberPreferenceController extends
- AbstractSerialNumberPreferenceController implements
- PreferenceControllerMixin {
- public SerialNumberPreferenceController(Context context) {
- super(context);
- }
-
- // This space intentionally left blank
-}
diff --git a/src/com/android/settings/deviceinfo/SimStatus.java b/src/com/android/settings/deviceinfo/SimStatus.java
deleted file mode 100644
index dad4419..0000000
--- a/src/com/android/settings/deviceinfo/SimStatus.java
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
- * Copyright (C) 2014 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.deviceinfo;
-
-import static android.content.Context.CARRIER_CONFIG_SERVICE;
-import static android.content.Context.TELEPHONY_SERVICE;
-
-import android.Manifest;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.res.Resources;
-import android.os.Bundle;
-import android.os.PersistableBundle;
-import android.os.UserHandle;
-import android.os.UserManager;
-import android.support.v7.preference.Preference;
-import android.telephony.CarrierConfigManager;
-import android.telephony.CellBroadcastMessage;
-import android.telephony.PhoneStateListener;
-import android.telephony.ServiceState;
-import android.telephony.SignalStrength;
-import android.telephony.SubscriptionInfo;
-import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ListView;
-import android.widget.TabHost;
-import android.widget.TabHost.OnTabChangeListener;
-import android.widget.TabHost.TabContentFactory;
-import android.widget.TabHost.TabSpec;
-import android.widget.TabWidget;
-
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneConstantConversions;
-import com.android.internal.telephony.PhoneFactory;
-import com.android.settings.R;
-import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.Utils;
-import com.android.settingslib.DeviceInfoUtils;
-
-import java.util.List;
-
-
-/**
- * Display the following information
- * # Phone Number
- * # Network
- * # Roaming
- * # Device Id (IMEI in GSM and MEID in CDMA)
- * # Network type
- * # Operator info (area update info cell broadcast)
- * # Signal Strength
- *
- * deprecated in favor of {@link com.android.settings.deviceinfo.simstatus.SimStatusDialogFragment}
- */
-@Deprecated
-public class SimStatus extends SettingsPreferenceFragment {
- private static final String TAG = "SimStatus";
-
- private static final String KEY_DATA_STATE = "data_state";
- private static final String KEY_SERVICE_STATE = "service_state";
- private static final String KEY_OPERATOR_NAME = "operator_name";
- private static final String KEY_ROAMING_STATE = "roaming_state";
- private static final String KEY_NETWORK_TYPE = "network_type";
- private static final String KEY_LATEST_AREA_INFO = "latest_area_info";
- private static final String KEY_PHONE_NUMBER = "number";
- private static final String KEY_SIGNAL_STRENGTH = "signal_strength";
- private static final String KEY_IMEI = "imei";
- private static final String KEY_IMEI_SV = "imei_sv";
- private static final String KEY_ICCID = "iccid";
-
- static private final String CB_AREA_INFO_RECEIVED_ACTION =
- "com.android.cellbroadcastreceiver.CB_AREA_INFO_RECEIVED";
-
- static private final String GET_LATEST_CB_AREA_INFO_ACTION =
- "com.android.cellbroadcastreceiver.GET_LATEST_CB_AREA_INFO";
-
- static private final String CELL_BROADCAST_RECEIVER_APP = "com.android.cellbroadcastreceiver";
-
- private TelephonyManager mTelephonyManager;
- private CarrierConfigManager mCarrierConfigManager;
- private Phone mPhone = null;
- private Resources mRes;
- private Preference mSignalStrength;
- private SubscriptionInfo mSir;
- private boolean mShowLatestAreaInfo;
- private boolean mShowICCID;
-
- // Default summary for items
- private String mDefaultText;
-
- private TabHost mTabHost;
- private TabWidget mTabWidget;
- private ListView mListView;
- private List<SubscriptionInfo> mSelectableSubInfos;
-
- private PhoneStateListener mPhoneStateListener;
-
- // Once the cell broadcast configuration is moved into telephony framework,
- private final BroadcastReceiver mAreaInfoReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- if (CB_AREA_INFO_RECEIVED_ACTION.equals(action)) {
- Bundle extras = intent.getExtras();
- if (extras == null) {
- return;
- }
- CellBroadcastMessage cbMessage = (CellBroadcastMessage) extras.get("message");
- if (cbMessage != null && mSir.getSubscriptionId() == cbMessage.getSubId()) {
- String latestAreaInfo = cbMessage.getMessageBody();
- updateAreaInfo(latestAreaInfo);
- }
- }
- }
- };
-
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- mTelephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
- mCarrierConfigManager = (CarrierConfigManager) getSystemService(CARRIER_CONFIG_SERVICE);
-
- mSelectableSubInfos = SubscriptionManager.from(getContext())
- .getActiveSubscriptionInfoList();
-
- addPreferencesFromResource(R.xml.device_info_sim_status);
-
- mRes = getResources();
- mDefaultText = mRes.getString(R.string.device_info_default);
- // Note - missing in zaku build, be careful later...
- mSignalStrength = findPreference(KEY_SIGNAL_STRENGTH);
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- if (mSelectableSubInfos == null) {
- mSir = null;
- } else {
- mSir = mSelectableSubInfos.size() > 0 ? mSelectableSubInfos.get(0) : null;
-
- if (mSelectableSubInfos.size() > 1) {
- View view = inflater.inflate(R.layout.icc_lock_tabs, container, false);
- final ViewGroup prefs_container = (ViewGroup) view.findViewById(
- R.id.prefs_container);
- Utils.prepareCustomPreferencesList(container, view, prefs_container, false);
- View prefs = super.onCreateView(inflater, prefs_container, savedInstanceState);
- prefs_container.addView(prefs);
-
- mTabHost = (TabHost) view.findViewById(android.R.id.tabhost);
- mTabWidget = (TabWidget) view.findViewById(android.R.id.tabs);
- mListView = (ListView) view.findViewById(android.R.id.list);
-
- mTabHost.setup();
- mTabHost.setOnTabChangedListener(mTabListener);
- mTabHost.clearAllTabs();
-
- for (int i = 0; i < mSelectableSubInfos.size(); i++) {
- mTabHost.addTab(buildTabSpec(String.valueOf(i),
- String.valueOf(mSelectableSubInfos.get(i).getDisplayName())));
- }
- return view;
- }
- }
- return super.onCreateView(inflater, container, savedInstanceState);
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
-
- updatePhoneInfos();
- }
-
- @Override
- public int getMetricsCategory() {
- return MetricsEvent.DEVICEINFO_SIM_STATUS;
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if (mPhone != null) {
- updatePreference();
-
- updateSignalStrength(mPhone.getSignalStrength());
- updateServiceState(mPhone.getServiceState());
- updateDataState();
- mTelephonyManager.listen(mPhoneStateListener,
- PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
- | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
- | PhoneStateListener.LISTEN_SERVICE_STATE);
- if (mShowLatestAreaInfo) {
- getContext().registerReceiver(mAreaInfoReceiver,
- new IntentFilter(CB_AREA_INFO_RECEIVED_ACTION),
- Manifest.permission.RECEIVE_EMERGENCY_BROADCAST, null);
- // Ask CellBroadcastReceiver to broadcast the latest area info received
- Intent getLatestIntent = new Intent(GET_LATEST_CB_AREA_INFO_ACTION);
- getLatestIntent.setPackage(CELL_BROADCAST_RECEIVER_APP);
- getContext().sendBroadcastAsUser(getLatestIntent, UserHandle.ALL,
- Manifest.permission.RECEIVE_EMERGENCY_BROADCAST);
- }
- }
- }
-
- @Override
- public void onPause() {
- super.onPause();
-
- if (mPhone != null) {
- mTelephonyManager.listen(mPhoneStateListener,
- PhoneStateListener.LISTEN_NONE);
- }
- if (mShowLatestAreaInfo) {
- getContext().unregisterReceiver(mAreaInfoReceiver);
- }
- }
-
- /**
- * Removes the specified preference, if it exists.
- * @param key the key for the Preference item
- */
- private void removePreferenceFromScreen(String key) {
- Preference pref = findPreference(key);
- if (pref != null) {
- getPreferenceScreen().removePreference(pref);
- }
- }
-
- private void setSummaryText(String key, String text) {
- if (TextUtils.isEmpty(text)) {
- text = mDefaultText;
- }
- // some preferences may be missing
- final Preference preference = findPreference(key);
- if (preference != null) {
- preference.setSummary(text);
- }
- }
-
- private void updateNetworkType() {
- // Whether EDGE, UMTS, etc...
- String networktype = null;
- final int subId = mSir.getSubscriptionId();
- final int actualDataNetworkType = mTelephonyManager.getDataNetworkType(
- mSir.getSubscriptionId());
- final int actualVoiceNetworkType = mTelephonyManager.getVoiceNetworkType(
- mSir.getSubscriptionId());
- if (TelephonyManager.NETWORK_TYPE_UNKNOWN != actualDataNetworkType) {
- networktype = mTelephonyManager.getNetworkTypeName(actualDataNetworkType);
- } else if (TelephonyManager.NETWORK_TYPE_UNKNOWN != actualVoiceNetworkType) {
- networktype = mTelephonyManager.getNetworkTypeName(actualVoiceNetworkType);
- }
-
- boolean show4GForLTE = false;
- try {
- Context con = getActivity().createPackageContext("com.android.systemui", 0);
- int id = con.getResources().getIdentifier("config_show4GForLTE",
- "bool", "com.android.systemui");
- show4GForLTE = con.getResources().getBoolean(id);
- } catch (NameNotFoundException e) {
- Log.e(TAG, "NameNotFoundException for show4GFotLTE");
- }
-
- if (networktype != null && networktype.equals("LTE") && show4GForLTE) {
- networktype = "4G";
- }
- setSummaryText(KEY_NETWORK_TYPE, networktype);
- }
-
- private void updateDataState() {
- final int state =
- PhoneConstantConversions.convertDataState(mPhone.getDataConnectionState());
-
- String display = mRes.getString(R.string.radioInfo_unknown);
-
- switch (state) {
- case TelephonyManager.DATA_CONNECTED:
- display = mRes.getString(R.string.radioInfo_data_connected);
- break;
- case TelephonyManager.DATA_SUSPENDED:
- display = mRes.getString(R.string.radioInfo_data_suspended);
- break;
- case TelephonyManager.DATA_CONNECTING:
- display = mRes.getString(R.string.radioInfo_data_connecting);
- break;
- case TelephonyManager.DATA_DISCONNECTED:
- display = mRes.getString(R.string.radioInfo_data_disconnected);
- break;
- }
-
- setSummaryText(KEY_DATA_STATE, display);
- }
-
- private void updateServiceState(ServiceState serviceState) {
- final int state = serviceState.getState();
- String display = mRes.getString(R.string.radioInfo_unknown);
-
- switch (state) {
- case ServiceState.STATE_IN_SERVICE:
- display = mRes.getString(R.string.radioInfo_service_in);
- break;
- case ServiceState.STATE_OUT_OF_SERVICE:
- // Set signal strength to 0 when service state is STATE_OUT_OF_SERVICE
- mSignalStrength.setSummary("0");
- case ServiceState.STATE_EMERGENCY_ONLY:
- // Set summary string of service state to radioInfo_service_out when
- // service state is both STATE_OUT_OF_SERVICE & STATE_EMERGENCY_ONLY
- display = mRes.getString(R.string.radioInfo_service_out);
- break;
- case ServiceState.STATE_POWER_OFF:
- display = mRes.getString(R.string.radioInfo_service_off);
- // Also set signal strength to 0
- mSignalStrength.setSummary("0");
- break;
- }
-
- setSummaryText(KEY_SERVICE_STATE, display);
-
- if (serviceState.getRoaming()) {
- setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_in));
- } else {
- setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_not));
- }
- setSummaryText(KEY_OPERATOR_NAME, serviceState.getOperatorAlphaLong());
- }
-
- private void updateAreaInfo(String areaInfo) {
- if (areaInfo != null) {
- setSummaryText(KEY_LATEST_AREA_INFO, areaInfo);
- }
- }
-
- void updateSignalStrength(SignalStrength signalStrength) {
- if (mSignalStrength != null) {
- final int state = mPhone.getServiceState().getState();
-
- if ((ServiceState.STATE_OUT_OF_SERVICE == state) ||
- (ServiceState.STATE_POWER_OFF == state)) {
- mSignalStrength.setSummary("0");
- return;
- }
-
- int signalDbm = signalStrength.getDbm();
- int signalAsu = signalStrength.getAsuLevel();
-
- if (-1 == signalDbm) {
- signalDbm = 0;
- }
-
- if (-1 == signalAsu) {
- signalAsu = 0;
- }
-
- mSignalStrength.setSummary(mRes.getString(R.string.sim_signal_strength,
- signalDbm, signalAsu));
- }
- }
-
- private void updatePreference() {
- if (mPhone.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) {
- mShowLatestAreaInfo = Resources.getSystem().getBoolean(
- com.android.internal.R.bool.config_showAreaUpdateInfoSettings);
- }
- PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(
- mSir.getSubscriptionId());
- mShowICCID = carrierConfig.getBoolean(
- CarrierConfigManager.KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL);
-
-
- // If formattedNumber is null or empty, it'll display as "Unknown".
- setSummaryText(KEY_PHONE_NUMBER,
- DeviceInfoUtils.getFormattedPhoneNumber(getContext(), mSir));
- setSummaryText(KEY_IMEI, mPhone.getImei());
- setSummaryText(KEY_IMEI_SV, mPhone.getDeviceSvn());
-
- if (!mShowICCID) {
- removePreferenceFromScreen(KEY_ICCID);
- } else {
- // Get ICCID, which is SIM serial number
- String iccid = mTelephonyManager.getSimSerialNumber(mSir.getSubscriptionId());
- setSummaryText(KEY_ICCID, iccid);
- }
-
- if (!mShowLatestAreaInfo) {
- removePreferenceFromScreen(KEY_LATEST_AREA_INFO);
- }
-
- boolean hideSignalStrength = carrierConfig.getBoolean(
- CarrierConfigManager.KEY_HIDE_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL);
- if (hideSignalStrength) {
- removePreferenceFromScreen(KEY_SIGNAL_STRENGTH);
- }
- }
-
- private void updatePhoneInfos() {
- if (mSir != null) {
- // TODO: http://b/23763013
- final Phone phone = PhoneFactory.getPhone(SubscriptionManager.getPhoneId(
- mSir.getSubscriptionId()));
- if (UserManager.get(getContext()).isAdminUser()
- && SubscriptionManager.isValidSubscriptionId(mSir.getSubscriptionId())) {
- if (phone == null) {
- Log.e(TAG, "Unable to locate a phone object for the given Subscription ID.");
- return;
- }
-
- mPhone = phone;
- // To avoid register multiple listeners when user changes the tab.
- if (mPhoneStateListener != null && mTelephonyManager != null) {
- mTelephonyManager.listen(mPhoneStateListener,
- PhoneStateListener.LISTEN_NONE);
- mPhoneStateListener = null;
- }
- mPhoneStateListener = new PhoneStateListener(mSir.getSubscriptionId()) {
- @Override
- public void onDataConnectionStateChanged(int state) {
- updateDataState();
- updateNetworkType();
- }
-
- @Override
- public void onSignalStrengthsChanged(SignalStrength signalStrength) {
- updateSignalStrength(signalStrength);
- }
-
- @Override
- public void onServiceStateChanged(ServiceState serviceState) {
- updateServiceState(serviceState);
- }
- };
- }
- }
- }
- private OnTabChangeListener mTabListener = new OnTabChangeListener() {
- @Override
- public void onTabChanged(String tabId) {
- final int slotId = Integer.parseInt(tabId);
- mSir = mSelectableSubInfos.get(slotId);
-
- // The User has changed tab; update the SIM information.
- updatePhoneInfos();
- mTelephonyManager.listen(mPhoneStateListener,
- PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
- | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
- | PhoneStateListener.LISTEN_SERVICE_STATE);
- updateDataState();
- updateNetworkType();
- updatePreference();
- }
- };
-
- private TabContentFactory mEmptyTabContent = new TabContentFactory() {
- @Override
- public View createTabContent(String tag) {
- return new View(mTabHost.getContext());
- }
- };
-
- private TabSpec buildTabSpec(String tag, String title) {
- return mTabHost.newTabSpec(tag).setIndicator(title).setContent(
- mEmptyTabContent);
- }
-}
diff --git a/src/com/android/settings/deviceinfo/SimStatusPreferenceController.java b/src/com/android/settings/deviceinfo/SimStatusPreferenceController.java
deleted file mode 100644
index ca531ea5..0000000
--- a/src/com/android/settings/deviceinfo/SimStatusPreferenceController.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2017 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.deviceinfo;
-
-import android.content.Context;
-
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settings.deviceinfo.simstatus.SimStatusPreferenceControllerV2;
-import com.android.settingslib.deviceinfo.AbstractSimStatusImeiInfoPreferenceController;
-
-/**
- * deprecated in favor of {@link SimStatusPreferenceControllerV2}
- */
-@Deprecated
-public class SimStatusPreferenceController extends AbstractSimStatusImeiInfoPreferenceController
- implements PreferenceControllerMixin {
-
- private static final String KEY_SIM_STATUS = "sim_status";
-
- public SimStatusPreferenceController(Context context) {
- super(context);
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY_SIM_STATUS;
- }
-}
diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java
deleted file mode 100644
index 15ad5cf..0000000
--- a/src/com/android/settings/deviceinfo/Status.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2008 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.deviceinfo;
-
-import android.content.Context;
-import android.provider.SearchIndexableResource;
-
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.DeviceInfoSettings;
-import com.android.settings.R;
-import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Fragment for showing device hardware info, such as MAC addresses and serial numbers
- * Deprecated in About Phone V2
- * Information on this page is available in {@link DeviceInfoSettings}
- */
-@Deprecated
-public class Status extends DashboardFragment {
-
- private static final String TAG = "DeviceStatus";
-
- @Override
- public int getMetricsCategory() {
- return MetricsEvent.DEVICEINFO_STATUS;
- }
-
- @Override
- protected String getLogTag() {
- return TAG;
- }
-
- @Override
- protected int getPreferenceScreenResId() {
- return R.xml.device_info_status;
- }
-
- @Override
- protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
- return buildPreferenceControllers(context, getLifecycle());
- }
-
- private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
- Lifecycle lifecycle) {
- final List<AbstractPreferenceController> controllers = new ArrayList<>();
- controllers.add(new SerialNumberPreferenceController(context));
- controllers.add(new UptimePreferenceController(context, lifecycle));
- controllers.add(new BluetoothAddressPreferenceController(context, lifecycle));
- controllers.add(new IpAddressPreferenceController(context, lifecycle));
- controllers.add(new WifiMacAddressPreferenceController(context, lifecycle));
- controllers.add(new ImsStatusPreferenceController(context, lifecycle));
- controllers.add(new SimStatusPreferenceController(context));
- controllers.add(new ImeiInfoPreferenceController(context));
- controllers.add(new BatteryInfoPreferenceController(context, lifecycle));
- return controllers;
- }
-
- /**
- * For Search.
- */
- public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
- new BaseSearchIndexProvider() {
-
- @Override
- public List<SearchIndexableResource> getXmlResourcesToIndex(
- Context context, boolean enabled) {
- final SearchIndexableResource sir = new SearchIndexableResource(context);
- sir.xmlResId = R.xml.device_info_status;
- return Arrays.asList(sir);
- }
-
- @Override
- public List<AbstractPreferenceController> getPreferenceControllers(Context
- context) {
- return buildPreferenceControllers(context, null /* lifecycle */);
- }
- };
-}
diff --git a/src/com/android/settings/deviceinfo/UptimePreferenceController.java b/src/com/android/settings/deviceinfo/UptimePreferenceController.java
deleted file mode 100644
index c25f984..0000000
--- a/src/com/android/settings/deviceinfo/UptimePreferenceController.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2017 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.deviceinfo;
-
-import android.content.Context;
-
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settings.fuelgauge.PowerUsageSummary;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.deviceinfo.AbstractUptimePreferenceController;
-
-/**
- * Concrete subclass of uptime preference controller
- *
- * Deprecated in About Phone V2
- * Information in this preference is available in {@link PowerUsageSummary}
- */
-@Deprecated
-public class UptimePreferenceController extends AbstractUptimePreferenceController
- implements PreferenceControllerMixin {
- public UptimePreferenceController(Context context, Lifecycle lifecycle) {
- super(context, lifecycle);
- }
-
- // This space intentionally left blank
-}
diff --git a/src/com/android/settings/display/ThemePreferenceController.java b/src/com/android/settings/display/ThemePreferenceController.java
index 3bb58b1..d1341dd74 100644
--- a/src/com/android/settings/display/ThemePreferenceController.java
+++ b/src/com/android/settings/display/ThemePreferenceController.java
@@ -125,7 +125,7 @@
private boolean isChangeableOverlay(String packageName) {
try {
PackageInfo pi = mPackageManager.getPackageInfo(packageName, 0);
- return pi != null && !pi.isStaticOverlay;
+ return pi != null && !pi.isStaticOverlayPackage();
} catch (PackageManager.NameNotFoundException e) {
return false;
}
diff --git a/tests/robotests/assets/grandfather_not_implementing_indexable b/tests/robotests/assets/grandfather_not_implementing_indexable
index eee2add..a82c9ef 100644
--- a/tests/robotests/assets/grandfather_not_implementing_indexable
+++ b/tests/robotests/assets/grandfather_not_implementing_indexable
@@ -1,12 +1,10 @@
com.android.settings.accessibility.ToggleScreenMagnificationPreferenceFragment
-com.android.settings.deviceinfo.SimStatus
com.android.settings.deviceinfo.PrivateVolumeForget
com.android.settings.inputmethod.SpellCheckersSettings
com.android.settings.inputmethod.KeyboardLayoutPickerFragment
com.android.settings.fuelgauge.InactiveApps
com.android.settings.accessibility.CaptionPropertiesFragment
com.android.settings.accessibility.AccessibilitySettingsForSetupWizard
-com.android.settings.deviceinfo.ImeiInformation
com.android.settings.datausage.DataUsageList
com.android.settings.vpn2.AppManagementFragment
com.android.settings.vpn2.VpnSettings
diff --git a/tests/robotests/assets/grandfather_not_in_search_index_provider_registry b/tests/robotests/assets/grandfather_not_in_search_index_provider_registry
index 9fd41f2..666b224 100644
--- a/tests/robotests/assets/grandfather_not_in_search_index_provider_registry
+++ b/tests/robotests/assets/grandfather_not_in_search_index_provider_registry
@@ -1,3 +1,2 @@
com.android.settings.display.ScreenZoomPreferenceFragmentForSetupWizard
-com.android.settings.search.indexing.FakeSettingsFragment
-com.android.settings.deviceinfo.Status
+com.android.settings.search.indexing.FakeSettingsFragment
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/DeviceInfoSettingsTest.java b/tests/robotests/src/com/android/settings/DeviceInfoSettingsTest.java
index 486993d..09ff9db 100644
--- a/tests/robotests/src/com/android/settings/DeviceInfoSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/DeviceInfoSettingsTest.java
@@ -30,12 +30,9 @@
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
-import android.os.SystemProperties;
import android.support.v7.preference.PreferenceScreen;
import android.telephony.TelephonyManager;
-import android.util.FeatureFlagUtils;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
@@ -98,8 +95,6 @@
SettingsShadowSystemProperties.class
})
public void getPrefXml_shouldReturnDeviceInfoXml() {
- SystemProperties.set(FeatureFlagUtils.FFLAG_OVERRIDE_PREFIX + FeatureFlags.DEVICE_INFO_V2,
- "true");
assertThat(mSettings.getPreferenceScreenResId()).isEqualTo(R.xml.device_info_settings_v2);
}
@@ -142,8 +137,6 @@
@Config(shadows = {SettingsShadowResources.SettingsShadowTheme.class,
SettingsShadowSystemProperties.class})
public void onCreate_singleSim_shouldAddSingleSimCount() {
- SystemProperties.set(FeatureFlagUtils.FFLAG_OVERRIDE_PREFIX + FeatureFlags.DEVICE_INFO_V2,
- "true");
doReturn(1).when(mTelephonyManager).getPhoneCount();
mSettings.onCreate(null /* icicle */);
@@ -156,8 +149,6 @@
@Config(shadows = {SettingsShadowResources.SettingsShadowTheme.class,
SettingsShadowSystemProperties.class})
public void onCreate_dualeSim_shouldAddDualSimCount() {
- SystemProperties.set(FeatureFlagUtils.FFLAG_OVERRIDE_PREFIX + FeatureFlags.DEVICE_INFO_V2,
- "true");
doReturn(2).when(mTelephonyManager).getPhoneCount();
mSettings.onCreate(null /* icicle */);
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/BasebandVersionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/BasebandVersionPreferenceControllerTest.java
deleted file mode 100644
index f71bae6..0000000
--- a/tests/robotests/src/com/android/settings/deviceinfo/BasebandVersionPreferenceControllerTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2017 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.deviceinfo;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.verify;
-import static org.robolectric.shadow.api.Shadow.extract;
-
-import android.net.ConnectivityManager;
-import android.support.v7.preference.Preference;
-
-import com.android.settings.TestConfig;
-import com.android.settings.deviceinfo.firmwareversion.BasebandVersionDialogController;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settings.testutils.shadow.SettingsShadowSystemProperties;
-import com.android.settings.testutils.shadow.ShadowConnectivityManager;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-
-/**
- * Deprecated in favor of {@link BasebandVersionDialogController}
- */
-@Deprecated
-@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
- shadows = ShadowConnectivityManager.class)
-public class BasebandVersionPreferenceControllerTest {
-
-
- @Mock
- private Preference mPreference;
-
- private BasebandVersionPreferenceController mController;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mController = new BasebandVersionPreferenceController(RuntimeEnvironment.application);
- }
-
- @Test
- public void isAvailable_wifiOnly_shouldReturnFalse() {
- ShadowConnectivityManager connectivityManager =
- extract(RuntimeEnvironment.application.getSystemService(ConnectivityManager.class));
- connectivityManager.setNetworkSupported(ConnectivityManager.TYPE_MOBILE, false);
- assertThat(mController.isAvailable()).isFalse();
- }
-
- @Test
- public void isAvailable_hasMobile_shouldReturnTrue() {
- ShadowConnectivityManager connectivityManager =
- extract(RuntimeEnvironment.application.getSystemService(ConnectivityManager.class));
- connectivityManager.setNetworkSupported(ConnectivityManager.TYPE_MOBILE, true);
- assertThat(mController.isAvailable()).isTrue();
- }
-
- @Config(shadows = {SettingsShadowSystemProperties.class})
- @Test
- public void updateState_shouldLoadFromSysProperty() {
- SettingsShadowSystemProperties.set("gsm.version.baseband", "test");
-
- mController.updateState(mPreference);
-
- verify(mPreference).setSummary("test");
- }
-}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/BatteryInfoPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/BatteryInfoPreferenceControllerTest.java
deleted file mode 100644
index 0ccc139..0000000
--- a/tests/robotests/src/com/android/settings/deviceinfo/BatteryInfoPreferenceControllerTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2017 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.deviceinfo;
-
-import static android.arch.lifecycle.Lifecycle.Event.ON_START;
-import static android.arch.lifecycle.Lifecycle.Event.ON_STOP;
-
-import static com.android.settings.deviceinfo.BatteryInfoPreferenceController
- .BATTERY_INFO_RECEIVER_INTENT_FILTER;
-import static com.android.settings.deviceinfo.BatteryInfoPreferenceController.KEY_BATTERY_LEVEL;
-import static com.android.settings.deviceinfo.BatteryInfoPreferenceController.KEY_BATTERY_STATUS;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.BatteryManager;
-import android.support.v7.preference.Preference;
-import android.support.v7.preference.PreferenceScreen;
-
-import com.android.settings.R;
-import com.android.settings.TestConfig;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-
-@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
-public class BatteryInfoPreferenceControllerTest {
-
- private Context mContext;
- @Mock
- private PreferenceScreen mScreen;
-
- private Preference mBatteryLevel;
- private Preference mBatteryStatus;
- private Lifecycle mLifecycle;
- private BatteryInfoPreferenceController mController;
-
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mContext = RuntimeEnvironment.application;
- mLifecycle = new Lifecycle(() -> mLifecycle);
- mController = new BatteryInfoPreferenceController(mContext, mLifecycle);
- mBatteryLevel = new Preference(mContext);
- mBatteryStatus = new Preference(mContext);
- when(mScreen.findPreference(KEY_BATTERY_STATUS)).thenReturn(mBatteryStatus);
- when(mScreen.findPreference(KEY_BATTERY_LEVEL)).thenReturn(mBatteryLevel);
- }
-
- @Test
- public void isAlwaysAvailable() {
- assertThat(mController.getPreferenceKey()).isNull();
- assertThat(mController.isAvailable()).isTrue();
- }
-
- @Test
- public void runThroughLifecycle_shouldRegisterUnregisterBatteryInfoReceiver() {
- final Context context = mock(Context.class);
- mController = new BatteryInfoPreferenceController(context, mLifecycle);
- mLifecycle.handleLifecycleEvent(ON_START);
- mLifecycle.handleLifecycleEvent(ON_STOP);
-
- verify(context).registerReceiver(mController.mBatteryInfoReceiver,
- BATTERY_INFO_RECEIVER_INTENT_FILTER);
- verify(context).unregisterReceiver(mController.mBatteryInfoReceiver);
- }
-
- @Test
- public void onReceiveBatteryInfoBroadcast_shouldUpdatePreferences() {
- mController.displayPreference(mScreen);
- final Intent intent = new Intent(Intent.ACTION_BATTERY_CHANGED);
- intent.putExtra(BatteryManager.EXTRA_LEVEL, 50);
- intent.putExtra(BatteryManager.EXTRA_SCALE, 100);
- intent.putExtra(BatteryManager.EXTRA_STATUS, BatteryManager.BATTERY_STATUS_CHARGING);
-
- mController.mBatteryInfoReceiver.onReceive(mContext, intent);
-
- assertThat(mBatteryLevel.getSummary()).isEqualTo("50%");
- assertThat(mBatteryStatus.getSummary())
- .isEqualTo(mContext.getText(R.string.battery_info_status_charging));
- }
-}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/DeviceModelPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/DeviceModelPreferenceControllerTest.java
index 347ca3a..6a5c7fa 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/DeviceModelPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/DeviceModelPreferenceControllerTest.java
@@ -19,6 +19,7 @@
import static com.android.settings.deviceinfo.DeviceModelPreferenceController.getDeviceModel;
import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.verify;
@@ -26,16 +27,12 @@
import android.app.Fragment;
import android.content.Context;
-import android.os.SystemProperties;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
-import android.util.FeatureFlagUtils;
import com.android.settings.R;
import com.android.settings.TestConfig;
-import com.android.settings.core.FeatureFlags;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settings.testutils.shadow.SettingsShadowSystemProperties;
import org.junit.Before;
import org.junit.Test;
@@ -57,6 +54,7 @@
@Mock
private PreferenceScreen mPreferenceScreen;
+
private Context mContext;
private DeviceModelPreferenceController mController;
@@ -76,12 +74,7 @@
}
@Test
- @Config(shadows = {
- SettingsShadowSystemProperties.class
- })
public void displayPref_shouldSetSummary() {
- SystemProperties.set(FeatureFlagUtils.FFLAG_OVERRIDE_PREFIX + FeatureFlags.DEVICE_INFO_V2,
- "true");
mController.displayPreference(mPreferenceScreen);
verify(mPreference).setSummary(mContext.getResources().getString(R.string.model_summary,
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/FirmwareVersionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/FirmwareVersionPreferenceControllerTest.java
deleted file mode 100644
index 09b2e7f..0000000
--- a/tests/robotests/src/com/android/settings/deviceinfo/FirmwareVersionPreferenceControllerTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2017 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.deviceinfo;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.os.UserManager;
-import android.support.v7.preference.Preference;
-import android.support.v7.preference.PreferenceScreen;
-
-import com.android.settings.TestConfig;
-import com.android.settings.deviceinfo.firmwareversion.FirmwareVersionDialogController;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.annotation.Config;
-
-/**
- * Deprecated in favor of {@link FirmwareVersionDialogController}
- */
-@Deprecated
-@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
-public class FirmwareVersionPreferenceControllerTest {
-
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private Context mContext;
- @Mock
- private Preference mPreference;
- @Mock
- private PreferenceScreen mPreferenceScreen;
- @Mock
- private UserManager mUserManager;
- private FirmwareVersionPreferenceController mController;
- private Lifecycle mLifecycle;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mLifecycle = new Lifecycle(() -> mLifecycle);
- when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
- when(mContext.getSystemService(Context.DEVICE_POLICY_SERVICE)).thenReturn(null);
- mController = new FirmwareVersionPreferenceController(mContext, mLifecycle);
- when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
- .thenReturn(mPreference);
- }
-
- @Test
- public void isAlwaysAvailable() {
- assertThat(mController.isAvailable()).isTrue();
- }
-}
diff --git a/tests/unit/src/com/android/settings/display/ThemePreferenceControllerTest.java b/tests/unit/src/com/android/settings/display/ThemePreferenceControllerTest.java
index 69c8c54..fe8203c 100644
--- a/tests/unit/src/com/android/settings/display/ThemePreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/display/ThemePreferenceControllerTest.java
@@ -118,8 +118,8 @@
}
return info;
});
- PackageInfo pi = new PackageInfo();
- pi.isStaticOverlay = true;
+ PackageInfo pi = mock(PackageInfo.class);
+ when(pi.isStaticOverlayPackage()).thenReturn(true);
when(mMockPackageManager.getPackageInfo(eq("com.android.Theme1"), anyInt())).thenReturn(pi);
when(mMockPackageManager.getPackageInfo(eq("com.android.Theme2"), anyInt())).thenReturn(
new PackageInfo());