Merge "Fixes incorrect Settings usages in ContextualAdaptiveSleepSliceTest" into rvc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 12075a2..17b498e 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -3196,7 +3196,6 @@
<activity-alias
android:name="MediaOutputSlice"
android:label="@string/media_output_panel_title"
- android:permission="android.permission.BLUETOOTH_PRIVILEGED"
android:targetActivity=".panel.SettingsPanelActivity">
<intent-filter>
<action android:name="com.android.settings.panel.action.MEDIA_OUTPUT" />
diff --git a/res/drawable/accessibility_captions.png b/res/drawable/accessibility_captions.png
new file mode 100644
index 0000000..5467386
--- /dev/null
+++ b/res/drawable/accessibility_captions.png
Binary files differ
diff --git a/res/drawable/accessibility_color_inversion_preview.png b/res/drawable/accessibility_color_inversion_preview.png
deleted file mode 100644
index 5c9f3ea..0000000
--- a/res/drawable/accessibility_color_inversion_preview.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/accessibility_dwell.png b/res/drawable/accessibility_dwell.png
new file mode 100644
index 0000000..b4f5598
--- /dev/null
+++ b/res/drawable/accessibility_dwell.png
Binary files differ
diff --git a/res/layout/color_inversion_preview.xml b/res/layout/accessibility_autoclick_preview.xml
similarity index 87%
rename from res/layout/color_inversion_preview.xml
rename to res/layout/accessibility_autoclick_preview.xml
index 18a0bb8..4fa3f8f 100644
--- a/res/layout/color_inversion_preview.xml
+++ b/res/layout/accessibility_autoclick_preview.xml
@@ -22,8 +22,9 @@
<ImageView
android:layout_width="match_parent"
- android:layout_height="@dimen/color_mode_preview_height"
+ android:layout_height="@dimen/autoclick_preview_height"
android:contentDescription="@null"
android:scaleType="fitCenter"
- android:src="@drawable/accessibility_color_inversion_preview"/>
+ android:src="@drawable/accessibility_dwell"/>
+
</FrameLayout>
diff --git a/res/layout/accessibility_captions_preview.xml b/res/layout/accessibility_captions_preview.xml
new file mode 100644
index 0000000..f3c0316
--- /dev/null
+++ b/res/layout/accessibility_captions_preview.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <ImageView
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/captioning_preview_height"
+ android:contentDescription="@null"
+ android:scaleType="fitCenter"
+ android:src="@drawable/accessibility_captions" />
+
+</FrameLayout>
diff --git a/res/layout/dialog_back_gesture_sensitivity.xml b/res/layout/dialog_back_gesture_sensitivity.xml
deleted file mode 100644
index 37ef771..0000000
--- a/res/layout/dialog_back_gesture_sensitivity.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2019 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
- -->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:padding="12dp">
-
- <SeekBar
- android:id="@+id/back_sensitivity_seekbar"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:min="0"
- android:max="3"
- style="@android:style/Widget.Material.SeekBar.Discrete"
- android:theme="@*android:style/ThemeOverlay.DeviceDefault.Accent" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:layout_marginTop="2dp"
- android:layout_marginBottom="8dp">
-
- <TextView android:id="@+id/low_tick"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_marginBottom="2dp"
- android:layout_marginStart="12dp"
- android:gravity="start"
- android:text="@string/low_label"
- android:textAppearance="?android:attr/textAppearance"
- android:singleLine="true"
- android:ellipsize="marquee" />
-
- <TextView android:id="@+id/high_tick"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_marginBottom="2dp"
- android:layout_marginEnd="12dp"
- android:gravity="end"
- android:text="@string/high_label"
- android:textAppearance="?android:attr/textAppearance"
- android:singleLine="true"
- android:ellipsize="marquee" />
-
- </LinearLayout>
-</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/notification_history_app_layout.xml b/res/layout/notification_history_app_layout.xml
index 4c899e6..5d8ff3f 100644
--- a/res/layout/notification_history_app_layout.xml
+++ b/res/layout/notification_history_app_layout.xml
@@ -82,10 +82,8 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/notification_list"
android:layout_width="match_parent"
- android:layout_height="0dp"
+ android:layout_height="wrap_content"
android:clipChildren="true"
- settings:layout_constraintHeight_max="300dp"
- settings:layout_constrainedHeight="true"
settings:fastScrollEnabled="true"
settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
diff --git a/res/layout/palette_listview_item.xml b/res/layout/palette_listview_item.xml
index 3342ef1..e67b7cb 100644
--- a/res/layout/palette_listview_item.xml
+++ b/res/layout/palette_listview_item.xml
@@ -28,6 +28,6 @@
android:maxLength="20"
android:paddingLeft="@dimen/accessibility_layout_margin_start_end"
android:singleLine="true"
- android:textSize="14dp" />
+ android:textSize="14sp" />
</FrameLayout>
diff --git a/res/raw/accessibility_color_inversion.mp4 b/res/raw/accessibility_color_inversion.mp4
new file mode 100644
index 0000000..d28b9b4
--- /dev/null
+++ b/res/raw/accessibility_color_inversion.mp4
Binary files differ
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
index c88158b..4ce02ee 100644
--- a/res/values-night/colors.xml
+++ b/res/values-night/colors.xml
@@ -37,6 +37,6 @@
<color name="palette_list_color_cyan">@color/palette_list_dark_mode_color_cyan</color>
<color name="palette_list_color_blue">@color/palette_list_dark_mode_color_blue</color>
<color name="palette_list_color_purple">@color/palette_list_dark_mode_color_purple</color>
- <color name="palette_list_color_pink">@color/palette_list_dark_mode_color_pink</color>
+ <color name="gestures_setting_background_color">@android:color/black</color>
</resources>
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index c19b948..1649cb2 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -786,7 +786,7 @@
<string-array name="captioning_font_size_selector_titles">
<item>Very small</item>
<item>Small</item>
- <item>Normal</item>
+ <item>Default</item>
<item>Large</item>
<item>Very large</item>
</string-array>
@@ -920,7 +920,7 @@
<!-- Titles for captioning text style preset preference. [CHAR LIMIT=35] -->
<string-array name="captioning_preset_selector_titles" >
- <item>Use app defaults</item>
+ <item>Set by app</item>
<item>White on black</item>
<item>Black on white</item>
<item>Yellow on black</item>
@@ -1375,89 +1375,6 @@
<item>"1"</item>
</string-array>
- <string-array name="enabled_networks_except_gsm_choices" translatable="false">
- <item>@string/network_lte</item>
- <item>@string/network_3G</item>
- </string-array>
- <string-array name="enabled_networks_except_gsm_4g_choices" translatable="false">
- <item>@string/network_4G</item>
- <item>@string/network_3G</item>
- </string-array>
- <string-array name="enabled_networks_except_gsm_values" translatable="false">
- <item>"9"</item>
- <item>"0"</item>
- </string-array>
-
- <string-array name="enabled_networks_except_lte_choices" translatable="false">
- <item>@string/network_3G</item>
- <item>@string/network_2G</item>
- </string-array>
- <string-array name="enabled_networks_except_lte_values" translatable="false">
- <item>"0"</item>
- <item>"1"</item>
- </string-array>
-
- <string-array name="enabled_networks_except_gsm_lte_choices" translatable="false">
- <item>@string/network_3G</item>
- </string-array>
- <string-array name="enabled_networks_except_gsm_lte_values" translatable="false">
- <item>"0"</item>
- </string-array>
-
- <string-array name="enabled_networks_cdma_choices" translatable="false">
- <item>@string/network_lte</item>
- <item>@string/network_3G</item>
- <item>@string/network_1x</item>
- <item>@string/network_global</item>
- </string-array>
- <string-array name="enabled_networks_cdma_values" translatable="false">
- <item>"8"</item>
- <item>"4"</item>
- <item>"5"</item>
- <item>"10"</item>
- </string-array>
-
- <string-array name="enabled_networks_cdma_no_lte_choices" translatable="false">
- <item>@string/network_3G</item>
- <item>@string/network_1x</item>
- </string-array>
- <string-array name="enabled_networks_cdma_no_lte_values" translatable="false">
- <item>"4"</item>
- <item>"5"</item>
- </string-array>
-
- <string-array name="enabled_networks_cdma_only_lte_choices" translatable="false">
- <item>@string/network_lte</item>
- <item>@string/network_global</item>
- </string-array>
- <string-array name="enabled_networks_cdma_only_lte_values" translatable="false">
- <item>"8"</item>
- <item>"10"</item>
- </string-array>
-
- <string-array name="enabled_networks_tdscdma_choices" translatable="false">
- <item>@string/network_lte</item>
- <item>@string/network_3G</item>
- <item>@string/network_2G</item>
- </string-array>
- <string-array name="enabled_networks_tdscdma_values" translatable="false">
- <item>"22"</item>
- <item>"18"</item>
- <item>"1"</item>
- </string-array>
-
- <!--String arrays for World preferred netwrok modes -->
- <string-array name="preferred_network_mode_choices_world_mode">
- <item>Global</item>
- <item>LTE / CDMA</item>
- <item>LTE / GSM / UMTS</item>
- </string-array>
-
- <string-array name="preferred_network_mode_values_world_mode" translatable="false">
- <item>"10"</item>
- <item>"8"</item>
- <item>"9"</item>
- </string-array>
<!-- WiFi calling mode array -->
<string-array name="wifi_calling_mode_summaries" translatable="false">
@@ -1507,7 +1424,6 @@
<item>@string/color_cyan</item>
<item>@string/color_blue</item>
<item>@string/color_purple</item>
- <item>@string/color_pink</item>
</string-array>
<!-- Values for palette list view preference. -->
@@ -1519,7 +1435,6 @@
<item>@color/palette_list_color_cyan</item>
<item>@color/palette_list_color_blue</item>
<item>@color/palette_list_color_purple</item>
- <item>@color/palette_list_color_pink</item>
</array>
<!--String arrays for showing the rtt settings options -->
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 1c18c6a..06f135f 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -158,7 +158,6 @@
<color name="palette_list_color_cyan">#12b5cb</color> <!-- Material Cyan 600 -->
<color name="palette_list_color_blue">#1a73e8</color> <!-- Material Blue 600 -->
<color name="palette_list_color_purple">#9334e6</color> <!-- Material Purple 600 -->
- <color name="palette_list_color_pink">#e52592</color> <!-- Material Pink 600 -->
<!-- Palette list preference dark mode colors. -->
<color name="palette_list_dark_mode_color_red">#f28b82</color> <!-- Material Red 300 -->
@@ -168,6 +167,5 @@
<color name="palette_list_dark_mode_color_cyan">#78d9ec</color> <!-- Material Cyan 300 -->
<color name="palette_list_dark_mode_color_blue">#8AB4F8</color> <!-- Material Blue 300 -->
<color name="palette_list_dark_mode_color_purple">#c58af9</color> <!-- Material Purple 300 -->
- <color name="palette_list_dark_mode_color_pink">#ff8bcb</color> <!-- Material Pink 300 -->
</resources>
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index ef6b818..4ca9798 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -56,6 +56,8 @@
<dimen name="captioning_preview_height">200dp</dimen>
+ <dimen name="autoclick_preview_height">200dp</dimen>
+
<dimen name="color_mode_preview_height">320dp</dimen>
<dimen name="ring_progress_bar_thickness">4dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 37badce..555cbd1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2755,8 +2755,10 @@
<string name="adaptive_sleep_description">Prevents your screen from turning off if you\u2019re looking at it</string>
<!-- Description feature's privacy sensitive details to make sure users understand what feature users, what it saves/sends etc [CHAR LIMIT=NONE]-->
<string name="adaptive_sleep_privacy">Screen attention uses the front camera to see if someone is looking at the screen. It works on device, and images are never stored or sent to Google.</string>
+ <!-- Title of the contextual adaptive sleep card [CHAR LIMIT=NONE]-->
+ <string name="adaptive_sleep_contextual_slice_title">Turn on screen attention</string>
<!-- Description about the contextual adaptive sleep card [CHAR LIMIT=NONE]-->
- <string name="adaptive_sleep_contextual_slice_summary">Keep screen on when viewing it</string>
+ <string name="adaptive_sleep_contextual_slice_summary">Keep screen on when looking at it</string>
<!-- Night display screen, setting option name to enable night display (renamed "Night Light" with title caps). [CHAR LIMIT=30] -->
<string name="night_display_title">Night Light</string>
@@ -3812,6 +3814,12 @@
<!-- Bluetooth Tethering settings. Message for untethering from a bluetooth device [CHAR LIMIT=50]-->
<string name="bluetooth_untether_blank"><xliff:g id="device_name">%1$s</xliff:g> will be untethered.</string>
+ <!-- Ethernet Tethering settings-->
+ <!-- Label for ethernet tether checkbox [CHAR LIMIT=25]-->
+ <string name="ethernet_tether_checkbox_text">Ethernet tethering</string>
+ <!-- Ethernet Tethering subtext [CHAR LIMIT=70]-->
+ <string name="ethernet_tethering_subtext" product="default">Share phone\u2019s internet connection via USB Ethernet</string>
+
<!-- Tethering footer info [CHAR LIMIT=NONE]-->
<string name="tethering_footer_info">Use hotspot and tethering to provide internet to other devices through your mobile data connection. Apps can also create a hotspot to share content with nearby devices.</string>
<!-- Tethering footer info for the device which supports Wi-Fi and Wi-Fi tethering enabled at the same time [CHAR LIMIT=NONE]-->
@@ -4877,52 +4885,74 @@
<!-- Short summary for nav bar Magnification. Tells the user that this feature allows the user to magnify the screen using a button in the nav bar -->
<string name="accessibility_screen_magnification_navbar_short_summary">Tap a button to zoom</string>
<!-- Summary for the accessibility preference screen to enable screen magnification gestures. [CHAR LIMIT=none] -->
- <string name="accessibility_screen_magnification_summary"><![CDATA[Quickly zoom in on the screen to see content more clearly.<br/><br/><b>To zoom in:</b><br/>\t1. Use shortcut to start magnification<br/>\t2. Tap the screen<br/>\t3. Drag 2 fingers to move around screen<br/>\t4. Pinch with 2 fingers to adjust zoom<br/>\t5. Use shortcut to stop magnification<br/><br/><b>To zoom in temporarily:</b><br/>\t1. Use shortcut to start magnification<br/>\t2. Touch & hold anywhere on the screen<br/>\t3. Drag finger to move around screen<br/>\t4. Lift finger to stop magnification]]></string>
+ <string name="accessibility_screen_magnification_summary">
+ <![CDATA[Quickly zoom in on the screen to display content more clearly.<br/><br/>
+ <b>To zoom in:</b><br/>
+ 1. Use shortcut to start magnification<br/>
+ 2. Tap the screen<br/>
+ 3. Drag 2 fingers to move around screen<br/>
+ 4. Pinch with 2 fingers to adjust zoom<br/>
+ 5. Use shortcut to stop magnification<br/><br/>
+ <b>To zoom in temporarily:</b><br/>
+ 1. Use shortcut to start magnification<br/>
+ 2. Touch & hold anywhere on the screen<br/>
+ 3. Drag finger to move around screen<br/>
+ 4. Lift finger to stop magnification
+ ]]>
+ </string>
<!-- Summary for the accessibility preference screen to enable screen magnification via the nav bar. [CHAR LIMIT=none] -->
<string name="accessibility_screen_magnification_navbar_summary">When magnification is turned on, you can zoom in on your screen.\n\n<b>To zoom</b>, start magnification, then tap anywhere on the screen.\n<ul><li>Drag 2 or more fingers to scroll</li>\n<li>Pinch 2 or more fingers to adjust zoom</li></ul>\n\n<b>To zoom temporarily</b>, start magnification, then touch & hold anywhere on the screen.\n<ul><li>Drag to move around the screen</li>\n<li>Lift finger to zoom out</li></ul>\n\nYou can’t zoom in on the keyboard or navigation bar.</string>
- <!-- Title for the Accessibility tutorial dialog in Accessibility service with button. [CHAR LIMIT=50] -->
+ <!-- Title for the accessibility tutorial dialog in accessibility service with button. [CHAR LIMIT=50] -->
<string name="accessibility_tutorial_dialog_title_button">Use accessibility button to open</string>
- <!-- Title for the Accessibility tutorial dialog in Accessibility service with gesture. [CHAR LIMIT=50] -->
+ <!-- Title for the accessibility tutorial dialog in accessibility service with volume keys. [CHAR LIMIT=50] -->
+ <string name="accessibility_tutorial_dialog_title_volume">Hold volume key to open</string>
+ <!-- Title for the accessibility tutorial dialog in accessibility service with triple tap. [CHAR LIMIT=100] -->
+ <string name="accessibility_tutorial_dialog_title_triple">Triple tap screen to open</string>
+ <!-- Title for the accessibility tutorial dialog in accessibility service with gesture. [CHAR LIMIT=50] -->
<string name="accessibility_tutorial_dialog_title_gesture">Use gesture to open</string>
- <!-- Title for the Accessibility tutorial dialog in gesture navigation settings. [CHAR LIMIT=50] -->
+ <!-- Title for the accessibility tutorial dialog in gesture navigation settings. [CHAR LIMIT=50] -->
<string name="accessibility_tutorial_dialog_title_gesture_settings">Use new accessibility gesture</string>
- <!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using the 3-button nav bar. [CHAR LIMIT=NONE] -->
- <string name="accessibility_tutorial_dialog_message_button">To turn this service on or off, tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> on the bottom of your screen.\n\nTo switch between services, touch & hold the accessibility button.</string>
- <!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is not enabled. [CHAR LIMIT=NONE] -->
- <string name="accessibility_tutorial_dialog_message_gesture">To turn this service on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between services, swipe up with two fingers and hold.</string>
- <!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is enabled. [CHAR LIMIT=NONE] -->
- <string name="accessibility_tutorial_dialog_message_gesture_talkback">To turn this service on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between services, swipe up with three fingers and hold.</string>
- <!-- Message for the Accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is disabled. [CHAR LIMIT=NONE] -->
- <string name="accessibility_tutorial_dialog_message_gesture_settings">To turn an accessibility service on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between services, swipe up with two fingers and hold.</string>
- <!-- Message for the Accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is enabled. [CHAR LIMIT=NONE] -->
- <string name="accessibility_tutorial_dialog_message_gesture_settings_talkback">To turn an accessibility service on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between services, swipe up with three fingers and hold.</string>
- <!-- Button for the Accessibility tutorial dialog to dismiss the dialog when user clicks it. [CHAR LIMIT=10] -->
+ <!-- Message for the accessibility tutorial dialog when user enables an accessibility service while using the 3-button nav bar. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_tutorial_dialog_message_button">To turn this app on or off, tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> on the bottom of your screen.\n\nTo switch between apps, touch & hold the accessibility button.</string>
+ <!-- Instruction for the accessibility tutorial dialog in accessibility service with volume keys. [CHAR LIMIT=100] -->
+ <string name="accessibility_tutorial_dialog_message_volume">To turn this app on or off, press & hold both volume keys for 1 second.</string>
+ <!-- Instruction for the accessibility tutorial dialog in accessibility service with triple tap. [CHAR LIMIT=100] -->
+ <string name="accessibility_tutorial_dialog_message_triple">To start and stop magnification, triple-tap anywhere on your screen.</string>
+ <!-- Message for the accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is not enabled. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_tutorial_dialog_message_gesture">To turn this app on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between apps, swipe up with two fingers and hold.</string>
+ <!-- Message for the accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is enabled. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_tutorial_dialog_message_gesture_talkback">To turn this app on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between apps, swipe up with three fingers and hold.</string>
+ <!-- Message for the accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is disabled. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_tutorial_dialog_message_gesture_settings">To turn an accessibility app on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between apps, swipe up with two fingers and hold.</string>
+ <!-- Message for the accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is enabled. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_tutorial_dialog_message_gesture_settings_talkback">To turn an accessibility app on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between apps, swipe up with three fingers and hold.</string>
+ <!-- Button for the accessibility tutorial dialog to dismiss the dialog when user clicks it. [CHAR LIMIT=10] -->
<string name="accessibility_tutorial_dialog_button">Got it</string>
<!-- Title for accessibility shortcut preference for accessibility apps. [CHAR LIMIT=40] -->
<string name="accessibility_shortcut_title"><xliff:g id="service" example="Select to Speak">%1$s</xliff:g> shortcut</string>
- <!-- Title for software shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+ <!-- Title for software shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_summary_software">Accessibility Button</string>
- <!-- Title for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
+ <!-- Title for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_title_software_gesture">Swipe up with 2 fingers</string>
- <!-- Title for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled. [CHAR LIMIT=NONE] -->
+ <!-- Title for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_title_software_gesture_talkback">Swipe up with 3 fingers</string>
<!-- Summary for accessibility shortcut preference for software shortcut type. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_title_software">Tap accessibility button</string>
- <!-- Summary for software shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+ <!-- Summary for software shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_summary_software">Tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> at the bottom of your screen</string>
- <!-- Summary for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
+ <!-- Summary for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture">Swipe up from the bottom of the screen with 2 fingers</string>
- <!-- Summary for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled [CHAR LIMIT=NONE] -->
+ <!-- Summary for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture_talkback">Swipe up from the bottom of the screen with 3 fingers</string>
- <!-- Title for hardware shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+ <!-- Title for hardware shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_title_hardware">Hold volume keys</string>
- <!-- Summary for hardware shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+ <!-- Summary for hardware shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_summary_hardware">Press & hold both volume keys for 1 second</string>
- <!-- Title for triple tap shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+ <!-- Title for triple tap shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_title_triple_tap">Triple-tap screen</string>
- <!-- Summary for triple tap shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+ <!-- Summary for triple tap shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_edit_dialog_summary_triple_tap">Quickly tap screen 3 times. This shortcut may slow down your device.</string>
- <!-- Title for the Accessibility edit shortcut dialog to save the preference when user clicks it. [CHAR LIMIT=10] -->
+ <!-- Title for the accessibility edit shortcut dialog to save the preference when user clicks it. [CHAR LIMIT=10] -->
<string name="accessibility_shortcut_edit_dialog_title_advance">Advanced</string>
<!-- Summary text appearing on the accessibility preference screen to enable screen magnification from the nav bar when the feature is enabled, but the accessibility button is not configured correctly for the feature to be used [CHAR LIMIT=none] -->
<string name="accessibility_screen_magnification_navbar_configuration_warning">The Accessibility button is set to <xliff:g id="service" example="Select to Speak">%1$s</xliff:g>. To use magnification, touch & hold the Accessibility button, then select magnification.</string>
@@ -4935,9 +4965,9 @@
<!-- Label for shortcut settings button. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_settings">Shortcut settings</string>
<!-- Title for the switch preference that controls whether or not the accessibility shortcut works on the lock screen. [CHAR LIMIT=35] -->
- <string name="accessibility_shortcut_service_on_lock_screen_title">Allow from lock screen</string>
+ <string name="accessibility_shortcut_service_on_lock_screen_title">Shortcut from lock screen</string>
<!-- Description of accessibility shortcut. [CHAR LIMIT=NONE] -->
- <string name="accessibility_shortcut_description">When the shortcut is on, you can press both volume keys for 3 seconds to start an accessibility feature.</string>
+ <string name="accessibility_shortcut_description">Allow feature shortcut to turn on from the lock screen. Hold both volume keys for 3 seconds.</string>
<!-- Title for the accessibility preference to high contrast text. [CHAR LIMIT=35] -->
<string name="accessibility_toggle_high_text_contrast_preference_title">High contrast text</string>
<!-- Title for the accessibility preference to auto update screen magnification. [CHAR LIMIT=35] -->
@@ -4987,13 +5017,22 @@
<!-- Used in the accessibility service settings to control turning display color inversion on/off entirely. [CHAR LIMIT=NONE] -->
<string name="accessibility_display_inversion_switch_title">Use color inversion</string>
<!-- Subtitle for the accessibility preference to configure display color inversion. [CHAR LIMIT=NONE] -->
- <string name="accessibility_display_inversion_preference_subtitle"><![CDATA[Color inversion turns light screens dark. This helps people who are sensitive to bright light see the screen more easily.<br/><br/>Note: Dark colors will turn light. Colors will change in media and images. You can also use Dark theme (Settings > Display).]]></string>
+ <string name="accessibility_display_inversion_preference_subtitle">
+ <![CDATA[Color inversion turns light screens dark.<br/><br/>
+ Note:
+ <ol>
+ <li>\u00a0Color inversion also turns dark screens light.</li>
+ <li>\u00a0Colors will change in media and images.</li>
+ <li>\u00a0Dark theme can be used to display a dark background. Dark theme works with supported apps. Color inversion works on all apps.</li>
+ </ol>
+ ]]>
+ </string>
<!-- Title for accessibility preference for configuring feature that performs click action soon after mouse/trackpad pointer stops moving. [CHAR LIMIT=NONE] -->
- <string name="accessibility_autoclick_preference_title">Auto click (dwell timing)</string>
+ <string name="accessibility_autoclick_preference_title">Autoclick (dwell timing)</string>
<!-- Footer text to explain what autoclick does -->
- <string name="accessibility_autoclick_description">If you are using a mouse, you can set the cursor to take action automatically when it stops moving for a certain amount of time.</string>
+ <string name="accessibility_autoclick_description">Autoclick works with a connected mouse. You can set the mouse cursor to click automatically when the cursor stops moving for a certain amount of time.</string>
<!-- Option heading to leave the auto click requirement for accessibility users at its default level. [CHAR LIMIT=50] -->
- <string name="accessibility_autoclick_default_title">Don\u2019t use auto click (default)</string>
+ <string name="accessibility_autoclick_default_title">Off</string>
<!-- Option heading to leave the auto click requirement for accessibility users at its short level. [CHAR LIMIT=35] -->
<string name="accessibility_autoclick_short_title">Short</string>
<!-- Option summary text for the auto click delay 0.2 seconds radio button. [CHAR LIMIT=35] -->
@@ -5028,16 +5067,18 @@
<string name="accessibility_service_master_open_title">Open <xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g></string>
<!-- Used in the Color correction settings screen to control turning on/off the feature entirely -->
<string name="accessibility_daltonizer_master_switch_title">Use color correction</string>
- <!-- Used in the Captions settings screen to control turning on/off the feature entirely -->
+ <!-- Title for Captions settings screen to control turning on/off the feature entirely -->
<string name="accessibility_caption_master_switch_title">Show captions</string>
+ <!-- Summary for Captions settings screen to control turning on/off the feature entirely [CHAR LIMIT=NONE] -->
+ <string name="accessibility_caption_master_switch_summary">For supported app only</string>
<!-- Title for Caption preference settings screen for configuring font style. [CHAR LIMIT=NONE] -->
- <string name="captioning_caption_appearance_title">Caption appearance</string>
+ <string name="captioning_caption_appearance_title">Caption size and style</string>
<!-- Summary for Captions settings, explaining important settings under it. [CHAR LIMIT=NONE] -->
- <string name="captioning_caption_appearance_summary">Text size, caption style</string>
+ <string name="captioning_caption_appearance_summary"><xliff:g id="accessibility_font_size" example="Large">%1$s</xliff:g> text size</string>
<!-- Title for Caption preference settings screen for configuring language. [CHAR LIMIT=NONE] -->
<string name="captioning_more_options_title">More options</string>
<!-- Used in the Captions preference to tell users that the setting doesn't support all apps. [CHAR LIMIT=NONE] -->
- <string name="accessibility_caption_preference_summary">Not all apps support this setting.</string>
+ <string name="accessibility_caption_preference_summary">Not all apps support these caption preferences</string>
<!-- Summary for accessibility shortcut preference for software shortcut type. [CHAR LIMIT=NONE] -->
<string name="accessibility_shortcut_type_software">Accessibility button</string>
<!-- Summary for accessibility shortcut preference for software shortcut type when gesture mode is on. [CHAR LIMIT=NONE] -->
@@ -5065,9 +5106,13 @@
<item quantity="other"><xliff:g id="number_device_count">%1$d</xliff:g> saved hearing aids</item>
</plurals>
- <!-- Preference's state when enabled. -->
+ <!-- Preference's shortcut when enabled. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_summary_shortcut_enabled">Shortcut on</string>
+ <!-- Preference's shortcut when disabled. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_summary_shortcut_disabled">Off</string>
+ <!-- Preference's state when enabled. [CHAR LIMIT=NONE] -->
<string name="accessibility_summary_state_enabled">On</string>
- <!-- Preference's state when disabled. -->
+ <!-- Preference's state when disabled. [CHAR LIMIT=NONE] -->
<string name="accessibility_summary_state_disabled">Off</string>
<!-- Accessibility service's preference's state when enabled but not running (like maybe it crashed). -->
<string name="accessibility_summary_state_stopped">Not working. Tap for info.</string>
@@ -5079,17 +5124,17 @@
<!-- Title for the preference to configure the type of color space correction to apply. [CHAR LIMIT=NONE] -->
<string name="daltonizer_type">Correction mode</string>
<!-- Title shown for deuteranomaly (red-green color blindness) [CHAR LIMIT=45] -->
- <string name="daltonizer_mode_deuteranomaly_title">Red-green</string>
+ <string name="daltonizer_mode_deuteranomaly_title">Deuteranomaly</string>
<!-- Title shown for protanomaly (red-green color blindness) [CHAR LIMIT=45] -->
- <string name="daltonizer_mode_protanomaly_title">Green-red</string>
+ <string name="daltonizer_mode_protanomaly_title">Protanomaly</string>
<!-- Title shown for tritanomaly (blue-yellow color blindness) [CHAR LIMIT=45] -->
- <string name="daltonizer_mode_tritanomaly_title">Blue-yellow</string>
+ <string name="daltonizer_mode_tritanomaly_title">Tritanomaly</string>
<!-- Summary shown for deuteranomaly (red-green color blindness) [CHAR LIMIT=45] -->
- <string name="daltonizer_mode_deuteranomaly_summary">Deuteranomaly</string>
+ <string name="daltonizer_mode_deuteranomaly_summary">Red-green</string>
<!-- Summary shown for protanomaly (red-green color blindness) [CHAR LIMIT=45] -->
- <string name="daltonizer_mode_protanomaly_summary">Protanomaly</string>
+ <string name="daltonizer_mode_protanomaly_summary">Red-green</string>
<!-- Summary shown for tritanomaly (blue-yellow color blindness) [CHAR LIMIT=45] -->
- <string name="daltonizer_mode_tritanomaly_summary">Tritanomaly</string>
+ <string name="daltonizer_mode_tritanomaly_summary">Blue-yellow</string>
<!-- Subtitle for the accessibility preference to configure feature that performs click action soon after mouse/trackpad pointer stops moving, in case delay before click is extremely short. Placeholder will be set to the number of milliseconds to which the delay amounts. [CHAR LIMIT=NONE] -->
<plurals name="accessibilty_autoclick_preference_subtitle_extremely_short_delay">
@@ -6128,13 +6173,13 @@
<!-- Title of Wi-Fi certificate [CHAR LIMIT=30] -->
<string name="wifi_certificate">Wi\u2011Fi certificate</string>
<!-- Title of warning shown to the user before they can install a CA certificate [CHAR LIMIT=NONE] -->
- <string name="ca_certificate_warning_title">Your privacy is at risk</string>
+ <string name="ca_certificate_warning_title">Your data won\u2019t be private</string>
<!-- Description of warning shown to the user before they can install a CA certificate [CHAR LIMIT=NONE] -->
- <string name="ca_certificate_warning_description">CA certificates are used by websites, apps, and VPNs for encryption. Only install CA certificates from organizations you trust. \n\n If you install a CA certificate, the certificate owner could access your information, such as passwords, messages, or credit card details, from websites you visit or apps you use - even if that information is encrypted.</string>
+ <string name="ca_certificate_warning_description">CA certificates are used by websites, apps, and VPNs for encryption. Only install CA certificates from organizations you trust. \n\n If you install a CA certificate, the certificate owner could access your data, such as passwords or credit card details, from websites you visit or apps you use – even if your data is encrypted.</string>
<!-- Label for button to not install a certificate [CHAR_LIMIT=50] -->
<string name="certificate_warning_dont_install">Don\u2019t install</string>
<!-- Label for button to continue installing a certificate [CHAR_LIMIT=50] -->
- <string name="certificate_warning_install_anyway">Install anyways</string>
+ <string name="certificate_warning_install_anyway">Install anyway</string>
<!-- Toast message that a certificate was not installed -->
<string name="cert_not_installed">Certificate not installed</string>
@@ -6968,7 +7013,7 @@
<string name="apps_with_restrictions_settings_button">Expand settings for application</string>
<!-- NFC payment settings --><skip/>
- <string name="nfc_payment_settings_title">Tap & pay</string>
+ <string name="nfc_payment_settings_title">Contactless payments</string>
<!-- Caption for button linking to a page explaining how Tap and Pay works-->
<string name="nfc_payment_how_it_works">How it works</string>
<!-- String shown when there are no NFC payment applications installed -->
@@ -7215,14 +7260,14 @@
contacts support advanced calling features, such as video calling. [CHAR LIMIT=50]-->
<string name="contact_discovery_opt_in_title">Contact discovery</string>
<!-- Summary of a preference determining whether or not the user has enabled contact discovery.
- [CHAR LIMIT=100] -->
+ [CHAR LIMIT=110] -->
<string name="contact_discovery_opt_in_summary">Allows your carrier to discover which calling features your contacts support.</string>
<!-- Title of the dialog shown when the user tries to enable Contact Discovery.
[CHAR LIMIT=50] -->
<string name="contact_discovery_opt_in_dialog_title">Enable contact discovery?</string>
<!-- Text displayed in the dialog shown when the user tries to enable Contact Discovery.
[CHAR LIMIT=NONE]-->
- <string name="contact_discovery_opt_in_dialog_message">Enabling this feature will allow your carrier access to phone numbers in your contacts in order to discover which calling features they support.</string>
+ <string name="contact_discovery_opt_in_dialog_message">All of the phone numbers in your contacts will be periodically sent to your carrier in order to discover which calling features are supported.</string>
<!-- Preferred network type title. [CHAR LIMIT=50] -->
<string name="preferred_network_type_title">Preferred network type</string>
<!-- Preferred network type summary. [CHAR LIMIT=100] -->
@@ -7343,8 +7388,6 @@
<string name="color_orange">Orange</string>
<!-- Purple label. [CHAR LIMIT=40] -->
<string name="color_purple">Purple</string>
- <!-- Pink label. [CHAR LIMIT=40] -->
- <string name="color_pink">Pink</string>
<!-- Message informing the user that no SIM card is inserted [CHAR LIMIT=60] -->
<string name="sim_no_inserted_msg">No SIM cards inserted</string>
<!-- SIM status title [CHAR LIMIT=40] -->
@@ -8146,6 +8189,24 @@
<!-- Button to cancel out of the dialog shown when the user has disabled bubbles at the feature level but tries to enable it for an app. [CHAR LIMIT=60] -->
<string name="bubbles_feature_disabled_button_cancel">Cancel</string>
+ <!-- Bubble feature settings: Description for toggle when bubbles are turned on in notification settings [CHAR LIMIT=100] -->
+ <string name="notifications_bubble_setting_on_summary">On / Conversations can appear as floating icons</string>
+ <!-- Bubble feature settings: Title of the toggle to turn bubbles on and off [CHAR LIMIT=100] -->
+ <string name="notifications_bubble_setting_title">Allow apps to show bubbles</string>
+ <!-- Bubble feature settings: Description shown with the toggle to turn bubbles on and off [CHAR LIMIT=NONE]-->
+ <string name="notifications_bubble_setting_description">Some conversations will appear as floating icons on top of other apps</string>
+
+ <!-- Bubble app settings: option allowing all conversations from an app to bubble if the app sends bubbles [CHAR LIMIT=60]-->
+ <string name="bubble_app_setting_all">All conversations can bubble</string>
+ <!-- Bubble app settings: option allowing only user selected conversations from an app to bubble if the app sends bubbles [CHAR LIMIT=60] -->
+ <string name="bubble_app_setting_selected">Selected conversations can bubble</string>
+ <!-- Bubble app settings: option allowing no bubbles from the app [CHAR LIMIT=60] -->
+ <string name="bubble_app_setting_none">Nothing can bubble</string>
+ <!-- Bubble app settings: Title above a list of conversations that have been selected to bubble [CHAR LIMIT=60]-->
+ <string name="bubble_app_setting_selected_conversation_title">Conversations</string>
+ <!-- Bubble app settings: Title above a list of conversations that have been excluded from bubbling [CHAR LIMIT=60] -->
+ <string name="bubble_app_setting_excluded_conversation_title">Excluded</string>
+
<!-- Configure notifications: title for swipe direction [CHAR LIMIT=60] -->
<string name="swipe_direction_title">Swipe actions</string>
@@ -8444,7 +8505,7 @@
<string name="notification_assistant_security_warning_summary">
<xliff:g id="notification_assistant_name" example="Notification Assistant">%1$s</xliff:g> will be able to read all notifications,
including personal information such as contact names and the text of messages you receive.
- It will also be able to modify or dismiss notifications or trigger action buttons they contain.
+ This app will also be able to dismiss notifications or take action on buttons in notifications, including answering phone calls.
\n\nThis will also give the app the ability to turn Do Not Disturb on or off and change related settings.
</string>
@@ -8457,7 +8518,7 @@
<string name="notification_listener_security_warning_summary">
<xliff:g id="notification_listener_name">%1$s</xliff:g> will be able to read all notifications,
including personal information such as contact names and the text of messages you receive.
- It will also be able to dismiss notifications or trigger action buttons they contain.
+ This app will also be able to dismiss notifications or take action on buttons in notifications, including answering phone calls.
\n\nThis will also give the app the ability to turn Do Not Disturb on or off and change related settings.
</string>
<string name="notification_listener_disable_warning_summary">
@@ -8511,58 +8572,98 @@
<!-- Apps > App Details > Picture-in-picture > Description. [CHAR LIMIT=NONE] -->
<string name="picture_in_picture_app_detail_summary">Allow this app to create a picture-in-picture window while the app is open or after you leave it (for example, to continue watching a video). This window displays on top of other apps you\'re using.</string>
- <!-- Special access > Title for managing the settings where users opt-in to connect a work app
- to its personal equivalent, allowing cross-profile communication. [CHAR LIMIT=50] -->
- <string name="interact_across_profiles_title" translatable="false">Connected personal and work apps</string>
+ <!-- Settings label. This setting shows a user's connected work and personal apps.
+ When a user connects select work and personal apps, they can access work and personal data together. [CHAR LIMIT=50] -->
+ <string name="interact_across_profiles_title">Connected work & personal apps</string>
- <!-- Special access > Connected personal and work apps > Text to display when the list is empty. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_empty_text" translatable="false">No connected apps</string>
+ <!-- Settings subtext. This text is shown when a user doesn't have any connected apps. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_empty_text">No connected apps</string>
- <!-- Special access > Connected personal and work apps > Additional keywords to search for. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_keywords" translatable="false">cross profile connected app apps work and personal</string>
+ <!-- Search keywords. If a user is searching for the "Connected work & personal apps" feature in Settings,
+ these keywords will surface that feature. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_keywords">cross profile connected app apps work and personal</string>
- <!-- Apps > App Details > Advanced section string title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_app_detail_title" translatable="false">Connected personal and work apps</string>
+ <!-- Settings header. This setting shows a user's connected work and personal apps.
+ When a user connects select work and personal apps, they can access work and personal data together. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_app_detail_title">Connected work & personal apps</string>
- <!-- Apps > App Details > Connected personal and work apps > Switch title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_switch_enabled" translatable="false">Connected</string>
+ <!-- Toggle label. This text is shown when a user's work and personal apps are connected. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_switch_enabled">Connected</string>
- <!-- Apps > App Details > Connected personal and work apps > Switch title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_switch_disabled" translatable="false">Connect these apps</string>
+ <!-- Toggle label. This text is shown when a user can connect specific work and personal apps.
+ The apps they can connect are shown above this toggle. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_switch_disabled">Connect these apps</string>
- <!-- Apps > App Details > Connected personal and work apps > Description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_summary_1" translatable="false">Connected apps share permissions and can access each other\u2019s data.</string>
+ <!-- Settings text. This text lets a user know that if they connect work and personal apps,
+ they will share permissions and can access each other's data. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_summary_1">Connected apps share permissions and can access each other\u2019s data.</string>
- <!-- Apps > App Details > Connected personal and work apps > Description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_summary_2" translatable="false">Only connect apps that you trust with your personal data. Work apps may expose your data to your IT admin.</string>
+ <!-- Settings text. This text lets a user know that they should only connect work and personal apps
+ if they trust the work app with their personal data. The work app could potentially show that data
+ to the user's IT admin. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_summary_2">Only connect apps that you trust with your personal data. Work apps may expose your data to your IT admin.</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_title" translatable="false">Trust work %1$s with your personal data?</string>
+ <!-- Dialog title. This dialog is shown when a user tries to connect a work app to a personal
+ app (e.g. their work Calendar to their personal Calendar), and it's confirming that they should
+ connect the apps only if they trust the work app with their personal data. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_title">Trust work <xliff:g id="name" example="Calendar">%1$s</xliff:g> with your personal data?</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_summary" translatable="false">%1$s may expose your personal data to your IT admin.</string>
+ <!-- Dialog text. This dialog is shown when a user tries to connect a work app to a personal
+ app (e.g. their work Calendar to their personal Calendar), and it's confirming that they should
+ connect the apps only if they trust the work app with their personal data.
+ The placeholder is the app name. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_summary"><xliff:g id="name" example="Calendar">%1$s</xliff:g> may expose your personal data to your IT admin.</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog App data title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_app_data_title" translatable="false">App data</string>
+ <!-- Title of a section in a dialog. This section shows the app data that will be
+ accessible when work and personal apps are connected. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_app_data_title">App data</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog App data description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_app_data_summary" translatable="false">It can access data in your personal %1$s app.</string>
+ <!-- Dialog text. This text lets the user know that their work app (e.g. Calendar) will be
+ able to access data in their personal app. The placeholder is the app name. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_app_data_summary">This app can access data in your personal <xliff:g id="name" example="Calendar">%1$s</xliff:g> app.</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog Permissions title. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_permissions_title" translatable="false">Permissions</string>
+ <!-- Title of a section in a dialog. This section shows the permissions that will be accessible
+ when work and personal apps are connected. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_permissions_title">Permissions</string>
- <!-- Apps > App Details > Connected personal and work apps > Consent dialog Permissions description. [CHAR LIMIT=NONE] -->
- <string name="interact_across_profiles_consent_dialog_permissions_summary" translatable="false">It can use your personal %1$s app\u2019s permissions, like access to location, storage, or contacts.</string>
+ <!-- Dialog text. This text lets the user know that their work app (e.g. Calendar) will be able
+ to use permissions in their personal app. The placeholder is the app name. [CHAR LIMIT=NONE] -->
+ <string name="interact_across_profiles_consent_dialog_permissions_summary">This app can use your personal <xliff:g id="name" example="Calendar">%1$s</xliff:g> app\u2019s permissions, like access to location, storage, or contacts.</string>
- <!-- Summary of preference to manage connected personal and work apps, informing the user that currently no apps are connected -->
- <string name="interact_across_profiles_number_of_connected_apps_none" translatable="false">No apps connected</string>
+ <!-- Summary of preference to manage connected work and personal apps, informing the user that
+ currently no apps are connected [CHAR LIMIT=NONE]-->
+ <string name="interact_across_profiles_number_of_connected_apps_none">No apps connected</string>
- <!-- Summary of preference to manage connected personal and work apps, informing the user how many apps are connected -->
- <plurals name="interact_across_profiles_number_of_connected_apps" translatable="false">
+ <!-- Summary of preference to manage connected work and personal apps, informing the user how many apps are connected -->
+ <plurals name="interact_across_profiles_number_of_connected_apps">
<item quantity="one"><xliff:g id="count">%d</xliff:g> app connected</item>
<item quantity="other"><xliff:g id="count">%d</xliff:g> apps connected</item>
</plurals>
+ <!-- Banner title. This banner lets a user know that they need to install an app in their
+ work profile in order to connect it to the corresponding personal app.
+ The placeholder would be the app name (e.g. Calendar). [CHAR LIMIT=50]-->
+ <string name="interact_across_profiles_install_work_app_title">Install <xliff:g id="name" example="Calendar">%1$s</xliff:g> in your work profile</string>
+
+ <!-- Banner text. This banner lets a user know that they need to install an app in their
+ work profile in order to connect it to the corresponding personal app.
+ The placeholder would be the app name (e.g. Calendar). [CHAR LIMIT=NONE]-->
+ <string name="interact_across_profiles_install_work_app_summary">To connect these apps, install the <xliff:g id="name" example="Calendar">%1$s</xliff:g> app in your work profile</string>
+
+ <!-- Banner title. This banner lets a user know that they need to install an app in their
+ personal profile in order to connect it to the corresponding work app.
+ The placeholder would be the app name (e.g. Calendar). [CHAR LIMIT=50]-->
+ <string name="interact_across_profiles_install_personal_app_title">Install <xliff:g id="name" example="Calendar">%1$s</xliff:g> in your personal profile</string>
+
+ <!-- Banner text. This banner lets a user know that they need to install an app in their
+ personal profile in order to connect it to the corresponding work app.
+ The placeholder would be the app name (e.g. Calendar). [CHAR LIMIT=NONE]-->
+ <string name="interact_across_profiles_install_personal_app_summary">To connect these apps, install the <xliff:g id="name" example="Calendar">%1$s</xliff:g> app in your personal profile</string>
+
+ <!-- Button text. This button takes a user to the app store so they can download and
+ install the app they need. [CHAR LIMIT=50]-->
+ <string name="interact_across_profiles_install_app_action">Get the app</string>
+
<!-- Sound & notification > Advanced section: Title for managing Do Not Disturb access option. [CHAR LIMIT=40] -->
<string name="manage_zen_access_title">Do Not Disturb access</string>
@@ -9721,7 +9822,7 @@
<!-- Label for setting which controls whether app can display over other apps [CHAR LIMIT=45] -->
<string name="permit_draw_overlay">Allow display over other apps</string>
<!-- Description of allowing overlay setting [CHAR LIMIT=NONE] -->
- <string name="allow_overlay_description">Allow this app to display on top of other apps you\u2019re using. It may interfere with your use of those apps or change the way they seem to appear or behave.</string>
+ <string name="allow_overlay_description">Allow this app to display on top of other apps you\u2019re using. This app will be able to see where you tap or change what\u2019s displayed on the screen.</string>
<!-- Manager External Storage settings title [CHAR LIMIT=40] -->
<string name="manage_external_storage_title">All files access</string>
@@ -10450,6 +10551,11 @@
<!-- [CHAR LIMIT=60] Name of dev option to enable extra quick settings tiles -->
<string name="quick_settings_developer_tiles">Quick settings developer tiles</string>
+ <!-- [CHAR LIMIT=50] Setting title to disable the adb authorization timeout feature. -->
+ <string name="adb_authorization_timeout_title">Disable adb authorization timeout</string>
+ <!-- [CHAR LIMIT=NONE] Setting summary explaining the disablement of the automatic adb authorization timeout. -->
+ <string name="adb_authorization_timeout_summary">Disable automatic revocation of adb authorizations for systems that have not reconnected within the default (7 days) or user-configured (minimum 1 day) amount of time.</string>
+
<!-- [CHAR LIMIT=25] Title of developer tile to toggle winscope trace -->
<string name="winscope_trace_quick_settings_title">Winscope Trace</string>
@@ -11297,7 +11403,11 @@
<!-- Text for Network 1x [CHAR LIMIT=NONE] -->
<string name="network_1x" translatable="false">1x</string>
<!-- Text for Network global [CHAR LIMIT=NONE] -->
- <string name="network_global">Global</string>
+ <string name="network_global" translatable="false">Global</string>
+ <!-- Text for Network world mode CDMA LTE [CHAR LIMIT=NONE] -->
+ <string name="network_world_mode_cdma_lte" translatable="false">LTE / CDMA</string>
+ <!-- Text for Network world mode GSM LTE [CHAR LIMIT=NONE] -->
+ <string name="network_world_mode_gsm_lte" translatable="false">LTE / GSM / UMTS</string>
<!-- Available networks screen title/heading [CHAR LIMIT=NONE] -->
<string name="label_available">Available networks</string>
@@ -11576,6 +11686,11 @@
<!-- UI debug setting: Force enable "smart dark" UI rendering feature summary [CHAR LIMIT=NONE] -->
<string name="hwui_force_dark_summary">Overrides the force-dark feature to be always-on</string>
+ <!-- If blurs are supported on SurfaceFlinger. [CHAR LIMIT=60] -->
+ <string name="enable_blurs_on_windows_title">Enable blurs</string>
+ <!-- If blurs are supported on SurfaceFlinger, summary. [CHAR LIMIT=NONE] -->
+ <string name="enable_blurs_on_windows_summary">Enables window blurs at compositor level. Requires device reboot.</string>
+
<!-- Title for the top level Privacy Settings [CHAR LIMIT=30]-->
<string name="privacy_dashboard_title">Privacy</string>
<!-- Summary for the top level Privacy Settings [CHAR LIMIT=NONE]-->
@@ -11762,4 +11877,9 @@
<!-- Button label to stop casting on media device. [CHAR LIMIT=40 -->
<string name="media_output_panel_stop_casting_button">Stop casting</string>
+
+ <!-- Title for the 5G limited VoLTE dialog. [CHAR LIMIT=50] -->
+ <string name="volte_5G_limited_title">Turn off VoLTE?</string>
+ <!-- Content description for the 5G limited VoLTE dialog. [CHAR LIMIT=NONE] -->
+ <string name="volte_5G_limited_text">This also turns off your 5G connection.\nDuring a voice call, you can\u2019t use the internet and some apps may not work.</string>
</resources>
diff --git a/res/xml/accessibility_autoclick_settings.xml b/res/xml/accessibility_autoclick_settings.xml
index f126113..d387b58 100644
--- a/res/xml/accessibility_autoclick_settings.xml
+++ b/res/xml/accessibility_autoclick_settings.xml
@@ -19,6 +19,15 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/accessibility_autoclick_preference_title">
+ <com.android.settingslib.widget.LayoutPreference
+ android:key="accessibility_autoclick_preview"
+ android:layout="@layout/accessibility_autoclick_preview"
+ android:persistent="false"
+ android:selectable="false"
+ android:title="@string/summary_placeholder"
+ settings:allowDividerBelow="true"
+ settings:searchable="false" />
+
<com.android.settingslib.widget.RadioButtonPreference
android:key="accessibility_control_autoclick_default"
android:title="@string/accessibility_autoclick_default_title"
diff --git a/res/xml/accessibility_color_inversion_settings.xml b/res/xml/accessibility_color_inversion_settings.xml
index ba0d6fd..f44d41f 100644
--- a/res/xml/accessibility_color_inversion_settings.xml
+++ b/res/xml/accessibility_color_inversion_settings.xml
@@ -21,14 +21,14 @@
android:persistent="false"
android:title="@string/accessibility_display_inversion_preference_title">
- <com.android.settingslib.widget.LayoutPreference
+ <com.android.settings.widget.VideoPreference
android:key="color_inversion_preview"
- android:layout="@layout/color_inversion_preview"
android:persistent="false"
android:selectable="false"
android:title="@string/summary_placeholder"
- settings:allowDividerAbove="true"
settings:allowDividerBelow="true"
+ settings:animation="@raw/accessibility_color_inversion"
+ settings:controller="com.android.settings.widget.VideoPreferenceController"
settings:searchable="false" />
</PreferenceScreen>
diff --git a/res/xml/accessibility_magnification_service_settings.xml b/res/xml/accessibility_magnification_service_settings.xml
index 74765b2..0548e5e 100644
--- a/res/xml/accessibility_magnification_service_settings.xml
+++ b/res/xml/accessibility_magnification_service_settings.xml
@@ -19,12 +19,14 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="magnification_mode_screen"
android:persistent="false"
- android:title="@string/accessibility_magnification_service_settings_title">
+ android:title="@string/accessibility_magnification_service_settings_title"
+ settings:searchable="false">
<Preference
android:key="magnification_mode"
android:persistent="false"
android:title="@string/accessibility_magnification_mode_title"
+ settings:searchable="false"
settings:controller="com.android.settings.accessibility.MagnificationModePreferenceController" />
<SwitchPreference
@@ -33,6 +35,7 @@
android:title="@string/accessibility_magnification_enable_mode_title"
android:summaryOn="@string/accessibility_magnification_area_settings_full_screen_summary"
android:summaryOff="@string/accessibility_magnification_area_settings_window_screen_summary"
+ settings:searchable="false"
settings:controller="com.android.settings.accessibility.MagnificationEnablePreferenceController" />
</PreferenceScreen>
diff --git a/res/xml/accessibility_magnification_settings.xml b/res/xml/accessibility_magnification_settings.xml
index 6731dba..83ce79b 100644
--- a/res/xml/accessibility_magnification_settings.xml
+++ b/res/xml/accessibility_magnification_settings.xml
@@ -16,15 +16,18 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:title="@string/accessibility_screen_magnification_title">
+ android:title="@string/accessibility_screen_magnification_title"
+ settings:searchable="false">
<Preference
android:fragment="com.android.settings.accessibility.ToggleScreenMagnificationPreferenceFragment"
android:key="screen_magnification_gestures_preference_screen"
android:title="@string/accessibility_screen_magnification_gestures_title"
+ settings:searchable="false"
settings:controller="com.android.settings.accessibility.MagnificationGesturesPreferenceController"/>
<Preference
android:fragment="com.android.settings.accessibility.ToggleScreenMagnificationPreferenceFragment"
android:key="screen_magnification_navbar_preference_screen"
android:title="@string/accessibility_screen_magnification_navbar_title"
+ settings:searchable="false"
settings:controller="com.android.settings.accessibility.MagnificationNavbarPreferenceController"/>
</PreferenceScreen>
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 7ff68aa..1802060 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -139,6 +139,7 @@
android:key="gesture_system_navigation_input_summary_accessibility"
android:persistent="false"
android:title="@string/system_navigation_title"
+ settings:searchable="false"
settings:controller="com.android.settings.gestures.SystemNavigationPreferenceController"/>
</PreferenceCategory>
diff --git a/res/xml/billing_cycle.xml b/res/xml/billing_cycle.xml
index e9a34f1..77f8bc3 100644
--- a/res/xml/billing_cycle.xml
+++ b/res/xml/billing_cycle.xml
@@ -17,7 +17,6 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:key="billing_cycle_settings"
android:title="@string/billing_cycle">
<Preference
diff --git a/res/xml/bluetooth_screen.xml b/res/xml/bluetooth_screen.xml
index cce114b..86dc8a1 100644
--- a/res/xml/bluetooth_screen.xml
+++ b/res/xml/bluetooth_screen.xml
@@ -33,6 +33,7 @@
settings:allowDividerAbove="true"
settings:userRestriction="no_config_bluetooth"
settings:useAdminDisabledSummary="true"
+ settings:searchable="false"
settings:controller="com.android.settings.connecteddevice.AddDevicePreferenceController"/>
<com.android.settingslib.widget.FooterPreference
diff --git a/res/xml/captioning_settings.xml b/res/xml/captioning_settings.xml
index c8cb46c..7ae93b9 100644
--- a/res/xml/captioning_settings.xml
+++ b/res/xml/captioning_settings.xml
@@ -18,25 +18,41 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:title="@string/accessibility_captioning_title" >
+ android:persistent="false"
+ android:title="@string/accessibility_captioning_title">
+
+ <com.android.settingslib.widget.LayoutPreference
+ android:key="captions_preview"
+ android:layout="@layout/accessibility_captions_preview"
+ android:persistent="false"
+ android:selectable="false"
+ android:title="@string/summary_placeholder"
+ settings:allowDividerBelow="true"
+ settings:searchable="false" />
<SwitchPreference
android:key="captioning_preference_switch"
- android:title="@string/accessibility_caption_master_switch_title" />
+ android:persistent="false"
+ android:summary="@string/accessibility_caption_master_switch_summary"
+ android:title="@string/accessibility_caption_master_switch_title"
+ settings:allowDividerAbove="true" />
<Preference
+ android:fragment="com.android.settings.accessibility.CaptionAppearanceFragment"
android:key="captioning_caption_appearance"
- android:title="@string/captioning_caption_appearance_title"
- android:summary="@string/captioning_caption_appearance_summary"
- android:fragment="com.android.settings.accessibility.CaptionAppearanceFragment" />
+ android:persistent="false"
+ android:title="@string/captioning_caption_appearance_title" />
<Preference
+ android:fragment="com.android.settings.accessibility.CaptionMoreOptionsFragment"
android:key="captioning_more_options"
- android:title="@string/captioning_more_options_title"
- android:fragment="com.android.settings.accessibility.CaptionMoreOptionsFragment" />
+ android:persistent="false"
+ android:title="@string/captioning_more_options_title" />
<com.android.settingslib.widget.FooterPreference
+ android:persistent="false"
+ android:selectable="false"
android:title="@string/accessibility_caption_preference_summary"
- android:selectable="false" />
+ settings:searchable="false"/>
</PreferenceScreen>
diff --git a/res/xml/configure_notification_settings.xml b/res/xml/configure_notification_settings.xml
index f0977e8..4078e82 100644
--- a/res/xml/configure_notification_settings.xml
+++ b/res/xml/configure_notification_settings.xml
@@ -42,7 +42,8 @@
android:key="all_notifications"
android:title="@string/notifications_title"
android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
- android:order="4">
+ android:order="4"
+ settings:searchable="false">
<extra
android:name="classname"
android:value="com.android.settings.Settings$NotificationAppListActivity"/>
@@ -136,7 +137,8 @@
android:title="@string/notification_ringtone_title"
android:dialogTitle="@string/notification_ringtone_title"
android:summary="@string/summary_placeholder"
- android:ringtoneType="notification"/>
+ android:ringtoneType="notification"
+ settings:searchable="false"/>
<SwitchPreference
android:key="notification_people_strip"
diff --git a/res/xml/connected_devices_advanced.xml b/res/xml/connected_devices_advanced.xml
index bd8f1dd..958af7f 100644
--- a/res/xml/connected_devices_advanced.xml
+++ b/res/xml/connected_devices_advanced.xml
@@ -32,6 +32,7 @@
android:title="@string/nfc_quick_toggle_title"
android:icon="@drawable/ic_nfc"
android:order="-7"
+ settings:searchable="false"
settings:controller="com.android.settings.connecteddevice.NfcAndPaymentFragmentController"/>
<Preference
diff --git a/res/xml/conversation_list_settings.xml b/res/xml/conversation_list_settings.xml
index 1d6b13c..5b9f0c4 100644
--- a/res/xml/conversation_list_settings.xml
+++ b/res/xml/conversation_list_settings.xml
@@ -27,11 +27,6 @@
<Preference
android:key="behavior"
android:summary="@string/important_conversation_behavior_summary"/>
- <SwitchPreference
- android:key="important_bubble"
- android:title="@string/important_bubble"
- android:icon="@drawable/ic_create_bubble"
- settings:controller="com.android.settings.notification.app.ImportantConversationBubblePreferenceController"/>
<!-- Important conversations added here -->
<PreferenceCategory
android:key="important_conversations_list"
diff --git a/res/xml/data_saver.xml b/res/xml/data_saver.xml
index 4a917f6..3816f26 100644
--- a/res/xml/data_saver.xml
+++ b/res/xml/data_saver.xml
@@ -24,6 +24,7 @@
android:title="@string/unrestricted_data_saver"
android:summary="@string/summary_two_lines_placeholder"
android:fragment="com.android.settings.datausage.UnrestrictedDataAccess"
+ settings:searchable="false"
settings:controller="com.android.settings.applications.specialaccess.DataSaverController" />
<com.android.settingslib.widget.FooterPreference
diff --git a/res/xml/default_autofill_picker_settings.xml b/res/xml/default_autofill_picker_settings.xml
index da72b43..2aa39e4 100644
--- a/res/xml/default_autofill_picker_settings.xml
+++ b/res/xml/default_autofill_picker_settings.xml
@@ -26,6 +26,7 @@
android:key="default_autofill_main"
android:title="@string/autofill_app"
android:fragment="com.android.settings.applications.defaultapps.DefaultAutofillPicker"
+ settings:searchable="false"
settings:keywords="@string/autofill_keywords">
<extra android:name="for_work" android:value="false" />
</com.android.settings.widget.GearPreference>
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index 834fb48..48a0850 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -149,6 +149,11 @@
settings:keywords="@string/keywords_adb_wireless" />
<SwitchPreference
+ android:key="adb_authorization_timeout"
+ android:title="@string/adb_authorization_timeout_title"
+ android:summary="@string/adb_authorization_timeout_summary" />
+
+ <SwitchPreference
android:key="enable_terminal"
android:title="@string/enable_terminal_title"
android:summary="@string/enable_terminal_summary" />
@@ -482,6 +487,11 @@
android:summary="@string/hwui_force_dark_summary" />
<SwitchPreference
+ android:key="enable_blurs_on_windows"
+ android:title="@string/enable_blurs_on_windows_title"
+ android:summary="@string/enable_blurs_on_windows_summary" />
+
+ <SwitchPreference
android:key="force_msaa"
android:title="@string/force_msaa"
android:summary="@string/force_msaa_summary" />
diff --git a/res/xml/firmware_version.xml b/res/xml/firmware_version.xml
index 41396f0..41f7733 100644
--- a/res/xml/firmware_version.xml
+++ b/res/xml/firmware_version.xml
@@ -27,6 +27,7 @@
android:title="@string/firmware_version"
android:summary="@string/summary_placeholder"
settings:enableCopying="true"
+ settings:searchable="false"
settings:controller="com.android.settings.deviceinfo.firmwareversion.FirmwareVersionDetailPreferenceController"/>
<!-- Security patch -->
diff --git a/res/xml/gestures.xml b/res/xml/gestures.xml
index 5ac27e0..a523ec6 100644
--- a/res/xml/gestures.xml
+++ b/res/xml/gestures.xml
@@ -30,18 +30,21 @@
android:key="gesture_swipe_down_fingerprint_input_summary"
android:title="@string/fingerprint_swipe_for_notifications_title"
android:fragment="com.android.settings.gestures.SwipeToNotificationSettings"
+ settings:searchable="false"
settings:controller="com.android.settings.gestures.SwipeToNotificationPreferenceController" />
<Preference
android:key="gesture_double_tap_power_input_summary"
android:title="@string/double_tap_power_for_camera_title"
android:fragment="com.android.settings.gestures.DoubleTapPowerSettings"
+ settings:searchable="false"
settings:controller="com.android.settings.gestures.DoubleTapPowerPreferenceController" />
<Preference
android:key="gesture_double_twist_input_summary"
android:title="@string/double_twist_for_camera_mode_title"
android:fragment="com.android.settings.gestures.DoubleTwistGestureSettings"
+ settings:searchable="false"
settings:controller="com.android.settings.gestures.DoubleTwistPreferenceController" />
<Preference
@@ -54,18 +57,21 @@
android:key="gesture_tap_screen_input_summary"
android:title="@string/ambient_display_tap_screen_title"
android:fragment="com.android.settings.gestures.TapScreenGestureSettings"
+ settings:searchable="false"
settings:controller="com.android.settings.gestures.TapScreenGesturePreferenceController" />
<Preference
android:key="gesture_double_tap_screen_input_summary"
android:title="@string/ambient_display_title"
android:fragment="com.android.settings.gestures.DoubleTapScreenSettings"
+ settings:searchable="false"
settings:controller="com.android.settings.gestures.DoubleTapScreenPreferenceController" />
<Preference
android:key="gesture_pick_up_input_summary"
android:title="@string/ambient_display_pickup_title"
android:fragment="com.android.settings.gestures.PickupGestureSettings"
+ settings:searchable="false"
settings:controller="com.android.settings.gestures.PickupGesturePreferenceController" />
<Preference
diff --git a/res/xml/mobile_network_list.xml b/res/xml/mobile_network_list.xml
index 01ddb28..6bf9ad2 100644
--- a/res/xml/mobile_network_list.xml
+++ b/res/xml/mobile_network_list.xml
@@ -17,7 +17,6 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:key="mobile_network_list_screen"
android:title="@string/network_settings_title">
<com.android.settingslib.RestrictedPreference
@@ -25,6 +24,7 @@
settings:isPreferenceVisible="false"
settings:userRestriction="no_config_mobile_networks"
settings:useAdminDisabledSummary="true"
+ settings:searchable="false"
android:title="@string/mobile_network_list_add_more"
android:icon="@drawable/ic_menu_add_activated_tint"
android:order="100" >
diff --git a/res/xml/privacy_dashboard_settings.xml b/res/xml/privacy_dashboard_settings.xml
index 623460c..7899963 100644
--- a/res/xml/privacy_dashboard_settings.xml
+++ b/res/xml/privacy_dashboard_settings.xml
@@ -46,7 +46,7 @@
android:title="@string/app_permissions"
android:summary="@string/summary_placeholder"
settings:allowDividerAbove="true"
- settings:keywords="@string/keywords_app_permissions"
+ settings:searchable="false"
settings:controller="com.android.settings.applications.AppPermissionsPreferenceController">
<intent android:action="android.intent.action.MANAGE_PERMISSIONS"/>
</Preference>
diff --git a/res/xml/privacy_settings.xml b/res/xml/privacy_settings.xml
index 2e09dbd..2fc3ca4 100644
--- a/res/xml/privacy_settings.xml
+++ b/res/xml/privacy_settings.xml
@@ -17,7 +17,6 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:key="privacy_settings_screen"
android:title="@string/privacy_settings_title">
<!-- Backup settings -->
diff --git a/res/xml/security_lockscreen_settings.xml b/res/xml/security_lockscreen_settings.xml
index dfc5ce7..8962fc2 100644
--- a/res/xml/security_lockscreen_settings.xml
+++ b/res/xml/security_lockscreen_settings.xml
@@ -69,18 +69,21 @@
android:key="ambient_display_tap"
android:title="@string/ambient_display_tap_screen_title"
android:fragment="com.android.settings.gestures.TapScreenGestureSettings"
+ settings:searchable="false"
settings:controller="com.android.settings.gestures.TapScreenGesturePreferenceController" />
<Preference
android:key="ambient_display_double_tap"
android:title="@string/ambient_display_title"
android:fragment="com.android.settings.gestures.DoubleTapScreenSettings"
+ settings:searchable="false"
settings:controller="com.android.settings.gestures.DoubleTapScreenPreferenceController" />
<Preference
android:key="ambient_display_pick_up"
android:title="@string/ambient_display_pickup_title"
android:fragment="com.android.settings.gestures.PickupGestureSettings"
+ settings:searchable="false"
settings:controller="com.android.settings.gestures.PickupGesturePreferenceController" />
<SwitchPreference
diff --git a/res/xml/security_settings_face.xml b/res/xml/security_settings_face.xml
index cc45a96..858911d 100644
--- a/res/xml/security_settings_face.xml
+++ b/res/xml/security_settings_face.xml
@@ -18,7 +18,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:key="security_settings_face_settings_page"
android:title="@string/security_settings_face_preference_title">
<com.android.settings.widget.VideoPreference
diff --git a/res/xml/special_access.xml b/res/xml/special_access.xml
index b0498f8..6ee87f4 100644
--- a/res/xml/special_access.xml
+++ b/res/xml/special_access.xml
@@ -51,6 +51,7 @@
android:title="@string/manage_device_admin"
android:fragment="com.android.settings.applications.specialaccess.deviceadmin.DeviceAdminSettings"
android:summary="@string/summary_placeholder"
+ settings:searchable="false"
settings:controller="com.android.settings.enterprise.ManageDeviceAdminPreferenceController" />
<Preference
diff --git a/res/xml/tether_prefs.xml b/res/xml/tether_prefs.xml
index abc49cc..9367a9b 100644
--- a/res/xml/tether_prefs.xml
+++ b/res/xml/tether_prefs.xml
@@ -38,6 +38,12 @@
android:summary="@string/bluetooth_tethering_subtext"
settings:keywords="@string/keywords_hotspot_tethering" />
+ <SwitchPreference
+ android:key="enable_ethernet_tethering"
+ android:title="@string/ethernet_tether_checkbox_text"
+ android:summary="@string/ethernet_tethering_subtext"
+ settings:keywords="@string/keywords_hotspot_tethering" />
+
<Preference
android:key="disabled_on_data_saver"
android:summary="@string/tether_settings_disabled_on_data_saver"
diff --git a/res/xml/zen_mode_restrict_notifications_settings.xml b/res/xml/zen_mode_restrict_notifications_settings.xml
index ad574d8..0bf8c26 100644
--- a/res/xml/zen_mode_restrict_notifications_settings.xml
+++ b/res/xml/zen_mode_restrict_notifications_settings.xml
@@ -17,6 +17,7 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/zen_mode_restrict_notifications_title">
<PreferenceCategory
@@ -25,16 +26,19 @@
<com.android.settings.notification.zen.ZenCustomRadioButtonPreference
android:key="zen_mute_notifications"
android:title="@string/zen_mode_restrict_notifications_mute"
- android:summary="@string/zen_mode_restrict_notifications_mute_summary"/>
+ android:summary="@string/zen_mode_restrict_notifications_mute_summary"
+ settings:searchable="false"/>
<com.android.settings.notification.zen.ZenCustomRadioButtonPreference
android:key="zen_hide_notifications"
android:title="@string/zen_mode_restrict_notifications_hide"
- android:summary="@string/zen_mode_restrict_notifications_hide_summary"/>
+ android:summary="@string/zen_mode_restrict_notifications_hide_summary"
+ settings:searchable="false"/>
<com.android.settings.notification.zen.ZenCustomRadioButtonPreference
android:key="zen_custom"
- android:title="@string/zen_mode_restrict_notifications_custom" />
+ android:title="@string/zen_mode_restrict_notifications_custom"
+ settings:searchable="false"/>
</PreferenceCategory>
<com.android.settingslib.widget.FooterPreference />
diff --git a/res/xml/zen_mode_settings.xml b/res/xml/zen_mode_settings.xml
index f8a3aa5..ce2d132 100644
--- a/res/xml/zen_mode_settings.xml
+++ b/res/xml/zen_mode_settings.xml
@@ -43,7 +43,6 @@
<Preference
android:key="zen_mode_behavior_apps"
android:title="@string/zen_category_apps"
- settings:controller="com.android.settings.notification.zen.ZenModeBypassingAppsPreferenceController"
android:fragment="com.android.settings.notification.zen.ZenModeBypassingAppsSettings" />
<!-- All sounds -->
diff --git a/src/com/android/settings/IccLockSettings.java b/src/com/android/settings/IccLockSettings.java
index b906a73..a9b496a 100644
--- a/src/com/android/settings/IccLockSettings.java
+++ b/src/com/android/settings/IccLockSettings.java
@@ -28,6 +28,8 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
+import android.os.PersistableBundle;
+import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionInfo;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -53,6 +55,7 @@
import com.android.settings.network.ProxySubscriptionManager;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -123,6 +126,7 @@
// @see android.widget.Toast$TN
private static final long LONG_DURATION_TIMEOUT = 7000;
+ private int mSlotId;
private int mSubId;
private TelephonyManager mTelephonyManager;
@@ -219,7 +223,30 @@
Bundle savedInstanceState) {
final int numSims = mProxySubscriptionMgr.getActiveSubscriptionInfoCountMax();
- if (numSims > 1) {
+ final List<SubscriptionInfo> subInfoList =
+ mProxySubscriptionMgr.getActiveSubscriptionsInfo();
+ mSlotId = 0;
+ final List<SubscriptionInfo> componenterList = new ArrayList<>();
+
+ for (int i = 0; i < numSims; ++i) {
+ final SubscriptionInfo subInfo =
+ getActiveSubscriptionInfoForSimSlotIndex(subInfoList, i);
+ final CarrierConfigManager carrierConfigManager = getContext().getSystemService(
+ CarrierConfigManager.class);
+ final PersistableBundle bundle = carrierConfigManager.getConfigForSubId(
+ subInfo.getSubscriptionId());
+ if (bundle != null
+ && !bundle.getBoolean(CarrierConfigManager.KEY_HIDE_SIM_LOCK_SETTINGS_BOOL)) {
+ componenterList.add(subInfo);
+ }
+ }
+
+ if (componenterList.size() == 0) {
+ Log.e(TAG, "onCreateView: no sim info");
+ return null;
+ }
+
+ if (componenterList.size() > 1) {
final 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);
@@ -234,24 +261,22 @@
mTabHost.setOnTabChangedListener(mTabListener);
mTabHost.clearAllTabs();
- final List<SubscriptionInfo> subInfoList =
- mProxySubscriptionMgr.getActiveSubscriptionsInfo();
- for (int i = 0; i < numSims; ++i) {
- final SubscriptionInfo subInfo =
- getActiveSubscriptionInfoForSimSlotIndex(subInfoList, i);
- mTabHost.addTab(buildTabSpec(String.valueOf(i),
+ for (SubscriptionInfo subInfo : componenterList) {
+ int slot = subInfo.getSimSlotIndex();
+ mTabHost.addTab(buildTabSpec(String.valueOf(slot),
String.valueOf(subInfo == null
- ? getContext().getString(R.string.sim_editor_title, i + 1)
- : subInfo.getDisplayName())));
+ ? getContext().getString(R.string.sim_editor_title, slot + 1)
+ : subInfo.getDisplayName())));
}
- final SubscriptionInfo sir = getActiveSubscriptionInfoForSimSlotIndex(subInfoList, 0);
- mSubId = sir.getSubscriptionId();
+
+ mSubId = componenterList.get(0).getSubscriptionId();
if (savedInstanceState != null && savedInstanceState.containsKey(CURRENT_TAB)) {
mTabHost.setCurrentTabByTag(savedInstanceState.getString(CURRENT_TAB));
}
return view;
} else {
+ mSlotId = componenterList.get(0).getSimSlotIndex();
return super.onCreateView(inflater, container, savedInstanceState);
}
}
@@ -266,7 +291,7 @@
final List<SubscriptionInfo> subInfoList =
mProxySubscriptionMgr.getActiveSubscriptionsInfo();
- final SubscriptionInfo sir = getActiveSubscriptionInfoForSimSlotIndex(subInfoList, 0);
+ final SubscriptionInfo sir = getActiveSubscriptionInfoForSimSlotIndex(subInfoList, mSlotId);
mSubId = sir.getSubscriptionId();
if (mPinDialog != null) {
@@ -653,9 +678,9 @@
private OnTabChangeListener mTabListener = new OnTabChangeListener() {
@Override
public void onTabChanged(String tabId) {
- final int slotId = Integer.parseInt(tabId);
+ mSlotId = Integer.parseInt(tabId);
final SubscriptionInfo sir = getActiveSubscriptionInfoForSimSlotIndex(
- mProxySubscriptionMgr.getActiveSubscriptionsInfo(), slotId);
+ mProxySubscriptionMgr.getActiveSubscriptionsInfo(), mSlotId);
// The User has changed tab; update the body.
updatePreferences();
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index cce2010..c61e573 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -18,6 +18,7 @@
import static android.net.ConnectivityManager.TETHERING_BLUETOOTH;
import static android.net.ConnectivityManager.TETHERING_USB;
+import static android.net.TetheringManager.TETHERING_ETHERNET;
import android.app.Activity;
import android.app.settings.SettingsEnums;
@@ -31,12 +32,16 @@
import android.content.pm.PackageManager;
import android.hardware.usb.UsbManager;
import android.net.ConnectivityManager;
+import android.net.EthernetManager;
+import android.net.TetheringManager;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
+import android.os.HandlerExecutor;
import android.os.UserManager;
import android.provider.SearchIndexableResource;
+import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import androidx.annotation.VisibleForTesting;
@@ -71,6 +76,7 @@
static final String KEY_USB_TETHER_SETTINGS = "usb_tether_settings";
@VisibleForTesting
static final String KEY_ENABLE_BLUETOOTH_TETHERING = "enable_bluetooth_tethering";
+ private static final String KEY_ENABLE_ETHERNET_TETHERING = "enable_ethernet_tethering";
private static final String KEY_DATA_SAVER_FOOTER = "disabled_on_data_saver";
@VisibleForTesting
static final String KEY_TETHER_PREFS_FOOTER = "tether_prefs_footer";
@@ -81,15 +87,22 @@
private SwitchPreference mBluetoothTether;
+ private SwitchPreference mEthernetTether;
+
private BroadcastReceiver mTetherChangeReceiver;
private String[] mUsbRegexs;
private String[] mBluetoothRegexs;
+ private String mEthernetRegex;
private AtomicReference<BluetoothPan> mBluetoothPan = new AtomicReference<>();
private Handler mHandler = new Handler();
private OnStartTetheringCallback mStartTetheringCallback;
private ConnectivityManager mCm;
+ private EthernetManager mEm;
+ private TetheringManager mTm;
+ private TetheringEventCallback mTetheringEventCallback;
+ private EthernetListener mEthernetListener;
private WifiTetherPreferenceController mWifiTetherPreferenceController;
@@ -144,17 +157,23 @@
mUsbTether = (SwitchPreference) findPreference(KEY_USB_TETHER_SETTINGS);
mBluetoothTether = (SwitchPreference) findPreference(KEY_ENABLE_BLUETOOTH_TETHERING);
+ mEthernetTether = (SwitchPreference) findPreference(KEY_ENABLE_ETHERNET_TETHERING);
setFooterPreferenceTitle();
mDataSaverBackend.addListener(this);
mCm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
+ mEm = (EthernetManager) getSystemService(Context.ETHERNET_SERVICE);
+ mTm = (TetheringManager) getSystemService(Context.TETHERING_SERVICE);
mUsbRegexs = mCm.getTetherableUsbRegexs();
mBluetoothRegexs = mCm.getTetherableBluetoothRegexs();
+ mEthernetRegex = getContext().getResources().getString(
+ com.android.internal.R.string.config_ethernet_iface_regex);
final boolean usbAvailable = mUsbRegexs.length != 0;
final boolean bluetoothAvailable = mBluetoothRegexs.length != 0;
+ final boolean ethernetAvailable = !TextUtils.isEmpty(mEthernetRegex);
if (!usbAvailable || Utils.isMonkeyRunning()) {
getPreferenceScreen().removePreference(mUsbTether);
@@ -172,6 +191,7 @@
mBluetoothTether.setChecked(false);
}
}
+ if (!ethernetAvailable) getPreferenceScreen().removePreference(mEthernetTether);
// Set initial state based on Data Saver mode.
onDataSaverChanged(mDataSaverBackend.isDataSaverEnabled());
}
@@ -194,6 +214,7 @@
mDataSaverEnabled = isDataSaving;
mUsbTether.setEnabled(!mDataSaverEnabled);
mBluetoothTether.setEnabled(!mDataSaverEnabled);
+ mEthernetTether.setEnabled(!mDataSaverEnabled);
mDataSaverFooter.setVisible(mDataSaverEnabled);
}
@@ -221,6 +242,7 @@
@Override
public void onReceive(Context content, Intent intent) {
String action = intent.getAction();
+ // TODO: stop using ACTION_TETHER_STATE_CHANGED and use mTetheringEventCallback instead.
if (action.equals(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)) {
// TODO - this should understand the interface types
ArrayList<String> available = intent.getStringArrayListExtra(
@@ -279,6 +301,8 @@
final Activity activity = getActivity();
mStartTetheringCallback = new OnStartTetheringCallback(this);
+ mTetheringEventCallback = new TetheringEventCallback();
+ mTm.registerTetheringEventCallback(new HandlerExecutor(mHandler), mTetheringEventCallback);
mMassStorageActive = Environment.MEDIA_SHARED.equals(Environment.getExternalStorageState());
mTetherChangeReceiver = new TetherChangeReceiver();
@@ -301,6 +325,9 @@
if (intent != null) mTetherChangeReceiver.onReceive(activity, intent);
+ mEthernetListener = new EthernetListener();
+ mEm.addListener(mEthernetListener);
+
updateState();
}
@@ -312,8 +339,12 @@
return;
}
getActivity().unregisterReceiver(mTetherChangeReceiver);
+ mTm.unregisterTetheringEventCallback(mTetheringEventCallback);
+ mEm.removeListener(mEthernetListener);
mTetherChangeReceiver = null;
mStartTetheringCallback = null;
+ mTetheringEventCallback = null;
+ mEthernetListener = null;
}
private void updateState() {
@@ -327,6 +358,7 @@
String[] errored) {
updateUsbState(available, tethered, errored);
updateBluetoothState();
+ updateEthernetState(available, tethered);
}
private void updateUsbState(String[] available, String[] tethered,
@@ -390,6 +422,31 @@
}
}
+ private void updateEthernetState(String[] available, String[] tethered) {
+
+ boolean isAvailable = false;
+ boolean isTethered = false;
+
+ for (String s : available) {
+ if (s.matches(mEthernetRegex)) isAvailable = true;
+ }
+
+ for (String s : tethered) {
+ if (s.matches(mEthernetRegex)) isTethered = true;
+ }
+
+ if (isTethered) {
+ mEthernetTether.setEnabled(!mDataSaverEnabled);
+ mEthernetTether.setChecked(true);
+ } else if (isAvailable || mEm.isAvailable()) {
+ mEthernetTether.setEnabled(!mDataSaverEnabled);
+ mEthernetTether.setChecked(false);
+ } else {
+ mEthernetTether.setEnabled(false);
+ mEthernetTether.setChecked(false);
+ }
+ }
+
public static boolean isProvisioningNeededButUnavailable(Context context) {
return (TetherUtil.isProvisioningNeeded(context)
&& !isIntentAvailable(context));
@@ -438,6 +495,12 @@
} else {
mCm.stopTethering(TETHERING_BLUETOOTH);
}
+ } else if (preference == mEthernetTether) {
+ if (mEthernetTether.isChecked()) {
+ startTethering(TETHERING_ETHERNET);
+ } else {
+ mCm.stopTethering(TETHERING_ETHERNET);
+ }
}
return super.onPreferenceTreeClick(preference);
@@ -495,6 +558,13 @@
if (!bluetoothAvailable) {
keys.add(KEY_ENABLE_BLUETOOTH_TETHERING);
}
+
+ final boolean ethernetAvailable = !TextUtils.isEmpty(
+ context.getResources().getString(
+ com.android.internal.R.string.config_ethernet_iface_regex));
+ if (!ethernetAvailable) {
+ keys.add(KEY_ENABLE_ETHERNET_TETHERING);
+ }
return keys;
}
};
@@ -524,4 +594,17 @@
}
}
}
+
+ private final class TetheringEventCallback implements TetheringManager.TetheringEventCallback {
+ @Override
+ public void onTetheredInterfacesChanged(List<String> interfaces) {
+ updateState();
+ }
+ }
+
+ private final class EthernetListener implements EthernetManager.Listener {
+ public void onAvailabilityChanged(String iface, boolean isAvailable) {
+ mHandler.post(TetherSettings.this::updateState);
+ }
+ }
}
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 315cba1..e8eb8ba 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -888,6 +888,27 @@
}
/**
+ * Return {@code true} if the supplied package is the device owner or profile owner of a
+ * given user.
+ *
+ * @param devicePolicyManager used to check whether it is device owner and profile owner app
+ * @param packageName package to check about
+ * @param userId the if of the relevant user
+ */
+ public static boolean isProfileOrDeviceOwner(DevicePolicyManager devicePolicyManager,
+ String packageName, int userId) {
+ if ((devicePolicyManager.getDeviceOwnerUserId() == userId)
+ && devicePolicyManager.isDeviceOwnerApp(packageName)) {
+ return true;
+ }
+ final ComponentName cn = devicePolicyManager.getProfileOwnerAsUser(userId);
+ if (cn != null && cn.getPackageName().equals(packageName)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Return the resource id to represent the install status for an app
*/
@StringRes
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 23b0f1a..1e3944e 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -76,8 +76,6 @@
// Index of the first preference in a preference category.
private static final int FIRST_PREFERENCE_IN_CATEGORY_INDEX = -1;
- private static final String EMPTY_STRING = "";
-
// Preference categories
private static final String CATEGORY_SCREEN_READER = "screen_reader_category";
private static final String CATEGORY_AUDIO_AND_CAPTIONS = "audio_and_captions_category";
@@ -195,6 +193,10 @@
for (AccessibilityShortcutController.ToggleableFrameworkFeatureInfo feature : features) {
shortcutFeatureKeys.add(feature.getSettingKey());
}
+
+ // Observe changes from accessibility selection menu
+ shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGET_COMPONENT);
+ shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
mSettingsContentObserver = new SettingsContentObserver(mHandler, shortcutFeatureKeys) {
@Override
public void onChange(boolean selfChange, Uri uri) {
@@ -268,16 +270,24 @@
return context.getText(R.string.accessibility_summary_state_stopped);
}
- final CharSequence serviceSummary = info.loadSummary(context.getPackageManager());
-
+ final CharSequence serviceState;
final int fragmentType = AccessibilityUtil.getAccessibilityServiceFragmentType(info);
if (fragmentType == AccessibilityServiceFragmentType.INVISIBLE) {
- return TextUtils.isEmpty(serviceSummary) ? EMPTY_STRING : serviceSummary;
+ final ComponentName componentName = new ComponentName(
+ info.getResolveInfo().serviceInfo.packageName,
+ info.getResolveInfo().serviceInfo.name);
+ final boolean shortcutEnabled = AccessibilityUtil.getUserShortcutTypesFromSettings(
+ context, componentName) != AccessibilityUtil.UserShortcutType.EMPTY;
+ serviceState = shortcutEnabled
+ ? context.getText(R.string.accessibility_summary_shortcut_enabled)
+ : context.getText(R.string.accessibility_summary_shortcut_disabled);
+ } else {
+ serviceState = serviceEnabled
+ ? context.getText(R.string.accessibility_summary_state_enabled)
+ : context.getText(R.string.accessibility_summary_state_disabled);
}
- final CharSequence serviceState = serviceEnabled
- ? context.getText(R.string.accessibility_summary_state_enabled)
- : context.getText(R.string.accessibility_summary_state_disabled);
+ final CharSequence serviceSummary = info.loadSummary(context.getPackageManager());
final String stateSummaryCombo = context.getString(
R.string.preference_summary_default_combination,
serviceState, serviceSummary);
@@ -485,6 +495,8 @@
mCategoryToPrefCategoryMap.get(CATEGORY_DISPLAY);
experimentalCategory.removePreference(mToggleInversionPreference);
experimentalCategory.removePreference(mDisplayDaltonizerPreferenceScreen);
+ mDisplayMagnificationPreferenceScreen.setSummary(
+ ToggleScreenMagnificationPreferenceFragment.getServiceSummary(getContext()));
mDisplayDaltonizerPreferenceScreen.setOrder(
mDisplayMagnificationPreferenceScreen.getOrder() + 1);
mDisplayDaltonizerPreferenceScreen.setSummary(AccessibilityUtil.getSummary(
diff --git a/src/com/android/settings/accessibility/CaptionPropertiesFragment.java b/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
index 8a4efbb..43539fd 100644
--- a/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
+++ b/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
@@ -32,6 +32,8 @@
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.SearchIndexable;
+import com.google.common.primitives.Floats;
+
import java.util.ArrayList;
import java.util.List;
@@ -52,6 +54,7 @@
private Preference mMoreOptions;
private final List<Preference> mPreferenceList = new ArrayList<>();
+ private float[] mFontSizeValuesArray;
@Override
public int getMetricsCategory() {
@@ -66,8 +69,14 @@
addPreferencesFromResource(R.xml.captioning_settings);
initializeAllPreferences();
- updateAllPreferences();
installUpdateListeners();
+ initFontSizeValuesArray();
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ updateAllPreferences();
}
private void initializeAllPreferences() {
@@ -83,8 +92,19 @@
mSwitch.setOnPreferenceChangeListener(this);
}
+ private void initFontSizeValuesArray() {
+ final String[] fontSizeValuesStrArray = getPrefContext().getResources().getStringArray(
+ R.array.captioning_font_size_selector_values);
+ final int length = fontSizeValuesStrArray.length;
+ mFontSizeValuesArray = new float[length];
+ for (int i = 0; i < length; ++i) {
+ mFontSizeValuesArray[i] = Float.parseFloat(fontSizeValuesStrArray[i]);
+ }
+ }
+
private void updateAllPreferences() {
mSwitch.setChecked(mCaptioningManager.isEnabled());
+ mTextAppearance.setSummary(geTextAppearanceSummary(getPrefContext()));
}
@Override
@@ -103,6 +123,16 @@
return R.string.help_url_caption;
}
+ private CharSequence geTextAppearanceSummary(Context context) {
+ final String[] fontSizeSummaries = context.getResources().getStringArray(
+ R.array.captioning_font_size_selector_titles);
+
+ final float fontSize = mCaptioningManager.getFontScale();
+ final int idx = Floats.indexOf(mFontSizeValuesArray, fontSize);
+ final String fontSizeSummary = fontSizeSummaries[idx == /* not exist */ -1 ? 0 : idx];
+ return context.getString(R.string.captioning_caption_appearance_summary, fontSizeSummary);
+ }
+
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.captioning_settings);
}
diff --git a/src/com/android/settings/accessibility/MagnificationPreferenceController.java b/src/com/android/settings/accessibility/MagnificationPreferenceController.java
index 7ac7bef..5b5236e 100644
--- a/src/com/android/settings/accessibility/MagnificationPreferenceController.java
+++ b/src/com/android/settings/accessibility/MagnificationPreferenceController.java
@@ -22,7 +22,6 @@
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
-import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
public class MagnificationPreferenceController extends BasePreferenceController {
@@ -40,8 +39,7 @@
@Override
public CharSequence getSummary() {
- return mContext.getResources().getText(
- R.string.accessibility_screen_magnification_navbar_title);
+ return ToggleScreenMagnificationPreferenceFragment.getServiceSummary(mContext);
}
@Override
diff --git a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
index 292e931..4c2945a 100644
--- a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
@@ -624,4 +624,17 @@
}
return shortcutTypes;
}
+
+ /**
+ * Gets the service summary of magnification.
+ *
+ * @param context The current context.
+ */
+ public static CharSequence getServiceSummary(Context context) {
+ // Get the user shortcut type from settings provider.
+ final int uerShortcutType = getUserShortcutTypeFromSettings(context);
+ return (uerShortcutType != AccessibilityUtil.UserShortcutType.EMPTY)
+ ? context.getText(R.string.accessibility_summary_shortcut_enabled)
+ : context.getText(R.string.accessibility_summary_shortcut_disabled);
+ }
}
diff --git a/src/com/android/settings/applications/AppStateManageExternalStorageBridge.java b/src/com/android/settings/applications/AppStateManageExternalStorageBridge.java
index 7933062..1132137 100644
--- a/src/com/android/settings/applications/AppStateManageExternalStorageBridge.java
+++ b/src/com/android/settings/applications/AppStateManageExternalStorageBridge.java
@@ -69,7 +69,7 @@
/**
* Returns the MANAGE_EXTERNAL_STORAGE {@link AppStateAppOpsBridge.PermissionState} object
- * associated with the given package and user.
+ * associated with the given package and UID.
*/
public PermissionState getManageExternalStoragePermState(String pkg, int uid) {
return getPermissionInfo(pkg, uid);
diff --git a/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java b/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java
index 1b14402..590384c 100644
--- a/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/AppButtonsPreferenceController.java
@@ -25,8 +25,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.om.OverlayManager;
import android.content.om.OverlayInfo;
+import android.content.om.OverlayManager;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@@ -393,11 +393,19 @@
enabled = false;
}
- // We don't allow uninstalling DO/PO on *any* users, because if it's a system app,
+ // We don't allow uninstalling DO/PO on *any* users if it's a system app, because
// "uninstall" is actually "downgrade to the system version + disable", and "downgrade"
// will clear data on all users.
- if (Utils.isProfileOrDeviceOwner(mUserManager, mDpm, mPackageInfo.packageName)) {
- enabled = false;
+ if (isSystemPackage(mActivity.getResources(), mPm, mPackageInfo)) {
+ if (Utils.isProfileOrDeviceOwner(mUserManager, mDpm, mPackageInfo.packageName)) {
+ enabled = false;
+ }
+ // We allow uninstalling if the calling user is not a DO/PO and if it's not a system app,
+ // because this will not have device-wide consequences.
+ } else {
+ if (Utils.isProfileOrDeviceOwner(mDpm, mPackageInfo.packageName, mUserId)) {
+ enabled = false;
+ }
}
// Don't allow uninstalling the device provisioning package.
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index 54af16f..8a37473 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -38,6 +38,7 @@
import android.app.settings.SettingsEnums;
import android.app.usage.IUsageStatsManager;
import android.compat.annotation.ChangeId;
+import android.compat.annotation.LoggingOnly;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
@@ -186,6 +187,7 @@
* requested such permission.
*/
@ChangeId
+ @LoggingOnly
private static final long CHANGE_RESTRICT_SAW_INTENT = 135920175L;
// sort order
diff --git a/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java b/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java
index 3e534b3..9afb2b4 100644
--- a/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java
+++ b/src/com/android/settings/applications/specialaccess/deviceadmin/DeviceAdminAdd.java
@@ -457,12 +457,20 @@
private void showPolicyTransparencyDialogIfRequired() {
if (isManagedProfile(mDeviceAdmin)
&& mDeviceAdmin.getComponent().equals(mDPM.getProfileOwner())) {
- if (hasBaseCantRemoveProfileRestriction()) {
- // If DISALLOW_REMOVE_MANAGED_PROFILE is set by the system, there's no
- // point showing a dialog saying it's disabled by an admin.
- return;
+ EnforcedAdmin enforcedAdmin;
+ ComponentName adminComponent = mDPM.getProfileOwnerAsUser(getUserId());
+ if (adminComponent != null && mDPM.isOrganizationOwnedDeviceWithManagedProfile()) {
+ enforcedAdmin = new EnforcedAdmin(adminComponent,
+ UserManager.DISALLOW_REMOVE_MANAGED_PROFILE, UserHandle.of(getUserId()));
+ } else {
+ // Todo (b/151061366): Investigate this case to check if it is still viable.
+ if (hasBaseCantRemoveProfileRestriction()) {
+ // If DISALLOW_REMOVE_MANAGED_PROFILE is set by the system, there's no
+ // point showing a dialog saying it's disabled by an admin.
+ return;
+ }
+ enforcedAdmin = getAdminEnforcingCantRemoveProfile();
}
- EnforcedAdmin enforcedAdmin = getAdminEnforcingCantRemoveProfile();
if (enforcedAdmin != null) {
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(
DeviceAdminAdd.this,
@@ -640,7 +648,8 @@
final EnforcedAdmin admin = getAdminEnforcingCantRemoveProfile();
final boolean hasBaseRestriction = hasBaseCantRemoveProfileRestriction();
- if (admin != null && !hasBaseRestriction) {
+ if ((hasBaseRestriction && mDPM.isOrganizationOwnedDeviceWithManagedProfile())
+ || (admin != null && !hasBaseRestriction)) {
findViewById(R.id.restricted_icon).setVisibility(View.VISIBLE);
}
mActionButton.setEnabled(admin == null && !hasBaseRestriction);
diff --git a/src/com/android/settings/biometrics/BiometricEnrollActivity.java b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
index a0aa6db..4179ea3 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollActivity.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
@@ -68,11 +68,13 @@
final int result = bm.canAuthenticate(authenticators);
- if (result == BiometricManager.BIOMETRIC_SUCCESS
- || result == BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE) {
- Log.e(TAG, "Unexpected result: " + result);
- finish();
- return;
+ if (!WizardManagerHelper.isAnySetupWizard(getIntent())) {
+ if (result == BiometricManager.BIOMETRIC_SUCCESS
+ || result == BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE) {
+ Log.e(TAG, "Unexpected result: " + result);
+ finish();
+ return;
+ }
}
if (authenticators == BiometricManager.Authenticators.DEVICE_CREDENTIAL) {
diff --git a/src/com/android/settings/biometrics/face/FaceSettings.java b/src/com/android/settings/biometrics/face/FaceSettings.java
index 08cfa70..c1ee545 100644
--- a/src/com/android/settings/biometrics/face/FaceSettings.java
+++ b/src/com/android/settings/biometrics/face/FaceSettings.java
@@ -336,7 +336,22 @@
keys.add(hasEnrolled ? PREF_KEY_ENROLL_FACE_UNLOCK
: PREF_KEY_DELETE_FACE_DATA);
}
+
+ if (!isAttentionSupported(context)) {
+ keys.add(FaceSettingsAttentionPreferenceController.KEY);
+ }
+
return keys;
}
+
+ private boolean isAttentionSupported(Context context) {
+ FaceFeatureProvider featureProvider = FeatureFactory.getFactory(
+ context).getFaceFeatureProvider();
+ boolean isAttentionSupported = false;
+ if (featureProvider != null) {
+ isAttentionSupported = featureProvider.isAttentionSupported(context);
+ }
+ return isAttentionSupported;
+ }
};
}
diff --git a/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceController.java b/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceController.java
new file mode 100644
index 0000000..79aa8e6
--- /dev/null
+++ b/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceController.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2020 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.development;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+/**
+ * Preference controller for the developer option to disable the automatic revocation of adb
+ * authorizations.
+ */
+public class AdbAuthorizationTimeoutPreferenceController extends
+ DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener {
+ private static final String ADB_AUTHORIZATION_TIMEOUT_KEY = "adb_authorization_timeout";
+
+ private final Context mContext;
+
+ public AdbAuthorizationTimeoutPreferenceController(Context context) {
+ super(context);
+ mContext = context;
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return ADB_AUTHORIZATION_TIMEOUT_KEY;
+ }
+
+ @Override
+ public void updateState(Preference preference) {
+ final long authTimeout = Settings.Global.getLong(mContext.getContentResolver(),
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME,
+ Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME);
+ // An authTimeout of 0 indicates this preference is enabled and adb authorizations will not
+ // be automatically revoked.
+ ((SwitchPreference) mPreference).setChecked(authTimeout == 0);
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ writeSetting((boolean) newValue);
+ return true;
+ }
+
+ @Override
+ public void onDeveloperOptionsSwitchDisabled() {
+ super.onDeveloperOptionsSwitchDisabled();
+ writeSetting(false);
+ ((SwitchPreference) mPreference).setChecked(false);
+ }
+
+ private void writeSetting(boolean isEnabled) {
+ long authTimeout = 0;
+ if (!isEnabled) {
+ authTimeout = Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME;
+ }
+ Settings.Global.putLong(mContext.getContentResolver(),
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME,
+ authTimeout);
+ }
+}
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index f3f2a3a..c349de9 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -444,6 +444,7 @@
controllers.add(new AdbPreferenceController(context, fragment));
controllers.add(new ClearAdbKeysPreferenceController(context, fragment));
controllers.add(new WirelessDebuggingPreferenceController(context, lifecycle));
+ controllers.add(new AdbAuthorizationTimeoutPreferenceController(context));
controllers.add(new LocalTerminalPreferenceController(context));
controllers.add(new BugReportInPowerPreferenceController(context));
controllers.add(new AutomaticSystemServerHeapDumpPreferenceController(context));
@@ -487,6 +488,7 @@
controllers.add(new DebugGpuOverdrawPreferenceController(context));
controllers.add(new DebugNonRectClipOperationsPreferenceController(context));
controllers.add(new ForceDarkPreferenceController(context));
+ controllers.add(new EnableBlursPreferenceController(context));
controllers.add(new ForceMSAAPreferenceController(context));
controllers.add(new HardwareOverlaysPreferenceController(context));
controllers.add(new SimulateColorSpacePreferenceController(context));
diff --git a/src/com/android/settings/development/EnableBlursPreferenceController.java b/src/com/android/settings/development/EnableBlursPreferenceController.java
new file mode 100644
index 0000000..88e0db1
--- /dev/null
+++ b/src/com/android/settings/development/EnableBlursPreferenceController.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2020 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.development;
+
+import android.content.Context;
+import android.os.SystemProperties;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+import com.android.settingslib.development.SystemPropPoker;
+
+/**
+ * Controller that toggles window blurs on SurfaceFlinger on devices that support it.
+ */
+public final class EnableBlursPreferenceController extends DeveloperOptionsPreferenceController
+ implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
+
+ @VisibleForTesting
+ static final String DISABLE_BLURS_SYSPROP = "persist.sys.sf.disable_blurs";
+ private static final String ENABLE_BLURS_ON_WINDOWS = "enable_blurs_on_windows";
+ private final boolean mBlurSupported;
+
+ public EnableBlursPreferenceController(Context context) {
+ this(context, SystemProperties
+ .getBoolean("ro.surface_flinger.supports_background_blur", false));
+ }
+
+ @VisibleForTesting
+ public EnableBlursPreferenceController(Context context, boolean blurSupported) {
+ super(context);
+ mBlurSupported = blurSupported;
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return ENABLE_BLURS_ON_WINDOWS;
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ final boolean isDisabled = !(Boolean) newValue;
+ SystemProperties.set(DISABLE_BLURS_SYSPROP, isDisabled ? "1" : "0");
+ SystemPropPoker.getInstance().poke();
+ return true;
+ }
+
+ @Override
+ public boolean isAvailable() {
+ return mBlurSupported;
+ }
+
+ @Override
+ public void updateState(Preference preference) {
+ boolean isEnabled = !SystemProperties.getBoolean(
+ DISABLE_BLURS_SYSPROP, false /* default */);
+ ((SwitchPreference) mPreference).setChecked(isEnabled);
+ }
+
+ @Override
+ protected void onDeveloperOptionsSwitchDisabled() {
+ super.onDeveloperOptionsSwitchDisabled();
+ SystemProperties.set(DISABLE_BLURS_SYSPROP, null);
+ updateState(null);
+ }
+}
diff --git a/src/com/android/settings/development/EnhancedConnectivityPreferenceController.java b/src/com/android/settings/development/EnhancedConnectivityPreferenceController.java
index 2dbd7d1..dc65973 100644
--- a/src/com/android/settings/development/EnhancedConnectivityPreferenceController.java
+++ b/src/com/android/settings/development/EnhancedConnectivityPreferenceController.java
@@ -37,7 +37,7 @@
@VisibleForTesting
static final int ENHANCED_CONNECTIVITY_ON = 1;
- // default is enhanced connectivity disabled.
+ // default is enhanced connectivity enabled.
@VisibleForTesting
static final int ENHANCED_CONNECTIVITY_OFF = 0;
@@ -65,7 +65,7 @@
public void updateState(Preference preference) {
final int enhancedConnectivityEnabled = Settings.Global.getInt(
mContext.getContentResolver(), Settings.Global.ENHANCED_CONNECTIVITY_ENABLED,
- ENHANCED_CONNECTIVITY_OFF);
+ ENHANCED_CONNECTIVITY_ON);
((SwitchPreference) mPreference).setChecked(
enhancedConnectivityEnabled == ENHANCED_CONNECTIVITY_ON);
}
@@ -75,7 +75,7 @@
super.onDeveloperOptionsSwitchDisabled();
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.ENHANCED_CONNECTIVITY_ENABLED,
- ENHANCED_CONNECTIVITY_OFF);
- ((SwitchPreference) mPreference).setChecked(false);
+ ENHANCED_CONNECTIVITY_ON);
+ ((SwitchPreference) mPreference).setChecked(true);
}
}
diff --git a/src/com/android/settings/development/compat/PlatformCompatDashboard.java b/src/com/android/settings/development/compat/PlatformCompatDashboard.java
index 7b79da7..2f2c750 100644
--- a/src/com/android/settings/development/compat/PlatformCompatDashboard.java
+++ b/src/com/android/settings/development/compat/PlatformCompatDashboard.java
@@ -100,7 +100,7 @@
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
try {
- mChanges = getPlatformCompat().listAllChanges();
+ mChanges = getPlatformCompat().listUIChanges();
} catch (RemoteException e) {
throw new RuntimeException("Could not list changes!", e);
}
diff --git a/src/com/android/settings/deviceinfo/StorageSettings.java b/src/com/android/settings/deviceinfo/StorageSettings.java
index 38626ca..7f2c645 100644
--- a/src/com/android/settings/deviceinfo/StorageSettings.java
+++ b/src/com/android/settings/deviceinfo/StorageSettings.java
@@ -587,12 +587,6 @@
result.add(data);
data = new SearchIndexableRaw(context);
- data.title = context.getString(R.string.memory_apps_usage);
- data.key = "storage_settings_apps_space";
- data.screenTitle = context.getString(R.string.storage_settings);
- result.add(data);
-
- data = new SearchIndexableRaw(context);
data.title = context.getString(R.string.memory_dcim_usage);
data.key = "storage_settings_dcim_space";
data.screenTitle = context.getString(R.string.storage_settings);
diff --git a/src/com/android/settings/fuelgauge/BatterySaverReceiver.java b/src/com/android/settings/fuelgauge/BatterySaverReceiver.java
index 300dc0f..bf5c51b 100644
--- a/src/com/android/settings/fuelgauge/BatterySaverReceiver.java
+++ b/src/com/android/settings/fuelgauge/BatterySaverReceiver.java
@@ -39,7 +39,7 @@
public void onReceive(Context context, Intent intent) {
if (DEBUG) Log.d(TAG, "Received " + intent.getAction());
String action = intent.getAction();
- if (PowerManager.ACTION_POWER_SAVE_MODE_CHANGING.equals(action)) {
+ if (PowerManager.ACTION_POWER_SAVE_MODE_CHANGED.equals(action)) {
if (mBatterySaverListener != null) {
mBatterySaverListener.onPowerSaveModeChanged();
}
@@ -55,7 +55,7 @@
public void setListening(boolean listening) {
if (listening && !mRegistered) {
final IntentFilter ifilter = new IntentFilter();
- ifilter.addAction(PowerManager.ACTION_POWER_SAVE_MODE_CHANGING);
+ ifilter.addAction(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED);
ifilter.addAction(Intent.ACTION_BATTERY_CHANGED);
mContext.registerReceiver(this, ifilter);
mRegistered = true;
diff --git a/src/com/android/settings/gestures/GestureNavigationBackSensitivityDialog.java b/src/com/android/settings/gestures/GestureNavigationBackSensitivityDialog.java
deleted file mode 100644
index e4f25eb..0000000
--- a/src/com/android/settings/gestures/GestureNavigationBackSensitivityDialog.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2019 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.gestures;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.content.om.IOverlayManager;
-import android.os.Bundle;
-import android.os.ServiceManager;
-import android.view.View;
-import android.widget.SeekBar;
-
-import com.android.settings.R;
-import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
-
-/**
- * Dialog to set the back gesture's sensitivity in Gesture navigation mode.
- */
-public class GestureNavigationBackSensitivityDialog extends InstrumentedDialogFragment {
- private static final String TAG = "GestureNavigationBackSensitivityDialog";
- private static final String KEY_BACK_SENSITIVITY = "back_sensitivity";
-
- public static void show(SystemNavigationGestureSettings parent, int sensitivity) {
- if (!parent.isAdded()) {
- return;
- }
-
- final GestureNavigationBackSensitivityDialog dialog =
- new GestureNavigationBackSensitivityDialog();
- final Bundle bundle = new Bundle();
- bundle.putInt(KEY_BACK_SENSITIVITY, sensitivity);
- dialog.setArguments(bundle);
- dialog.setTargetFragment(parent, 0);
- dialog.show(parent.getFragmentManager(), TAG);
- }
-
- @Override
- public int getMetricsCategory() {
- return SettingsEnums.SETTINGS_GESTURE_NAV_BACK_SENSITIVITY_DLG;
- }
-
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- final View view = getActivity().getLayoutInflater().inflate(
- R.layout.dialog_back_gesture_sensitivity, null);
- final SeekBar seekBar = view.findViewById(R.id.back_sensitivity_seekbar);
- seekBar.setProgress(getArguments().getInt(KEY_BACK_SENSITIVITY));
- return new AlertDialog.Builder(getContext())
- .setTitle(R.string.back_sensitivity_dialog_title)
- .setMessage(R.string.back_sensitivity_dialog_message)
- .setView(view)
- .setPositiveButton(R.string.okay, (dialog, which) -> {
- int sensitivity = seekBar.getProgress();
- getArguments().putInt(KEY_BACK_SENSITIVITY, sensitivity);
- SystemNavigationGestureSettings.setBackSensitivity(getActivity(),
- getOverlayManager(), sensitivity);
- })
- .create();
- }
-
- private IOverlayManager getOverlayManager() {
- return IOverlayManager.Stub.asInterface(ServiceManager.getService(Context.OVERLAY_SERVICE));
- }
-}
\ No newline at end of file
diff --git a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
index 9e78388..728343e 100644
--- a/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
+++ b/src/com/android/settings/gestures/SystemNavigationGestureSettings.java
@@ -66,11 +66,6 @@
private static final String TAG = "SystemNavigationGesture";
@VisibleForTesting
- static final String SHARED_PREFERENCES_NAME = "system_navigation_settings_preferences";
- @VisibleForTesting
- static final String PREFS_BACK_SENSITIVITY_KEY = "system_navigation_back_sensitivity";
-
- @VisibleForTesting
static final String KEY_SYSTEM_NAV_3BUTTONS = "system_nav_3buttons";
@VisibleForTesting
static final String KEY_SYSTEM_NAV_2BUTTONS = "system_nav_2buttons";
@@ -80,25 +75,6 @@
public static final String PREF_KEY_SUGGESTION_COMPLETE =
"pref_system_navigation_suggestion_complete";
- @VisibleForTesting
- static final String NAV_BAR_MODE_GESTURAL_OVERLAY_NARROW_BACK
- = "com.android.internal.systemui.navbar.gestural_narrow_back";
- @VisibleForTesting
- static final String NAV_BAR_MODE_GESTURAL_OVERLAY_WIDE_BACK
- = "com.android.internal.systemui.navbar.gestural_wide_back";
- @VisibleForTesting
- static final String NAV_BAR_MODE_GESTURAL_OVERLAY_EXTRA_WIDE_BACK
- = "com.android.internal.systemui.navbar.gestural_extra_wide_back";
- @VisibleForTesting
- static final String[] BACK_GESTURE_INSET_OVERLAYS = {
- NAV_BAR_MODE_GESTURAL_OVERLAY_NARROW_BACK,
- NAV_BAR_MODE_GESTURAL_OVERLAY,
- NAV_BAR_MODE_GESTURAL_OVERLAY_WIDE_BACK,
- NAV_BAR_MODE_GESTURAL_OVERLAY_EXTRA_WIDE_BACK
- };
- @VisibleForTesting
- static int BACK_GESTURE_INSET_DEFAULT_OVERLAY = 1;
-
private IOverlayManager mOverlayManager;
private VideoPreference mVideoPreference;
@@ -122,6 +98,8 @@
mVideoPreference.setHeight( /* Illustration height in dp */
getResources().getDimension(R.dimen.system_navigation_illustration_height)
/ getResources().getDisplayMetrics().density);
+
+ migrateOverlaySensitivityToSettings(context, mOverlayManager);
}
@Override
@@ -164,8 +142,8 @@
RadioButtonPreferenceWithExtraWidget p = (RadioButtonPreferenceWithExtraWidget) pref;
if (info.getKey() == KEY_SYSTEM_NAV_GESTURAL) {
p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_SETTING);
- p.setExtraWidgetOnClickListener((v) -> GestureNavigationBackSensitivityDialog
- .show(this, getBackSensitivity(getContext(), mOverlayManager)));
+ p.setExtraWidgetOnClickListener((v) -> startActivity(new Intent(
+ GestureNavigationSettingsFragment.GESTURE_NAVIGATION_SETTINGS)));
} else {
p.setExtraWidgetVisibility(EXTRA_WIDGET_VISIBILITY_GONE);
}
@@ -213,8 +191,7 @@
@Override
protected boolean setDefaultKey(String key) {
- final Context c = getContext();
- setCurrentSystemNavigationMode(c, mOverlayManager, key);
+ setCurrentSystemNavigationMode(mOverlayManager, key);
setIllustrationVideo(mVideoPreference, key);
if (TextUtils.equals(KEY_SYSTEM_NAV_GESTURAL, key) && (
isAnyServiceSupportAccessibilityButton() || isNavBarMagnificationEnabled())) {
@@ -225,38 +202,28 @@
return true;
}
- @VisibleForTesting
- static void setBackSensitivity(Context context, IOverlayManager overlayManager,
- int sensitivity) {
- if (sensitivity < 0 || sensitivity >= BACK_GESTURE_INSET_OVERLAYS.length) {
- throw new IllegalArgumentException("Sensitivity out of range.");
+ static void migrateOverlaySensitivityToSettings(Context context,
+ IOverlayManager overlayManager) {
+ if (!SystemNavigationPreferenceController.isGestureNavigationEnabled(context)) {
+ return;
}
- // Store the sensitivity level, to be able to restore when user returns to Gesture Nav mode
- context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE).edit()
- .putInt(PREFS_BACK_SENSITIVITY_KEY, sensitivity).apply();
- if (getCurrentSystemNavigationMode(context) == KEY_SYSTEM_NAV_GESTURAL) {
- setNavBarInteractionMode(overlayManager, BACK_GESTURE_INSET_OVERLAYS[sensitivity]);
+ OverlayInfo info = null;
+ try {
+ info = overlayManager.getOverlayInfo(NAV_BAR_MODE_GESTURAL_OVERLAY, USER_CURRENT);
+ } catch (RemoteException e) { /* Do nothing */ }
+ if (info != null && !info.isEnabled()) {
+ // Enable the default gesture nav overlay. Back sensitivity for left and right are
+ // stored as separate settings values, and other gesture nav overlays are deprecated.
+ setCurrentSystemNavigationMode(overlayManager, KEY_SYSTEM_NAV_GESTURAL);
+ Settings.Secure.putFloat(context.getContentResolver(),
+ Settings.Secure.BACK_GESTURE_INSET_SCALE_LEFT, 1.0f);
+ Settings.Secure.putFloat(context.getContentResolver(),
+ Settings.Secure.BACK_GESTURE_INSET_SCALE_RIGHT, 1.0f);
}
}
@VisibleForTesting
- static int getBackSensitivity(Context context, IOverlayManager overlayManager) {
- for (int i = 0; i < BACK_GESTURE_INSET_OVERLAYS.length; i++) {
- OverlayInfo info = null;
- try {
- info = overlayManager.getOverlayInfo(BACK_GESTURE_INSET_OVERLAYS[i], USER_CURRENT);
- } catch (RemoteException e) { /* Do nothing */ }
- if (info != null && info.isEnabled()) {
- return i;
- }
- }
- // If Gesture nav is not selected, read the value from shared preferences.
- return context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
- .getInt(PREFS_BACK_SENSITIVITY_KEY, BACK_GESTURE_INSET_DEFAULT_OVERLAY);
- }
-
- @VisibleForTesting
static String getCurrentSystemNavigationMode(Context context) {
if (SystemNavigationPreferenceController.isGestureNavigationEnabled(context)) {
return KEY_SYSTEM_NAV_GESTURAL;
@@ -268,24 +235,20 @@
}
@VisibleForTesting
- static void setCurrentSystemNavigationMode(Context context, IOverlayManager overlayManager,
- String key) {
+ static void setCurrentSystemNavigationMode(IOverlayManager overlayManager, String key) {
+ String overlayPackage = NAV_BAR_MODE_GESTURAL_OVERLAY;
switch (key) {
case KEY_SYSTEM_NAV_GESTURAL:
- int sensitivity = getBackSensitivity(context, overlayManager);
- setNavBarInteractionMode(overlayManager, BACK_GESTURE_INSET_OVERLAYS[sensitivity]);
+ overlayPackage = NAV_BAR_MODE_GESTURAL_OVERLAY;
break;
case KEY_SYSTEM_NAV_2BUTTONS:
- setNavBarInteractionMode(overlayManager, NAV_BAR_MODE_2BUTTON_OVERLAY);
+ overlayPackage = NAV_BAR_MODE_2BUTTON_OVERLAY;
break;
case KEY_SYSTEM_NAV_3BUTTONS:
- setNavBarInteractionMode(overlayManager, NAV_BAR_MODE_3BUTTON_OVERLAY);
+ overlayPackage = NAV_BAR_MODE_3BUTTON_OVERLAY;
break;
}
- }
- private static void setNavBarInteractionMode(IOverlayManager overlayManager,
- String overlayPackage) {
try {
overlayManager.setEnabledExclusiveInCategory(overlayPackage, USER_CURRENT);
} catch (RemoteException e) {
diff --git a/src/com/android/settings/homepage/contextualcards/slices/ContextualAdaptiveSleepSlice.java b/src/com/android/settings/homepage/contextualcards/slices/ContextualAdaptiveSleepSlice.java
index c94469a..b9cc202 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/ContextualAdaptiveSleepSlice.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/ContextualAdaptiveSleepSlice.java
@@ -81,7 +81,8 @@
if (isSettingsAvailable() && !isUserInteracted() && !isRecentlySetup() && !isTurnedOn()) {
final IconCompat icon = IconCompat.createWithResource(mContext,
R.drawable.ic_settings_adaptive_sleep);
- final CharSequence title = mContext.getText(R.string.adaptive_sleep_title);
+ final CharSequence title =
+ mContext.getText(R.string.adaptive_sleep_contextual_slice_title);
final CharSequence subtitle = mContext.getText(
R.string.adaptive_sleep_contextual_slice_summary);
diff --git a/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java b/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
index 5ac407d..2716e4c 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/NotificationChannelSlice.java
@@ -467,7 +467,7 @@
return true;
}
- return channel.isBlockableSystem()
+ return channel.isBlockable()
|| channel.getImportance() == IMPORTANCE_NONE;
}
diff --git a/src/com/android/settings/localepicker/LocaleDragAndDropAdapter.java b/src/com/android/settings/localepicker/LocaleDragAndDropAdapter.java
index a06c77e..ab9110d 100644
--- a/src/com/android/settings/localepicker/LocaleDragAndDropAdapter.java
+++ b/src/com/android/settings/localepicker/LocaleDragAndDropAdapter.java
@@ -251,6 +251,10 @@
return result;
}
+ boolean isFirstLocaleChecked() {
+ return mFeedItemList != null && mFeedItemList.get(0).getChecked();
+ }
+
void addLocale(LocaleStore.LocaleInfo li) {
mFeedItemList.add(li);
notifyItemInserted(mFeedItemList.size() - 1);
diff --git a/src/com/android/settings/localepicker/LocaleListEditor.java b/src/com/android/settings/localepicker/LocaleListEditor.java
index 0666e0b..3165d09 100644
--- a/src/com/android/settings/localepicker/LocaleListEditor.java
+++ b/src/com/android/settings/localepicker/LocaleListEditor.java
@@ -34,6 +34,7 @@
import android.view.ViewGroup;
import android.widget.TextView;
+import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.RecyclerView;
@@ -184,7 +185,8 @@
// Shows no warning if there is no locale checked, shows a warning
// about removing all the locales if all of them are checked, and
// a "regular" warning otherwise.
- private void showRemoveLocaleWarningDialog() {
+ @VisibleForTesting
+ void showRemoveLocaleWarningDialog() {
int checkedCount = mAdapter.getCheckedCount();
// Nothing checked, just exit remove mode without a warning dialog
@@ -218,33 +220,41 @@
final String title = getResources().getQuantityString(R.plurals.dlg_remove_locales_title,
checkedCount);
mShowingRemoveDialog = true;
- new AlertDialog.Builder(getActivity())
- .setTitle(title)
- .setMessage(R.string.dlg_remove_locales_message)
+
+ final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ if (mAdapter.isFirstLocaleChecked()) {
+ builder.setMessage(R.string.dlg_remove_locales_message);
+ }
+
+ builder.setTitle(title)
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setRemoveMode(false);
}
})
- .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- // This is a sensitive area to change.
- // removeChecked() triggers a system update and "kills" the frame.
- // This means that saveState + restoreState are called before
- // setRemoveMode is called.
- // So we want that mRemoveMode and dialog status have the right values
- // before that save.
- // We can't just call setRemoveMode(false) before calling removeCheched
- // because that unchecks all items and removeChecked would have nothing
- // to remove.
- mRemoveMode = false;
- mShowingRemoveDialog = false;
- mAdapter.removeChecked();
- setRemoveMode(false);
- }
- })
+ .setPositiveButton(R.string.locale_remove_menu,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ // This is a sensitive area to change.
+ // removeChecked() triggers a system update and "kills" the frame.
+ // This means that saveState + restoreState are called before
+ // setRemoveMode is called.
+ // So we want that mRemoveMode and dialog status have the right
+ // values
+ // before that save.
+ // We can't just call setRemoveMode(false) before calling
+ // removeCheched
+ // because that unchecks all items and removeChecked would have
+ // nothing
+ // to remove.
+ mRemoveMode = false;
+ mShowingRemoveDialog = false;
+ mAdapter.removeChecked();
+ setRemoveMode(false);
+ }
+ })
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
diff --git a/src/com/android/settings/media/MediaDeviceUpdateWorker.java b/src/com/android/settings/media/MediaDeviceUpdateWorker.java
index 7557fd9..281d23e 100644
--- a/src/com/android/settings/media/MediaDeviceUpdateWorker.java
+++ b/src/com/android/settings/media/MediaDeviceUpdateWorker.java
@@ -112,6 +112,11 @@
notifySliceChange();
}
+ @Override
+ public void onRequestFailed(int reason) {
+ notifySliceChange();
+ }
+
public Collection<MediaDevice> getMediaDevices() {
return mMediaDevices;
}
@@ -119,6 +124,9 @@
public void connectDevice(MediaDevice device) {
ThreadUtils.postOnBackgroundThread(() -> {
mLocalMediaManager.connectDevice(device);
+ ThreadUtils.postOnMainThread(() -> {
+ notifySliceChange();
+ });
});
}
diff --git a/src/com/android/settings/media/MediaOutputSlice.java b/src/com/android/settings/media/MediaOutputSlice.java
index 318a50d..785d1df 100644
--- a/src/com/android/settings/media/MediaOutputSlice.java
+++ b/src/com/android/settings/media/MediaOutputSlice.java
@@ -42,6 +42,7 @@
import com.android.settings.slices.CustomSliceable;
import com.android.settings.slices.SliceBackgroundWorker;
import com.android.settings.slices.SliceBroadcastReceiver;
+import com.android.settingslib.media.LocalMediaManager;
import com.android.settingslib.media.MediaDevice;
import com.android.settingslib.media.MediaOutputSliceConstants;
@@ -246,6 +247,15 @@
rowBuilder.setTitle(deviceName);
rowBuilder.setPrimaryAction(SliceAction.create(broadcastAction, deviceIcon,
ListBuilder.ICON_IMAGE, deviceName));
+ switch (device.getState()) {
+ case LocalMediaManager.MediaDeviceState.STATE_CONNECTING:
+ rowBuilder.setSubtitle(mContext.getText(R.string.media_output_switching));
+ break;
+ case LocalMediaManager.MediaDeviceState.STATE_CONNECTING_FAILED:
+ rowBuilder.setSubtitle(mContext.getText(
+ R.string.media_output_switch_error_text));
+ break;
+ }
}
return rowBuilder;
diff --git a/src/com/android/settings/network/ims/ImsQueryController.java b/src/com/android/settings/network/ims/ImsQueryController.java
index 8fdad40..068a805 100644
--- a/src/com/android/settings/network/ims/ImsQueryController.java
+++ b/src/com/android/settings/network/ims/ImsQueryController.java
@@ -20,6 +20,7 @@
import android.telephony.SubscriptionManager;
import android.telephony.ims.ImsException;
import android.telephony.ims.ImsMmTelManager;
+import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;
@@ -84,4 +85,20 @@
boolean isProvisionedOnDevice(int subId) {
return (new ImsQueryProvisioningStat(subId, mCapability, mTech)).query();
}
+
+ @VisibleForTesting
+ boolean isServiceStateReady(int subId) throws InterruptedException, ImsException,
+ IllegalArgumentException {
+ if (!SubscriptionManager.isValidSubscriptionId(subId)) {
+ return false;
+ }
+
+ final ImsMmTelManager imsMmTelManager = ImsMmTelManager.createForSubscriptionId(subId);
+ // TODO: have a shared thread pool instead of create ExecutorService
+ // everytime to improve performance.
+ final ExecutorService executor = Executors.newSingleThreadExecutor();
+ final IntegerConsumer intResult = new IntegerConsumer();
+ imsMmTelManager.getFeatureState(executor, intResult);
+ return (intResult.get(TIMEOUT_MILLIS) == ImsFeature.STATE_READY);
+ }
}
diff --git a/src/com/android/settings/network/ims/IntegerConsumer.java b/src/com/android/settings/network/ims/IntegerConsumer.java
new file mode 100644
index 0000000..02c8227
--- /dev/null
+++ b/src/com/android/settings/network/ims/IntegerConsumer.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2020 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.network.ims;
+
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
+
+class IntegerConsumer extends Semaphore implements Consumer<Integer> {
+
+ private static final String TAG = "IntegerConsumer";
+
+ IntegerConsumer() {
+ super(0);
+ mValue = new AtomicInteger();
+ }
+
+ private volatile AtomicInteger mValue;
+
+ /**
+ * Get boolean value reported from callback
+ *
+ * @param timeout callback waiting time in milliseconds
+ * @return int value reported
+ * @throws InterruptedException when thread get interrupted
+ */
+ int get(long timeout) throws InterruptedException {
+ tryAcquire(timeout, TimeUnit.MILLISECONDS);
+ return mValue.get();
+ }
+
+ /**
+ * Implementation of {@link Consumer#accept(Integer)}
+ *
+ * @param value int reported from {@link Consumer#accept(Integer)}
+ */
+ public void accept(Integer value) {
+ if (value != null) {
+ mValue.set(value.intValue());
+ }
+ release();
+ }
+}
diff --git a/src/com/android/settings/network/ims/VtQueryImsState.java b/src/com/android/settings/network/ims/VtQueryImsState.java
index 60bd729..c077603 100644
--- a/src/com/android/settings/network/ims/VtQueryImsState.java
+++ b/src/com/android/settings/network/ims/VtQueryImsState.java
@@ -20,20 +20,23 @@
import android.telecom.TelecomManager;
import android.telephony.AccessNetworkConstants;
import android.telephony.SubscriptionManager;
+import android.telephony.ims.ImsException;
import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;
+import android.util.Log;
import androidx.annotation.VisibleForTesting;
import com.android.ims.ImsManager;
import com.android.settings.network.SubscriptionUtil;
-import com.android.settings.network.telephony.MobileNetworkUtils;
/**
* Controller class for querying VT status
*/
public class VtQueryImsState extends ImsQueryController {
+ private static final String LOG_TAG = "VtQueryImsState";
+
private Context mContext;
private int mSubId;
@@ -71,14 +74,25 @@
* @return true when Video Call can be performed, otherwise false
*/
public boolean isReadyToVideoCall() {
+ if (!isProvisionedOnDevice(mSubId)) {
+ return false;
+ }
+
final ImsManager imsManager = getImsManager(mSubId);
if (imsManager == null) {
return false;
}
- return imsManager.isVtEnabledByPlatform()
- && isProvisionedOnDevice(mSubId)
- && MobileNetworkUtils.isImsServiceStateReady(imsManager);
+ if (!imsManager.isVtEnabledByPlatform()) {
+ return false;
+ }
+
+ try {
+ return isServiceStateReady(mSubId);
+ } catch (InterruptedException | IllegalArgumentException | ImsException exception) {
+ Log.w(LOG_TAG, "fail to get Vt service status. subId=" + mSubId, exception);
+ }
+ return false;
}
/**
diff --git a/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java b/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java
index f3fdcc9..21d49d9 100644
--- a/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java
+++ b/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceController.java
@@ -42,7 +42,7 @@
implements LifecycleObserver {
private static final String TAG = "ContactDiscoveryPref";
private static final Uri UCE_URI = Uri.withAppendedPath(Telephony.SimInfo.CONTENT_URI,
- Telephony.SimInfo.IMS_RCS_UCE_ENABLED);
+ Telephony.SimInfo.COLUMN_IMS_RCS_UCE_ENABLED);
private ImsManager mImsManager;
private CarrierConfigManager mCarrierConfigManager;
diff --git a/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java b/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
index d633b39..c0df851 100644
--- a/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
+++ b/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
@@ -28,10 +28,8 @@
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
-import android.text.TextUtils;
import android.util.Log;
-import androidx.annotation.VisibleForTesting;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
@@ -43,6 +41,7 @@
import com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
@@ -53,19 +52,14 @@
ListPreference.OnPreferenceChangeListener, LifecycleObserver {
private static final String LOG_TAG = "EnabledNetworkMode";
- private CarrierConfigManager mCarrierConfigManager;
private ContentObserver mPreferredNetworkModeObserver;
- private TelephonyManager mTelephonyManager;
- private boolean mIsGlobalCdma;
- @VisibleForTesting
- boolean mShow4GForLTE;
private Preference mPreference;
- @VisibleForTesting
- boolean mDisplay5gList = false;
+ private TelephonyManager mTelephonyManager;
+ private CarrierConfigManager mCarrierConfigManager;
+ private PreferenceEntriesBuilder mBuilder;
public EnabledNetworkModePreferenceController(Context context, String key) {
super(context, key);
- mCarrierConfigManager = context.getSystemService(CarrierConfigManager.class);
mPreferredNetworkModeObserver = new ContentObserver(new Handler(Looper.getMainLooper())) {
@Override
public void onChange(boolean selfChange) {
@@ -101,7 +95,8 @@
@OnLifecycleEvent(ON_START)
public void onStart() {
mContext.getContentResolver().registerContentObserver(
- Settings.Global.getUriFor(Settings.Global.PREFERRED_NETWORK_MODE + mSubId), true,
+ Settings.Global.getUriFor(Settings.Global.PREFERRED_NETWORK_MODE + mSubId),
+ true,
mPreferredNetworkModeObserver);
}
@@ -120,444 +115,539 @@
public void updateState(Preference preference) {
super.updateState(preference);
final ListPreference listPreference = (ListPreference) preference;
- final int networkMode = getPreferredNetworkMode();
- Log.d(LOG_TAG, "updateState networkMode: " + networkMode);
- updatePreferenceEntries(listPreference);
- updatePreferenceValueAndSummary(listPreference, networkMode);
+ mBuilder.setPreferenceEntries();
+ mBuilder.setPreferenceValueAndSummary();
+
+ listPreference.setEntries(mBuilder.getEntries());
+ listPreference.setEntryValues(mBuilder.getEntryValues());
+ listPreference.setValue(Integer.toString(mBuilder.getSelectedEntryValue()));
+ listPreference.setSummary(mBuilder.getSummary());
}
@Override
public boolean onPreferenceChange(Preference preference, Object object) {
final int newPreferredNetworkMode = Integer.parseInt((String) object);
+ final ListPreference listPreference = (ListPreference) preference;
if (mTelephonyManager.setPreferredNetworkTypeBitmask(
MobileNetworkUtils.getRafFromNetworkType(newPreferredNetworkMode))) {
- updatePreferenceValueAndSummary((ListPreference) preference, newPreferredNetworkMode);
+ mBuilder.setPreferenceValueAndSummary(newPreferredNetworkMode);
+ listPreference.setValue(Integer.toString(mBuilder.getSelectedEntryValue()));
+ listPreference.setSummary(mBuilder.getSummary());
return true;
}
-
return false;
}
public void init(Lifecycle lifecycle, int subId) {
mSubId = subId;
- final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
.createForSubscriptionId(mSubId);
+ mCarrierConfigManager = mContext.getSystemService(CarrierConfigManager.class);
+ mBuilder = new PreferenceEntriesBuilder(mContext, mSubId);
- mIsGlobalCdma = mTelephonyManager.isLteCdmaEvdoGsmWcdmaEnabled()
- && carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_CDMA_CHOICES_BOOL);
- mShow4GForLTE = carrierConfig != null
- ? carrierConfig.getBoolean(
- CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL)
- : false;
-
- final long supportedRadioBitmask = mTelephonyManager.getSupportedRadioAccessFamily();
- final boolean is5gEnabledByCarrier = (mTelephonyManager.getAllowedNetworkTypes()
- & TelephonyManager.NETWORK_TYPE_BITMASK_NR) > 0;
- mDisplay5gList = checkSupportedRadioBitmask(
- supportedRadioBitmask, mTelephonyManager.NETWORK_TYPE_BITMASK_NR)
- && is5gEnabledByCarrier;
lifecycle.addObserver(this);
}
- private int getPreferredNetworkMode() {
- long preferredNetworkBitMask = MobileNetworkUtils.getRafFromNetworkType(
- Settings.Global.getInt(mContext.getContentResolver(),
- Settings.Global.PREFERRED_NETWORK_MODE + mSubId,
- TelephonyManager.DEFAULT_PREFERRED_NETWORK_MODE));
- return MobileNetworkUtils.getNetworkTypeFromRaf((int)
- (preferredNetworkBitMask & mTelephonyManager.getAllowedNetworkTypes()));
- }
+ private final static class PreferenceEntriesBuilder {
+ private CarrierConfigManager mCarrierConfigManager;
+ private Context mContext;
+ private TelephonyManager mTelephonyManager;
- private void updatePreferenceEntries(ListPreference preference) {
- final int phoneType = mTelephonyManager.getPhoneType();
- final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);
- if (phoneType == TelephonyManager.PHONE_TYPE_CDMA) {
- final int lteForced = android.provider.Settings.Global.getInt(
- mContext.getContentResolver(),
- android.provider.Settings.Global.LTE_SERVICE_FORCED + mSubId,
- 0);
- final int settingsNetworkMode = getPreferredNetworkMode();
- if (mTelephonyManager.isLteCdmaEvdoGsmWcdmaEnabled()) {
- if (lteForced == 0) {
- preference.setEntries(
- R.array.enabled_networks_cdma_choices);
- preference.setEntryValues(
- R.array.enabled_networks_cdma_values);
- } else {
- switch (settingsNetworkMode) {
- case TelephonyManagerConstants.NETWORK_MODE_CDMA_EVDO:
- case TelephonyManagerConstants.NETWORK_MODE_CDMA_NO_EVDO:
- case TelephonyManagerConstants.NETWORK_MODE_EVDO_NO_CDMA:
- preference.setEntries(
- R.array.enabled_networks_cdma_no_lte_choices);
- preference.setEntryValues(
- R.array.enabled_networks_cdma_no_lte_values);
- break;
- case TelephonyManagerConstants.NETWORK_MODE_GLOBAL:
- case TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO:
- case TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA:
- case TelephonyManagerConstants.NETWORK_MODE_LTE_ONLY:
- preference.setEntries(
- R.array.enabled_networks_cdma_only_lte_choices);
- preference.setEntryValues(
- R.array.enabled_networks_cdma_only_lte_values);
- break;
- default:
- preference.setEntries(
- R.array.enabled_networks_cdma_choices);
- preference.setEntryValues(
- R.array.enabled_networks_cdma_values);
- break;
- }
- }
- }
- } else if (phoneType == TelephonyManager.PHONE_TYPE_GSM) {
- if (MobileNetworkUtils.isTdscdmaSupported(mContext, mSubId)) {
- preference.setEntries(
- R.array.enabled_networks_tdscdma_choices);
- preference.setEntryValues(
- R.array.enabled_networks_tdscdma_values);
- } else if (carrierConfig != null
- && !carrierConfig.getBoolean(CarrierConfigManager.KEY_PREFER_2G_BOOL)
- && !carrierConfig.getBoolean(CarrierConfigManager.KEY_LTE_ENABLED_BOOL)) {
- preference.setEntries(R.array.enabled_networks_except_gsm_lte_choices);
- preference.setEntryValues(R.array.enabled_networks_except_gsm_lte_values);
- } else if (carrierConfig != null
- && !carrierConfig.getBoolean(CarrierConfigManager.KEY_PREFER_2G_BOOL)) {
- int select = mShow4GForLTE
- ? R.array.enabled_networks_except_gsm_4g_choices
- : R.array.enabled_networks_except_gsm_choices;
- preference.setEntries(select);
- preference.setEntryValues(
- R.array.enabled_networks_except_gsm_values);
- } else if (carrierConfig != null
- && !carrierConfig.getBoolean(CarrierConfigManager.KEY_LTE_ENABLED_BOOL)) {
- preference.setEntries(
- R.array.enabled_networks_except_lte_choices);
- preference.setEntryValues(
- R.array.enabled_networks_except_lte_values);
- } else if (mIsGlobalCdma) {
- preference.setEntries(R.array.enabled_networks_cdma_choices);
- preference.setEntryValues(R.array.enabled_networks_cdma_values);
- } else {
- int select = mShow4GForLTE ? R.array.enabled_networks_4g_choices
- : R.array.enabled_networks_choices;
- preference.setEntries(select);
- preference.setEntryValues(R.array.enabled_networks_values);
- }
- }
- //TODO(b/117881708): figure out what world mode is, then we can optimize code. Otherwise
- // I prefer to keep this old code
- if (MobileNetworkUtils.isWorldMode(mContext, mSubId)) {
- preference.setEntries(
- R.array.preferred_network_mode_choices_world_mode);
- preference.setEntryValues(
- R.array.preferred_network_mode_values_world_mode);
+ private boolean mAllowed5gNetworkType;
+ private boolean mIsGlobalCdma;
+ private boolean mIs5gEntryDisplayed;
+ private boolean mShow4gForLTE;
+ private boolean mSupported5gRadioAccessFamily;
+ private int mSelectedEntry;
+ private int mSubId;
+ private String mSummary;
+
+ private List<String> mEntries = new ArrayList<>();
+ private List<Integer> mEntriesValue = new ArrayList<>();
+
+ enum EnabledNetworks {
+ ENABLED_NETWORKS_UNKNOWN,
+ ENABLED_NETWORKS_CDMA_CHOICES,
+ ENABLED_NETWORKS_CDMA_NO_LTE_CHOICES,
+ ENABLED_NETWORKS_CDMA_ONLY_LTE_CHOICES,
+ ENABLED_NETWORKS_TDSCDMA_CHOICES,
+ ENABLED_NETWORKS_EXCEPT_GSM_LTE_CHOICES,
+ ENABLED_NETWORKS_EXCEPT_GSM_4G_CHOICES,
+ ENABLED_NETWORKS_EXCEPT_GSM_CHOICES,
+ ENABLED_NETWORKS_EXCEPT_LTE_CHOICES,
+ ENABLED_NETWORKS_4G_CHOICES,
+ ENABLED_NETWORKS_CHOICES,
+ PREFERRED_NETWORK_MODE_CHOICES_WORLD_MODE
}
- if (mDisplay5gList) {
- add5gListItem(preference);
- }
- }
+ PreferenceEntriesBuilder(Context context, int subId) {
+ this.mContext = context;
+ this.mSubId = subId;
- @VisibleForTesting
- boolean checkSupportedRadioBitmask(long supportedRadioBitmask, long targetBitmask) {
- Log.d(LOG_TAG, "supportedRadioBitmask: " + supportedRadioBitmask);
- if ((targetBitmask & supportedRadioBitmask) > 0) {
- return true;
- }
- return false;
- }
+ mCarrierConfigManager = mContext.getSystemService(CarrierConfigManager.class);
+ mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
+ .createForSubscriptionId(mSubId);
- /***
- * Generate preferred network choices list for 5G
- *
- * @string/enabled_networks_cdma_choices
- * Before | After
- * @string/network_lte , 8 |@string/network_5G + @string/network_recommended , 25
- * @string/network_3G , 4 |@string/network_lte_pure, 8
- * @string/network_1x , 5 |@string/network_3G , 4
- * @string/network_global, 10|@string/network_1x , 5
- * |@string/network_global , 27
- *
- * @string/enabled_networks_cdma_only_lte_choices
- * Before | After
- * @string/network_lte , 8 |@string/network_5G + @string/network_recommended , 25
- * @string/network_global, 10|@string/network_lte_pure, 8
- * |@string/network_global , 27
- *
- * @string/enabled_networks_tdscdma_choices
- * Before | After
- * @string/network_lte, 22|@string/network_5G + @string/network_recommended , 33
- * @string/network_3G , 18|@string/network_lte_pure, 22
- * @string/network_2G , 1 |@string/network_3G , 18
- * |@string/network_2G , 1
- *
- * @string/enabled_networks_except_gsm_4g_choices
- * Before | After
- * @string/network_4G , 9 |@string/network_5G + @string/network_recommended , 26
- * @string/network_3G , 0 |@string/network_4G_pure , 9
- * |@string/network_3G , 0
- *
- * @string/enabled_networks_except_gsm_choices
- * Before | After
- * @string/network_lte, 9 |@string/network_5G + @string/network_recommended , 26
- * @string/network_3G , 0 |@string/network_lte_pure, 9
- * |@string/network_3G , 0
- *
- * @string/enabled_networks_4g_choices
- * Before | After
- * @string/network_4G , 9 |@string/network_5G + @string/network_recommended , 26
- * @string/network_3G , 0 |@string/network_4G_pure , 9
- * @string/network_2G , 1 |@string/network_3G , 0
- * |@string/network_2G , 1
- *
- * @string/enabled_networks_choices
- * Before | After
- * @string/network_lte, 9 |@string/network_5G + @string/network_recommended , 26
- * @string/network_3G , 0 |@string/network_lte_pure, 9
- * @string/network_2G , 1 |@string/network_3G , 0
- * |@string/network_2G , 1
- *
- * @string/preferred_network_mode_choices_world_mode
- * Before | After
- * "Global" , 10|@string/network_global , 27
- * "LTE / CDMA" , 8 |"LTE / CDMA" , 8
- * "LTE / GSM / UMTS" , 9 |"LTE / GSM / UMTS" , 9
- */
- @VisibleForTesting
- void add5gListItem(ListPreference preference) {
- final CharSequence[] oldEntries = preference.getEntries();
- final CharSequence[] oldEntryValues = preference.getEntryValues();
- List<CharSequence> newEntries = new ArrayList<>();
- List<CharSequence> newEntryValues = new ArrayList<>();
-
- CharSequence oldEntry;
- CharSequence oldEntryValue;
- CharSequence new5gEntry;
- CharSequence new5gEntryValue;
-
- for (int i = 0; i < oldEntries.length; i++) {
- oldEntry = oldEntries[i];
- oldEntryValue = oldEntryValues[i];
- new5gEntry = "";
- new5gEntryValue = "";
-
- if (mContext.getString(R.string.network_lte).equals(oldEntry)) {
- oldEntry = mContext.getString(R.string.network_lte_pure);
- new5gEntry = mContext.getString(R.string.network_5G)
- + mContext.getString(R.string.network_recommended);
- new5gEntryValue = transformLteEntryValueTo5gEntryValue(oldEntryValue);
- } else if (mContext.getString(R.string.network_4G).equals(oldEntry)) {
- oldEntry = mContext.getString(R.string.network_4G_pure);
- new5gEntry = mContext.getString(R.string.network_5G)
- + mContext.getString(R.string.network_recommended);
- new5gEntryValue = transformLteEntryValueTo5gEntryValue(oldEntryValue);
- } else if (mContext.getString(R.string.network_global).equals(oldEntry)) {
- //oldEntry: network_global
- //oldEntryValue: TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA
- oldEntryValue = Integer.toString(
- TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
- }
-
- if (!TextUtils.isEmpty(new5gEntry)) {
- newEntries.add(new5gEntry);
- newEntryValues.add(new5gEntryValue);
- }
- newEntries.add(oldEntry);
- newEntryValues.add(oldEntryValue);
+ final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);
+ mAllowed5gNetworkType = checkSupportedRadioBitmask(
+ mTelephonyManager.getAllowedNetworkTypes(),
+ TelephonyManager.NETWORK_TYPE_BITMASK_NR);
+ mSupported5gRadioAccessFamily = checkSupportedRadioBitmask(
+ mTelephonyManager.getSupportedRadioAccessFamily(),
+ TelephonyManager.NETWORK_TYPE_BITMASK_NR);
+ mIsGlobalCdma = mTelephonyManager.isLteCdmaEvdoGsmWcdmaEnabled()
+ && carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_CDMA_CHOICES_BOOL);
+ mShow4gForLTE = carrierConfig != null && carrierConfig.getBoolean(
+ CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL);
}
- preference.setEntries(newEntries.toArray(new CharSequence[newEntries.size()]));
- preference.setEntryValues(newEntryValues.toArray(new CharSequence[newEntryValues.size()]));
- }
-
- /**
- * transform LTE network mode to 5G network mode.
- *
- * @param networkMode an LTE network mode without 5G.
- * @return the corresponding network mode with 5G.
- */
- private CharSequence transformLteEntryValueTo5gEntryValue(CharSequence networkMode) {
- int networkModeInt = Integer.valueOf(networkMode.toString());
- return Integer.toString(addNrToLteNetworkType(networkModeInt));
- }
- private int addNrToLteNetworkType(int networkType) {
- switch(networkType) {
- case TelephonyManagerConstants.NETWORK_MODE_LTE_ONLY:
- return TelephonyManagerConstants.NETWORK_MODE_NR_LTE;
- case TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO:
- return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO;
- case TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA:
- return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_GSM_WCDMA;
- case TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA:
- return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA;
- case TelephonyManagerConstants.NETWORK_MODE_LTE_WCDMA:
- return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_WCDMA;
- case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA:
- return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA;
- case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_GSM:
- return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM;
- case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_WCDMA:
- return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA;
- case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA:
- return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA;
- case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
- return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA;
- default:
- return networkType; // not LTE
- }
- }
-
- /**
- * Sets the display string for the network mode choice and selects the corresponding item
- *
- * @param preference ListPreference for selecting the preferred network mode.
- * @param networkMode the current network mode. The current mode might not be an option in the
- * choice list. The nearest choice is selected instead
- */
- private void updatePreferenceValueAndSummary(ListPreference preference, int networkMode) {
- preference.setValue(Integer.toString(networkMode));
- switch (networkMode) {
- case TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_WCDMA:
- case TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA:
- case TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_GSM:
- preference.setValue(
- Integer.toString(TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA));
- preference.setSummary(R.string.network_3G);
- break;
- case TelephonyManagerConstants.NETWORK_MODE_WCDMA_ONLY:
- case TelephonyManagerConstants.NETWORK_MODE_GSM_UMTS:
- case TelephonyManagerConstants.NETWORK_MODE_WCDMA_PREF:
- if (!mIsGlobalCdma) {
- preference.setValue(Integer.toString(TelephonyManagerConstants.NETWORK_MODE_WCDMA_PREF));
- preference.setSummary(R.string.network_3G);
- } else {
- preference.setValue(Integer.toString(TelephonyManagerConstants
- .NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA));
- preference.setSummary(R.string.network_global);
- }
- break;
- case TelephonyManagerConstants.NETWORK_MODE_GSM_ONLY:
- if (!mIsGlobalCdma) {
- preference.setValue(
- Integer.toString(TelephonyManagerConstants.NETWORK_MODE_GSM_ONLY));
- preference.setSummary(R.string.network_2G);
- } else {
- preference.setValue(
- Integer.toString(TelephonyManagerConstants
- .NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA));
- preference.setSummary(R.string.network_global);
- }
- break;
- case TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA:
- if (MobileNetworkUtils.isWorldMode(mContext, mSubId)) {
- preference.setSummary(
- R.string.preferred_network_mode_lte_gsm_umts_summary);
+ void setPreferenceEntries() {
+ switch (getEnabledNetworkType()) {
+ case ENABLED_NETWORKS_CDMA_CHOICES:
+ add5gEntry(addNrToLteNetworkType(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO));
+ addLteEntry(TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO);
+ add3gEntry(TelephonyManagerConstants.NETWORK_MODE_CDMA_EVDO);
+ add1xEntry(TelephonyManagerConstants.NETWORK_MODE_CDMA_NO_EVDO);
+ addGlobalEntry();
break;
- }
- case TelephonyManagerConstants.NETWORK_MODE_LTE_ONLY:
- case TelephonyManagerConstants.NETWORK_MODE_LTE_WCDMA:
- if (!mIsGlobalCdma) {
- preference.setValue(
- Integer.toString(TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA));
- preference.setSummary(
- mShow4GForLTE ? R.string.network_4G : R.string.network_lte);
- } else {
- preference.setValue(
- Integer.toString(TelephonyManagerConstants
- .NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA));
- preference.setSummary(R.string.network_global);
- }
- break;
- case TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO:
- if (MobileNetworkUtils.isWorldMode(mContext, mSubId)) {
- preference.setSummary(
- R.string.preferred_network_mode_lte_cdma_summary);
- } else {
- preference.setValue(
- Integer.toString(TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO));
- preference.setSummary(
- mDisplay5gList ? R.string.network_lte_pure : R.string.network_lte);
- }
- break;
- case TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
- preference.setValue(Integer.toString(TelephonyManagerConstants
- .NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA));
- preference.setSummary(R.string.network_3G);
- break;
- case TelephonyManagerConstants.NETWORK_MODE_CDMA_EVDO:
- case TelephonyManagerConstants.NETWORK_MODE_EVDO_NO_CDMA:
- case TelephonyManagerConstants.NETWORK_MODE_GLOBAL:
- preference.setValue(
- Integer.toString(TelephonyManagerConstants.NETWORK_MODE_CDMA_EVDO));
- preference.setSummary(R.string.network_3G);
- break;
- case TelephonyManagerConstants.NETWORK_MODE_CDMA_NO_EVDO:
- preference.setValue(
- Integer.toString(TelephonyManagerConstants.NETWORK_MODE_CDMA_NO_EVDO));
- preference.setSummary(R.string.network_1x);
- break;
- case TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_ONLY:
- preference.setValue(
- Integer.toString(TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_ONLY));
- preference.setSummary(R.string.network_3G);
- break;
- case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_GSM:
- case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA:
- case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA:
- case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_WCDMA:
- case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
- case TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA:
- if (MobileNetworkUtils.isTdscdmaSupported(mContext, mSubId)) {
- preference.setValue(
- Integer.toString(TelephonyManagerConstants
- .NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA));
- preference.setSummary(
- mDisplay5gList ? R.string.network_lte_pure : R.string.network_lte);
- } else {
- preference.setValue(
- Integer.toString(TelephonyManagerConstants
- .NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA));
- if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA
- || mIsGlobalCdma
- || MobileNetworkUtils.isWorldMode(mContext, mSubId)) {
- preference.setSummary(R.string.network_global);
+ case ENABLED_NETWORKS_CDMA_NO_LTE_CHOICES:
+ add3gEntry(TelephonyManagerConstants.NETWORK_MODE_CDMA_EVDO);
+ add1xEntry(TelephonyManagerConstants.NETWORK_MODE_CDMA_NO_EVDO);
+ break;
+ case ENABLED_NETWORKS_CDMA_ONLY_LTE_CHOICES:
+ addLteEntry(TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO);
+ addGlobalEntry();
+ break;
+ case ENABLED_NETWORKS_TDSCDMA_CHOICES:
+ add5gEntry(addNrToLteNetworkType(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA));
+ addLteEntry(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA);
+ add3gEntry(TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA);
+ add2gEntry(TelephonyManagerConstants.NETWORK_MODE_GSM_ONLY);
+ break;
+ case ENABLED_NETWORKS_EXCEPT_GSM_LTE_CHOICES:
+ add3gEntry(TelephonyManagerConstants.NETWORK_MODE_WCDMA_PREF);
+ break;
+ case ENABLED_NETWORKS_EXCEPT_GSM_4G_CHOICES:
+ add5gEntry(addNrToLteNetworkType(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA));
+ add4gEntry(TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA);
+ add3gEntry(TelephonyManagerConstants.NETWORK_MODE_WCDMA_PREF);
+ break;
+ case ENABLED_NETWORKS_EXCEPT_GSM_CHOICES:
+ add5gEntry(addNrToLteNetworkType(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA));
+ addLteEntry(TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA);
+ add3gEntry(TelephonyManagerConstants.NETWORK_MODE_WCDMA_PREF);
+ break;
+ case ENABLED_NETWORKS_EXCEPT_LTE_CHOICES:
+ add3gEntry(TelephonyManagerConstants.NETWORK_MODE_WCDMA_PREF);
+ add2gEntry(TelephonyManagerConstants.NETWORK_MODE_GSM_ONLY);
+ break;
+ case ENABLED_NETWORKS_4G_CHOICES:
+ add5gEntry(addNrToLteNetworkType(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA));
+ add4gEntry(TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA);
+ add3gEntry(TelephonyManagerConstants.NETWORK_MODE_WCDMA_PREF);
+ add2gEntry(TelephonyManagerConstants.NETWORK_MODE_GSM_ONLY);
+ break;
+ case ENABLED_NETWORKS_CHOICES:
+ add5gEntry(addNrToLteNetworkType(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA));
+ addLteEntry(TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA);
+ add3gEntry(TelephonyManagerConstants.NETWORK_MODE_WCDMA_PREF);
+ add2gEntry(TelephonyManagerConstants.NETWORK_MODE_GSM_ONLY);
+ break;
+ case PREFERRED_NETWORK_MODE_CHOICES_WORLD_MODE:
+ addGlobalEntry();
+ addCustomEntry(mContext.getString(R.string.network_world_mode_cdma_lte),
+ TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO);
+ addCustomEntry(mContext.getString(R.string.network_world_mode_gsm_lte),
+ TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA);
+ break;
+ default:
+ throw new IllegalArgumentException("Not supported enabled network types.");
+ }
+ }
+
+ private int getPreferredNetworkMode() {
+ return Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.PREFERRED_NETWORK_MODE + mSubId,
+ TelephonyManager.DEFAULT_PREFERRED_NETWORK_MODE);
+ }
+
+ private EnabledNetworks getEnabledNetworkType() {
+ EnabledNetworks enabledNetworkType = EnabledNetworks.ENABLED_NETWORKS_UNKNOWN;
+ final int phoneType = mTelephonyManager.getPhoneType();
+ final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);
+
+ if (phoneType == TelephonyManager.PHONE_TYPE_CDMA) {
+ final int lteForced = android.provider.Settings.Global.getInt(
+ mContext.getContentResolver(),
+ android.provider.Settings.Global.LTE_SERVICE_FORCED + mSubId,
+ 0);
+ final int settingsNetworkMode = getPreferredNetworkMode();
+ if (mTelephonyManager.isLteCdmaEvdoGsmWcdmaEnabled()) {
+ if (lteForced == 0) {
+ enabledNetworkType = EnabledNetworks.ENABLED_NETWORKS_CDMA_CHOICES;
} else {
- if (mDisplay5gList) {
- preference.setSummary(mShow4GForLTE
- ? R.string.network_4G_pure : R.string.network_lte_pure);
- } else {
- preference.setSummary(mShow4GForLTE
- ? R.string.network_4G : R.string.network_lte);
+ switch (settingsNetworkMode) {
+ case TelephonyManagerConstants.NETWORK_MODE_CDMA_EVDO:
+ case TelephonyManagerConstants.NETWORK_MODE_CDMA_NO_EVDO:
+ case TelephonyManagerConstants.NETWORK_MODE_EVDO_NO_CDMA:
+ enabledNetworkType =
+ EnabledNetworks.ENABLED_NETWORKS_CDMA_NO_LTE_CHOICES;
+ break;
+ case TelephonyManagerConstants.NETWORK_MODE_GLOBAL:
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO:
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA:
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_ONLY:
+ enabledNetworkType =
+ EnabledNetworks.ENABLED_NETWORKS_CDMA_ONLY_LTE_CHOICES;
+ break;
+ default:
+ enabledNetworkType = EnabledNetworks.ENABLED_NETWORKS_CDMA_CHOICES;
+ break;
}
}
}
- break;
- case TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO:
- case TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
- preference.setValue(Integer.toString(networkMode));
- preference.setSummary(mContext.getString(R.string.network_5G)
- + mContext.getString(R.string.network_recommended));
- break;
- case TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA:
- preference.setValue(
- Integer.toString(TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA));
- if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA
- || mIsGlobalCdma
- || MobileNetworkUtils.isWorldMode(mContext, mSubId)) {
- preference.setSummary(R.string.network_global);
+ } else if (phoneType == TelephonyManager.PHONE_TYPE_GSM) {
+ if (MobileNetworkUtils.isTdscdmaSupported(mContext, mSubId)) {
+ enabledNetworkType = EnabledNetworks.ENABLED_NETWORKS_TDSCDMA_CHOICES;
+ } else if (carrierConfig != null
+ && !carrierConfig.getBoolean(CarrierConfigManager.KEY_PREFER_2G_BOOL)
+ && !carrierConfig.getBoolean(CarrierConfigManager.KEY_LTE_ENABLED_BOOL)) {
+ enabledNetworkType = EnabledNetworks.ENABLED_NETWORKS_EXCEPT_GSM_LTE_CHOICES;
+ } else if (carrierConfig != null
+ && !carrierConfig.getBoolean(CarrierConfigManager.KEY_PREFER_2G_BOOL)) {
+ enabledNetworkType = mShow4gForLTE
+ ? EnabledNetworks.ENABLED_NETWORKS_EXCEPT_GSM_4G_CHOICES
+ : EnabledNetworks.ENABLED_NETWORKS_EXCEPT_GSM_CHOICES;
+ } else if (carrierConfig != null
+ && !carrierConfig.getBoolean(CarrierConfigManager.KEY_LTE_ENABLED_BOOL)) {
+ enabledNetworkType = EnabledNetworks.ENABLED_NETWORKS_EXCEPT_LTE_CHOICES;
+ } else if (mIsGlobalCdma) {
+ enabledNetworkType = EnabledNetworks.ENABLED_NETWORKS_CDMA_CHOICES;
} else {
- preference.setSummary(mContext.getString(R.string.network_5G)
- + mContext.getString(R.string.network_recommended));
+ enabledNetworkType = mShow4gForLTE ? EnabledNetworks.ENABLED_NETWORKS_4G_CHOICES
+ : EnabledNetworks.ENABLED_NETWORKS_CHOICES;
}
- break;
- default:
- preference.setSummary(
- mContext.getString(R.string.mobile_network_mode_error, networkMode));
+ }
+ //TODO(b/117881708): figure out what world mode is, then we can optimize code. Otherwise
+ // I prefer to keep this old code
+ if (MobileNetworkUtils.isWorldMode(mContext, mSubId)) {
+ enabledNetworkType = EnabledNetworks.PREFERRED_NETWORK_MODE_CHOICES_WORLD_MODE;
+ }
+
+ Log.d(LOG_TAG, "enabledNetworkType: " + enabledNetworkType);
+ return enabledNetworkType;
}
+
+ /**
+ * Sets the display string for the network mode choice and selects the corresponding item
+ *
+ * @param networkMode the current network mode. The current mode might not be an option in
+ * the choice list. The nearest choice is selected instead
+ */
+ void setPreferenceValueAndSummary(int networkMode) {
+ setSelectedEntry(networkMode);
+ switch (networkMode) {
+ case TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_WCDMA:
+ case TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA:
+ case TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_GSM:
+ setSelectedEntry(
+ TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA);
+ setSummary(R.string.network_3G);
+ break;
+ case TelephonyManagerConstants.NETWORK_MODE_WCDMA_ONLY:
+ case TelephonyManagerConstants.NETWORK_MODE_GSM_UMTS:
+ case TelephonyManagerConstants.NETWORK_MODE_WCDMA_PREF:
+ if (!mIsGlobalCdma) {
+ setSelectedEntry(TelephonyManagerConstants.NETWORK_MODE_WCDMA_PREF);
+ setSummary(R.string.network_3G);
+ } else {
+ setSelectedEntry(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA);
+ setSummary(R.string.network_global);
+ }
+ break;
+ case TelephonyManagerConstants.NETWORK_MODE_GSM_ONLY:
+ if (!mIsGlobalCdma) {
+ setSelectedEntry(TelephonyManagerConstants.NETWORK_MODE_GSM_ONLY);
+ setSummary(R.string.network_2G);
+ } else {
+ setSelectedEntry(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA);
+ setSummary(R.string.network_global);
+ }
+ break;
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA:
+ if (MobileNetworkUtils.isWorldMode(mContext, mSubId)) {
+ setSummary(
+ R.string.preferred_network_mode_lte_gsm_umts_summary);
+ break;
+ }
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_ONLY:
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_WCDMA:
+ if (!mIsGlobalCdma) {
+ setSelectedEntry(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA);
+ setSummary(
+ mShow4gForLTE ? R.string.network_4G : R.string.network_lte);
+ } else {
+ setSelectedEntry(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA);
+ setSummary(R.string.network_global);
+ }
+ break;
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO:
+ if (MobileNetworkUtils.isWorldMode(mContext, mSubId)) {
+ setSummary(
+ R.string.preferred_network_mode_lte_cdma_summary);
+ } else {
+ setSelectedEntry(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO);
+ setSummary(is5gEntryDisplayed()
+ ? R.string.network_lte_pure : R.string.network_lte);
+ }
+ break;
+ case TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
+ setSelectedEntry(
+ TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA);
+ setSummary(R.string.network_3G);
+ break;
+ case TelephonyManagerConstants.NETWORK_MODE_CDMA_EVDO:
+ case TelephonyManagerConstants.NETWORK_MODE_EVDO_NO_CDMA:
+ case TelephonyManagerConstants.NETWORK_MODE_GLOBAL:
+ setSelectedEntry(TelephonyManagerConstants.NETWORK_MODE_CDMA_EVDO);
+ setSummary(R.string.network_3G);
+ break;
+ case TelephonyManagerConstants.NETWORK_MODE_CDMA_NO_EVDO:
+ setSelectedEntry(TelephonyManagerConstants.NETWORK_MODE_CDMA_NO_EVDO);
+ setSummary(R.string.network_1x);
+ break;
+ case TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_ONLY:
+ setSelectedEntry(TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_ONLY);
+ setSummary(R.string.network_3G);
+ break;
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_GSM:
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA:
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA:
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_WCDMA:
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA:
+ if (MobileNetworkUtils.isTdscdmaSupported(mContext, mSubId)) {
+ setSelectedEntry(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA);
+ setSummary(is5gEntryDisplayed()
+ ? R.string.network_lte_pure : R.string.network_lte);
+ } else {
+ setSelectedEntry(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA);
+ if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA
+ || mIsGlobalCdma
+ || MobileNetworkUtils.isWorldMode(mContext, mSubId)) {
+ setSummary(R.string.network_global);
+ } else {
+ if (is5gEntryDisplayed()) {
+ setSummary(mShow4gForLTE
+ ? R.string.network_4G_pure : R.string.network_lte_pure);
+ } else {
+ setSummary(mShow4gForLTE
+ ? R.string.network_4G : R.string.network_lte);
+ }
+ }
+ }
+ break;
+ case TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO:
+ case TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
+ setSelectedEntry(networkMode);
+ setSummary(mContext.getString(R.string.network_5G)
+ + mContext.getString(R.string.network_recommended));
+ break;
+ case TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA:
+ setSelectedEntry(
+ TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
+ if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA
+ || mIsGlobalCdma
+ || MobileNetworkUtils.isWorldMode(mContext, mSubId)) {
+ setSummary(R.string.network_global);
+ } else {
+ setSummary(mContext.getString(R.string.network_5G)
+ + mContext.getString(R.string.network_recommended));
+ }
+ break;
+ default:
+ setSummary(
+ mContext.getString(R.string.mobile_network_mode_error, networkMode));
+ }
+ }
+
+ /**
+ * Transform LTE network mode to 5G network mode.
+ *
+ * @param networkType an LTE network mode without 5G.
+ * @return the corresponding network mode with 5G.
+ */
+ private static int addNrToLteNetworkType(int networkType) {
+ switch(networkType) {
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_ONLY:
+ return TelephonyManagerConstants.NETWORK_MODE_NR_LTE;
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO:
+ return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO;
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA:
+ return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_GSM_WCDMA;
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA:
+ return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA;
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_WCDMA:
+ return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_WCDMA;
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA:
+ return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA;
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_GSM:
+ return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM;
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_WCDMA:
+ return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA;
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA:
+ return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA;
+ case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
+ return TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA;
+ default:
+ return networkType; // not LTE
+ }
+ }
+
+ private void setPreferenceValueAndSummary() {
+ setPreferenceValueAndSummary(getPreferredNetworkMode());
+ }
+
+ private boolean checkSupportedRadioBitmask(long supportedRadioBitmask, long targetBitmask) {
+ return (targetBitmask & supportedRadioBitmask) > 0;
+ }
+
+ /**
+ * Add 5G option. Only show the UI when device supported 5G and allowed 5G.
+ */
+ private void add5gEntry(int value) {
+ boolean isNRValue = value >= TelephonyManagerConstants.NETWORK_MODE_NR_ONLY;
+ if (mSupported5gRadioAccessFamily && mAllowed5gNetworkType && isNRValue) {
+ mEntries.add(mContext.getString(R.string.network_5G)
+ + mContext.getString(R.string.network_recommended));
+ mEntriesValue.add(value);
+ mIs5gEntryDisplayed = true;
+ } else {
+ Log.d(LOG_TAG, "Hide 5G option. "
+ + " supported5GRadioAccessFamily: " + mSupported5gRadioAccessFamily
+ + " allowed5GNetworkType: " + mAllowed5gNetworkType
+ + " isNRValue: " + isNRValue);
+ }
+ }
+
+ private void addGlobalEntry() {
+ Log.d(LOG_TAG, "addGlobalEntry. "
+ + " supported5GRadioAccessFamily: " + mSupported5gRadioAccessFamily
+ + " allowed5GNetworkType: " + mAllowed5gNetworkType);
+ mEntries.add(mContext.getString(R.string.network_global));
+ if (mSupported5gRadioAccessFamily & mAllowed5gNetworkType) {
+ mEntriesValue.add(
+ TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
+ } else {
+ mEntriesValue.add(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA);
+ }
+ }
+
+ /**
+ * Add LTE entry. If device supported 5G, show "LTE" instead of "LTE (recommended)".
+ */
+ private void addLteEntry(int value) {
+ if (mSupported5gRadioAccessFamily) {
+ mEntries.add(mContext.getString(R.string.network_lte_pure));
+ } else {
+ mEntries.add(mContext.getString(R.string.network_lte));
+ }
+ mEntriesValue.add(value);
+ }
+
+ /**
+ * Add 4G entry. If device supported 5G, show "4G" instead of "4G (recommended)".
+ */
+ private void add4gEntry(int value) {
+ if (mSupported5gRadioAccessFamily) {
+ mEntries.add(mContext.getString(R.string.network_4G_pure));
+ } else {
+ mEntries.add(mContext.getString(R.string.network_4G));
+ }
+ mEntriesValue.add(value);
+ }
+
+ private void add3gEntry(int value) {
+ mEntries.add(mContext.getString(R.string.network_3G));
+ mEntriesValue.add(value);
+ }
+
+ private void add2gEntry(int value) {
+ mEntries.add(mContext.getString(R.string.network_2G));
+ mEntriesValue.add(value);
+ }
+
+ private void add1xEntry(int value) {
+ mEntries.add(mContext.getString(R.string.network_1x));
+ mEntriesValue.add(value);
+ }
+
+ private void addCustomEntry(String name, int value) {
+ mEntries.add(name);
+ mEntriesValue.add(value);
+ }
+
+ private String[] getEntries() {
+ return mEntries.toArray(new String[0]);
+ }
+
+ private String[] getEntryValues() {
+ Integer intArr[] = mEntriesValue.toArray(new Integer[0]);
+ return Arrays.stream(intArr)
+ .map(String::valueOf)
+ .toArray(String[]::new);
+ }
+
+ private int getSelectedEntryValue() {
+ return mSelectedEntry;
+ }
+
+ private void setSelectedEntry(int value) {
+ boolean isInEntriesValue = mEntriesValue.stream()
+ .anyMatch(v -> v == value);
+
+ if (isInEntriesValue) {
+ mSelectedEntry = value;
+ } else if (mEntriesValue.size() > 0) {
+ // if the value isn't in entriesValue, select on the first one.
+ mSelectedEntry = mEntriesValue.get(0);
+ } else {
+ Log.e(LOG_TAG, "entriesValue is empty");
+ }
+ }
+
+ private String getSummary() {
+ return mSummary;
+ }
+
+ private void setSummary(int summaryResId) {
+ setSummary(mContext.getString(summaryResId));
+ }
+
+ private void setSummary(String summary) {
+ this.mSummary = summary;
+ }
+
+ private boolean is5gEntryDisplayed() {
+ return mIs5gEntryDisplayed;
+ }
+
}
}
diff --git a/src/com/android/settings/network/telephony/MobileNetworkUtils.java b/src/com/android/settings/network/telephony/MobileNetworkUtils.java
index b505c2f..076a87b 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkUtils.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkUtils.java
@@ -26,6 +26,10 @@
import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.RAF_TD_SCDMA;
import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.RAF_UNKNOWN;
import static com.android.settings.network.telephony.TelephonyConstants.RadioAccessFamily.WCDMA;
+import static com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA;
+import static com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO;
+import static com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO;
+import static com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants.NETWORK_MODE_NR_LTE_GSM_WCDMA;
import android.content.ContentResolver;
import android.content.Context;
@@ -379,8 +383,10 @@
context.getContentResolver(),
android.provider.Settings.Global.PREFERRED_NETWORK_MODE + subId,
TelephonyManager.DEFAULT_PREFERRED_NETWORK_MODE);
- if (settingsNetworkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA
- || settingsNetworkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO) {
+ if (settingsNetworkMode == NETWORK_MODE_LTE_GSM_WCDMA
+ || settingsNetworkMode == NETWORK_MODE_LTE_CDMA_EVDO
+ || settingsNetworkMode == NETWORK_MODE_NR_LTE_GSM_WCDMA
+ || settingsNetworkMode == NETWORK_MODE_NR_LTE_CDMA_EVDO) {
return true;
}
@@ -407,8 +413,10 @@
android.provider.Settings.Global.PREFERRED_NETWORK_MODE + subId,
TelephonyManager.DEFAULT_PREFERRED_NETWORK_MODE);
if (isWorldMode(context, subId)) {
- if (networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO
- || networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA) {
+ if (networkMode == NETWORK_MODE_LTE_CDMA_EVDO
+ || networkMode == NETWORK_MODE_LTE_GSM_WCDMA
+ || networkMode == NETWORK_MODE_NR_LTE_CDMA_EVDO
+ || networkMode == NETWORK_MODE_NR_LTE_GSM_WCDMA) {
return true;
} else if (shouldSpeciallyUpdateGsmCdma(context, subId)) {
return true;
diff --git a/src/com/android/settings/network/telephony/cdma/CdmaSystemSelectPreferenceController.java b/src/com/android/settings/network/telephony/cdma/CdmaSystemSelectPreferenceController.java
index e90a240..023f89e 100644
--- a/src/com/android/settings/network/telephony/cdma/CdmaSystemSelectPreferenceController.java
+++ b/src/com/android/settings/network/telephony/cdma/CdmaSystemSelectPreferenceController.java
@@ -16,6 +16,9 @@
package com.android.settings.network.telephony.cdma;
+import static com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA;
+import static com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants.NETWORK_MODE_NR_LTE_GSM_WCDMA;
+
import android.content.Context;
import android.provider.Settings;
import android.telephony.TelephonyManager;
@@ -53,8 +56,9 @@
mContext.getContentResolver(),
Settings.Global.PREFERRED_NETWORK_MODE + mSubId,
TelephonyManager.DEFAULT_PREFERRED_NETWORK_MODE);
- listPreference.setEnabled(
- settingsNetworkMode != TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA);
+ final boolean enableList = settingsNetworkMode != NETWORK_MODE_LTE_GSM_WCDMA
+ && settingsNetworkMode != NETWORK_MODE_NR_LTE_GSM_WCDMA;
+ listPreference.setEnabled(enableList);
}
@Override
diff --git a/src/com/android/settings/notification/app/ImportantConversationBubblePreferenceController.java b/src/com/android/settings/notification/app/ImportantConversationBubblePreferenceController.java
deleted file mode 100644
index f6f14aa..0000000
--- a/src/com/android/settings/notification/app/ImportantConversationBubblePreferenceController.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2020 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.notification.app;
-
-import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
-import static android.provider.Settings.Secure.BUBBLE_IMPORTANT_CONVERSATIONS;
-
-import android.content.Context;
-import android.provider.Settings;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
-
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settings.core.TogglePreferenceController;
-
-public class ImportantConversationBubblePreferenceController extends TogglePreferenceController
- implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
-
- private static final String TAG = "ImpConvBubPrefContr";
- @VisibleForTesting
- static final int ON = 1;
- @VisibleForTesting
- static final int OFF = 0;
-
-
- public ImportantConversationBubblePreferenceController(Context context, String preferenceKey) {
- super(context, preferenceKey);
- }
-
- private boolean isGloballyEnabled() {
- return Settings.Global.getInt(mContext.getContentResolver(),
- NOTIFICATION_BUBBLES, OFF) == ON;
- }
-
- @Override
- public int getAvailabilityStatus() {
- return isGloballyEnabled() ? AVAILABLE : DISABLED_DEPENDENT_SETTING;
- }
-
- @Override
- public boolean isSliceable() {
- return false;
- }
-
- @Override
- public boolean isChecked() {
- return Settings.Secure.getInt(mContext.getContentResolver(),
- BUBBLE_IMPORTANT_CONVERSATIONS, ON) == ON;
- }
-
- @Override
- public boolean setChecked(boolean isChecked) {
- return Settings.Secure.putInt(mContext.getContentResolver(),
- BUBBLE_IMPORTANT_CONVERSATIONS, isChecked ? ON : OFF);
- }
-}
diff --git a/src/com/android/settings/notification/app/NotificationPreferenceController.java b/src/com/android/settings/notification/app/NotificationPreferenceController.java
index be1ce1b..ecba95b 100644
--- a/src/com/android/settings/notification/app/NotificationPreferenceController.java
+++ b/src/com/android/settings/notification/app/NotificationPreferenceController.java
@@ -134,7 +134,7 @@
return channel.getImportance() == IMPORTANCE_NONE;
}
- return channel.isBlockableSystem() || !mAppRow.systemApp
+ return channel.isBlockable() || !mAppRow.systemApp
|| channel.getImportance() == IMPORTANCE_NONE;
}
return false;
diff --git a/src/com/android/settings/panel/MediaOutputGroupPanel.java b/src/com/android/settings/panel/MediaOutputGroupPanel.java
index 4a37c52..d98c0b1 100644
--- a/src/com/android/settings/panel/MediaOutputGroupPanel.java
+++ b/src/com/android/settings/panel/MediaOutputGroupPanel.java
@@ -148,7 +148,7 @@
@Override
public void onDeviceListUpdate(List<MediaDevice> devices) {
if (mCallback != null) {
- mCallback.onGroupChanged();
+ mCallback.onHeaderChanged();
}
}
diff --git a/src/com/android/settings/panel/MediaOutputPanel.java b/src/com/android/settings/panel/MediaOutputPanel.java
index 1145c42..998cfc8 100644
--- a/src/com/android/settings/panel/MediaOutputPanel.java
+++ b/src/com/android/settings/panel/MediaOutputPanel.java
@@ -33,6 +33,7 @@
import android.media.MediaMetadata;
import android.media.session.MediaController;
import android.media.session.MediaSessionManager;
+import android.media.session.PlaybackState;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
@@ -66,12 +67,11 @@
private final Context mContext;
private final String mPackageName;
- private PanelContentCallback mCallback;
- private boolean mIsCustomizedButtonUsed = true;
-
@VisibleForTesting
LocalMediaManager mLocalMediaManager;
+ private PanelContentCallback mCallback;
+ private boolean mIsCustomizedButtonUsed = true;
private MediaSessionManager mMediaSessionManager;
private MediaController mMediaController;
@@ -82,20 +82,6 @@
private MediaOutputPanel(Context context, String packageName) {
mContext = context.getApplicationContext();
mPackageName = TextUtils.isEmpty(packageName) ? "" : packageName;
-
- if (!TextUtils.isEmpty(mPackageName)) {
- mMediaSessionManager = mContext.getSystemService(MediaSessionManager.class);
- for (MediaController controller : mMediaSessionManager.getActiveSessions(null)) {
- if (TextUtils.equals(controller.getPackageName(), mPackageName)) {
- mMediaController = controller;
- break;
- }
- }
- }
-
- if (mMediaController == null) {
- Log.e(TAG, "Unable to find " + mPackageName + " media controller");
- }
}
@Override
@@ -228,6 +214,19 @@
@OnLifecycleEvent(ON_START)
public void onStart() {
+ if (!TextUtils.isEmpty(mPackageName)) {
+ mMediaSessionManager = mContext.getSystemService(MediaSessionManager.class);
+ for (MediaController controller : mMediaSessionManager.getActiveSessions(null)) {
+ if (TextUtils.equals(controller.getPackageName(), mPackageName)) {
+ mMediaController = controller;
+ mMediaController.registerCallback(mCb);
+ break;
+ }
+ }
+ }
+ if (mMediaController == null) {
+ Log.d(TAG, "No media controller for " + mPackageName);
+ }
if (mLocalMediaManager == null) {
mLocalMediaManager = new LocalMediaManager(mContext, mPackageName, null);
}
@@ -237,6 +236,9 @@
@OnLifecycleEvent(ON_STOP)
public void onStop() {
+ if (mMediaController != null) {
+ mMediaController.unregisterCallback(mCb);
+ }
mLocalMediaManager.unregisterCallback(this);
mLocalMediaManager.stopScan();
}
@@ -245,4 +247,20 @@
public int getViewType() {
return PanelContent.VIEW_TYPE_SLIDER;
}
+
+ private final MediaController.Callback mCb = new MediaController.Callback() {
+ @Override
+ public void onMetadataChanged(MediaMetadata metadata) {
+ if (mCallback != null) {
+ mCallback.onHeaderChanged();
+ }
+ }
+
+ @Override
+ public void onPlaybackStateChanged(PlaybackState state) {
+ if (mCallback != null && state.getState() != PlaybackState.STATE_PLAYING) {
+ mCallback.forceClose();
+ }
+ }
+ };
}
diff --git a/src/com/android/settings/panel/PanelContentCallback.java b/src/com/android/settings/panel/PanelContentCallback.java
index ce8ea22..63c2c55 100644
--- a/src/com/android/settings/panel/PanelContentCallback.java
+++ b/src/com/android/settings/panel/PanelContentCallback.java
@@ -28,8 +28,13 @@
void onCustomizedButtonStateChanged();
/**
- * It will be called when group content is changed. For example, to add/remove a device into
+ * It will be called when header content is changed. For example, to add/remove a device into
* a group
*/
- void onGroupChanged();
+ void onHeaderChanged();
+
+ /**
+ * It will be called when panel requests to close itself.
+ */
+ void forceClose();
}
diff --git a/src/com/android/settings/panel/PanelFragment.java b/src/com/android/settings/panel/PanelFragment.java
index 30cc2a8..28515fd 100644
--- a/src/com/android/settings/panel/PanelFragment.java
+++ b/src/com/android/settings/panel/PanelFragment.java
@@ -426,10 +426,23 @@
}
@Override
- public void onGroupChanged() {
+ public void onHeaderChanged() {
ThreadUtils.postOnMainThread(() -> {
+ mTitleIcon.setImageIcon(mPanel.getIcon().toIcon(getContext()));
+ mHeaderTitle.setText(mPanel.getTitle());
mHeaderSubtitle.setText(mPanel.getSubTitle());
});
}
+
+ @Override
+ public void forceClose() {
+ mPanelClosedKey = PanelClosedKeys.KEY_OTHERS;
+ getFragmentActivity().finish();
+ }
+
+ @VisibleForTesting
+ FragmentActivity getFragmentActivity() {
+ return getActivity();
+ }
}
}
diff --git a/src/com/android/settings/password/BiometricFragment.java b/src/com/android/settings/password/BiometricFragment.java
index bc0e5c7..7e78322 100644
--- a/src/com/android/settings/password/BiometricFragment.java
+++ b/src/com/android/settings/password/BiometricFragment.java
@@ -70,6 +70,13 @@
});
cleanup();
}
+
+ @Override
+ public void onAuthenticationFailed() {
+ mClientExecutor.execute(() -> {
+ mClientCallback.onAuthenticationFailed();
+ });
+ }
};
private final DialogInterface.OnClickListener mNegativeButtonListener =
diff --git a/src/com/android/settings/password/ChooseLockGeneric.java b/src/com/android/settings/password/ChooseLockGeneric.java
index 6809f35..755d158 100644
--- a/src/com/android/settings/password/ChooseLockGeneric.java
+++ b/src/com/android/settings/password/ChooseLockGeneric.java
@@ -42,6 +42,7 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.os.storage.StorageManager;
+import android.service.persistentdata.PersistentDataBlockManager;
import android.text.TextUtils;
import android.util.EventLog;
import android.util.Log;
@@ -281,7 +282,11 @@
}
protected boolean canRunBeforeDeviceProvisioned() {
- return false;
+ PersistentDataBlockManager pdbm = (PersistentDataBlockManager)
+ getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+
+ // Can only run during setup if factory reset protection has already been cleared
+ return (pdbm != null && pdbm.getDataBlockSize() == 0);
}
protected Class<? extends ChooseLockGeneric.InternalActivity> getInternalActivityClass() {
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
index 83368f9..220b649 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
@@ -111,6 +111,7 @@
});
private AuthenticationCallback mAuthenticationCallback = new AuthenticationCallback() {
+ @Override
public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
if (!mGoingToBackground) {
if (errorCode == BiometricPrompt.BIOMETRIC_ERROR_USER_CANCELED
@@ -123,17 +124,24 @@
}
}
+ @Override
public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
mTrustManager.setDeviceLockedForUser(mUserId, false);
-
+ final boolean isStrongAuth = result.getAuthenticationType()
+ == BiometricPrompt.AUTHENTICATION_RESULT_TYPE_DEVICE_CREDENTIAL;
ConfirmDeviceCredentialUtils.reportSuccessfulAttempt(mLockPatternUtils, mUserManager,
- mUserId);
+ mDevicePolicyManager, mUserId, isStrongAuth);
ConfirmDeviceCredentialUtils.checkForPendingIntent(
ConfirmDeviceCredentialActivity.this);
setResult(Activity.RESULT_OK);
finish();
}
+
+ @Override
+ public void onAuthenticationFailed() {
+ mDevicePolicyManager.reportFailedBiometricAttempt(mUserId);
+ }
};
private String getStringForError(int errorCode) {
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java b/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
index 11d6924..a5febeb 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
@@ -20,6 +20,7 @@
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.IActivityManager;
+import android.app.admin.DevicePolicyManager;
import android.content.Intent;
import android.content.IntentSender;
import android.os.RemoteException;
@@ -54,8 +55,12 @@
}
public static void reportSuccessfulAttempt(LockPatternUtils utils, UserManager userManager,
- int userId) {
- utils.reportSuccessfulPasswordAttempt(userId);
+ DevicePolicyManager dpm, int userId, boolean isStrongAuth) {
+ if (isStrongAuth) {
+ utils.reportSuccessfulPasswordAttempt(userId);
+ } else {
+ dpm.reportSuccessfulBiometricAttempt(userId);
+ }
if (userManager.isManagedProfile(userId)) {
// Keyguard is responsible to disable StrongAuth for primary user. Disable StrongAuth
// for work challenge only here.
diff --git a/src/com/android/settings/password/ConfirmLockPassword.java b/src/com/android/settings/password/ConfirmLockPassword.java
index ce8813f..260919d 100644
--- a/src/com/android/settings/password/ConfirmLockPassword.java
+++ b/src/com/android/settings/password/ConfirmLockPassword.java
@@ -475,7 +475,8 @@
if (matched) {
if (newResult) {
ConfirmDeviceCredentialUtils.reportSuccessfulAttempt(mLockPatternUtils,
- mUserManager, mEffectiveUserId);
+ mUserManager, mDevicePolicyManager, mEffectiveUserId,
+ /* isStrongAuth */ true);
}
startDisappearAnimation(intent);
ConfirmDeviceCredentialUtils.checkForPendingIntent(getActivity());
diff --git a/src/com/android/settings/password/ConfirmLockPattern.java b/src/com/android/settings/password/ConfirmLockPattern.java
index b2afb22..06f3d93 100644
--- a/src/com/android/settings/password/ConfirmLockPattern.java
+++ b/src/com/android/settings/password/ConfirmLockPattern.java
@@ -509,7 +509,8 @@
if (matched) {
if (newResult) {
ConfirmDeviceCredentialUtils.reportSuccessfulAttempt(mLockPatternUtils,
- mUserManager, mEffectiveUserId);
+ mUserManager, mDevicePolicyManager, mEffectiveUserId,
+ /* isStrongAuth */ true);
}
startDisappearAnimation(intent);
ConfirmDeviceCredentialUtils.checkForPendingIntent(getActivity());
diff --git a/src/com/android/settings/password/SetNewPasswordActivity.java b/src/com/android/settings/password/SetNewPasswordActivity.java
index 4bffbf5..19f2941 100644
--- a/src/com/android/settings/password/SetNewPasswordActivity.java
+++ b/src/com/android/settings/password/SetNewPasswordActivity.java
@@ -110,7 +110,7 @@
@Override
public void launchChooseLock(Bundle chooseLockFingerprintExtras) {
- final boolean isInSetupWizard = !WizardManagerHelper.isDeviceProvisioned(this);
+ final boolean isInSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
Intent intent = isInSetupWizard ? new Intent(this, SetupChooseLockGeneric.class)
: new Intent(this, ChooseLockGeneric.class);
intent.setAction(mNewPasswordAction);
diff --git a/src/com/android/settings/search/SettingsSearchIndexablesProvider.java b/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
index 237e58f..bb3c762 100644
--- a/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
+++ b/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
@@ -61,12 +61,14 @@
import androidx.annotation.Nullable;
import androidx.slice.SliceViewManager;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.dashboard.DashboardFeatureProvider;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.slices.SettingsSliceProvider;
import com.android.settingslib.drawer.ActivityTile;
+import com.android.settingslib.drawer.CategoryKey;
import com.android.settingslib.drawer.DashboardCategory;
import com.android.settingslib.drawer.Tile;
import com.android.settingslib.search.Indexable;
@@ -379,9 +381,7 @@
final String currentPackageName = context.getPackageName();
for (DashboardCategory category : dashboardFeatureProvider.getAllCategories()) {
for (Tile tile : category.getTiles()) {
- if (currentPackageName.equals(tile.getPackageName())
- && tile instanceof ActivityTile) {
- // Skip Settings injected items because they should be indexed in the sub-pages.
+ if (!isEligibleForIndexing(currentPackageName, tile)) {
continue;
}
final SearchIndexableRaw raw = new SearchIndexableRaw(context);
@@ -402,6 +402,20 @@
return rawList;
}
+ @VisibleForTesting
+ boolean isEligibleForIndexing(String packageName, Tile tile) {
+ if (TextUtils.equals(packageName, tile.getPackageName())
+ && tile instanceof ActivityTile) {
+ // Skip Settings injected items because they should be indexed in the sub-pages.
+ return false;
+ }
+ if (TextUtils.equals(tile.getCategory(), CategoryKey.CATEGORY_HOMEPAGE)) {
+ // Skip homepage injected items since we would like to index their target activity.
+ return false;
+ }
+ return true;
+ }
+
private static Object[] createIndexableRawColumnObjects(SearchIndexableRaw raw) {
final Object[] ref = new Object[INDEXABLES_RAW_COLUMNS.length];
ref[COLUMN_INDEX_RAW_TITLE] = raw.title;
diff --git a/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java b/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java
index 8d093c0..bf807a1 100644
--- a/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java
+++ b/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java
@@ -17,6 +17,7 @@
package com.android.settings.security;
import android.app.KeyguardManager;
+import android.app.settings.SettingsEnums;
import android.content.Context;
import android.provider.Settings;
@@ -26,19 +27,23 @@
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.network.telephony.MobileNetworkUtils;
+import com.android.settings.overlay.FeatureFactory;
import com.android.settings.wifi.dpp.WifiDppUtils;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
/** Enable/disable user confirmation before deleting an eSim */
public class ConfirmSimDeletionPreferenceController extends BasePreferenceController implements
Preference.OnPreferenceChangeListener{
public static final String KEY_CONFIRM_SIM_DELETION = "confirm_sim_deletion";
private boolean mConfirmationDefaultOn;
+ private MetricsFeatureProvider mMetricsFeatureProvider;
public ConfirmSimDeletionPreferenceController(Context context, String key) {
super(context, key);
mConfirmationDefaultOn =
context.getResources()
.getBoolean(R.bool.config_sim_deletion_confirmation_default_on);
+ mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
}
@Override
@@ -72,11 +77,15 @@
return false;
}
if (!isChecked()) {
+ mMetricsFeatureProvider.action(mContext,
+ SettingsEnums.ACTION_CONFIRM_SIM_DELETION_ON);
setChecked(true);
return true;
} else {
// prevent disabling the feature until authorized
WifiDppUtils.showLockScreen(mContext, () -> {
+ mMetricsFeatureProvider.action(mContext,
+ SettingsEnums.ACTION_CONFIRM_SIM_DELETION_OFF);
// set data
setChecked(false);
// set UI
diff --git a/src/com/android/settings/security/SimLockPreferenceController.java b/src/com/android/settings/security/SimLockPreferenceController.java
index ffc1d6b..03983b5 100644
--- a/src/com/android/settings/security/SimLockPreferenceController.java
+++ b/src/com/android/settings/security/SimLockPreferenceController.java
@@ -52,13 +52,19 @@
@Override
public int getAvailabilityStatus() {
- final PersistableBundle b = mCarrierConfigManager.getConfig();
- final boolean IsAdmin = mUserManager.isAdminUser();
- if (!IsAdmin || !isSimIccReady() ||
- b.getBoolean(CarrierConfigManager.KEY_HIDE_SIM_LOCK_SETTINGS_BOOL)) {
+ final List<SubscriptionInfo> subInfoList =
+ mSubscriptionManager.getActiveSubscriptionInfoList();
+
+ if (subInfoList == null) {
return DISABLED_FOR_USER;
}
- return AVAILABLE;
+
+ final boolean isAdmin = mUserManager.isAdminUser();
+ if (isAdmin && (!isHideSimLockSetting(subInfoList))) {
+ return AVAILABLE;
+ }
+
+ return DISABLED_FOR_USER;
}
@Override
@@ -78,34 +84,37 @@
private boolean isSimReady() {
final List<SubscriptionInfo> subInfoList =
mSubscriptionManager.getActiveSubscriptionInfoList();
- if (subInfoList != null) {
- for (SubscriptionInfo subInfo : subInfoList) {
- final int simState = mTelephonyManager.getSimState(subInfo.getSimSlotIndex());
- if ((simState != TelephonyManager.SIM_STATE_ABSENT) &&
- (simState != TelephonyManager.SIM_STATE_UNKNOWN)) {
- return true;
- }
+ if (subInfoList == null) {
+ return false;
+ }
+
+ for (SubscriptionInfo subInfo : subInfoList) {
+ final int simState = mTelephonyManager.getSimState(subInfo.getSimSlotIndex());
+ if ((simState != TelephonyManager.SIM_STATE_ABSENT)
+ && (simState != TelephonyManager.SIM_STATE_UNKNOWN)) {
+ return true;
}
}
return false;
}
- /**
- * Return true if a there is a Slot that has Icc
- */
- private boolean isSimIccReady() {
- final List<SubscriptionInfo> subInfoList =
- mSubscriptionManager.getActiveSubscriptionInfoList();
+ private boolean isHideSimLockSetting(List<SubscriptionInfo> subInfoList) {
+ if (subInfoList == null) {
+ return true;
+ }
- if (subInfoList != null) {
- for (SubscriptionInfo subInfo : subInfoList) {
- mTelephonyManager = mTelephonyManager
- .createForSubscriptionId(subInfo.getSimSlotIndex());
- if (mTelephonyManager.hasIccCard()) {
- return true;
- }
+ for (SubscriptionInfo subInfo : subInfoList) {
+ final TelephonyManager telephonyManager = mTelephonyManager
+ .createForSubscriptionId(subInfo.getSubscriptionId());
+ final PersistableBundle bundle = mCarrierConfigManager.getConfigForSubId(
+ subInfo.getSubscriptionId());
+ if (telephonyManager.hasIccCard() && bundle != null
+ && !bundle.getBoolean(CarrierConfigManager.KEY_HIDE_SIM_LOCK_SETTINGS_BOOL)) {
+ // one or more sims show sim lock setting UI.
+ return false;
}
}
- return false;
+
+ return true;
}
}
diff --git a/src/com/android/settings/widget/VideoPreference.java b/src/com/android/settings/widget/VideoPreference.java
index 6356378..fe91669 100644
--- a/src/com/android/settings/widget/VideoPreference.java
+++ b/src/com/android/settings/widget/VideoPreference.java
@@ -39,17 +39,12 @@
public class VideoPreference extends Preference {
private static final String TAG = "VideoPreference";
- private static final int DEFAULT_BACKGROUND_RESOURCE_ID = -1;
private final Context mContext;
@VisibleForTesting
AnimationController mAnimationController;
@VisibleForTesting
boolean mAnimationAvailable;
- @VisibleForTesting
- LinearLayout mAnimationView;
- @VisibleForTesting
- int mBackgroundResId = DEFAULT_BACKGROUND_RESOURCE_ID;
private float mAspectRatio = 1.0f;
private int mPreviewId;
@@ -120,7 +115,6 @@
mVideo = (TextureView) holder.findViewById(R.id.video_texture_view);
mPreviewImage = (ImageView) holder.findViewById(R.id.video_preview_image);
mPlayButton = (ImageView) holder.findViewById(R.id.video_play_button);
- mAnimationView = (LinearLayout) holder.itemView;
final AspectRatioFrameLayout layout = (AspectRatioFrameLayout) holder.findViewById(
R.id.video_container);
@@ -130,9 +124,6 @@
layout.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, mHeight));
}
- if (mBackgroundResId != DEFAULT_BACKGROUND_RESOURCE_ID) {
- mAnimationView.setBackgroundResource(mBackgroundResId);
- }
if (mAnimationController != null) {
mAnimationController.attachView(mVideo, mPreviewImage, mPlayButton);
}
@@ -213,14 +204,6 @@
}
/**
- * Set the background color of the video preference
- * @param resId resource id of color
- */
- public void setBackgroundColor(int resId) {
- mBackgroundResId = resId;
- }
-
- /**
* Handle animation operations.
*/
interface AnimationController {
diff --git a/src/com/android/settings/wifi/ConfigureWifiEntryFragment.java b/src/com/android/settings/wifi/ConfigureWifiEntryFragment.java
index a28f990..23971e7 100644
--- a/src/com/android/settings/wifi/ConfigureWifiEntryFragment.java
+++ b/src/com/android/settings/wifi/ConfigureWifiEntryFragment.java
@@ -71,7 +71,8 @@
private Button mSubmitBtn;
private Button mCancelBtn;
private WifiEntry mWifiEntry;
- private NetworkDetailsTracker mNetworkDetailsTracker;
+ @VisibleForTesting
+ NetworkDetailsTracker mNetworkDetailsTracker;
private HandlerThread mWorkerThread;
@Override
diff --git a/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java b/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java
index 27cf1e2..44114e5 100644
--- a/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java
+++ b/src/com/android/settings/wifi/UseOpenWifiPreferenceController.java
@@ -100,6 +100,10 @@
@Override
public int getAvailabilityStatus() {
+ // It is possible that mEnableUseWifiComponentName is no longer enabled by
+ // USE_OPEN_WIFI_PACKAGE. So update this component to reflect correct availability.
+ updateEnableUseWifiComponentName();
+ checkForFeatureSupportedScorers();
return mDoFeatureSupportedScorersExist ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
}
diff --git a/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceController.java b/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceController.java
index 03ea121..a4a51dc 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceController.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceController.java
@@ -18,18 +18,22 @@
import static com.android.settings.AllInOneTetherSettings.DEDUP_POSTFIX;
+import android.app.settings.SettingsEnums;
import android.content.Context;
import android.net.wifi.SoftApConfiguration;
import android.text.TextUtils;
import android.util.FeatureFlagUtils;
+import androidx.annotation.VisibleForTesting;
import androidx.preference.EditTextPreference;
import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settings.core.FeatureFlags;
+import com.android.settings.overlay.FeatureFactory;
import com.android.settings.widget.ValidatedEditTextPreference;
import com.android.settings.wifi.WifiUtils;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import java.util.UUID;
@@ -40,9 +44,19 @@
private String mPassword;
+ private final MetricsFeatureProvider mMetricsFeatureProvider;
+
+ @VisibleForTesting
+ WifiTetherPasswordPreferenceController(Context context, OnTetherConfigUpdateListener listener,
+ MetricsFeatureProvider provider) {
+ super(context, listener);
+ mMetricsFeatureProvider = provider;
+ }
+
public WifiTetherPasswordPreferenceController(Context context,
OnTetherConfigUpdateListener listener) {
super(context, listener);
+ mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
}
@Override
@@ -69,6 +83,10 @@
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
+ if (!TextUtils.equals(mPassword, (String) newValue)) {
+ mMetricsFeatureProvider.action(mContext,
+ SettingsEnums.ACTION_SETTINGS_CHANGE_WIFI_HOTSPOT_PASSWORD);
+ }
mPassword = (String) newValue;
updatePasswordDisplay((EditTextPreference) mPreference);
mListener.onTetherConfigUpdated(this);
diff --git a/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceController.java b/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceController.java
index a4289a6..9070d44 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceController.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceController.java
@@ -22,6 +22,7 @@
import android.content.Context;
import android.content.Intent;
import android.net.wifi.SoftApConfiguration;
+import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import android.util.Log;
@@ -48,6 +49,15 @@
private final MetricsFeatureProvider mMetricsFeatureProvider;
+ // This constructor is used for testing.
+ @VisibleForTesting
+ WifiTetherSSIDPreferenceController(Context context, OnTetherConfigUpdateListener listener,
+ MetricsFeatureProvider provider) {
+ super(context, listener);
+ mWifiDeviceNameTextValidator = new WifiDeviceNameTextValidator();
+ mMetricsFeatureProvider = provider;
+ }
+
public WifiTetherSSIDPreferenceController(Context context,
OnTetherConfigUpdateListener listener) {
super(context, listener);
@@ -93,6 +103,10 @@
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
+ if (!TextUtils.equals(mSSID, (String) newValue)) {
+ mMetricsFeatureProvider.action(mContext,
+ SettingsEnums.ACTION_SETTINGS_CHANGE_WIFI_HOTSPOT_NAME);
+ }
mSSID = (String) newValue;
updateSsidDisplay((EditTextPreference) preference);
mListener.onTetherConfigUpdated(this);
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
index 3528fb6..98d2918 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
@@ -130,14 +130,17 @@
}
@Test
- public void getServiceSummary_invisibleType_showsDefaultSummary() {
+ public void getServiceSummary_invisibleType_shortcutDisabled_showsOffSummary() {
setInvisibleFragmentType(mServiceInfo);
doReturn(DEFAULT_SUMMARY).when(mServiceInfo).loadSummary(any());
final CharSequence summary = AccessibilitySettings.getServiceSummary(mContext,
mServiceInfo, SERVICE_ENABLED);
- assertThat(summary).isEqualTo(DEFAULT_SUMMARY);
+ assertThat(summary).isEqualTo(
+ mContext.getString(R.string.preference_summary_default_combination,
+ mContext.getString(R.string.accessibility_summary_shortcut_disabled),
+ DEFAULT_SUMMARY));
}
@Test
diff --git a/tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java
index ca2a800..7304fc2 100644
--- a/tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/appinfo/AppButtonsPreferenceControllerTest.java
@@ -36,7 +36,6 @@
import static org.mockito.Mockito.when;
import android.app.ActivityManager;
-import android.app.Application;
import android.app.admin.DevicePolicyManager;
import android.app.settings.SettingsEnums;
import android.content.Context;
@@ -51,8 +50,6 @@
import android.util.ArraySet;
import android.view.View;
-import androidx.preference.PreferenceScreen;
-
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.core.InstrumentedPreferenceFragment;
@@ -277,7 +274,8 @@
}
@Test
- public void updateUninstallButton_isProfileOrDeviceOwner_setButtonDisable() {
+ public void updateUninstallButton_isSystemAndIsProfileOrDeviceOwner_setButtonDisable() {
+ doReturn(true).when(mController).isSystemPackage(any(), any(), any());
doReturn(true).when(mDpm).isDeviceOwnerAppOnAnyUser(anyString());
mController.updateUninstallButton();
@@ -286,6 +284,38 @@
}
@Test
+ public void updateUninstallButton_isSystemAndIsNotProfileOrDeviceOwner_setButtonEnabled() {
+ doReturn(true).when(mController).isSystemPackage(any(), any(), any());
+ doReturn(false).when(mDpm).isDeviceOwnerAppOnAnyUser(anyString());
+
+ mController.updateUninstallButton();
+
+ verify(mButtonPrefs).setButton2Enabled(true);
+ }
+
+ @Test
+ public void updateUninstallButton_isNotSystemAndIsProfileOrDeviceOwner_setButtonDisable() {
+ doReturn(false).when(mController).isSystemPackage(any(), any(), any());
+ doReturn(0).when(mDpm).getDeviceOwnerUserId();
+ doReturn(true).when(mDpm).isDeviceOwnerApp(anyString());
+
+ mController.updateUninstallButton();
+
+ verify(mButtonPrefs).setButton2Enabled(false);
+ }
+
+ @Test
+ public void updateUninstallButton_isNotSystemAndIsNotProfileOrDeviceOwner_setButtonEnabled() {
+ doReturn(false).when(mController).isSystemPackage(any(), any(), any());
+ doReturn(10).when(mDpm).getDeviceOwnerUserId();
+ doReturn(false).when(mDpm).isDeviceOwnerApp(anyString());
+
+ mController.updateUninstallButton();
+
+ verify(mButtonPrefs).setButton2Enabled(true);
+ }
+
+ @Test
public void updateUninstallButton_isDeviceProvisioningApp_setButtonDisable() {
doReturn(true).when(mDpm).isDeviceOwnerAppOnAnyUser(anyString());
when(mSettingsActivity.getResources().getString(anyInt())).thenReturn(PACKAGE_NAME);
diff --git a/tests/robotests/src/com/android/settings/applications/appinfo/ManageExternalStorageDetailsTest.java b/tests/robotests/src/com/android/settings/applications/appinfo/ManageExternalStorageDetailsTest.java
index ed85c01..88c2471 100644
--- a/tests/robotests/src/com/android/settings/applications/appinfo/ManageExternalStorageDetailsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/appinfo/ManageExternalStorageDetailsTest.java
@@ -64,13 +64,11 @@
private ManageExternalStorageDetails mFragment;
- private final HashMap<String, Integer> mPkgToOpModeMap = new HashMap<>();
private final HashMap<Integer, Integer> mUidToOpModeMap = new HashMap<>();
@Before
public void setUp() {
// Reset the global trackers
- mPkgToOpModeMap.clear();
mUidToOpModeMap.clear();
//Start the mockin'
@@ -106,8 +104,7 @@
// Verify that mAppOpsManager was called to allow the app-op
verify(mAppOpsManager, times(1))
- .setMode(anyInt(), anyInt(), nullable(String.class), anyInt());
- assertThat(mPkgToOpModeMap).containsExactly(mockPkgName, AppOpsManager.MODE_ALLOWED);
+ .setUidMode(anyInt(), anyInt(), anyInt());
assertThat(mUidToOpModeMap).containsExactly(mockUid, AppOpsManager.MODE_ALLOWED);
// Verify the mSwitchPref was enabled
@@ -141,8 +138,7 @@
// Verify that mAppOpsManager was called to deny the app-op
verify(mAppOpsManager, times(1))
- .setMode(anyInt(), anyInt(), nullable(String.class), anyInt());
- assertThat(mPkgToOpModeMap).containsExactly(mockPkgName, AppOpsManager.MODE_ERRORED);
+ .setUidMode(anyInt(), anyInt(), anyInt());
assertThat(mUidToOpModeMap).containsExactly(mockUid, AppOpsManager.MODE_ERRORED);
// Verify the mSwitchPref was enabled
@@ -164,33 +160,32 @@
}
private void mockAppOpsOperations() {
- Answer<Void> answerSetMode = invocation -> {
+ Answer<Void> answerSetUidMode = invocation -> {
int code = invocation.getArgument(0);
int uid = invocation.getArgument(1);
- String packageName = invocation.getArgument(2);
- int mode = invocation.getArgument(3);
+ int mode = invocation.getArgument(2);
if (code != AppOpsManager.OP_MANAGE_EXTERNAL_STORAGE) {
return null;
}
- mPkgToOpModeMap.put(packageName, mode);
mUidToOpModeMap.put(uid, mode);
return null;
};
- doAnswer(answerSetMode).when(mAppOpsManager)
- .setMode(anyInt(), anyInt(), nullable(String.class), anyInt());
+ doAnswer(answerSetUidMode).when(mAppOpsManager)
+ .setUidMode(anyInt(), anyInt(), anyInt());
Answer<PermissionState> answerPermState = invocation -> {
String packageName = invocation.getArgument(0);
+ int uid = invocation.getArgument(1);
PermissionState res = new PermissionState(packageName, null);
res.permissionDeclared = false;
- if (mPkgToOpModeMap.containsKey(packageName)) {
+ if (mUidToOpModeMap.containsKey(uid)) {
res.permissionDeclared = true;
- res.appOpMode = mPkgToOpModeMap.get(packageName);
+ res.appOpMode = mUidToOpModeMap.get(uid);
}
return res;
};
diff --git a/tests/robotests/src/com/android/settings/applications/assist/AssistFlashScreenPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/assist/AssistFlashScreenPreferenceControllerTest.java
index 8392ac1..1e6faa1 100644
--- a/tests/robotests/src/com/android/settings/applications/assist/AssistFlashScreenPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/assist/AssistFlashScreenPreferenceControllerTest.java
@@ -41,7 +41,6 @@
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
@@ -81,7 +80,6 @@
}
@Test
- @Ignore
@Config(shadows = {ShadowSecureSettings.class})
public void isAvailable_hasAssistantAndAllowDisclosure_shouldReturnTrue() {
ReflectionHelpers.setField(mController, "mContext", mMockContext);
@@ -93,7 +91,6 @@
}
@Test
- @Ignore
@Config(shadows = {ShadowSecureSettings.class})
public void isAvailable_hasAssistantAndDisallowDisclosure_shouldReturnTrue() {
ReflectionHelpers.setField(mController, "mContext", mMockContext);
@@ -112,7 +109,6 @@
}
@Test
- @Ignore
@Config(shadows = {ShadowSecureSettings.class})
public void onResume_shouldUpdatePreference() {
Settings.Secure.putString(mContext.getContentResolver(),
diff --git a/tests/robotests/src/com/android/settings/applications/assist/DefaultAssistPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/assist/DefaultAssistPreferenceControllerTest.java
index 7de830c..3e46027 100644
--- a/tests/robotests/src/com/android/settings/applications/assist/DefaultAssistPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/assist/DefaultAssistPreferenceControllerTest.java
@@ -44,7 +44,6 @@
import com.android.settingslib.applications.DefaultAppInfo;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -95,7 +94,6 @@
}
@Test
- @Ignore
@Config(shadows = {ShadowSecureSettings.class})
public void getDefaultAppInfo_hasDefaultAssist_shouldReturnKey() {
final String flattenKey = "com.android.settings/assist";
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPickerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPickerTest.java
index dfacd81..9ec7f0b 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPickerTest.java
@@ -45,7 +45,6 @@
import com.android.settingslib.applications.DefaultAppInfo;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
@@ -107,7 +106,6 @@
}
@Test
- @Ignore
public void setAndGetDefaultAppKey_shouldUpdateDefaultAutoFill() {
mPicker.onAttach((Context) mActivity);
diff --git a/tests/robotests/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceControllerTest.java
new file mode 100644
index 0000000..bc3544d
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/AdbAuthorizationTimeoutPreferenceControllerTest.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2020 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.development;
+
+import static junit.framework.Assert.assertEquals;
+
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.PreferenceScreen;
+import androidx.preference.SwitchPreference;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class AdbAuthorizationTimeoutPreferenceControllerTest {
+ @Mock
+ private PreferenceScreen mPreferenceScreen;
+ @Mock
+ private DevelopmentSettingsDashboardFragment mFragment;
+
+ private Context mContext;
+ private ContentResolver mContentResolver;
+ private SwitchPreference mPreference;
+ private AdbAuthorizationTimeoutPreferenceController mPreferenceController;
+ private long mInitialAuthTimeout;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ mContext = RuntimeEnvironment.application;
+ mContentResolver = mContext.getContentResolver();
+
+ mPreferenceController = new AdbAuthorizationTimeoutPreferenceController(mContext);
+ mPreference = spy(new SwitchPreference(mContext));
+ when(mPreferenceScreen.findPreference(mPreferenceController.getPreferenceKey())).thenReturn(
+ mPreference);
+ mPreferenceController.displayPreference(mPreferenceScreen);
+
+ mInitialAuthTimeout = Settings.Global.getLong(mContext.getContentResolver(),
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME,
+ Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ Settings.Global.putLong(mContext.getContentResolver(),
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME, mInitialAuthTimeout);
+ }
+
+ @Test
+ public void onPreferenceChange_enableSetting_timeoutSetToZero() throws Exception {
+ // This developer option disables the automatic adb authorization revocation by setting
+ // the timeout value to 0 when enabled.
+ mPreferenceController.onPreferenceChange(mPreference, true);
+ long authTimeout = Settings.Global.getLong(mContentResolver,
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME);
+
+ assertEquals(0, authTimeout);
+ }
+
+ @Test
+ public void onPreferenceChange_enableAndDisableSetting_timeoutSetToDefault()
+ throws Exception {
+ // A non-default setting value is not saved when this developer option is enabled and the
+ // setting value is set to 0. If the user subsequently disables the option the setting
+ // value is restored to the default value.
+ Settings.Global.putLong(mContentResolver, Settings.Global.ADB_ALLOWED_CONNECTION_TIME, 1);
+
+ mPreferenceController.onPreferenceChange(mPreference, true);
+ mPreferenceController.onPreferenceChange(mPreference, false);
+ long authTimeout = Settings.Global.getLong(mContentResolver,
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME);
+
+ assertEquals(Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME, authTimeout);
+ }
+
+ @Test
+ public void updateState_timeoutSetToZero_preferenceDisplayedEnabled() throws Exception {
+ Settings.Global.putLong(mContentResolver, Settings.Global.ADB_ALLOWED_CONNECTION_TIME, 0);
+
+ mPreferenceController.updateState(mPreference);
+
+ verify(mPreference).setChecked(true);
+ }
+
+ @Test
+ public void updateState_timeoutSetToDefault_preferenceDisplayedDisabled() throws Exception {
+ Settings.Global.putLong(mContentResolver, Settings.Global.ADB_ALLOWED_CONNECTION_TIME,
+ Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME);
+
+ mPreferenceController.updateState(mPreference);
+
+ verify(mPreference).setChecked(false);
+ }
+
+ @Test
+ public void onDeveloperOptionsSwitchDisabled_preferenceAndTimeoutDisabled() throws Exception {
+ mPreferenceController.onDeveloperOptionsSwitchDisabled();
+
+ long authTimeout = Settings.Global.getLong(mContentResolver,
+ Settings.Global.ADB_ALLOWED_CONNECTION_TIME);
+
+ assertEquals(Settings.Global.DEFAULT_ADB_ALLOWED_CONNECTION_TIME, authTimeout);
+ verify(mPreference).setChecked(false);
+ }
+}
+
diff --git a/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java
index 83a4880..101297b 100644
--- a/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java
@@ -49,9 +49,9 @@
import org.robolectric.annotation.Config;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
-import org.robolectric.shadows.androidx.fragment.FragmentController;
import org.robolectric.shadow.api.Shadow;
import org.robolectric.shadows.ShadowUserManager;
+import org.robolectric.shadows.androidx.fragment.FragmentController;
import org.robolectric.util.ReflectionHelpers;
import java.util.List;
@@ -133,7 +133,8 @@
@Config(shadows = {
ShadowPictureColorModePreferenceController.class,
ShadowAdbPreferenceController.class,
- ShadowClearAdbKeysPreferenceController.class
+ ShadowClearAdbKeysPreferenceController.class,
+ ShadowWirelessDebuggingPreferenceController.class
})
public void searchIndex_pageEnabled_shouldNotAddKeysToNonIndexable() {
final Context appContext = RuntimeEnvironment.application;
@@ -325,4 +326,12 @@
return true;
}
}
+
+ @Implements(WirelessDebuggingPreferenceController.class)
+ public static class ShadowWirelessDebuggingPreferenceController {
+ @Implementation
+ protected boolean isAvailable() {
+ return true;
+ }
+ }
}
diff --git a/tests/robotests/src/com/android/settings/development/EnableBlursPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/EnableBlursPreferenceControllerTest.java
new file mode 100644
index 0000000..d943cb1
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/EnableBlursPreferenceControllerTest.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2020 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.development;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.os.SystemProperties;
+
+import androidx.preference.PreferenceScreen;
+import androidx.preference.SwitchPreference;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public final class EnableBlursPreferenceControllerTest {
+
+ @Mock
+ private SwitchPreference mPreference;
+ @Mock
+ private PreferenceScreen mPreferenceScreen;
+
+ @Rule
+ public MockitoRule mockitoRule = MockitoJUnit.rule();
+
+ private Context mContext;
+ private EnableBlursPreferenceController mController;
+
+ @Before
+ public void setup() {
+ mContext = RuntimeEnvironment.application;
+ mController = new EnableBlursPreferenceController(mContext, true);
+ when(mPreferenceScreen.findPreference(mController.getPreferenceKey())).thenReturn(
+ mPreference);
+ mController.displayPreference(mPreferenceScreen);
+ }
+
+ @Test
+ public void onPreferenceChanged_settingEnabled_enableBlurs() {
+ mController.onPreferenceChange(mPreference, true /* new value */);
+
+ final boolean mode = SystemProperties
+ .getBoolean(EnableBlursPreferenceController.DISABLE_BLURS_SYSPROP,
+ false /* default */);
+ assertThat(mode).isFalse();
+ }
+
+ @Test
+ public void onPreferenceChanged_settingDisabled_disableBlurs() {
+ mController.onPreferenceChange(mPreference, false /* new value */);
+
+ final boolean mode = SystemProperties
+ .getBoolean(EnableBlursPreferenceController.DISABLE_BLURS_SYSPROP,
+ false /* default */);
+
+ assertThat(mode).isTrue();
+ }
+
+ @Test
+ public void updateState_settingEnabled_preferenceShouldNotBeChecked() {
+ SystemProperties.set(EnableBlursPreferenceController.DISABLE_BLURS_SYSPROP, "1");
+ mController.updateState(mPreference);
+
+ verify(mPreference).setChecked(false);
+ }
+
+ @Test
+ public void updateState_settingDisabled_preferenceShouldBeChecked() {
+ SystemProperties.set(EnableBlursPreferenceController.DISABLE_BLURS_SYSPROP, "0");
+ mController.updateState(mPreference);
+
+ verify(mPreference).setChecked(true);
+ }
+
+ @Test
+ public void onDeveloperOptionsDisabled_shouldResetPreference() {
+ mController.onDeveloperOptionsDisabled();
+ // Can predict true or false, depends on device config.
+ verify(mPreference).setChecked(anyBoolean());
+ }
+
+ @Test
+ public void isAvailable_whenSupported() {
+ assertThat(mController.isAvailable()).isTrue();
+
+ mController = new EnableBlursPreferenceController(mContext, false);
+ assertThat(mController.isAvailable()).isFalse();
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/development/EnhancedConnectivityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/EnhancedConnectivityPreferenceControllerTest.java
index 6fd6f55..171fc6b 100644
--- a/tests/robotests/src/com/android/settings/development/EnhancedConnectivityPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/EnhancedConnectivityPreferenceControllerTest.java
@@ -88,20 +88,20 @@
}
@Test
- public void onDeveloperOptionsDisabled_shouldDisablePreference() {
- mController.onDeveloperOptionsDisabled();
+ public void onDeveloperOptionsDisabled_shouldEnablePreference() {
+ mController.onDeveloperOptionsSwitchDisabled();
verify(mPreference).setEnabled(false);
- verify(mPreference).setChecked(false);
+ verify(mPreference).setChecked(true);
- assertThat(isSettingEnabled()).isFalse();
+ assertThat(isSettingEnabled()).isTrue();
}
private boolean isSettingEnabled() {
return Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.ENHANCED_CONNECTIVITY_ENABLED,
- EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_OFF
- /* default off */)
+ EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_ON
+ /* default on */)
== EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_ON;
}
}
diff --git a/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java b/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java
index 1e59167..e59bd0b 100644
--- a/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java
+++ b/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java
@@ -93,7 +93,7 @@
mChanges[2] = new CompatibilityChangeInfo(3L, "Enabled_After_SDK_1_1", 1, false, false, "");
mChanges[3] = new CompatibilityChangeInfo(4L, "Enabled_After_SDK_1_2", 1, false, false, "");
mChanges[4] = new CompatibilityChangeInfo(5L, "Enabled_After_SDK_2", 2, false, false, "");
- when(mPlatformCompat.listAllChanges()).thenReturn(mChanges);
+ when(mPlatformCompat.listUIChanges()).thenReturn(mChanges);
when(mPlatformCompat.getOverrideValidator()).thenReturn(mOverrideValidator);
// By default, allow any change
when(mOverrideValidator.getOverrideAllowedState(anyLong(),anyString()))
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverReceiverTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverReceiverTest.java
index ec6436a..e411531 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverReceiverTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverReceiverTest.java
@@ -68,7 +68,7 @@
@Test
public void testOnReceive_powerSaveModeChanged_invokeCallback() {
- Intent intent = new Intent(PowerManager.ACTION_POWER_SAVE_MODE_CHANGING);
+ Intent intent = new Intent(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED);
mBatterySaverReceiver.onReceive(mContext, intent);
diff --git a/tests/robotests/src/com/android/settings/gestures/SystemNavigationGestureSettingsTest.java b/tests/robotests/src/com/android/settings/gestures/SystemNavigationGestureSettingsTest.java
index 24cb9ed..78424da 100644
--- a/tests/robotests/src/com/android/settings/gestures/SystemNavigationGestureSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/SystemNavigationGestureSettingsTest.java
@@ -24,14 +24,9 @@
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY;
-import static com.android.settings.gestures.SystemNavigationGestureSettings.BACK_GESTURE_INSET_DEFAULT_OVERLAY;
-import static com.android.settings.gestures.SystemNavigationGestureSettings.BACK_GESTURE_INSET_OVERLAYS;
import static com.android.settings.gestures.SystemNavigationGestureSettings.KEY_SYSTEM_NAV_2BUTTONS;
import static com.android.settings.gestures.SystemNavigationGestureSettings.KEY_SYSTEM_NAV_3BUTTONS;
import static com.android.settings.gestures.SystemNavigationGestureSettings.KEY_SYSTEM_NAV_GESTURAL;
-import static com.android.settings.gestures.SystemNavigationGestureSettings.NAV_BAR_MODE_GESTURAL_OVERLAY_EXTRA_WIDE_BACK;
-import static com.android.settings.gestures.SystemNavigationGestureSettings.NAV_BAR_MODE_GESTURAL_OVERLAY_NARROW_BACK;
-import static com.android.settings.gestures.SystemNavigationGestureSettings.NAV_BAR_MODE_GESTURAL_OVERLAY_WIDE_BACK;
import static com.google.common.truth.Truth.assertThat;
@@ -39,7 +34,6 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -116,96 +110,16 @@
@Test
public void testSetCurrentSystemNavigationMode() throws Exception {
- mSettings.setBackSensitivity(mContext, mOverlayManager, 0);
- mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
- KEY_SYSTEM_NAV_GESTURAL);
- verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
- NAV_BAR_MODE_GESTURAL_OVERLAY_NARROW_BACK, USER_CURRENT);
-
- mSettings.setBackSensitivity(mContext, mOverlayManager, 1);
- mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
- KEY_SYSTEM_NAV_GESTURAL);
+ mSettings.setCurrentSystemNavigationMode(mOverlayManager, KEY_SYSTEM_NAV_GESTURAL);
verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
NAV_BAR_MODE_GESTURAL_OVERLAY, USER_CURRENT);
- mSettings.setBackSensitivity(mContext, mOverlayManager, 2);
- mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
- KEY_SYSTEM_NAV_GESTURAL);
- verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
- NAV_BAR_MODE_GESTURAL_OVERLAY_WIDE_BACK, USER_CURRENT);
-
- mSettings.setBackSensitivity(mContext, mOverlayManager, 3);
- mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
- KEY_SYSTEM_NAV_GESTURAL);
- verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
- NAV_BAR_MODE_GESTURAL_OVERLAY_EXTRA_WIDE_BACK, USER_CURRENT);
-
- mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
- KEY_SYSTEM_NAV_2BUTTONS);
+ mSettings.setCurrentSystemNavigationMode(mOverlayManager, KEY_SYSTEM_NAV_2BUTTONS);
verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
NAV_BAR_MODE_2BUTTON_OVERLAY, USER_CURRENT);
- mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
- KEY_SYSTEM_NAV_3BUTTONS);
+ mSettings.setCurrentSystemNavigationMode(mOverlayManager, KEY_SYSTEM_NAV_3BUTTONS);
verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
NAV_BAR_MODE_3BUTTON_OVERLAY, USER_CURRENT);
}
-
- @Test
- public void testSetCurrentSystemNavigationMode_backSensitivityValuePersists() throws Exception {
- SettingsShadowResources.overrideResource(
- R.integer.config_navBarInteractionMode, NAV_BAR_MODE_3BUTTON);
-
- mSettings.setBackSensitivity(mContext, mOverlayManager, 2);
- mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
- KEY_SYSTEM_NAV_3BUTTONS);
- verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
- NAV_BAR_MODE_3BUTTON_OVERLAY, USER_CURRENT);
-
- // Return to Gesture navigation, without setting the sensitivity value.
- mSettings.setCurrentSystemNavigationMode(mContext, mOverlayManager,
- KEY_SYSTEM_NAV_GESTURAL);
- verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
- NAV_BAR_MODE_GESTURAL_OVERLAY_WIDE_BACK, USER_CURRENT);
- }
-
- @Test
- public void testGetBackSensitivity_default() {
- assertEquals(BACK_GESTURE_INSET_DEFAULT_OVERLAY,
- mSettings.getBackSensitivity(mContext, mOverlayManager));
- }
-
- @Test
- public void testBackSensitivitySetterAndGetter_currentNavModeNotGestural() throws Exception {
- SettingsShadowResources.overrideResource(
- R.integer.config_navBarInteractionMode, NAV_BAR_MODE_3BUTTON);
-
- mSettings.setBackSensitivity(mContext, mOverlayManager, 3);
- assertEquals(3, mSettings.getBackSensitivity(mContext, mOverlayManager));
- mSettings.setBackSensitivity(mContext, mOverlayManager, 2);
- assertEquals(2, mSettings.getBackSensitivity(mContext, mOverlayManager));
-
- verify(mOverlayManager, never()).setEnabledExclusiveInCategory(any(), anyInt());
- }
-
- @Test
- public void testBackSensitivitySetterAndGetter_currentNavModeIsGestural() throws Exception {
- SettingsShadowResources.overrideResource(
- R.integer.config_navBarInteractionMode, NAV_BAR_MODE_GESTURAL);
-
- when(mOverlayManager.getOverlayInfo(BACK_GESTURE_INSET_OVERLAYS[3], USER_CURRENT))
- .thenReturn(mOverlayInfoEnabled);
- mSettings.setBackSensitivity(mContext, mOverlayManager, 3);
- assertEquals(3, mSettings.getBackSensitivity(mContext, mOverlayManager));
-
- when(mOverlayManager.getOverlayInfo(BACK_GESTURE_INSET_OVERLAYS[2], USER_CURRENT))
- .thenReturn(mOverlayInfoEnabled);
- mSettings.setBackSensitivity(mContext, mOverlayManager, 2);
- assertEquals(2, mSettings.getBackSensitivity(mContext, mOverlayManager));
-
- verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
- NAV_BAR_MODE_GESTURAL_OVERLAY_WIDE_BACK, USER_CURRENT);
- verify(mOverlayManager, times(1)).setEnabledExclusiveInCategory(
- NAV_BAR_MODE_GESTURAL_OVERLAY_EXTRA_WIDE_BACK, USER_CURRENT);
- }
}
diff --git a/tests/robotests/src/com/android/settings/localepicker/LocaleListEditorTest.java b/tests/robotests/src/com/android/settings/localepicker/LocaleListEditorTest.java
index d84d779..f9b1543 100644
--- a/tests/robotests/src/com/android/settings/localepicker/LocaleListEditorTest.java
+++ b/tests/robotests/src/com/android/settings/localepicker/LocaleListEditorTest.java
@@ -18,40 +18,68 @@
import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
import android.content.Context;
import android.view.View;
import android.widget.TextView;
-import com.android.settings.testutils.FakeFeatureFactory;
+import androidx.appcompat.app.AlertDialog;
+import androidx.fragment.app.FragmentActivity;
+import com.android.settings.R;
+import com.android.settings.testutils.FakeFeatureFactory;
+import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
+
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
import org.robolectric.util.ReflectionHelpers;
@RunWith(RobolectricTestRunner.class)
+@Config(shadows = ShadowAlertDialogCompat.class)
public class LocaleListEditorTest {
private LocaleListEditor mLocaleListEditor;
- @Mock
private Context mContext;
+ private FragmentActivity mActivity;
+
+ @Mock
+ private LocaleDragAndDropAdapter mAdapter;
@Before
public void setUp() {
- mLocaleListEditor = new LocaleListEditor();
+ MockitoAnnotations.initMocks(this);
+ mContext = RuntimeEnvironment.application;
+ mLocaleListEditor = spy(new LocaleListEditor());
+ when(mLocaleListEditor.getContext()).thenReturn(mContext);
+ mActivity = Robolectric.buildActivity(FragmentActivity.class).get();
+ when(mLocaleListEditor.getActivity()).thenReturn(mActivity);
ReflectionHelpers.setField(mLocaleListEditor, "mEmptyTextView",
new TextView(RuntimeEnvironment.application));
ReflectionHelpers.setField(mLocaleListEditor, "mRestrictionsManager",
RuntimeEnvironment.application.getSystemService(Context.RESTRICTIONS_SERVICE));
ReflectionHelpers.setField(mLocaleListEditor, "mUserManager",
RuntimeEnvironment.application.getSystemService(Context.USER_SERVICE));
+ ReflectionHelpers.setField(mLocaleListEditor, "mAdapter", mAdapter);
FakeFeatureFactory.setupForTest();
}
+ @After
+ public void tearDown() {
+ ReflectionHelpers.setField(mLocaleListEditor, "mRemoveMode", false);
+ ReflectionHelpers.setField(mLocaleListEditor, "mShowingRemoveDialog", false);
+ }
+
@Test
public void testDisallowConfigLocale_unrestrict() {
ReflectionHelpers.setField(mLocaleListEditor, "mIsUiRestricted", true);
@@ -67,4 +95,69 @@
mLocaleListEditor.onResume();
assertThat(mLocaleListEditor.getEmptyTextView().getVisibility()).isEqualTo(View.VISIBLE);
}
+
+ @Test
+ public void showRemoveLocaleWarningDialog_allLocaleSelected_shouldShowErrorDialog() {
+ //pre-condition
+ when(mAdapter.getCheckedCount()).thenReturn(1);
+ when(mAdapter.getItemCount()).thenReturn(1);
+ when(mAdapter.isFirstLocaleChecked()).thenReturn(true);
+ ReflectionHelpers.setField(mLocaleListEditor, "mRemoveMode", true);
+ ReflectionHelpers.setField(mLocaleListEditor, "mShowingRemoveDialog", true);
+
+ //launch dialog
+ mLocaleListEditor.showRemoveLocaleWarningDialog();
+
+ final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
+
+ assertThat(dialog).isNotNull();
+
+ final ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
+
+ assertThat(shadowDialog.getTitle()).isEqualTo(
+ mContext.getString(R.string.dlg_remove_locales_error_title));
+ }
+
+ @Test
+ public void showRemoveLocaleWarningDialog_mainLocaleSelected_shouldShowLocaleChangeDialog() {
+ //pre-condition
+ when(mAdapter.getCheckedCount()).thenReturn(1);
+ when(mAdapter.getItemCount()).thenReturn(2);
+ when(mAdapter.isFirstLocaleChecked()).thenReturn(true);
+ ReflectionHelpers.setField(mLocaleListEditor, "mRemoveMode", true);
+ ReflectionHelpers.setField(mLocaleListEditor, "mShowingRemoveDialog", true);
+
+ //launch dialog
+ mLocaleListEditor.showRemoveLocaleWarningDialog();
+
+ final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
+
+ assertThat(dialog).isNotNull();
+
+ final ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
+
+ assertThat(shadowDialog.getMessage()).isEqualTo(
+ mContext.getString(R.string.dlg_remove_locales_message));
+ }
+
+ @Test
+ public void showRemoveLocaleWarningDialog_mainLocaleNotSelected_shouldShowConfirmDialog() {
+ //pre-condition
+ when(mAdapter.getCheckedCount()).thenReturn(1);
+ when(mAdapter.getItemCount()).thenReturn(2);
+ when(mAdapter.isFirstLocaleChecked()).thenReturn(false);
+ ReflectionHelpers.setField(mLocaleListEditor, "mRemoveMode", true);
+ ReflectionHelpers.setField(mLocaleListEditor, "mShowingRemoveDialog", true);
+
+ //launch dialog
+ mLocaleListEditor.showRemoveLocaleWarningDialog();
+
+ final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
+
+ assertThat(dialog).isNotNull();
+
+ final ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
+
+ assertThat(shadowDialog.getMessage()).isNull();
+ }
}
diff --git a/tests/robotests/src/com/android/settings/media/MediaDeviceUpdateWorkerTest.java b/tests/robotests/src/com/android/settings/media/MediaDeviceUpdateWorkerTest.java
index f92b012..8014e56 100644
--- a/tests/robotests/src/com/android/settings/media/MediaDeviceUpdateWorkerTest.java
+++ b/tests/robotests/src/com/android/settings/media/MediaDeviceUpdateWorkerTest.java
@@ -30,6 +30,7 @@
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
+import android.media.MediaRoute2ProviderService;
import android.net.Uri;
import com.android.settings.testutils.shadow.ShadowAudioManager;
@@ -95,7 +96,8 @@
@Test
public void onSelectedDeviceStateChanged_shouldNotifyChange() {
- mMediaDeviceUpdateWorker.onSelectedDeviceStateChanged(null, 0);
+ mMediaDeviceUpdateWorker.onSelectedDeviceStateChanged(mMediaDevice1,
+ LocalMediaManager.MediaDeviceState.STATE_CONNECTED);
verify(mResolver).notifyChange(URI, null);
}
@@ -156,6 +158,13 @@
}
@Test
+ public void onRequestFailed_shouldNotifyChange() {
+ mMediaDeviceUpdateWorker.onRequestFailed(MediaRoute2ProviderService.REASON_UNKNOWN_ERROR);
+
+ verify(mResolver).notifyChange(URI, null /* observer */);
+ }
+
+ @Test
public void onReceive_inCallState_shouldNotifyChange() {
mMediaDeviceUpdateWorker.mLocalMediaManager = mock(LocalMediaManager.class);
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
diff --git a/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java b/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java
index 03d85b2..426eacc 100644
--- a/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java
+++ b/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java
@@ -336,6 +336,81 @@
}
@Test
+ public void getSlice_onTransferring_containTransferringSubtitle() {
+ final List<MediaDevice> mSelectedDevices = new ArrayList<>();
+ final List<MediaDevice> mSelectableDevices = new ArrayList<>();
+ mDevices.clear();
+ final MediaDevice device = mock(MediaDevice.class);
+ when(device.getName()).thenReturn(TEST_DEVICE_1_NAME);
+ when(device.getIcon()).thenReturn(mTestDrawable);
+ when(device.getMaxVolume()).thenReturn(100);
+ when(device.isConnected()).thenReturn(true);
+ when(device.getDeviceType()).thenReturn(MediaDevice.MediaDeviceType.TYPE_CAST_DEVICE);
+ when(device.getId()).thenReturn(TEST_DEVICE_1_ID);
+ final MediaDevice device2 = mock(MediaDevice.class);
+ when(device2.getName()).thenReturn(TEST_DEVICE_2_NAME);
+ when(device2.getIcon()).thenReturn(mTestDrawable);
+ when(device2.getMaxVolume()).thenReturn(100);
+ when(device2.isConnected()).thenReturn(false);
+ when(device2.getState()).thenReturn(LocalMediaManager.MediaDeviceState.STATE_CONNECTING);
+ when(device2.getDeviceType()).thenReturn(MediaDevice.MediaDeviceType.TYPE_CAST_DEVICE);
+ when(device2.getId()).thenReturn(TEST_DEVICE_2_ID);
+ mSelectedDevices.add(device);
+ mSelectableDevices.add(device2);
+ when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(device);
+ mDevices.add(device);
+ mDevices.add(device2);
+ when(mLocalMediaManager.getSelectedMediaDevice()).thenReturn(mSelectedDevices);
+ when(mLocalMediaManager.getSelectableMediaDevice()).thenReturn(mSelectableDevices);
+ mMediaDeviceUpdateWorker.onDeviceListUpdate(mDevices);
+
+ final Slice mediaSlice = mMediaOutputSlice.getSlice();
+ final String sliceInfo = SliceQuery.findAll(mediaSlice, FORMAT_SLICE, HINT_LIST_ITEM,
+ null).toString();
+
+ assertThat(TextUtils.indexOf(sliceInfo, mContext.getText(R.string.media_output_switching)))
+ .isNotEqualTo(-1);
+ }
+
+ @Test
+ public void getSlice_onTransferringFailed_containFailedSubtitle() {
+ final List<MediaDevice> mSelectedDevices = new ArrayList<>();
+ final List<MediaDevice> mSelectableDevices = new ArrayList<>();
+ mDevices.clear();
+ final MediaDevice device = mock(MediaDevice.class);
+ when(device.getName()).thenReturn(TEST_DEVICE_1_NAME);
+ when(device.getIcon()).thenReturn(mTestDrawable);
+ when(device.getMaxVolume()).thenReturn(100);
+ when(device.isConnected()).thenReturn(true);
+ when(device.getDeviceType()).thenReturn(MediaDevice.MediaDeviceType.TYPE_CAST_DEVICE);
+ when(device.getId()).thenReturn(TEST_DEVICE_1_ID);
+ final MediaDevice device2 = mock(MediaDevice.class);
+ when(device2.getName()).thenReturn(TEST_DEVICE_2_NAME);
+ when(device2.getIcon()).thenReturn(mTestDrawable);
+ when(device2.getMaxVolume()).thenReturn(100);
+ when(device2.isConnected()).thenReturn(false);
+ when(device2.getState()).thenReturn(LocalMediaManager.MediaDeviceState
+ .STATE_CONNECTING_FAILED);
+ when(device2.getDeviceType()).thenReturn(MediaDevice.MediaDeviceType.TYPE_CAST_DEVICE);
+ when(device2.getId()).thenReturn(TEST_DEVICE_2_ID);
+ mSelectedDevices.add(device);
+ mSelectableDevices.add(device2);
+ when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(device);
+ mDevices.add(device);
+ mDevices.add(device2);
+ when(mLocalMediaManager.getSelectedMediaDevice()).thenReturn(mSelectedDevices);
+ when(mLocalMediaManager.getSelectableMediaDevice()).thenReturn(mSelectableDevices);
+ mMediaDeviceUpdateWorker.onDeviceListUpdate(mDevices);
+
+ final Slice mediaSlice = mMediaOutputSlice.getSlice();
+ final String sliceInfo = SliceQuery.findAll(mediaSlice, FORMAT_SLICE, HINT_LIST_ITEM,
+ null).toString();
+
+ assertThat(TextUtils.indexOf(sliceInfo, mContext.getText(
+ R.string.media_output_switch_error_text))).isNotEqualTo(-1);
+ }
+
+ @Test
public void onNotifyChange_foundMediaDevice_connect() {
mDevices.clear();
final MediaDevice device = mock(MediaDevice.class);
diff --git a/tests/robotests/src/com/android/settings/network/ims/MockVtQueryImsState.java b/tests/robotests/src/com/android/settings/network/ims/MockVtQueryImsState.java
index 4fd7d0c..3daf6cb 100644
--- a/tests/robotests/src/com/android/settings/network/ims/MockVtQueryImsState.java
+++ b/tests/robotests/src/com/android/settings/network/ims/MockVtQueryImsState.java
@@ -17,6 +17,7 @@
package com.android.settings.network.ims;
import android.content.Context;
+import android.telephony.ims.ImsException;
import com.android.ims.ImsManager;
@@ -29,6 +30,7 @@
private Boolean mIsTtyOnVolteEnabled;
private Boolean mIsProvisionedOnDevice;
private Boolean mIsEnabledByUser;
+ private Boolean mIsServiceStateReady;
/**
* Constructor
@@ -68,6 +70,19 @@
return super.isProvisionedOnDevice(subId);
}
+ public void setServiceStateReady(boolean isReady) {
+ mIsServiceStateReady = isReady;
+ }
+
+ @Override
+ boolean isServiceStateReady(int subId) throws InterruptedException, ImsException,
+ IllegalArgumentException {
+ if (mIsServiceStateReady != null) {
+ return mIsServiceStateReady;
+ }
+ return super.isServiceStateReady(subId);
+ }
+
public void setIsEnabledByUser(boolean enabled) {
mIsEnabledByUser = enabled;
}
diff --git a/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java
index 45a4563..0370bfa 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/ContactDiscoveryPreferenceControllerTest.java
@@ -64,7 +64,7 @@
private static final int TEST_SUB_ID = 2;
private static final Uri UCE_URI = Uri.withAppendedPath(Telephony.SimInfo.CONTENT_URI,
- Telephony.SimInfo.IMS_RCS_UCE_ENABLED);
+ Telephony.SimInfo.COLUMN_IMS_RCS_UCE_ENABLED);
@Mock private ImsManager mImsManager;
@Mock private ImsRcsManager mImsRcsManager;
diff --git a/tests/robotests/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceControllerTest.java
index 2f3aecc..57729ea 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceControllerTest.java
@@ -44,7 +44,6 @@
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
-import com.android.settings.R;
import com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants;
import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -61,6 +60,9 @@
private static final int SUB_ID = 2;
public static final String KEY = "enabled_network";
+ private static final long ALLOWED_ALL_NETWORK_TYPE = -1;
+ private static final long DISABLED_5G_NETWORK_TYPE = ~TelephonyManager.NETWORK_TYPE_BITMASK_NR;
+
@Mock
private TelephonyManager mTelephonyManager;
@Mock
@@ -92,19 +94,20 @@
doReturn(mContext).when(mContext).createPackageContext(anyString(), anyInt());
doReturn(mServiceState).when(mTelephonyManager).getServiceState();
mPersistableBundle = new PersistableBundle();
+ doReturn(mPersistableBundle).when(mCarrierConfigManager).getConfig();
doReturn(mPersistableBundle).when(mCarrierConfigManager).getConfigForSubId(SUB_ID);
-
mPreference = new ListPreference(mContext);
- mPreference.setEntries(R.array.enabled_networks_choices);
- mPreference.setEntryValues(R.array.enabled_networks_values);
mController = new EnabledNetworkModePreferenceController(mContext, KEY);
+ mockAllowedNetworkTypes(ALLOWED_ALL_NETWORK_TYPE);
+ mockAccessFamily(TelephonyManager.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA);
mController.init(mLifecycle, SUB_ID);
mPreference.setKey(mController.getPreferenceKey());
}
@Test
public void getAvailabilityStatus_hideCarrierNetworkSettings_returnUnavailable() {
- mPersistableBundle.putBoolean(CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL,
+ mPersistableBundle.putBoolean(
+ CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL,
true);
assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
@@ -140,40 +143,118 @@
}
@Test
- public void init_initShow4GForLTE() {
- mPersistableBundle.putBoolean(CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL,
- true);
+ public void updateState_LteWorldPhone_GlobalHasLte() {
+ mPersistableBundle.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
- mController.init(mLifecycle, SUB_ID);
+ mController.updateState(mPreference);
- assertThat(mController.mShow4GForLTE).isTrue();
+ assertThat(mPreference.getEntryValues())
+ .asList()
+ .contains(String.valueOf(TelephonyManager.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA));
}
@Test
- public void init_initDisplay5gList_returnTrue() {
- long testBitmask = TelephonyManager.NETWORK_TYPE_BITMASK_NR
- | TelephonyManager.NETWORK_TYPE_BITMASK_LTE;
- long allowedNetworkTypes = -1;
- doReturn(testBitmask).when(mTelephonyManager).getSupportedRadioAccessFamily();
- doReturn(allowedNetworkTypes).when(mTelephonyManager).getAllowedNetworkTypes();
+ public void updateState_5gWorldPhone_GlobalHasNr() {
+ mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
mController.init(mLifecycle, SUB_ID);
+ mPersistableBundle.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
- assertThat(mController.mDisplay5gList).isTrue();
+ mController.updateState(mPreference);
+
+ assertThat(mPreference.getEntryValues())
+ .asList()
+ .contains(String.valueOf(TelephonyManager.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA));
}
@Test
- public void checkSupportedRadioBitmask_nrBitmask_returnTrue() {
- long testBitmask = TelephonyManager.NETWORK_TYPE_BITMASK_NR
- | TelephonyManager.NETWORK_TYPE_BITMASK_LTE;
+ public void updateState_selectedOn5gItem() {
+ mockEnabledNetworkMode(TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
+ mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
+ mController.init(mLifecycle, SUB_ID);
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID,
+ TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
- assertThat(mController.checkSupportedRadioBitmask(testBitmask,
- TelephonyManager.NETWORK_TYPE_BITMASK_NR)).isTrue();
+ mController.updateState(mPreference);
+
+ assertThat(mPreference.getValue()).isEqualTo(
+ String.valueOf(
+ TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA));
+ }
+
+ @Test
+ public void updateState_disAllowed5g_5gOptionHidden() {
+ mockEnabledNetworkMode(TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
+ mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
+ mockAllowedNetworkTypes(DISABLED_5G_NETWORK_TYPE);
+ mController.init(mLifecycle, SUB_ID);
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID,
+ TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
+
+ mController.updateState(mPreference);
+
+ assertThat(mPreference.getEntryValues())
+ .asList()
+ .doesNotContain(
+ String.valueOf(TelephonyManager.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA));
+ }
+
+ @Test
+ public void updateState_disAllowed5g_selectOn4gOption() {
+ mockEnabledNetworkMode(TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
+ mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
+ mockAllowedNetworkTypes(DISABLED_5G_NETWORK_TYPE);
+ mController.init(mLifecycle, SUB_ID);
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID,
+ TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
+
+ mController.updateState(mPreference);
+
+ assertThat(mPreference.getValue()).isEqualTo(
+ String.valueOf(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA));
+ }
+
+ @Test
+ public void updateState_GlobalDisAllowed5g_GlobalWithoutNR() {
+ mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
+ mockAllowedNetworkTypes(DISABLED_5G_NETWORK_TYPE);
+ mController.init(mLifecycle, SUB_ID);
+ mPersistableBundle.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID,
+ TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
+
+ mController.updateState(mPreference);
+
+ assertThat(mPreference.getEntryValues())
+ .asList()
+ .doesNotContain(
+ String.valueOf(TelephonyManager.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA));
+ }
+
+ @Test
+ public void updateState_GlobalDisAllowed5g_SelectOnGlobal() {
+ mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
+ mockAllowedNetworkTypes(DISABLED_5G_NETWORK_TYPE);
+ mController.init(mLifecycle, SUB_ID);
+ mPersistableBundle.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID,
+ TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
+
+ mController.updateState(mPreference);
+
+ assertThat(mPreference.getValue()).isEqualTo(
+ String.valueOf(
+ TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA));
}
@Test
public void updateState_updateByNetworkMode() {
- long allowedNetworkTypes = -1;
- doReturn(allowedNetworkTypes).when(mTelephonyManager).getAllowedNetworkTypes();
+ mockEnabledNetworkMode(TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA);
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID,
TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA);
@@ -187,8 +268,7 @@
@Test
public void updateState_updateByNetworkMode_useDefaultValue() {
- long allowedNetworkTypes = -1;
- doReturn(allowedNetworkTypes).when(mTelephonyManager).getAllowedNetworkTypes();
+ mockEnabledNetworkMode(TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA);
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID,
TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA);
@@ -199,208 +279,13 @@
String.valueOf(TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA));
}
- /**
- * @string/enabled_networks_cdma_choices
- * Before | After
- * @string/network_lte , 8 |@string/network_5G + @string/network_recommended , 25
- * @string/network_3G , 4 |@string/network_lte_pure, 8
- * @string/network_1x , 5 |@string/network_3G , 4
- * @string/network_global, 10|@string/network_1x , 5
- * |@string/network_global , 27
- *
- * @string/enabled_networks_cdma_only_lte_choices
- * Before | After
- * @string/network_lte , 8 |@string/network_5G + @string/network_recommended , 25
- * @string/network_global, 10|@string/network_lte_pure, 8
- * |@string/network_global , 27
- */
- @Test
- public void add5gListItem_lteCdma_5gLteCdma() {
- //case#1
- mPreference.setEntries(R.array.enabled_networks_cdma_choices);
- mPreference.setEntryValues(R.array.enabled_networks_cdma_values);
- CharSequence[] testEntries = {mContext.getString(R.string.network_5G)
- + mContext.getString(R.string.network_recommended)
- , mContext.getString(R.string.network_lte_pure)
- , mContext.getString(R.string.network_3G)
- , mContext.getString(R.string.network_1x)
- , mContext.getString(R.string.network_global)};
- CharSequence[] testEntryValues = {"25", "8", "4", "5", "27"};
-
- mController.add5gListItem(mPreference);
-
- assertThat(mPreference.getEntries()).isEqualTo(testEntries);
- assertThat(mPreference.getEntryValues()).isEqualTo(testEntryValues);
-
- //case#2
- mPreference.setEntries(R.array.enabled_networks_cdma_only_lte_choices);
- mPreference.setEntryValues(R.array.enabled_networks_cdma_only_lte_values);
- CharSequence[] testEntries1 = {mContext.getString(R.string.network_5G)
- + mContext.getString(R.string.network_recommended)
- , mContext.getString(R.string.network_lte_pure)
- , mContext.getString(R.string.network_global)};
- CharSequence[] testEntryValues1 = {"25", "8", "27"};
-
- mController.add5gListItem(mPreference);
-
- assertThat(mPreference.getEntries()).isEqualTo(testEntries1);
- assertThat(mPreference.getEntryValues()).isEqualTo(testEntryValues1);
- }
-
- /**
- * @string/enabled_networks_except_gsm_4g_choices
- * Before | After
- * @string/network_4G , 9 |@string/network_5G + @string/network_recommended , 26
- * @string/network_3G , 0 |@string/network_4G_pure , 9
- * |@string/network_3G , 0
- *
- * @string/enabled_networks_except_gsm_choices
- * Before | After
- * @string/network_lte, 9 |@string/network_5G + @string/network_recommended , 26
- * @string/network_3G , 0 |@string/network_lte_pure, 9
- * |@string/network_3G , 0
- *
- * @string/enabled_networks_4g_choices
- * Before | After
- * @string/network_4G , 9 |@string/network_5G + @string/network_recommended , 26
- * @string/network_3G , 0 |@string/network_4G_pure , 9
- * @string/network_2G , 1 |@string/network_3G , 0
- * |@string/network_2G , 1
- *
- * @string/enabled_networks_choices
- * Before | After
- * @string/network_lte, 9 |@string/network_5G + @string/network_recommended , 26
- * @string/network_3G , 0 |@string/network_lte_pure, 9
- * @string/network_2G , 1 |@string/network_3G , 0
- * |@string/network_2G , 1
- */
- @Test
- public void add5gListItem_lteGsm_5gLteGsm() {
- //csae#1
- mPreference.setEntries(R.array.enabled_networks_except_gsm_4g_choices);
- mPreference.setEntryValues(R.array.enabled_networks_except_gsm_values);
- CharSequence[] testEntries = {mContext.getString(R.string.network_5G)
- + mContext.getString(R.string.network_recommended)
- , mContext.getString(R.string.network_4G_pure)
- , mContext.getString(R.string.network_3G)};
- CharSequence[] testEntryValues = {"26", "9", "0"};
-
- mController.add5gListItem(mPreference);
-
- assertThat(mPreference.getEntries()).isEqualTo(testEntries);
- assertThat(mPreference.getEntryValues()).isEqualTo(testEntryValues);
-
- //case#2
- mPreference.setEntries(R.array.enabled_networks_except_gsm_choices);
- mPreference.setEntryValues(R.array.enabled_networks_except_gsm_values);
- CharSequence[] testEntries1 = {mContext.getString(R.string.network_5G)
- + mContext.getString(R.string.network_recommended)
- , mContext.getString(R.string.network_lte_pure)
- , mContext.getString(R.string.network_3G)};
- CharSequence[] testEntryValues1 = {"26", "9", "0"};
-
- mController.add5gListItem(mPreference);
-
- assertThat(mPreference.getEntries()).isEqualTo(testEntries1);
- assertThat(mPreference.getEntryValues()).isEqualTo(testEntryValues1);
-
- //case#3
- mPreference.setEntries(R.array.enabled_networks_4g_choices);
- mPreference.setEntryValues(R.array.enabled_networks_values);
- CharSequence[] testEntries2 = {mContext.getString(R.string.network_5G)
- + mContext.getString(R.string.network_recommended)
- , mContext.getString(R.string.network_4G_pure)
- , mContext.getString(R.string.network_3G)
- , mContext.getString(R.string.network_2G)};
- CharSequence[] testEntryValues2 = {"26", "9", "0", "1"};
-
- mController.add5gListItem(mPreference);
-
- assertThat(mPreference.getEntries()).isEqualTo(testEntries2);
- assertThat(mPreference.getEntryValues()).isEqualTo(testEntryValues2);
-
- //case#4
- mPreference.setEntries(R.array.enabled_networks_choices);
- mPreference.setEntryValues(R.array.enabled_networks_values);
- CharSequence[] testEntries3 = {mContext.getString(R.string.network_5G)
- + mContext.getString(R.string.network_recommended)
- , mContext.getString(R.string.network_lte_pure)
- , mContext.getString(R.string.network_3G)
- , mContext.getString(R.string.network_2G)};
- CharSequence[] testEntryValues3 = {"26", "9", "0", "1"};
-
- mController.add5gListItem(mPreference);
-
- assertThat(mPreference.getEntries()).isEqualTo(testEntries3);
- assertThat(mPreference.getEntryValues()).isEqualTo(testEntryValues3);
- }
-
- /**
- * @string/preferred_network_mode_choices_world_mode
- * Before | After
- * "Global" , 10|@string/network_global , 27
- * "LTE / CDMA" , 8 |"LTE / CDMA" , 8
- * "LTE / GSM / UMTS" , 9 |"LTE / GSM / UMTS" , 9
- */
- @Test
- public void add5gListItem_worldPhone_Global() {
- mPreference.setEntries(R.array.preferred_network_mode_choices_world_mode);
- mPreference.setEntryValues(R.array.preferred_network_mode_values_world_mode);
- CharSequence[] testEntries = {mContext.getString(R.string.network_global)
- , "LTE / CDMA"
- , "LTE / GSM / UMTS"};
- CharSequence[] testEntryValues = {"27", "8", "9"};
-
- mController.add5gListItem(mPreference);
-
- assertThat(mPreference.getEntries()).isEqualTo(testEntries);
- assertThat(mPreference.getEntryValues()).isEqualTo(testEntryValues);
- }
-
- /**
- * @string/enabled_networks_tdscdma_choices
- * Before | After
- * @string/network_lte, 22|@string/network_5G + @string/network_recommended , 33
- * @string/network_3G , 18|@string/network_lte_pure, 22
- * @string/network_2G , 1 |@string/network_3G , 18
- * |@string/network_2G , 1
- */
- @Test
- public void add5gListItem_td_5gTd() {
- mPreference.setEntries(R.array.enabled_networks_tdscdma_choices);
- mPreference.setEntryValues(R.array.enabled_networks_tdscdma_values);
- CharSequence[] testEntries = {mContext.getString(R.string.network_5G)
- + mContext.getString(R.string.network_recommended)
- , mContext.getString(R.string.network_lte_pure)
- , mContext.getString(R.string.network_3G)
- , mContext.getString(R.string.network_2G)};
- CharSequence[] testEntryValues = {"33", "22", "18", "1"};
-
- mController.add5gListItem(mPreference);
-
- assertThat(mPreference.getEntries()).isEqualTo(testEntries);
- assertThat(mPreference.getEntryValues()).isEqualTo(testEntryValues);
- }
-
- @Test
- public void add5gListItem_noLte_no5g() {
- mPreference.setEntries(R.array.enabled_networks_except_lte_choices);
- mPreference.setEntryValues(R.array.enabled_networks_except_lte_values);
- CharSequence[] testEntries = {mContext.getString(R.string.network_3G)
- , mContext.getString(R.string.network_2G)};
- CharSequence[] testEntryValues = {"0", "1"};
-
- mController.add5gListItem(mPreference);
-
- assertThat(mPreference.getEntries()).isEqualTo(testEntries);
- assertThat(mPreference.getEntryValues()).isEqualTo(testEntryValues);
- }
-
@Test
public void onPreferenceChange_updateSuccess() {
+ mockEnabledNetworkMode(TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA);
doReturn(true).when(mTelephonyManager).setPreferredNetworkTypeBitmask(
getRafFromNetworkType(TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA));
+ mController.updateState(mPreference);
mController.onPreferenceChange(mPreference,
String.valueOf(TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA));
@@ -410,9 +295,11 @@
@Test
public void onPreferenceChange_updateFail() {
+ mockEnabledNetworkMode(TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA);
doReturn(false).when(mTelephonyManager).setPreferredNetworkTypeBitmask(
getRafFromNetworkType(TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA));
+ mController.updateState(mPreference);
mController.onPreferenceChange(mPreference,
String.valueOf(TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA));
@@ -423,8 +310,7 @@
@Test
public void preferredNetworkModeNotification_preferenceUpdates() {
PreferenceScreen screen = mock(PreferenceScreen.class);
- long allowedNetworkTypes = -1;
- doReturn(allowedNetworkTypes).when(mTelephonyManager).getAllowedNetworkTypes();
+ mockEnabledNetworkMode(TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA);
doReturn(mPreference).when(screen).findPreference(KEY);
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID,
@@ -448,4 +334,32 @@
TelephonyManagerConstants.NETWORK_MODE_GSM_ONLY);
assertThat(mPreference.getSummary()).isEqualTo("2G");
}
+
+ private void mockEnabledNetworkMode(int networkMode) {
+ if (networkMode == TelephonyManagerConstants.NETWORK_MODE_TDSCDMA_GSM_WCDMA) {
+ mockPhoneType(TelephonyManager.PHONE_TYPE_GSM);
+ mPersistableBundle.putBoolean(CarrierConfigManager.KEY_SUPPORT_TDSCDMA_BOOL, true);
+ } else if (networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA) {
+ mockPhoneType(TelephonyManager.PHONE_TYPE_GSM);
+ mPersistableBundle.putBoolean(CarrierConfigManager.KEY_PREFER_2G_BOOL, true);
+ mPersistableBundle.putBoolean(CarrierConfigManager.KEY_LTE_ENABLED_BOOL, true);
+ } else if (networkMode == TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA) {
+ mockPhoneType(TelephonyManager.PHONE_TYPE_GSM);
+ mPersistableBundle.putBoolean(CarrierConfigManager.KEY_SUPPORT_TDSCDMA_BOOL, true);
+ }
+ }
+
+ private void mockAllowedNetworkTypes(long allowedNetworkType) {
+ doReturn(allowedNetworkType).when(mTelephonyManager).getAllowedNetworkTypes();
+ }
+
+ private void mockAccessFamily(int networkMode) {
+ doReturn(MobileNetworkUtils.getRafFromNetworkType(networkMode))
+ .when(mTelephonyManager)
+ .getSupportedRadioAccessFamily();
+ }
+
+ private void mockPhoneType(int phoneType) {
+ doReturn(TelephonyManager.PHONE_TYPE_GSM).when(mTelephonyManager).getPhoneType();
+ }
}
diff --git a/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkActivityTest.java b/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkActivityTest.java
index 3641a97..eaa0011 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkActivityTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/MobileNetworkActivityTest.java
@@ -42,7 +42,6 @@
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -121,7 +120,6 @@
}
@Test
- @Ignore
public void updateBottomNavigationView_oneSubscription_shouldNotCrash() {
mSubscriptionManager.setActiveSubscriptionInfos(mSubscriptionInfo1);
@@ -131,7 +129,6 @@
}
@Test
- @Ignore
public void updateBottomNavigationView_twoSubscription_shouldNotCrash() {
mSubscriptionManager.setActiveSubscriptionInfos(mSubscriptionInfo1, mSubscriptionInfo2);
@@ -141,7 +138,6 @@
}
@Test
- @Ignore
public void switchFragment_switchBetweenTwoSubscriptions() {
mSubscriptionManager.setActiveSubscriptionInfos(mSubscriptionInfo1, mSubscriptionInfo2);
@@ -152,12 +148,12 @@
mMobileNetworkActivity.onActivity(activity -> {
final MockMobileNetworkActivity mockActivity = (MockMobileNetworkActivity) activity;
+ mockActivity.switchFragment(mSubscriptionInfo1);
assertThat(mockActivity.mSubscriptionInFragment).isEqualTo(mSubscriptionInfo1);
});
}
@Test
- @Ignore
public void switchFragment_subscriptionsUpdate_notifyByIntent() {
mSubscriptionManager.setActiveSubscriptionInfos(mSubscriptionInfo1, mSubscriptionInfo2);
@@ -168,24 +164,24 @@
mMobileNetworkActivity.onActivity(activity -> {
final MockMobileNetworkActivity mockActivity = (MockMobileNetworkActivity) activity;
+ mockActivity.switchFragment(mSubscriptionInfo1);
assertThat(mockActivity.mSubscriptionInFragment).isEqualTo(mSubscriptionInfo1);
- mSubscriptionManager.setActiveSubscriptionInfos(mSubscriptionInfo2);
mContext.sendBroadcast(new Intent(
CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED), null);
+ mockActivity.switchFragment(mSubscriptionInfo2);
assertThat(mockActivity.mSubscriptionInFragment).isEqualTo(mSubscriptionInfo2);
- mSubscriptionManager.setActiveSubscriptionInfos(mSubscriptionInfo1);
mContext.sendBroadcast(new Intent(
TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED), null);
+ mockActivity.switchFragment(mSubscriptionInfo1);
assertThat(mockActivity.mSubscriptionInFragment).isEqualTo(mSubscriptionInfo1);
});
}
@Test
- @Ignore
public void onSaveInstanceState_saveCurrentSubId() {
mSubscriptionManager.setActiveSubscriptionInfos(mSubscriptionInfo1, mSubscriptionInfo2);
diff --git a/tests/robotests/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.java
index c766289..04fc4b9 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.java
@@ -27,7 +27,6 @@
import android.telephony.CarrierConfigManager;
import android.telephony.TelephonyManager;
import android.telephony.ims.ProvisioningManager;
-import android.telephony.ims.feature.ImsFeature;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference;
@@ -98,7 +97,7 @@
doReturn(true).when(mImsManager).isVtEnabledByPlatform();
mQueryImsState.setIsProvisionedOnDevice(true);
- doReturn(ImsFeature.STATE_READY).when(mImsManager).getImsServiceState();
+ mQueryImsState.setServiceStateReady(true);
doReturn(true).when(mTelephonyManager).isDataEnabled();
mController.mCallState = TelephonyManager.CALL_STATE_IDLE;
diff --git a/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java
index b83ab77..d203c47 100644
--- a/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/app/BlockPreferenceControllerTest.java
@@ -200,7 +200,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannel channel = new NotificationChannel("", "", IMPORTANCE_DEFAULT);
- channel.setBlockableSystem(true);
+ channel.setBlockable(true);
mController.onResume(appRow, channel, null, null, null, null);
mController.updateState(mPreference);
assertTrue(mSwitch.isEnabled());
diff --git a/tests/robotests/src/com/android/settings/notification/app/ImportantConversationBubblePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/ImportantConversationBubblePreferenceControllerTest.java
deleted file mode 100644
index c99e095..0000000
--- a/tests/robotests/src/com/android/settings/notification/app/ImportantConversationBubblePreferenceControllerTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2020 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.notification.app;
-
-import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
-import static android.provider.Settings.Secure.BUBBLE_IMPORTANT_CONVERSATIONS;
-
-import static com.android.settings.core.BasePreferenceController.AVAILABLE;
-import static com.android.settings.core.BasePreferenceController.DISABLED_DEPENDENT_SETTING;
-import static com.android.settings.notification.app.ImportantConversationBubblePreferenceController.OFF;
-import static com.android.settings.notification.app.ImportantConversationBubblePreferenceController.ON;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.provider.Settings;
-
-import androidx.preference.PreferenceScreen;
-import androidx.preference.TwoStatePreference;
-
-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.RobolectricTestRunner;
-
-@RunWith(RobolectricTestRunner.class)
-public class ImportantConversationBubblePreferenceControllerTest {
-
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private Context mContext;
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private PreferenceScreen mScreen;
-
- private ImportantConversationBubblePreferenceController mController;
- @Mock
- private TwoStatePreference mPreference;
-
- private static final String KEY = "important_bubble";
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mController = new ImportantConversationBubblePreferenceController(mContext, KEY);
- when(mPreference.getKey()).thenReturn(mController.getPreferenceKey());
- when(mScreen.findPreference(mPreference.getKey())).thenReturn(mPreference);
- }
-
- @Test
- public void testGetAvailabilityStatus_globallyOn() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON);
-
- assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
- }
-
- @Test
- public void testGetAvailabilityStatus_globallyOff() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, OFF);
-
- assertThat(mController.getAvailabilityStatus()).isEqualTo(DISABLED_DEPENDENT_SETTING);
- }
-
- @Test
- public void updateState_preferenceSetCheckedWhenSettingIsOn() {
- Settings.Secure.putInt(mContext.getContentResolver(), BUBBLE_IMPORTANT_CONVERSATIONS, ON);
-
- mController.updateState(mPreference);
-
- verify(mPreference).setChecked(true);
- }
-
- @Test
- public void updateState_preferenceSetUncheckedWhenSettingIsOff() {
- Settings.Secure.putInt(mContext.getContentResolver(), BUBBLE_IMPORTANT_CONVERSATIONS, OFF);
-
- mController.updateState(mPreference);
-
- verify(mPreference).setChecked(false);
- }
-
- @Test
- public void isChecked_settingIsOff_shouldReturnFalse() {
- Settings.Secure.putInt(mContext.getContentResolver(), BUBBLE_IMPORTANT_CONVERSATIONS, OFF);
-
- assertThat(mController.isChecked()).isFalse();
- }
-
- @Test
- public void isChecked_settingIsOn_shouldReturnTrue() {
- Settings.Secure.putInt(mContext.getContentResolver(), BUBBLE_IMPORTANT_CONVERSATIONS, ON);
-
- assertThat(mController.isChecked()).isTrue();
- }
-
- @Test
- public void setChecked_setFalse_disablesSetting() {
- Settings.Secure.putInt(mContext.getContentResolver(), BUBBLE_IMPORTANT_CONVERSATIONS, ON);
-
- mController.setChecked(false);
- int updatedValue = Settings.Secure.getInt(mContext.getContentResolver(),
- BUBBLE_IMPORTANT_CONVERSATIONS, -1);
-
- assertThat(updatedValue).isEqualTo(OFF);
- }
-
- @Test
- public void setChecked_setTrue_enablesSetting() {
- Settings.Secure.putInt(mContext.getContentResolver(), BUBBLE_IMPORTANT_CONVERSATIONS, OFF);
-
- mController.setChecked(true);
- int updatedValue = Settings.Secure.getInt(mContext.getContentResolver(),
- BUBBLE_IMPORTANT_CONVERSATIONS, -1);
-
- assertThat(updatedValue).isEqualTo(ON);
- }
-
- @Test
- public void isSliceable_returnsFalse() {
- assertThat(mController.isSliceable()).isFalse();
- }
-}
diff --git a/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java
index 170a5e0..259f40e 100644
--- a/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/app/NotificationPreferenceControllerTest.java
@@ -236,7 +236,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = false;
NotificationChannel channel = mock(NotificationChannel.class);
- when(channel.isBlockableSystem()).thenReturn(false);
+ when(channel.isBlockable()).thenReturn(false);
mController.onResume(appRow, channel, null, null, null, null);
assertTrue(mController.isChannelBlockable());
@@ -247,7 +247,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannel channel = mock(NotificationChannel.class);
- when(channel.isBlockableSystem()).thenReturn(false);
+ when(channel.isBlockable()).thenReturn(false);
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
mController.onResume(appRow, channel, null, null, null, null);
@@ -259,7 +259,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannel channel = mock(NotificationChannel.class);
- when(channel.isBlockableSystem()).thenReturn(true);
+ when(channel.isBlockable()).thenReturn(true);
mController.onResume(appRow, channel, null, null, null, null);
assertTrue(mController.isChannelBlockable());
@@ -270,7 +270,7 @@
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = true;
NotificationChannel channel = mock(NotificationChannel.class);
- when(channel.isBlockableSystem()).thenReturn(false);
+ when(channel.isBlockable()).thenReturn(false);
when(channel.getImportance()).thenReturn(IMPORTANCE_NONE);
mController.onResume(appRow, channel, null, null, null, null);
diff --git a/tests/robotests/src/com/android/settings/panel/FakePanelContent.java b/tests/robotests/src/com/android/settings/panel/FakePanelContent.java
index 4d91f52..bf2ac0d 100644
--- a/tests/robotests/src/com/android/settings/panel/FakePanelContent.java
+++ b/tests/robotests/src/com/android/settings/panel/FakePanelContent.java
@@ -42,6 +42,7 @@
public static final Intent INTENT = new Intent();
+ private CharSequence mTitle = TITLE;
private CharSequence mSubTitle;
private IconCompat mIcon;
private int mViewType;
@@ -51,22 +52,26 @@
return mIcon;
}
+ public void setIcon(IconCompat icon) {
+ mIcon = icon;
+ }
+
@Override
public CharSequence getSubTitle() {
return mSubTitle;
}
- public void setIcon(IconCompat icon) {
- mIcon = icon;
- }
-
public void setSubTitle(CharSequence subTitle) {
mSubTitle = subTitle;
}
@Override
public CharSequence getTitle() {
- return TITLE;
+ return mTitle;
+ }
+
+ public void setTitle(CharSequence title) {
+ mTitle = title;
}
@Override
diff --git a/tests/robotests/src/com/android/settings/panel/MediaOutputPanelTest.java b/tests/robotests/src/com/android/settings/panel/MediaOutputPanelTest.java
index b95c9d0..43cecfe 100644
--- a/tests/robotests/src/com/android/settings/panel/MediaOutputPanelTest.java
+++ b/tests/robotests/src/com/android/settings/panel/MediaOutputPanelTest.java
@@ -22,6 +22,7 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -30,6 +31,7 @@
import android.media.MediaMetadata;
import android.media.session.MediaController;
import android.media.session.MediaSessionManager;
+import android.media.session.PlaybackState;
import android.net.Uri;
import com.android.settings.R;
@@ -41,6 +43,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
@@ -62,15 +65,18 @@
private MediaController mMediaController;
@Mock
private MediaMetadata mMediaMetadata;
-
@Mock
private LocalMediaManager mLocalMediaManager;
@Mock
private PanelContentCallback mCallback;
+ @Mock
+ private PlaybackState mPlaybackState;
private MediaOutputPanel mPanel;
private Context mContext;
private List<MediaController> mMediaControllers = new ArrayList<>();
+ private ArgumentCaptor<MediaController.Callback> mControllerCbs =
+ ArgumentCaptor.forClass(MediaController.Callback.class);
@Before
public void setUp() {
@@ -112,6 +118,7 @@
public void onStart_shouldRegisterCallback() {
mPanel.onStart();
+ verify(mMediaController).registerCallback(any());
verify(mLocalMediaManager).registerCallback(any());
verify(mLocalMediaManager).startScan();
}
@@ -167,6 +174,7 @@
@Test
public void getTitle_withMetadata_returnArtistName() {
+ mPanel.onStart();
when(mMediaMetadata.getString(MediaMetadata.METADATA_KEY_ARTIST)).thenReturn(TEST_ARTIST);
when(mMediaController.getMetadata()).thenReturn(mMediaMetadata);
@@ -201,6 +209,7 @@
@Test
public void getSubTitle_withMetadata_returnAlbumName() {
+ mPanel.onStart();
when(mMediaMetadata.getString(MediaMetadata.METADATA_KEY_ALBUM)).thenReturn(TEST_ALBUM);
when(mMediaController.getMetadata()).thenReturn(mMediaMetadata);
@@ -243,4 +252,30 @@
verify(mLocalMediaManager).releaseSession();
}
+
+ @Test
+ public void onMetadataChanged_verifyCallOnHeaderChanged() {
+ mPanel.onStart();
+ verify(mMediaController).registerCallback(mControllerCbs.capture());
+ final MediaController.Callback controllerCallbacks = mControllerCbs.getValue();
+
+ controllerCallbacks.onMetadataChanged(mMediaMetadata);
+
+ verify(mCallback).onHeaderChanged();
+ }
+
+ @Test
+ public void onPlaybackStateChanged_stateFromPlayingToStopped_verifyCallForceClose() {
+ mPanel.onStart();
+ verify(mMediaController).registerCallback(mControllerCbs.capture());
+ final MediaController.Callback controllerCallbacks = mControllerCbs.getValue();
+ when(mPlaybackState.getState()).thenReturn(PlaybackState.STATE_PLAYING);
+ controllerCallbacks.onPlaybackStateChanged(mPlaybackState);
+ verify(mCallback, never()).forceClose();
+
+ when(mPlaybackState.getState()).thenReturn(PlaybackState.STATE_STOPPED);
+ controllerCallbacks.onPlaybackStateChanged(mPlaybackState);
+
+ verify(mCallback).forceClose();
+ }
}
diff --git a/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java b/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
index 1976557..9df5af1 100644
--- a/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
@@ -23,6 +23,7 @@
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import android.app.settings.SettingsEnums;
import android.content.Context;
@@ -41,6 +42,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
@@ -51,7 +53,10 @@
@RunWith(RobolectricTestRunner.class)
public class PanelFragmentTest {
+ private static final String TITLE = "title";
+ private static final String TITLE2 = "title2";
private static final String SUBTITLE = "subtitle";
+ private static final String SUBTITLE2 = "subtitle2";
private Context mContext;
private PanelFragment mPanelFragment;
@@ -59,6 +64,8 @@
private FakeFeatureFactory mFakeFeatureFactory;
private PanelFeatureProvider mPanelFeatureProvider;
private FakePanelContent mFakePanelContent;
+ private ArgumentCaptor<PanelContentCallback> mPanelContentCbs = ArgumentCaptor.forClass(
+ PanelContentCallback.class);
private final String FAKE_EXTRA = "fake_extra";
@@ -69,9 +76,11 @@
mPanelFeatureProvider = spy(new PanelFeatureProviderImpl());
mFakeFeatureFactory = FakeFeatureFactory.setupForTest();
mFakeFeatureFactory.panelFeatureProvider = mPanelFeatureProvider;
- mFakePanelContent = new FakePanelContent();
+ mFakePanelContent = spy(new FakePanelContent());
doReturn(mFakePanelContent).when(mPanelFeatureProvider).getPanel(any(), any());
+ }
+ private void initFakeActivity() {
mActivity = spy(Robolectric.buildActivity(FakeSettingsPanelActivity.class).setup().get());
mPanelFragment =
@@ -86,6 +95,7 @@
@Test
public void onCreateView_countdownLatch_setup() {
+ initFakeActivity();
mPanelFragment.onCreateView(LayoutInflater.from(mContext),
new LinearLayout(mContext), null);
PanelSlicesLoaderCountdownLatch countdownLatch =
@@ -99,6 +109,7 @@
@Test
public void onCreate_logsOpenEvent() {
+ initFakeActivity();
verify(mFakeFeatureFactory.metricsFeatureProvider).action(
0,
SettingsEnums.PAGE_VISIBLE,
@@ -109,6 +120,7 @@
@Test
public void onDestroy_logCloseEvent() {
+ initFakeActivity();
mPanelFragment.onDestroyView();
verify(mFakeFeatureFactory.metricsFeatureProvider).action(
0,
@@ -120,6 +132,7 @@
@Test
public void panelSeeMoreClick_logsCloseEvent() {
+ initFakeActivity();
final View.OnClickListener listener = mPanelFragment.getSeeMoreListener();
listener.onClick(null);
verify(mActivity).finish();
@@ -136,6 +149,7 @@
@Test
public void panelDoneClick_logsCloseEvent() {
+ initFakeActivity();
final View.OnClickListener listener = mPanelFragment.getCloseListener();
listener.onClick(null);
verify(mActivity).finish();
@@ -178,10 +192,62 @@
@Test
public void notSupportIcon_displayDefaultHeaderLayout() {
- final View titleView = mPanelFragment.mLayoutView.findViewById(R.id.panel_title);
- final View panelHeader = mPanelFragment.mLayoutView.findViewById(R.id.panel_header);
+ final ActivityController<FakeSettingsPanelActivity> activityController =
+ Robolectric.buildActivity(FakeSettingsPanelActivity.class);
+ activityController.setup();
+ final PanelFragment panelFragment = (PanelFragment)
+ Objects.requireNonNull(activityController
+ .get()
+ .getSupportFragmentManager()
+ .findFragmentById(R.id.main_content));
+
+ final View titleView = panelFragment.mLayoutView.findViewById(R.id.panel_title);
+ final View panelHeader = panelFragment.mLayoutView.findViewById(R.id.panel_header);
assertThat(panelHeader.getVisibility()).isEqualTo(View.GONE);
assertThat(titleView.getVisibility()).isEqualTo(View.VISIBLE);
}
+
+ @Test
+ public void onHeaderChanged_updateHeader_verifyTitle() {
+ mFakePanelContent.setIcon(IconCompat.createWithResource(mContext, R.drawable.ic_android));
+ mFakePanelContent.setTitle(TITLE);
+ mFakePanelContent.setSubTitle(SUBTITLE);
+ final ActivityController<FakeSettingsPanelActivity> activityController =
+ Robolectric.buildActivity(FakeSettingsPanelActivity.class);
+ activityController.setup();
+ final PanelFragment panelFragment = (PanelFragment)
+ Objects.requireNonNull(activityController
+ .get()
+ .getSupportFragmentManager()
+ .findFragmentById(R.id.main_content));
+ final TextView headerTitle = panelFragment.mLayoutView.findViewById(R.id.header_title);
+ final TextView headerSubtitle = panelFragment.mLayoutView.findViewById(
+ R.id.header_subtitle);
+
+ assertThat(headerTitle.getText()).isEqualTo(TITLE);
+ assertThat(headerSubtitle.getText()).isEqualTo(SUBTITLE);
+
+ mFakePanelContent.setTitle(TITLE2);
+ mFakePanelContent.setSubTitle(SUBTITLE2);
+ verify(mFakePanelContent).registerCallback(mPanelContentCbs.capture());
+ final PanelContentCallback panelContentCallbacks = mPanelContentCbs.getValue();
+ panelContentCallbacks.onHeaderChanged();
+
+ assertThat(headerTitle.getText()).isEqualTo(TITLE2);
+ assertThat(headerSubtitle.getText()).isEqualTo(SUBTITLE2);
+ }
+
+ @Test
+ public void forceClose_verifyFinish() {
+ initFakeActivity();
+ verify(mFakePanelContent).registerCallback(mPanelContentCbs.capture());
+ final PanelContentCallback panelContentCallbacks = spy(mPanelContentCbs.getValue());
+ when(((PanelFragment.LocalPanelCallback) panelContentCallbacks).getFragmentActivity())
+ .thenReturn(mActivity);
+
+ panelContentCallbacks.forceClose();
+
+ verify(mActivity).finish();
+ }
}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java b/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java
index 1bdadb2..6b3fdf4 100644
--- a/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java
+++ b/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java
@@ -46,6 +46,7 @@
import com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment;
import com.android.settings.search.SearchFeatureProvider;
import com.android.settings.testutils.shadow.ShadowLockPatternUtils;
+import com.android.settings.testutils.shadow.ShadowPersistentDataBlockManager;
import com.android.settings.testutils.shadow.ShadowStorageManager;
import com.android.settings.testutils.shadow.ShadowUserManager;
import com.android.settings.testutils.shadow.ShadowUtils;
@@ -63,6 +64,7 @@
@Config(
shadows = {
ShadowLockPatternUtils.class,
+ ShadowPersistentDataBlockManager.class,
ShadowStorageManager.class,
ShadowUserManager.class,
ShadowUtils.class
@@ -82,11 +84,13 @@
public void tearDown() {
Global.putInt(application.getContentResolver(), Global.DEVICE_PROVISIONED, 1);
ShadowStorageManager.reset();
+ ShadowPersistentDataBlockManager.reset();
}
@Test
- public void onCreate_deviceNotProvisioned_shouldFinishActivity() {
+ public void onCreate_deviceNotProvisioned_persistentDataExists_shouldFinishActivity() {
Global.putInt(application.getContentResolver(), Global.DEVICE_PROVISIONED, 0);
+ ShadowPersistentDataBlockManager.setDataBlockSize(1000);
initActivity(null);
assertThat(mActivity.isFinishing()).isTrue();
@@ -191,7 +195,18 @@
}
@Test
- public void updatePreferencesOrFinish_callingAppIsAdmin_footerInvisible() {
+ public void updatePreferencesOrFinish_callingAppIsAdmin_deviceProvisioned_footerInvisible() {
+ initActivity(new Intent().putExtra(EXTRA_KEY_IS_CALLING_APP_ADMIN, true));
+
+ mFragment.updatePreferencesOrFinish(/* isRecreatingActivity= */ false);
+
+ FooterPreference footer = mFragment.findPreference(KEY_LOCK_SETTINGS_FOOTER);
+ assertThat(footer.isVisible()).isFalse();
+ }
+
+ @Test
+ public void updatePreferencesOrFinish_callingAppIsAdmin_deviceNotProvisioned_footerInvisible() {
+ Global.putInt(application.getContentResolver(), Global.DEVICE_PROVISIONED, 0);
initActivity(new Intent().putExtra(EXTRA_KEY_IS_CALLING_APP_ADMIN, true));
mFragment.updatePreferencesOrFinish(/* isRecreatingActivity= */ false);
diff --git a/tests/robotests/src/com/android/settings/password/SetNewPasswordActivityTest.java b/tests/robotests/src/com/android/settings/password/SetNewPasswordActivityTest.java
index 04a2157..b36af98 100644
--- a/tests/robotests/src/com/android/settings/password/SetNewPasswordActivityTest.java
+++ b/tests/robotests/src/com/android/settings/password/SetNewPasswordActivityTest.java
@@ -45,6 +45,8 @@
import com.android.settings.testutils.shadow.ShadowPasswordUtils;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
+import com.google.android.setupcompat.util.WizardManagerHelper;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -111,6 +113,7 @@
activity.launchChooseLock(new Bundle());
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
Intent intent = getLaunchChooseLockIntent(shadowActivity);
+ intent.putExtra(WizardManagerHelper.EXTRA_IS_FIRST_RUN, true);
assertThat(intent.getComponent())
.isEqualTo(new ComponentName(activity, SetupChooseLockGeneric.class));
diff --git a/tests/robotests/src/com/android/settings/search/SettingsSearchIndexablesProviderTest.java b/tests/robotests/src/com/android/settings/search/SettingsSearchIndexablesProviderTest.java
index 0db684e..c9bff38 100644
--- a/tests/robotests/src/com/android/settings/search/SettingsSearchIndexablesProviderTest.java
+++ b/tests/robotests/src/com/android/settings/search/SettingsSearchIndexablesProviderTest.java
@@ -6,6 +6,7 @@
import static org.mockito.Mockito.spy;
import android.Manifest;
+import android.content.pm.ActivityInfo;
import android.content.pm.ProviderInfo;
import android.database.Cursor;
import android.net.Uri;
@@ -13,6 +14,8 @@
import com.android.settings.R;
import com.android.settings.testutils.FakeFeatureFactory;
+import com.android.settingslib.drawer.ActivityTile;
+import com.android.settingslib.drawer.CategoryKey;
import com.android.settingslib.search.SearchIndexableData;
import org.junit.After;
@@ -29,7 +32,8 @@
@RunWith(RobolectricTestRunner.class)
public class SettingsSearchIndexablesProviderTest {
- private static final String BASE_AUTHORITY = "com.android.settings";
+ private static final String PACKAGE_NAME = "com.android.settings";
+ private static final String BASE_AUTHORITY = "content://" + PACKAGE_NAME + "/";
private SettingsSearchIndexablesProvider mProvider;
private FakeFeatureFactory mFakeFeatureFactory;
@@ -40,7 +44,7 @@
ProviderInfo info = new ProviderInfo();
info.exported = true;
info.grantUriPermissions = true;
- info.authority = BASE_AUTHORITY;
+ info.authority = PACKAGE_NAME;
info.readPermission = Manifest.permission.READ_SEARCH_INDEXABLES;
mProvider.attachInfo(RuntimeEnvironment.application, info);
@@ -60,8 +64,7 @@
@Test
public void testRawColumnFetched() {
- Uri rawUri = Uri.parse("content://" + BASE_AUTHORITY + "/" +
- SearchIndexablesContract.INDEXABLES_RAW_PATH);
+ Uri rawUri = Uri.parse(BASE_AUTHORITY + SearchIndexablesContract.INDEXABLES_RAW_PATH);
final Cursor cursor = mProvider.query(rawUri,
SearchIndexablesContract.INDEXABLES_RAW_COLUMNS, null, null, null);
@@ -83,8 +86,7 @@
@Test
public void testResourcesColumnFetched() {
- Uri rawUri = Uri.parse("content://" + BASE_AUTHORITY + "/" +
- SearchIndexablesContract.INDEXABLES_XML_RES_PATH);
+ Uri rawUri = Uri.parse(BASE_AUTHORITY + SearchIndexablesContract.INDEXABLES_XML_RES_PATH);
final Cursor cursor = mProvider.query(rawUri,
SearchIndexablesContract.INDEXABLES_XML_RES_COLUMNS, null, null, null);
@@ -102,8 +104,8 @@
@Test
@Config(qualifiers = "mcc999")
public void testNonIndexablesColumnFetched() {
- final Uri rawUri = Uri.parse("content://" + BASE_AUTHORITY + "/" +
- SearchIndexablesContract.NON_INDEXABLES_KEYS_PATH);
+ final Uri rawUri = Uri.parse(
+ BASE_AUTHORITY + SearchIndexablesContract.NON_INDEXABLES_KEYS_PATH);
final List<String> keys = new ArrayList<>();
@@ -117,4 +119,37 @@
assertThat(keys).hasSize(3);
assertThat(keys).containsAllOf("pref_key_1", "pref_key_3", "pref_key_5");
}
+
+ @Test
+ public void testIsEligibleForIndexing_isSettingsInjectedItem_ShouldBeFalse() {
+ final ActivityInfo activityInfo = new ActivityInfo();
+ activityInfo.packageName = PACKAGE_NAME;
+ activityInfo.name = "class";
+ final ActivityTile activityTile = new ActivityTile(activityInfo,
+ CategoryKey.CATEGORY_SYSTEM);
+
+ assertThat(mProvider.isEligibleForIndexing(PACKAGE_NAME, activityTile)).isFalse();
+ }
+
+ @Test
+ public void testIsEligibleForIndexing_isHomepageInjectedItem_ShouldBeFalse() {
+ final ActivityInfo activityInfo = new ActivityInfo();
+ activityInfo.packageName = "pkg";
+ activityInfo.name = "class";
+ final ActivityTile activityTile = new ActivityTile(activityInfo,
+ CategoryKey.CATEGORY_HOMEPAGE);
+
+ assertThat(mProvider.isEligibleForIndexing(PACKAGE_NAME, activityTile)).isFalse();
+ }
+
+ @Test
+ public void testIsEligibleForIndexing_normalInjectedItem_ShouldBeTrue() {
+ final ActivityInfo activityInfo = new ActivityInfo();
+ activityInfo.packageName = "pkg";
+ activityInfo.name = "class";
+ final ActivityTile activityTile = new ActivityTile(activityInfo,
+ CategoryKey.CATEGORY_CONNECT);
+
+ assertThat(mProvider.isEligibleForIndexing(PACKAGE_NAME, activityTile)).isTrue();
+ }
}
diff --git a/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java
index 89be17a..0ab4256 100644
--- a/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java
@@ -103,7 +103,7 @@
setupMockIcc();
final PersistableBundle pb = new PersistableBundle();
pb.putBoolean(CarrierConfigManager.KEY_HIDE_SIM_LOCK_SETTINGS_BOOL, true);
- when(mCarrierManager.getConfig()).thenReturn(pb);
+ when(mCarrierManager.getConfigForSubId(anyInt())).thenReturn(pb);
assertThat(mController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.DISABLED_FOR_USER);
@@ -114,7 +114,7 @@
when(mUserManager.isAdminUser()).thenReturn(true);
setupMockIcc();
final PersistableBundle pb = new PersistableBundle();
- when(mCarrierManager.getConfig()).thenReturn(pb);
+ when(mCarrierManager.getConfigForSubId(anyInt())).thenReturn(pb);
assertThat(mController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.AVAILABLE);
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPersistentDataBlockManager.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPersistentDataBlockManager.java
new file mode 100644
index 0000000..dbbdd3d
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPersistentDataBlockManager.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2020 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.testutils.shadow;
+
+import android.service.persistentdata.PersistentDataBlockManager;
+
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+import org.robolectric.annotation.Resetter;
+
+@Implements(PersistentDataBlockManager.class)
+public class ShadowPersistentDataBlockManager {
+ private static int sDataBlockSize = 0;
+
+ @Resetter
+ public static void reset() {
+ sDataBlockSize = 0;
+ }
+
+ @Implementation
+ protected int getDataBlockSize() {
+ return sDataBlockSize;
+ }
+
+ public static void setDataBlockSize(int dataBlockSize) {
+ sDataBlockSize = dataBlockSize;
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/wallpaper/StyleSuggestionActivityTest.java b/tests/robotests/src/com/android/settings/wallpaper/StyleSuggestionActivityTest.java
index 72f9c62..120c780 100644
--- a/tests/robotests/src/com/android/settings/wallpaper/StyleSuggestionActivityTest.java
+++ b/tests/robotests/src/com/android/settings/wallpaper/StyleSuggestionActivityTest.java
@@ -28,7 +28,6 @@
import com.android.settings.testutils.shadow.ShadowSecureSettings;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -61,7 +60,6 @@
}
@Test
- @Ignore
@Config(shadows = ShadowSecureSettings.class)
public void hasStyleSet_yes_shouldReturnTrue() {
when(mResources.getBoolean(com.android.internal.R.bool.config_enableWallpaperService))
@@ -73,7 +71,6 @@
}
@Test
- @Ignore
@Config(shadows = ShadowSecureSettings.class)
public void hasStyleSet_no_shouldReturnFalse() {
when(mResources.getBoolean(com.android.internal.R.bool.config_enableWallpaperService))
diff --git a/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
index 720ad20..46b582f 100644
--- a/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
@@ -32,7 +32,6 @@
import android.view.TextureView;
import android.view.View;
import android.widget.ImageView;
-import android.widget.LinearLayout;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceViewHolder;
@@ -61,8 +60,6 @@
private ImageView fakePreview;
@Mock
private ImageView fakePlayButton;
- @Mock
- private LinearLayout mAnimationView;
private Context mContext;
private VideoPreference mVideoPreference;
@@ -77,7 +74,6 @@
new MediaAnimationController(mContext, R.raw.accessibility_screen_magnification));
mVideoPreference = new VideoPreference(mContext, null /* attrs */);
mVideoPreference.mAnimationController = mAnimationController;
- mVideoPreference.mAnimationView = mAnimationView;
when(mAnimationController.getVideoWidth()).thenReturn(VIDEO_WIDTH);
when(mAnimationController.getVideoHeight()).thenReturn(VIDEO_HEIGHT);
@@ -162,13 +158,6 @@
assertThat(vp2.mAnimationController instanceof VectorAnimationController).isTrue();
}
- @Test
- public void setBackgroundColor_shouldBeCalled() {
- mVideoPreference.setBackgroundColor(1111);
-
- assertThat(mVideoPreference.mBackgroundResId).isEqualTo(1111);
- }
-
public static class TestFragment extends PreferenceFragmentCompat {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
diff --git a/tests/robotests/src/com/android/settings/wifi/ConfigureWifiEntryFragmentTest.java b/tests/robotests/src/com/android/settings/wifi/ConfigureWifiEntryFragmentTest.java
index 1f0c312..ce9d10c 100644
--- a/tests/robotests/src/com/android/settings/wifi/ConfigureWifiEntryFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/ConfigureWifiEntryFragmentTest.java
@@ -24,21 +24,17 @@
import android.app.settings.SettingsEnums;
import android.os.Bundle;
-import com.android.settings.testutils.shadow.ShadowConnectivityManager;
+import com.android.wifitrackerlib.NetworkDetailsTracker;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
-import org.robolectric.annotation.Config;
import org.robolectric.shadows.androidx.fragment.FragmentController;
-// TODO(b/70983952): Can't test because b/146802959, should remove @Ignore tag after it's fixed.
-@Ignore
@RunWith(RobolectricTestRunner.class)
-@Config(shadows = ShadowConnectivityManager.class)
public class ConfigureWifiEntryFragmentTest {
private static final String KEY_SSID = "key_ssid";
@@ -46,6 +42,9 @@
private ConfigureWifiEntryFragment mConfigureWifiEntryFragment;
+ @Mock
+ private NetworkDetailsTracker mNetworkDetailsTracker;
+
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
@@ -55,6 +54,8 @@
bundle.putInt(KEY_SECURITY, 1 /* WEP */);
mConfigureWifiEntryFragment = spy(new ConfigureWifiEntryFragment());
mConfigureWifiEntryFragment.setArguments(bundle);
+ mConfigureWifiEntryFragment.mNetworkDetailsTracker = mNetworkDetailsTracker;
+
FragmentController.setupFragment(mConfigureWifiEntryFragment);
}
diff --git a/tests/robotests/src/com/android/settings/wifi/UseOpenWifiPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/UseOpenWifiPreferenceControllerTest.java
index beaa1a6..ca636a4 100644
--- a/tests/robotests/src/com/android/settings/wifi/UseOpenWifiPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/UseOpenWifiPreferenceControllerTest.java
@@ -39,7 +39,6 @@
import android.provider.Settings;
import androidx.fragment.app.Fragment;
-import androidx.preference.Preference;
import androidx.preference.SwitchPreference;
import com.android.settings.R;
@@ -144,6 +143,19 @@
}
@Test
+ public void isAvailable_disableUseOpenWifiComponentBetweenCalls_returnsTrueThenReturnsFalse() {
+ setupScorers(Lists.newArrayList(sAppData));
+ createController();
+
+ assertThat(mController.isAvailable()).isTrue();
+
+ // Update NetworkScorerAppData so that it no longer has openWifiActivity.
+ setupScorers(Lists.newArrayList(sAppDataNoActivity));
+
+ assertThat(mController.isAvailable()).isFalse();
+ }
+
+ @Test
public void setChecked_withTrue_enableShouldStartEnableActivity() {
setupScorers(Lists.newArrayList(sAppData, sAppDataNoActivity));
createController();
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java
index bf2261a..7835f7e 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java
@@ -19,10 +19,12 @@
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import android.app.settings.SettingsEnums;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.wifi.SoftApConfiguration;
@@ -31,6 +33,7 @@
import androidx.preference.PreferenceScreen;
import com.android.settings.widget.ValidatedEditTextPreference;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import org.junit.Before;
import org.junit.Test;
@@ -46,6 +49,7 @@
private static final String VALID_PASS = "12345678";
private static final String VALID_PASS2 = "23456789";
+ private static final String INITIAL_PASSWORD = "test_password";
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private Context mContext;
@Mock
@@ -56,6 +60,8 @@
private WifiTetherBasePreferenceController.OnTetherConfigUpdateListener mListener;
@Mock
private PreferenceScreen mScreen;
+ @Mock
+ private MetricsFeatureProvider mMetricsFeatureProvider;
private WifiTetherPasswordPreferenceController mController;
private ValidatedEditTextPreference mPreference;
@@ -66,7 +72,8 @@
MockitoAnnotations.initMocks(this);
mPreference = new ValidatedEditTextPreference(RuntimeEnvironment.application);
mConfig = new SoftApConfiguration.Builder().setSsid("test_1234")
- .setPassphrase("test_password", SoftApConfiguration.SECURITY_TYPE_WPA2_PSK).build();
+ .setPassphrase(INITIAL_PASSWORD, SoftApConfiguration.SECURITY_TYPE_WPA2_PSK)
+ .build();
when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
when(mWifiManager.getSoftApConfiguration()).thenReturn(mConfig);
@@ -76,7 +83,8 @@
when(mContext.getResources()).thenReturn(RuntimeEnvironment.application.getResources());
when(mScreen.findPreference(anyString())).thenReturn(mPreference);
- mController = new WifiTetherPasswordPreferenceController(mContext, mListener);
+ mController = new WifiTetherPasswordPreferenceController(mContext, mListener,
+ mMetricsFeatureProvider);
}
@Test
@@ -102,6 +110,22 @@
}
@Test
+ public void changePreference_shouldLogActionWhenChanged() {
+ mController.displayPreference(mScreen);
+ mController.onPreferenceChange(mPreference, VALID_PASS);
+ verify(mMetricsFeatureProvider).action(mContext,
+ SettingsEnums.ACTION_SETTINGS_CHANGE_WIFI_HOTSPOT_PASSWORD);
+ }
+
+ @Test
+ public void changePreference_shouldNotLogActionWhenNotChanged() {
+ mController.displayPreference(mScreen);
+ mController.onPreferenceChange(mPreference, INITIAL_PASSWORD);
+ verify(mMetricsFeatureProvider, never()).action(mContext,
+ SettingsEnums.ACTION_SETTINGS_CHANGE_WIFI_HOTSPOT_PASSWORD);
+ }
+
+ @Test
public void updateDisplay_shouldUpdateValue() {
// Set controller password to anything and verify is set.
mController.displayPreference(mScreen);
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceControllerTest.java
index fc38088..a6a9dda 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceControllerTest.java
@@ -19,10 +19,12 @@
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import android.app.settings.SettingsEnums;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.wifi.SoftApConfiguration;
@@ -30,6 +32,8 @@
import androidx.preference.PreferenceScreen;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -52,6 +56,8 @@
private WifiTetherBasePreferenceController.OnTetherConfigUpdateListener mListener;
@Mock
private PreferenceScreen mScreen;
+ @Mock
+ private MetricsFeatureProvider mMetricsFeatureProvider;
private WifiTetherSSIDPreferenceController mController;
private WifiTetherSsidPreference mPreference;
@@ -67,8 +73,8 @@
when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"});
when(mContext.getResources()).thenReturn(RuntimeEnvironment.application.getResources());
when(mScreen.findPreference(anyString())).thenReturn(mPreference);
-
- mController = new WifiTetherSSIDPreferenceController(mContext, mListener);
+ mController = new WifiTetherSSIDPreferenceController(mContext, mListener,
+ mMetricsFeatureProvider);
}
@Test
@@ -103,6 +109,23 @@
}
@Test
+ public void changePreference_shouldLogActionWhenChanged() {
+ mController.displayPreference(mScreen);
+ mController.onPreferenceChange(mPreference, "1");
+ verify(mMetricsFeatureProvider).action(mContext,
+ SettingsEnums.ACTION_SETTINGS_CHANGE_WIFI_HOTSPOT_NAME);
+ }
+
+ @Test
+ public void changePreference_shouldNotLogActionWhenNotChanged() {
+ mController.displayPreference(mScreen);
+ mController.onPreferenceChange(mPreference,
+ WifiTetherSSIDPreferenceController.DEFAULT_SSID);
+ verify(mMetricsFeatureProvider, never()).action(mContext,
+ SettingsEnums.ACTION_SETTINGS_CHANGE_WIFI_HOTSPOT_NAME);
+ }
+
+ @Test
public void updateDisplay_shouldUpdateValue() {
// Set controller ssid to anything and verify is set.
mController.displayPreference(mScreen);
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
index e501689..e996b2d 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
@@ -33,11 +33,13 @@
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
+import android.util.FeatureFlagUtils;
import android.widget.TextView;
import androidx.fragment.app.FragmentActivity;
import androidx.preference.PreferenceScreen;
+import com.android.settings.core.FeatureFlags;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.shadow.ShadowFragment;
import com.android.settings.testutils.shadow.ShadowWifiManager;
@@ -83,6 +85,7 @@
@Test
public void wifiTetherNonIndexableKeys_tetherAvailable_keysNotReturned() {
+ FeatureFlagUtils.setEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE, false);
// To let TetherUtil.isTetherAvailable return true, select one of the combinations
setupIsTetherAvailable(true);