Snap for 11533280 from ea341bdf98 to 24Q3-release

Change-Id: If804bc9f19451c14dc639a5090ee84e7bcd775eb
This commit is contained in:
Android Build Coastguard Worker
2024-03-06 00:20:54 +00:00
50 changed files with 898 additions and 543 deletions

View File

@@ -653,7 +653,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/layout/battery_tips_card.xml"
line="57"
line="58"
column="13"/>
</issue>
@@ -669,7 +669,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/layout/battery_tips_card.xml"
line="57"
line="58"
column="13"/>
</issue>
@@ -1577,11 +1577,11 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;screen_flash_color_button_outer_circle_stroke_color&quot;>#FFFFFF&lt;/color>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
errorLine1=" &lt;color name=&quot;battery_good_color_light&quot;>#43a047&lt;/color> &lt;!-- Material Green 600 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-night/colors.xml"
line="74"
file="res/values/colors.xml"
line="75"
column="5"/>
</issue>
@@ -1593,11 +1593,11 @@
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" &lt;color name=&quot;battery_good_color_light&quot;>#43a047&lt;/color> &lt;!-- Material Green 600 -->"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
errorLine1=" &lt;color name=&quot;screen_flash_color_button_outer_circle_stroke_color&quot;>#FFFFFF&lt;/color>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="75"
file="res/values-night/colors.xml"
line="76"
column="5"/>
</issue>
@@ -1629,7 +1629,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-night/colors.xml"
line="77"
line="79"
column="5"/>
</issue>
@@ -2269,7 +2269,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="141"
line="143"
column="5"/>
</issue>
@@ -2285,7 +2285,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="142"
line="144"
column="5"/>
</issue>
@@ -2301,7 +2301,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="143"
line="145"
column="5"/>
</issue>
@@ -2317,7 +2317,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="144"
line="146"
column="5"/>
</issue>
@@ -2333,7 +2333,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="146"
line="148"
column="5"/>
</issue>
@@ -2349,7 +2349,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="148"
line="150"
column="5"/>
</issue>
@@ -2365,7 +2365,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="151"
line="153"
column="5"/>
</issue>
@@ -2381,7 +2381,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="154"
line="156"
column="5"/>
</issue>
@@ -2397,7 +2397,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="155"
line="157"
column="5"/>
</issue>
@@ -2413,7 +2413,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="156"
line="158"
column="5"/>
</issue>
@@ -2429,7 +2429,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="157"
line="159"
column="5"/>
</issue>
@@ -2445,7 +2445,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="158"
line="160"
column="5"/>
</issue>
@@ -2461,7 +2461,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="173"
line="175"
column="5"/>
</issue>
@@ -2477,7 +2477,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="174"
line="176"
column="5"/>
</issue>
@@ -2493,7 +2493,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="177"
line="179"
column="5"/>
</issue>
@@ -2509,7 +2509,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="178"
line="180"
column="5"/>
</issue>
@@ -2525,7 +2525,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="180"
line="182"
column="5"/>
</issue>
@@ -2541,7 +2541,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="181"
line="183"
column="5"/>
</issue>
@@ -2557,7 +2557,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="182"
line="184"
column="5"/>
</issue>
@@ -2573,7 +2573,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="183"
line="185"
column="5"/>
</issue>
@@ -2589,7 +2589,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="187"
line="189"
column="5"/>
</issue>
@@ -2605,7 +2605,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="188"
line="190"
column="5"/>
</issue>
@@ -2621,7 +2621,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="191"
line="193"
column="5"/>
</issue>
@@ -2637,7 +2637,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="192"
line="194"
column="5"/>
</issue>
@@ -2653,7 +2653,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="193"
line="195"
column="5"/>
</issue>
@@ -2669,7 +2669,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="194"
line="196"
column="5"/>
</issue>
@@ -2685,7 +2685,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="195"
line="197"
column="5"/>
</issue>
@@ -2701,7 +2701,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="196"
line="198"
column="5"/>
</issue>
@@ -2717,7 +2717,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="197"
line="199"
column="5"/>
</issue>
@@ -2733,7 +2733,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="198"
line="200"
column="5"/>
</issue>
@@ -2749,7 +2749,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="199"
line="201"
column="5"/>
</issue>
@@ -2765,7 +2765,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="200"
line="202"
column="5"/>
</issue>
@@ -2781,7 +2781,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="201"
line="203"
column="5"/>
</issue>
@@ -2797,7 +2797,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="202"
line="204"
column="5"/>
</issue>
@@ -2813,7 +2813,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="205"
line="207"
column="5"/>
</issue>
@@ -2829,7 +2829,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="206"
line="208"
column="5"/>
</issue>
@@ -2845,7 +2845,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="207"
line="209"
column="5"/>
</issue>
@@ -2861,7 +2861,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="208"
line="210"
column="5"/>
</issue>
@@ -2877,7 +2877,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="209"
line="211"
column="5"/>
</issue>
@@ -2893,7 +2893,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="210"
line="212"
column="5"/>
</issue>
@@ -2909,7 +2909,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="211"
line="213"
column="5"/>
</issue>
@@ -2925,7 +2925,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="212"
line="214"
column="5"/>
</issue>
@@ -2941,7 +2941,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="213"
line="215"
column="5"/>
</issue>
@@ -2957,7 +2957,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="214"
line="216"
column="5"/>
</issue>
@@ -2973,7 +2973,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="215"
line="217"
column="5"/>
</issue>
@@ -2989,7 +2989,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="216"
line="218"
column="5"/>
</issue>
@@ -3005,7 +3005,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/colors.xml"
line="219"
line="221"
column="5"/>
</issue>
@@ -3937,6 +3937,22 @@
column="13"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
category="Correctness"
priority="4"
summary="Using hardcoded color"
explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
errorLine1=" android:color=&quot;@color/accessibility_feature_background&quot;/>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/drawable/ic_color_contrast.xml"
line="22"
column="13"/>
</issue>
<issue
id="HardCodedColor"
severity="Error"
@@ -6125,7 +6141,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="944"
line="943"
column="43"/>
</issue>
@@ -6141,7 +6157,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="944"
line="943"
column="43"/>
</issue>
@@ -6157,7 +6173,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="945"
line="944"
column="49"/>
</issue>
@@ -6173,7 +6189,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="945"
line="944"
column="49"/>
</issue>
@@ -6189,7 +6205,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="946"
line="945"
column="54"/>
</issue>
@@ -6205,7 +6221,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="946"
line="945"
column="54"/>
</issue>
@@ -6221,7 +6237,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="947"
line="946"
column="47"/>
</issue>
@@ -6237,7 +6253,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="947"
line="946"
column="47"/>
</issue>
@@ -6253,7 +6269,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="948"
line="947"
column="51"/>
</issue>
@@ -6269,7 +6285,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="948"
line="947"
column="51"/>
</issue>
@@ -6285,7 +6301,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="949"
line="948"
column="63"/>
</issue>
@@ -6301,7 +6317,7 @@
errorLine2=" ^">
<location
file="res/values/styles.xml"
line="949"
line="948"
column="63"/>
</issue>

View File

@@ -1,25 +0,0 @@
<!--
Copyright (C) 2023 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M120,840L120,780L780,780Q780,780 780,780Q780,780 780,780L780,120L840,120L840,780Q840,804.75 822.38,822.38Q804.75,840 780,840L120,840ZM599.91,670Q571,670 550.5,649.41Q530,628.82 530,599.91Q530,571 550.59,550.5Q571.18,530 600.09,530Q629,530 649.5,550.59Q670,571.18 670,600.09Q670,629 649.41,649.5Q628.82,670 599.91,670ZM220,480L220,420L378,420L119,161L161,119L420,378L420,220L480,220L480,480L220,480Z"/>
</vector>

View File

@@ -1,25 +0,0 @@
<!--
Copyright (C) 2022 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M407,635Q430,658 473.5,656.5Q517,655 537,624L753,285L418,504Q388,524 386,568Q384,612 407,635ZM478,161Q535,161 597,179.5Q659,198 716,243L664,280Q619,250 567.5,235.5Q516,221 477.98,221Q337.51,221 238.75,321.21Q140,421.43 140,563.98Q140,609 152.5,655Q165,701 188,740L767,740Q789,704 802,656Q815,608 815,562Q815,520 802.5,471.5Q790,423 758,382L797,330Q835,386 854,442.5Q873,499 875,556Q877,616 863,669Q849,722 822,767Q810,790 796.5,795Q783,800 763,800L192,800Q175,800 158.5,791.5Q142,783 134,767Q108,719 94,669.5Q80,620 80,564Q80,481 111.5,407.5Q143,334 197,279.5Q251,225 323.68,193Q396.36,161 478,161ZM469,492L469,492Q469,492 469,492Q469,492 469,492Q469,492 469,492Q469,492 469,492Q469,492 469,492Q469,492 469,492L469,492L469,492L469,492Q469,492 469,492Q469,492 469,492Q469,492 469,492Q469,492 469,492Z"/>
</vector>

View File

@@ -1,25 +0,0 @@
<!--
Copyright (C) 2022 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M16.1,25.5V9.7L10.1,15.7L8,13.6L17.65,3.95L27.3,13.6L25.2,15.7L19.1,9.65V25.5ZM30.35,43.95 L20.7,34.25 22.8,32.2 28.8,38.2V22.4H31.8V38.25L37.9,32.2L40,34.3Z"/>
</vector>

View File

@@ -1,25 +0,0 @@
<!--
Copyright (C) 2022 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M23.25,2Q27.8,2 31.025,5.175Q34.25,8.35 34.25,12.9Q34.25,15.5 33.125,17.8Q32,20.1 29.95,21.7H28.25V19.2Q29.7,18.05 30.475,16.4Q31.25,14.75 31.25,12.9Q31.25,9.6 28.9,7.3Q26.55,5 23.25,5Q19.95,5 17.6,7.3Q15.25,9.6 15.25,12.9Q15.25,14.75 16.025,16.4Q16.8,18.05 18.25,19.2V22.8Q15.45,21.35 13.85,18.7Q12.25,16.05 12.25,12.9Q12.25,8.35 15.475,5.175Q18.7,2 23.25,2ZM21.35,44Q20.5,44 19.75,43.675Q19,43.35 18.45,42.8L8.15,32.5L10.95,29.6Q11.65,28.9 12.525,28.525Q13.4,28.15 14.35,28.4L18.25,29.3V13Q18.25,10.9 19.7,9.45Q21.15,8 23.25,8Q25.35,8 26.8,9.45Q28.25,10.9 28.25,13V21.6H29.55Q29.8,21.6 30,21.7Q30.2,21.8 30.45,21.9L37.85,25.5Q39.05,26.05 39.625,27.275Q40.2,28.5 39.95,29.8L38.15,40.7Q37.9,42.15 36.75,43.075Q35.6,44 34.15,44ZM20.95,41H35L37.15,28.55Q37.15,28.55 37.15,28.55Q37.15,28.55 37.15,28.55L28,24H25.25V13Q25.25,12.1 24.7,11.55Q24.15,11 23.25,11Q22.35,11 21.8,11.55Q21.25,12.1 21.25,13V32.95L13.55,31.3L12.4,32.45ZM35,41H20.95H21.25Q21.25,41 21.8,41Q22.35,41 23.25,41Q24.15,41 24.7,41Q25.25,41 25.25,41H28H35Q35,41 35,41Q35,41 35,41Z"/>
</vector>

View File

@@ -1,25 +0,0 @@
<!--
Copyright (C) 2022 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="48"
android:viewportHeight="48"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M40.15,47 L38.2,43.1 34.3,41.15 38.2,39.3 40.15,35.3 42,39.3 46,41.15 42,43.1ZM28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4Q28.5,31.4 28.5,31.4ZM23.05,48H30.4L29.75,45H23.05Q22,45 20.975,44.8Q19.95,44.6 19.25,43.9L6.5,30.65L7.85,29.4L19.75,35.85V9.15Q19.75,8.6 20.1,8.25Q20.45,7.9 21,7.9Q21.55,7.9 21.9,8.25Q22.25,8.6 22.25,9.15V24H26V4.25Q26,3.7 26.35,3.35Q26.7,3 27.25,3Q27.8,3 28.15,3.35Q28.5,3.7 28.5,4.25V24H32.25V6.1Q32.25,5.55 32.6,5.2Q32.95,4.85 33.5,4.85Q34.05,4.85 34.4,5.2Q34.75,5.55 34.75,6.1V24H38.5V12.45Q38.5,11.9 38.85,11.55Q39.2,11.2 39.75,11.2Q40.3,11.2 40.65,11.55Q41,11.9 41,12.45V31.4H44V12.45Q44,10.7 42.75,9.45Q41.5,8.2 39.75,8.2Q39.2,8.2 38.675,8.3Q38.15,8.4 37.75,8.75V6.45Q37.75,4.55 36.525,3.2Q35.3,1.85 33.5,1.85Q32.85,1.85 32.25,2.025Q31.65,2.2 31.1,2.6Q30.65,1.4 29.625,0.7Q28.6,0 27.3,0Q25.55,0 24.275,1.25Q23,2.5 23,4.25V5.55Q22.6,5.2 22.075,5.05Q21.55,4.9 21,4.9Q19.25,4.9 18,6.15Q16.75,7.4 16.75,9.15V30.95L8.85,26.5Q8,26.05 7.1,26.325Q6.2,26.6 5.5,27.25L2,30.3L16.85,45.7Q18.05,46.95 19.675,47.475Q21.3,48 23.05,48ZM6.85,14.8 L5.15,11.15 1.5,9.45 5.15,7.75 6.85,4.1 8.55,7.7 12.2,9.6 8.6,11.15Z"/>
</vector>

View File

@@ -34,8 +34,7 @@
android:paddingStart="@dimen/search_bar_padding_start"
android:paddingEnd="@dimen/search_bar_padding_end"
android:background="@drawable/search_bar_selected_background"
android:focusable="true"
android:focusableInTouchMode="true"
android:touchscreenBlocksFocus="false"
android:nextFocusForward="@+id/homepage_container"
android:contentInsetStartWithNavigation="@dimen/search_bar_content_inset"
android:navigationIcon="@drawable/ic_homepage_search">

View File

@@ -29,8 +29,7 @@
android:paddingStart="@dimen/search_bar_padding_start_two_pane"
android:paddingEnd="@dimen/search_bar_padding_end_two_pane"
android:background="@drawable/search_bar_selected_background"
android:focusable="true"
android:focusableInTouchMode="true"
android:touchscreenBlocksFocus="false"
android:nextFocusForward="@+id/homepage_container"
android:contentInsetStartWithNavigation="@dimen/search_bar_content_inset"
android:navigationIcon="@drawable/ic_homepage_search">

View File

@@ -3562,6 +3562,8 @@
<!-- [CHAR LIMIT=30] Title for managed profile location switch -->
<string name="managed_profile_location_switch_title">Location for work profile</string>
<!-- [CHAR LIMIT=60] Title for private profile location switch -->
<string name="private_profile_location_switch_title">Location for private space</string>
<!-- [CHAR LIMIT=30] Location settings screen. It's a link that directs the user to a page that
shows the location permission setting for each installed app -->
<string name="location_app_level_permissions">App location permissions</string>
@@ -4375,6 +4377,8 @@
<!-- Title text for 'Tap to click'. [CHAR LIMIT=35] -->
<string name="trackpad_tap_to_click">Tap to click</string>
<!-- TODO(b/321978150): mark as translatable once we have finalized text from UX. -->
<string name="trackpad_tap_dragging" translatable="false">Tap dragging</string>
<!-- Title text for 'Touchpad gestures' [CHAR LIMIT=35] -->
<string name="trackpad_touchpad_gesture_title">Touchpad gestures</string>
<!-- Summary text for 'Touchpad gestures' [CHAR LIMIT=60] -->
@@ -4478,8 +4482,14 @@
<!-- Summary for the modifier key picker dialog page [CHAR LIMIT=35] -->
<string name="modifier_keys_picker_summary">Choose a new key for <xliff:g id="modifier_key_default_name">%1$s</xliff:g>:</string>
<!-- Title text for per IME subtype keyboard layout. [CHAR LIMIT=35] -->
<string name="ime_label_title"><xliff:g id="ime_label" example="Gboard">%s</xliff:g> layout</string>
<!-- Summary text for keyboards when no layout has been selected. [CHAR LIMIT=35] -->
<string name="default_keyboard_layout">Default</string>
<!-- Summary text for keyboards when a layout is automatically selected. [CHAR LIMIT=35] -->
<string name="automatic_keyboard_layout_label">Automatic: <xliff:g id="layout_label" example="English(US)">%s</xliff:g></string>
<!-- Summary text for keyboards when a layout is user selected. [CHAR LIMIT=35] -->
<string name="user_selected_keyboard_layout_label">User selected: <xliff:g id="layout_label" example="English(US)">%s</xliff:g></string>
<!-- Title for the 'Speech' preference category. [CHAR LIMIT=45] -->
<string name="speech_category_title">Speech</string>

View File

@@ -18,66 +18,68 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto">
<PreferenceCategory
android:key="@string/accessibility_shortcut_description_pref">
<Preference
android:key="@string/accessibility_shortcut_description_pref"
android:persistent="false"
android:selectable="false"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"/>
<com.android.settings.accessibility.shortcuts.ShortcutOptionPreference
android:key="@string/accessibility_shortcut_fab_pref"
android:persistent="false"
android:selectable="true"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"
settings:controller="com.android.settings.accessibility.shortcuts.FloatingButtonShortcutOptionController" />
<com.android.settings.accessibility.shortcuts.ShortcutOptionPreference
android:key="@string/accessibility_shortcut_fab_pref"
android:persistent="false"
android:selectable="true"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"
settings:controller="com.android.settings.accessibility.shortcuts.FloatingButtonShortcutOptionController" />
<com.android.settings.accessibility.shortcuts.ShortcutOptionPreference
android:key="@string/accessibility_shortcut_gesture_pref"
android:persistent="false"
android:selectable="true"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"
settings:controller="com.android.settings.accessibility.shortcuts.GestureShortcutOptionController" />
<com.android.settings.accessibility.shortcuts.ShortcutOptionPreference
android:key="@string/accessibility_shortcut_gesture_pref"
android:persistent="false"
android:selectable="true"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"
settings:controller="com.android.settings.accessibility.shortcuts.GestureShortcutOptionController" />
<com.android.settings.accessibility.shortcuts.ShortcutOptionPreference
android:key="@string/accessibility_shortcut_nav_button_pref"
android:persistent="false"
android:selectable="true"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"
settings:controller="com.android.settings.accessibility.shortcuts.NavButtonShortcutOptionController" />
<com.android.settings.accessibility.shortcuts.ShortcutOptionPreference
android:key="@string/accessibility_shortcut_nav_button_pref"
android:persistent="false"
android:selectable="true"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"
settings:controller="com.android.settings.accessibility.shortcuts.NavButtonShortcutOptionController" />
<com.android.settings.accessibility.shortcuts.ShortcutOptionPreference
android:key="@string/accessibility_shortcut_volume_keys_pref"
android:persistent="false"
android:selectable="true"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"
settings:controller="com.android.settings.accessibility.shortcuts.VolumeKeysShortcutOptionController" />
<com.android.settings.accessibility.shortcuts.ShortcutOptionPreference
android:key="@string/accessibility_shortcut_volume_keys_pref"
android:persistent="false"
android:selectable="true"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"
settings:controller="com.android.settings.accessibility.shortcuts.VolumeKeysShortcutOptionController" />
<com.android.settings.accessibility.shortcuts.ShortcutOptionPreference
android:key="@string/accessibility_shortcut_two_fingers_double_tap_pref"
android:persistent="false"
android:selectable="true"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"
settings:controller="com.android.settings.accessibility.shortcuts.TwoFingersDoubleTapShortcutOptionController" />
<com.android.settings.accessibility.shortcuts.ShortcutOptionPreference
android:key="@string/accessibility_shortcut_two_fingers_double_tap_pref"
android:persistent="false"
android:selectable="true"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"
settings:controller="com.android.settings.accessibility.shortcuts.TwoFingersDoubleTapShortcutOptionController" />
<Preference
android:icon="@drawable/ic_keyboard_arrow_down"
android:key="@string/accessibility_shortcuts_advanced_collapsed"
android:persistent="false"
android:selectable="true"
android:title="@string/accessibility_shortcut_edit_dialog_title_advance"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"
settings:controller="com.android.settings.accessibility.shortcuts.AdvancedShortcutsPreferenceController" />
<com.android.settings.accessibility.shortcuts.ShortcutOptionPreference
android:key="@string/accessibility_shortcut_triple_tap_pref"
android:persistent="false"
android:selectable="true"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"
settings:controller="com.android.settings.accessibility.shortcuts.TripleTapShortcutOptionController" />
</PreferenceCategory>
<Preference
android:icon="@drawable/ic_keyboard_arrow_down"
android:key="@string/accessibility_shortcuts_advanced_collapsed"
android:persistent="false"
android:selectable="true"
android:title="@string/accessibility_shortcut_edit_dialog_title_advance"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"
settings:controller="com.android.settings.accessibility.shortcuts.AdvancedShortcutsPreferenceController" />
<com.android.settings.accessibility.shortcuts.ShortcutOptionPreference
android:key="@string/accessibility_shortcut_triple_tap_pref"
android:persistent="false"
android:selectable="true"
settings:allowDividerAbove="false"
settings:allowDividerBelow="false"
settings:controller="com.android.settings.accessibility.shortcuts.TripleTapShortcutOptionController" />
</PreferenceScreen>

View File

@@ -49,6 +49,14 @@
settings:forWork="true"
settings:useAdminDisabledSummary="true"/>
<!-- This preference gets removed if there is no private profile -->
<com.android.settingslib.RestrictedSwitchPreference
android:enabled="false"
android:key="private_profile_location_switch"
android:selectable="true"
android:title="@string/private_profile_location_switch_title"
settings:controller="com.android.settings.location.LocationForPrivateProfilePreferenceController"/>
<!-- This preference category gets removed if new_recent_location_ui is disabled -->
<Preference
android:key="app_level_permissions"

View File

@@ -23,7 +23,6 @@
android:key="trackpad_gesture_settings"
android:title="@string/trackpad_touchpad_gesture_title"
android:summary="@string/trackpad_touchpad_gesture_summary"
android:icon="@drawable/ic_trackpad_touch_gestures_normal"
android:order="-10"
android:fragment="com.android.settings.inputmethod.TrackpadTouchGestureSettings"
settings:controller="com.android.settings.inputmethod.TrackpadTouchGestureSettingsController"/>
@@ -31,7 +30,6 @@
<SwitchPreferenceCompat
android:key="trackpad_tap_to_click"
android:title="@string/trackpad_tap_to_click"
android:icon="@drawable/ic_trackpad_tap_to_click"
settings:controller="com.android.settings.inputmethod.TrackpadTapToClickPreferenceController"
android:order="10"/>
@@ -39,7 +37,6 @@
android:key="trackpad_reverse_scrolling"
android:title="@string/trackpad_reverse_scrolling_title"
android:summary="@string/trackpad_reverse_scrolling_summary"
android:icon="@drawable/ic_trackpad_reverse_scrolling"
settings:controller="com.android.settings.inputmethod.TrackpadReverseScrollingPreferenceController"
android:order="20"/>
@@ -47,15 +44,20 @@
android:key="trackpad_bottom_right_tap"
android:title="@string/trackpad_bottom_right_tap_title"
android:summary="@string/trackpad_bottom_right_tap_summary"
android:icon="@drawable/ic_trackpad_bottom_right_click"
settings:controller="com.android.settings.inputmethod.TrackpadBottomPreferenceController"
android:order="30"
settings:keywords="@string/keywords_trackpad_bottom_right_tap"/>
<!-- TODO(b/321978150): add a summary line once we have finalized text from UX. -->
<SwitchPreferenceCompat
android:key="trackpad_tap_dragging"
android:title="@string/trackpad_tap_dragging"
settings:controller="com.android.settings.inputmethod.TrackpadTapDraggingPreferenceController"
android:order="35"/>
<com.android.settings.widget.SeekBarPreference
android:key="trackpad_pointer_speed"
android:title="@string/trackpad_pointer_speed"
android:icon="@drawable/ic_trackpad_pointer_speed"
android:order="40"
android:selectable="false"
settings:controller="com.android.settings.inputmethod.TrackpadPointerSpeedPreferenceController"/>
@@ -63,6 +65,5 @@
<com.android.settingslib.widget.ButtonPreference
android:key="trackpad_touch_gesture"
android:title="@string/trackpad_touch_gesture"
android:icon="@drawable/ic_trackpad_touch_gestures_inverse"
settings:controller="com.android.settings.inputmethod.TouchGesturesButtonPreferenceController"/>
</PreferenceScreen>

View File

@@ -22,12 +22,6 @@ import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
import android.content.Context;
import android.provider.Settings;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.preference.PreferenceScreen;
import androidx.preference.TwoStatePreference;
import com.android.settings.R;
import com.android.settings.core.TogglePreferenceController;
@@ -36,15 +30,12 @@ import com.android.settings.core.TogglePreferenceController;
* feature, where the magnifier will not deactivate on Activity transitions; it will only zoom out
* to 100%.
*/
public class MagnificationAlwaysOnPreferenceController extends TogglePreferenceController
implements LifecycleObserver {
public class MagnificationAlwaysOnPreferenceController extends TogglePreferenceController {
private static final String TAG =
MagnificationAlwaysOnPreferenceController.class.getSimpleName();
static final String PREF_KEY = Settings.Secure.ACCESSIBILITY_MAGNIFICATION_ALWAYS_ON_ENABLED;
private TwoStatePreference mSwitchPreference;
public MagnificationAlwaysOnPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
}
@@ -71,24 +62,4 @@ public class MagnificationAlwaysOnPreferenceController extends TogglePreferenceC
public int getSliceHighlightMenuRes() {
return R.string.menu_key_accessibility;
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mSwitchPreference = screen.findPreference(getPreferenceKey());
}
// TODO(b/186731461): Remove it when this controller is used in DashBoardFragment only.
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
void onResume() {
updateState();
}
/**
* Updates the state of preference components which has been displayed by
* {@link MagnificationAlwaysOnPreferenceController#displayPreference}.
*/
void updateState() {
updateState(mSwitchPreference);
}
}

View File

@@ -22,25 +22,16 @@ import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
import android.content.Context;
import android.provider.Settings;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.preference.PreferenceScreen;
import androidx.preference.TwoStatePreference;
import com.android.settings.R;
import com.android.settings.core.TogglePreferenceController;
/** Controller that accesses and switches the preference status of following typing feature */
public class MagnificationFollowTypingPreferenceController extends TogglePreferenceController
implements LifecycleObserver {
public class MagnificationFollowTypingPreferenceController extends TogglePreferenceController {
private static final String TAG =
MagnificationFollowTypingPreferenceController.class.getSimpleName();
static final String PREF_KEY = "magnification_follow_typing";
private TwoStatePreference mFollowTypingPreference;
public MagnificationFollowTypingPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
}
@@ -67,24 +58,4 @@ public class MagnificationFollowTypingPreferenceController extends TogglePrefere
public int getSliceHighlightMenuRes() {
return R.string.menu_key_accessibility;
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mFollowTypingPreference = screen.findPreference(getPreferenceKey());
}
// TODO(b/186731461): Remove it when this controller is used in DashBoardFragment only.
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
void onResume() {
updateState();
}
/**
* Updates the state of preference components which has been displayed by
* {@link MagnificationFollowTypingPreferenceController#displayPreference}.
*/
void updateState() {
updateState(mFollowTypingPreference);
}
}

View File

@@ -22,27 +22,18 @@ import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
import android.content.Context;
import android.provider.Settings;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.preference.PreferenceScreen;
import androidx.preference.TwoStatePreference;
import com.android.settings.R;
import com.android.settings.core.TogglePreferenceController;
/**
* Controller that accesses and switches the preference status of the magnification joystick feature
*/
public class MagnificationJoystickPreferenceController extends TogglePreferenceController
implements LifecycleObserver {
public class MagnificationJoystickPreferenceController extends TogglePreferenceController {
private static final String TAG =
MagnificationJoystickPreferenceController.class.getSimpleName();
static final String PREF_KEY = Settings.Secure.ACCESSIBILITY_MAGNIFICATION_JOYSTICK_ENABLED;
private TwoStatePreference mSwitchPreference;
public MagnificationJoystickPreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
}
@@ -69,24 +60,4 @@ public class MagnificationJoystickPreferenceController extends TogglePreferenceC
public int getSliceHighlightMenuRes() {
return R.string.menu_key_accessibility;
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mSwitchPreference = screen.findPreference(getPreferenceKey());
}
// TODO(b/186731461): Remove it when this controller is used in DashBoardFragment only.
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
void onResume() {
updateState();
}
/**
* Updates the state of preference components which has been displayed by
* {@link MagnificationJoystickPreferenceController#displayPreference}.
*/
void updateState() {
updateState(mSwitchPreference);
}
}

View File

@@ -47,7 +47,6 @@ import com.android.settings.core.BasePreferenceController;
import com.android.settings.utils.AnnotationSpan;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnCreate;
import com.android.settingslib.core.lifecycle.events.OnResume;
import com.android.settingslib.core.lifecycle.events.OnSaveInstanceState;
import java.util.ArrayList;
@@ -55,7 +54,7 @@ import java.util.List;
/** Controller that shows the magnification area mode summary and the preference click behavior. */
public class MagnificationModePreferenceController extends BasePreferenceController implements
DialogCreatable, LifecycleObserver, OnCreate, OnResume, OnSaveInstanceState {
DialogCreatable, LifecycleObserver, OnCreate, OnSaveInstanceState {
static final String PREF_KEY = "screen_magnification_mode";
private static final int DIALOG_ID_BASE = 10;
@@ -297,12 +296,6 @@ public class MagnificationModePreferenceController extends BasePreferenceControl
updateCapabilitiesAndSummary(mModeCache);
}
// TODO(b/186731461): Remove it when this controller is used in DashBoardFragment only.
@Override
public void onResume() {
updateState(mModePreference);
}
/**
* An interface to help the delegate to show the dialog. It will be injected to the delegate.
*/

View File

@@ -206,22 +206,9 @@ public class ToggleScreenMagnificationPreferenceFragment extends
magnificationModePreferenceController.setDialogHelper(this);
getSettingsLifecycle().addObserver(magnificationModePreferenceController);
magnificationModePreferenceController.displayPreference(getPreferenceScreen());
addPreferenceController(magnificationModePreferenceController);
mFollowingTypingSwitchPreference = new SwitchPreferenceCompat(getPrefContext());
mFollowingTypingSwitchPreference.setTitle(
R.string.accessibility_screen_magnification_follow_typing_title);
mFollowingTypingSwitchPreference.setSummary(
R.string.accessibility_screen_magnification_follow_typing_summary);
mFollowingTypingSwitchPreference.setKey(
MagnificationFollowTypingPreferenceController.PREF_KEY);
generalCategory.addPreference(mFollowingTypingSwitchPreference);
mFollowTypingPreferenceController = new MagnificationFollowTypingPreferenceController(
getContext(), MagnificationFollowTypingPreferenceController.PREF_KEY);
getSettingsLifecycle().addObserver(mFollowTypingPreferenceController);
mFollowTypingPreferenceController.displayPreference(getPreferenceScreen());
addPreferenceController(mFollowTypingPreferenceController);
addFollowTypingSetting(generalCategory);
addAlwaysOnSetting(generalCategory);
addJoystickSetting(generalCategory);
}
@@ -250,6 +237,22 @@ public class ToggleScreenMagnificationPreferenceFragment extends
super.onProcessArguments(arguments);
}
private void addFollowTypingSetting(PreferenceCategory generalCategory) {
var followTypingSwitchPreference = new SwitchPreferenceCompat(getPrefContext());
followTypingSwitchPreference.setTitle(
R.string.accessibility_screen_magnification_follow_typing_title);
followTypingSwitchPreference.setSummary(
R.string.accessibility_screen_magnification_follow_typing_summary);
followTypingSwitchPreference.setKey(
MagnificationFollowTypingPreferenceController.PREF_KEY);
generalCategory.addPreference(followTypingSwitchPreference);
var followTypingPreferenceController = new MagnificationFollowTypingPreferenceController(
getContext(), MagnificationFollowTypingPreferenceController.PREF_KEY);
followTypingPreferenceController.displayPreference(getPreferenceScreen());
addPreferenceController(followTypingPreferenceController);
}
private boolean isAlwaysOnSettingEnabled() {
final boolean defaultValue = getContext().getResources().getBoolean(
com.android.internal.R.bool.config_magnification_always_on_enabled);
@@ -276,7 +279,6 @@ public class ToggleScreenMagnificationPreferenceFragment extends
var alwaysOnPreferenceController = new MagnificationAlwaysOnPreferenceController(
getContext(), MagnificationAlwaysOnPreferenceController.PREF_KEY);
getSettingsLifecycle().addObserver(alwaysOnPreferenceController);
alwaysOnPreferenceController.displayPreference(getPreferenceScreen());
addPreferenceController(alwaysOnPreferenceController);
}
@@ -304,7 +306,6 @@ public class ToggleScreenMagnificationPreferenceFragment extends
getContext(),
MagnificationJoystickPreferenceController.PREF_KEY
);
getSettingsLifecycle().addObserver(joystickPreferenceController);
joystickPreferenceController.displayPreference(getPreferenceScreen());
addPreferenceController(joystickPreferenceController);
}

View File

@@ -207,9 +207,9 @@ public class EditShortcutsPreferenceFragment extends DashboardFragment {
activity.setTitle(titles.first);
String categoryKey = activity.getResources().getString(
String screenDescriptionPrefKey = getString(
R.string.accessibility_shortcut_description_pref);
findPreference(categoryKey).setTitle(titles.second);
findPreference(screenDescriptionPrefKey).setSummary(titles.second);
}
@NonNull

View File

@@ -39,7 +39,6 @@ import com.android.settings.Settings;
import com.android.settings.SettingsActivity;
import com.android.settings.SubSettings;
import com.android.settings.biometrics.face.FaceEnrollIntroduction;
import com.android.settings.biometrics.face.FaceEnrollIntroductionInternal;
import com.android.settings.biometrics.fingerprint.FingerprintEnrollEnrolling;
import com.android.settings.biometrics.fingerprint.FingerprintEnrollIntroduction;
import com.android.settings.biometrics.fingerprint.FingerprintEnrollIntroductionInternal;
@@ -260,7 +259,6 @@ public class ActivityEmbeddingRulesController {
addActivityFilter(activityFilters, FingerprintEnrollIntroduction.class);
addActivityFilter(activityFilters, FingerprintEnrollIntroductionInternal.class);
addActivityFilter(activityFilters, FingerprintEnrollEnrolling.class);
addActivityFilter(activityFilters, FaceEnrollIntroductionInternal.class);
addActivityFilter(activityFilters, FaceEnrollIntroduction.class);
addActivityFilter(activityFilters, RemoteAuthActivity.class);
addActivityFilter(activityFilters, RemoteAuthActivityInternal.class);

View File

@@ -17,7 +17,6 @@
package com.android.settings.applications.credentials;
import android.os.UserManager;
import android.util.Slog;
import com.android.settings.Utils;
import com.android.settings.dashboard.profileselector.ProfileSelectFragment.ProfileType;
@@ -33,13 +32,6 @@ public class DefaultCombinedPickerPrivate extends DefaultCombinedPicker {
/** Returns whether the user is handled by this fragment. */
public static boolean isUserHandledByFragment(UserManager userManager) {
try {
// If there is no private profile then this will throw an exception.
Utils.getCurrentUserIdOfType(userManager, ProfileType.PRIVATE);
return true;
} catch (IllegalStateException e) {
Slog.e(TAG, "Failed to get private profile user id", e);
return false;
}
return android.os.Flags.allowPrivateProfile() && userManager.isPrivateProfile();
}
}

View File

@@ -156,7 +156,7 @@ class ThreadNetworkPreferenceController @VisibleForTesting constructor(
return true
}
override fun onStateChanged(lifecycleOwner: LifecycleOwner, event: Lifecycle.Event) {
override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
if (threadController == null) {
return
}

View File

@@ -21,6 +21,7 @@ import android.content.Context;
import android.hardware.input.InputDeviceIdentifier;
import android.hardware.input.InputManager;
import android.hardware.input.KeyboardLayout;
import android.hardware.input.KeyboardLayoutSelectionResult;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
@@ -180,7 +181,7 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
mapLanguageWithLayout(info, subtype);
}
}
updatePreferenceLayout(preferenceScreen, info);
updatePreferenceLayout(preferenceScreen, info, infoList.size() > 1);
}
}
@@ -189,14 +190,15 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
KeyboardLayout[] keyboardLayouts =
NewKeyboardSettingsUtils.getKeyboardLayouts(
mIm, mUserId, mInputDeviceIdentifier, info, subtype);
String layout = NewKeyboardSettingsUtils.getKeyboardLayout(
KeyboardLayoutSelectionResult result = NewKeyboardSettingsUtils.getKeyboardLayout(
mIm, mUserId, mInputDeviceIdentifier, info, subtype);
if (layout != null) {
if (result.getLayoutDescriptor() != null) {
for (int i = 0; i < keyboardLayouts.length; i++) {
if (keyboardLayouts[i].getDescriptor().equals(layout)) {
if (keyboardLayouts[i].getDescriptor().equals(result.getLayoutDescriptor())) {
KeyboardInfo keyboardInfo = new KeyboardInfo(
subtypeLabel,
keyboardLayouts[i].getLabel(),
result.getSelectionCriteria(),
info,
subtype);
mKeyboardInfoList.add(keyboardInfo);
@@ -208,18 +210,22 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
KeyboardInfo keyboardInfo = new KeyboardInfo(
subtypeLabel,
mContext.getString(R.string.keyboard_default_layout),
KeyboardLayoutSelectionResult.LAYOUT_SELECTION_CRITERIA_UNSPECIFIED,
info,
subtype);
mKeyboardInfoList.add(keyboardInfo);
}
}
private void updatePreferenceLayout(PreferenceScreen preferenceScreen, InputMethodInfo info) {
private void updatePreferenceLayout(PreferenceScreen preferenceScreen, InputMethodInfo info,
boolean hasMultipleImes) {
if (mKeyboardInfoList.isEmpty()) {
return;
}
PreferenceCategory preferenceCategory = new PreferenceCategory(mContext);
preferenceCategory.setTitle(info.loadLabel(mContext.getPackageManager()));
preferenceCategory.setTitle(hasMultipleImes ? mContext.getString(R.string.ime_label_title,
info.loadLabel(mContext.getPackageManager()))
: mContext.getString(R.string.enabled_locales_keyboard_layout));
preferenceCategory.setKey(info.getPackageName());
preferenceScreen.addPreference(preferenceCategory);
Collections.sort(mKeyboardInfoList, new Comparator<KeyboardInfo>() {
@@ -234,7 +240,7 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
final Preference pref = new Preference(mContext);
pref.setKey(keyboardInfo.getPrefId());
pref.setTitle(keyboardInfo.getSubtypeLabel());
pref.setSummary(keyboardInfo.getLayout());
pref.setSummary(keyboardInfo.getLayoutSummaryText(mContext));
pref.setOnPreferenceClickListener(
preference -> {
showKeyboardLayoutPicker(

View File

@@ -21,6 +21,7 @@ import android.content.Context;
import android.hardware.input.InputDeviceIdentifier;
import android.hardware.input.InputManager;
import android.hardware.input.KeyboardLayout;
import android.hardware.input.KeyboardLayoutSelectionResult;
import android.os.Bundle;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
@@ -201,13 +202,13 @@ public class NewKeyboardLayoutPickerController extends BasePreferenceController
private String getSelectedLayoutLabel() {
String label = mContext.getString(R.string.keyboard_default_layout);
String layout = NewKeyboardSettingsUtils.getKeyboardLayout(
KeyboardLayoutSelectionResult result = NewKeyboardSettingsUtils.getKeyboardLayout(
mIm, mUserId, mInputDeviceIdentifier, mInputMethodInfo, mInputMethodSubtype);
KeyboardLayout[] keyboardLayouts = NewKeyboardSettingsUtils.getKeyboardLayouts(
mIm, mUserId, mInputDeviceIdentifier, mInputMethodInfo, mInputMethodSubtype);
if (layout != null) {
if (result.getLayoutDescriptor() != null) {
for (KeyboardLayout keyboardLayout : keyboardLayouts) {
if (keyboardLayout.getDescriptor().equals(layout)) {
if (keyboardLayout.getDescriptor().equals(result.getLayoutDescriptor())) {
label = keyboardLayout.getLabel();
break;
}

View File

@@ -16,20 +16,30 @@
package com.android.settings.inputmethod;
import static android.hardware.input.KeyboardLayoutSelectionResult.LAYOUT_SELECTION_CRITERIA_USER;
import static android.hardware.input.KeyboardLayoutSelectionResult.LAYOUT_SELECTION_CRITERIA_DEVICE;
import static android.hardware.input.KeyboardLayoutSelectionResult.LAYOUT_SELECTION_CRITERIA_VIRTUAL_KEYBOARD;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.UserIdInt;
import android.content.Context;
import android.hardware.input.InputDeviceIdentifier;
import android.hardware.input.InputManager;
import android.hardware.input.KeyboardLayout;
import android.hardware.input.KeyboardLayoutSelectionResult;
import android.hardware.input.KeyboardLayoutSelectionResult.LayoutSelectionCriteria;
import android.os.UserHandle;
import android.view.InputDevice;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
import java.util.ArrayList;
import com.android.settings.R;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
/**
* Utilities of keyboard settings
@@ -56,36 +66,47 @@ public class NewKeyboardSettingsUtils {
return false;
}
static List<String> getSuitableImeLabels(Context context, InputMethodManager imm, int userId) {
List<String> suitableInputMethodInfoLabels = new ArrayList<>();
List<InputMethodInfo> infoList = imm.getEnabledInputMethodListAsUser(UserHandle.of(userId));
for (InputMethodInfo info : infoList) {
List<InputMethodSubtype> subtypes =
imm.getEnabledInputMethodSubtypeList(info, true);
for (InputMethodSubtype subtype : subtypes) {
if (subtype.isSuitableForPhysicalKeyboardLayoutMapping()) {
suitableInputMethodInfoLabels.add(
info.loadLabel(context.getPackageManager()).toString());
break;
@SuppressLint("MissingPermission")
@Nullable
static String getSelectedKeyboardLayoutLabelForUser(Context context, @UserIdInt int userId,
InputDeviceIdentifier inputDeviceIdentifier) {
InputMethodManager imm = context.getSystemService(InputMethodManager.class);
InputManager im = context.getSystemService(InputManager.class);
if (imm == null || im == null) {
return null;
}
InputMethodInfo imeInfo = imm.getCurrentInputMethodInfoAsUser(UserHandle.of(userId));
InputMethodSubtype subtype = imm.getCurrentInputMethodSubtype();
KeyboardLayout[] keyboardLayouts = getKeyboardLayouts(im, userId, inputDeviceIdentifier,
imeInfo, subtype);
KeyboardLayoutSelectionResult result = getKeyboardLayout(im, userId, inputDeviceIdentifier,
imeInfo, subtype);
if (result != null) {
for (KeyboardLayout keyboardLayout : keyboardLayouts) {
if (keyboardLayout.getDescriptor().equals(result.getLayoutDescriptor())) {
return keyboardLayout.getLabel();
}
}
}
return suitableInputMethodInfoLabels;
return null;
}
static class KeyboardInfo {
CharSequence mSubtypeLabel;
String mLayout;
@LayoutSelectionCriteria int mSelectionCriteria;
InputMethodInfo mInputMethodInfo;
InputMethodSubtype mInputMethodSubtype;
KeyboardInfo(
CharSequence subtypeLabel,
String layout,
@LayoutSelectionCriteria int selectionCriteria,
InputMethodInfo inputMethodInfo,
InputMethodSubtype inputMethodSubtype) {
mSubtypeLabel = subtypeLabel;
mLayout = layout;
mSelectionCriteria = selectionCriteria;
mInputMethodInfo = inputMethodInfo;
mInputMethodSubtype = inputMethodSubtype;
}
@@ -102,6 +123,17 @@ public class NewKeyboardSettingsUtils {
return mLayout;
}
String getLayoutSummaryText(Context context) {
if (isAutomaticSelection(mSelectionCriteria)) {
return context.getResources().getString(R.string.automatic_keyboard_layout_label,
mLayout);
} else if (isUserSelection(mSelectionCriteria)) {
return context.getResources().getString(
R.string.user_selected_keyboard_layout_label, mLayout);
}
return mLayout;
}
InputMethodInfo getInputMethodInfo() {
return mInputMethodInfo;
}
@@ -121,11 +153,21 @@ public class NewKeyboardSettingsUtils {
return inputManager.getKeyboardLayoutListForInputDevice(identifier, userId, info, subtype);
}
static String getKeyboardLayout(InputManager inputManager, int userId,
@NonNull
static KeyboardLayoutSelectionResult getKeyboardLayout(InputManager inputManager, int userId,
InputDeviceIdentifier identifier, InputMethodInfo info, InputMethodSubtype subtype) {
return inputManager.getKeyboardLayoutForInputDevice(identifier, userId, info, subtype);
}
static boolean isAutomaticSelection(@LayoutSelectionCriteria int criteria) {
return criteria == LAYOUT_SELECTION_CRITERIA_DEVICE
|| criteria == LAYOUT_SELECTION_CRITERIA_VIRTUAL_KEYBOARD;
}
static boolean isUserSelection(@LayoutSelectionCriteria int criteria) {
return criteria == LAYOUT_SELECTION_CRITERIA_USER;
}
static void sortKeyboardLayoutsByLabel(KeyboardLayout[] keyboardLayouts) {
Arrays.sort(
keyboardLayouts,

View File

@@ -3,6 +3,7 @@ include platform/frameworks/base:/services/core/java/com/android/server/inputmet
include /OWNERS
# Settings for physical keyboard and game pad are better to be reviewed by the input team
per-file GameControllerPreferenceController.java = file: platform/frameworks/base:/services/core/java/com/android/server/input/OWNERS
per-file KeyboardLayoutPicker*.java = file: platform/frameworks/base:/services/core/java/com/android/server/input/OWNERS
per-file PhysicalKeyboard*.java = file: platform/frameworks/base:/services/core/java/com/android/server/input/OWNERS
per-file GameControllerPreferenceController.java = file:platform/frameworks/base:/INPUT_OWNERS
per-file KeyboardLayoutPicker*.java = file:platform/frameworks/base:/INPUT_OWNERS
per-file PhysicalKeyboard*.java = file:platform/frameworks/base:/INPUT_OWNERS
per-file Trackpad*.java = file:platform/frameworks/base:/INPUT_OWNERS

View File

@@ -288,19 +288,11 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment
final Preference pref = new Preference(getPrefContext());
pref.setTitle(hardKeyboardDeviceInfo.mDeviceName);
if (mIsNewKeyboardSettings) {
List<String> suitableImes = new ArrayList<>();
suitableImes.addAll(
NewKeyboardSettingsUtils.getSuitableImeLabels(
getContext(), mImm, UserHandle.myUserId()));
if (!suitableImes.isEmpty()) {
String summary = suitableImes.get(0);
StringBuilder result = new StringBuilder(summary);
for (int i = 1; i < suitableImes.size(); i++) {
result.append(", ").append(suitableImes.get(i));
}
pref.setSummary(result.toString());
} else {
pref.setSummary(hardKeyboardDeviceInfo.mLayoutLabel);
String currentLayout =
NewKeyboardSettingsUtils.getSelectedKeyboardLayoutLabelForUser(getContext(),
UserHandle.myUserId(), hardKeyboardDeviceInfo.mDeviceIdentifier);
if (currentLayout != null) {
pref.setSummary(currentLayout);
}
pref.setOnPreferenceClickListener(
preference -> {

View File

@@ -0,0 +1,53 @@
/*
* Copyright 2024 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.inputmethod;
import android.content.Context;
import android.hardware.input.InputSettings;
import com.android.settings.R;
import com.android.settings.core.TogglePreferenceController;
public class TrackpadTapDraggingPreferenceController extends TogglePreferenceController {
public TrackpadTapDraggingPreferenceController(Context context, String key) {
super(context, key);
}
@Override
public boolean isChecked() {
return InputSettings.useTouchpadTapDragging(mContext);
}
@Override
public boolean setChecked(boolean isChecked) {
InputSettings.setTouchpadTapDragging(mContext, isChecked);
// TODO(b/321978150): add a metric for tap dragging settings changes.
return true;
}
@Override
public int getAvailabilityStatus() {
return InputSettings.isTouchpadTapDraggingFeatureFlagEnabled()
? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
}
@Override
public int getSliceHighlightMenuRes() {
return R.string.menu_key_system;
}
}

View File

@@ -0,0 +1,117 @@
/*
* Copyright (C) 2024 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.location;
import android.content.Context;
import android.os.UserHandle;
import android.os.UserManager;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.dashboard.profileselector.ProfileSelectFragment.ProfileType;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedSwitchPreference;
public class LocationForPrivateProfilePreferenceController
extends LocationBasePreferenceController {
@Nullable private RestrictedSwitchPreference mPreference;
@Nullable private final UserHandle mPrivateProfileHandle;
public LocationForPrivateProfilePreferenceController(
@NonNull Context context, @NonNull String key) {
super(context, key);
mPrivateProfileHandle = Utils.getProfileOfType(mUserManager, ProfileType.PRIVATE);
}
@Override
public boolean handlePreferenceTreeClick(@NonNull Preference preference) {
if (TextUtils.equals(preference.getKey(), getPreferenceKey())) {
final boolean switchState = mPreference.isChecked();
mUserManager.setUserRestriction(
UserManager.DISALLOW_SHARE_LOCATION,
!switchState,
mPrivateProfileHandle);
mPreference.setSummary(switchState
? R.string.switch_on_text : R.string.switch_off_text);
return true;
}
return false;
}
@Override
public void displayPreference(@NonNull PreferenceScreen screen) {
super.displayPreference(screen);
mPreference = screen.findPreference(getPreferenceKey());
if (mPreference != null) {
mPreference.setEnabled(isPrivateProfileAvailable());
}
}
@Override
public int getAvailabilityStatus() {
if (!android.os.Flags.allowPrivateProfile()
|| !android.multiuser.Flags.handleInterleavedSettingsForPrivateSpace()
|| !isPrivateProfileAvailable()) {
return CONDITIONALLY_UNAVAILABLE;
}
return AVAILABLE;
}
@Override
public void onLocationModeChanged(int mode, boolean restricted) {
if ((mPreference != null && !mPreference.isVisible())
|| !isAvailable()
|| !isPrivateProfileAvailable()) {
return;
}
// The profile owner (which is the admin for the child profile) might have added a location
// sharing restriction.
final RestrictedLockUtils.EnforcedAdmin admin =
mLocationEnabler.getShareLocationEnforcedAdmin(
mPrivateProfileHandle.getIdentifier());
if (admin != null) {
mPreference.setDisabledByAdmin(admin);
} else {
final boolean enabled = mLocationEnabler.isEnabled(mode);
mPreference.setEnabled(enabled);
int summaryResId;
final boolean isRestrictedByBase =
mLocationEnabler
.hasShareLocationRestriction(mPrivateProfileHandle.getIdentifier());
if (isRestrictedByBase || !enabled) {
mPreference.setChecked(false);
summaryResId = enabled ? R.string.switch_off_text
: R.string.location_app_permission_summary_location_off;
} else {
mPreference.setChecked(true);
summaryResId = R.string.switch_on_text;
}
mPreference.setSummary(summaryResId);
}
}
private boolean isPrivateProfileAvailable() {
return mPrivateProfileHandle != null
&& !mUserManager.isQuietModeEnabled(mPrivateProfileHandle);
}
}

View File

@@ -119,6 +119,7 @@ public class LocationSettings extends DashboardFragment implements
use(RecentLocationAccessSeeAllButtonPreferenceController.class).init(this);
use(LocationForWorkPreferenceController.class).init(this);
use(LocationSettingsFooterPreferenceController.class).init(this);
use(LocationForPrivateProfilePreferenceController.class).init(this);
}
@Override

View File

@@ -30,6 +30,7 @@ import android.icu.text.MessageFormat;
import android.net.Uri;
import android.provider.ContactsContract;
import android.provider.Settings;
import android.service.notification.ZenAdapters;
import android.service.notification.ZenModeConfig;
import android.service.notification.ZenPolicy;
import android.util.Log;
@@ -399,14 +400,16 @@ public class ZenModeBackend {
ZenPolicy setDefaultZenPolicy(ZenPolicy zenPolicy) {
int calls;
if (mPolicy.allowCalls()) {
calls = ZenModeConfig.getZenPolicySenders(mPolicy.allowCallsFrom());
calls = ZenAdapters.notificationPolicySendersToZenPolicyPeopleType(
mPolicy.allowCallsFrom());
} else {
calls = ZenPolicy.PEOPLE_TYPE_NONE;
}
int messages;
if (mPolicy.allowMessages()) {
messages = ZenModeConfig.getZenPolicySenders(mPolicy.allowMessagesFrom());
messages = ZenAdapters.notificationPolicySendersToZenPolicyPeopleType(
mPolicy.allowMessagesFrom());
} else {
messages = ZenPolicy.PEOPLE_TYPE_NONE;
}

View File

@@ -38,6 +38,8 @@ import java.util.List;
public class AutoLockSettingsFragment extends RadioButtonPickerFragment {
private static final String TAG = "PSAutoLockSetting";
private static final String AUTOLOCK_METRIC_KEY = "private_space_autolock_mode";
private PrivateSpaceMaintainer mPrivateSpaceMaintainer;
private CharSequence[] mAutoLockRadioOptions;
private CharSequence[] mAutoLockRadioValues;
@@ -111,6 +113,12 @@ public class AutoLockSettingsFragment extends RadioButtonPickerFragment {
try {
@Settings.Secure.PrivateSpaceAutoLockOption final int value = Integer.parseInt(key);
mPrivateSpaceMaintainer.setPrivateSpaceAutoLockSetting(value);
mMetricsFeatureProvider.action(
mMetricsFeatureProvider.getAttribution(getActivity()),
SettingsEnums.ACTION_SET_PRIVATE_SPACE_AUTOLOCK,
getMetricsCategory(),
AUTOLOCK_METRIC_KEY,
value /* value */);
} catch (NumberFormatException e) {
Log.e(TAG, "could not persist screen timeout setting", e);
}

View File

@@ -100,6 +100,7 @@ public interface SearchFeatureProvider {
// and goes to the search UI. Also set the background to null so there's no ripple.
final View navView = toolbar.getNavigationView();
navView.setClickable(false);
navView.setFocusable(false);
navView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
navView.setBackground(null);

View File

@@ -17,10 +17,10 @@
package com.android.settings.accessibility;
import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
@@ -56,38 +56,13 @@ public class MagnificationAlwaysOnPreferenceControllerTest {
mSwitchPreference.setKey(MagnificationAlwaysOnPreferenceController.PREF_KEY);
screen.addPreference(mSwitchPreference);
mController.displayPreference(screen);
}
@Test
public void isChecked_defaultStateForAlwaysOn_onResumeShouldReturnTrue() {
mController.onResume();
assertThat(mController.isChecked()).isTrue();
assertThat(mSwitchPreference.isChecked()).isTrue();
}
@Test
public void isChecked_enableAlwaysOn_onResumeShouldReturnTrue() {
Settings.Secure.putInt(mContext.getContentResolver(), KEY_ALWAYS_ON, ON);
mController.onResume();
assertThat(mController.isChecked()).isTrue();
assertThat(mSwitchPreference.isChecked()).isTrue();
}
@Test
public void isChecked_disableAlwaysOn_onResumeShouldReturnFalse() {
Settings.Secure.putInt(mContext.getContentResolver(), KEY_ALWAYS_ON, OFF);
mController.onResume();
assertThat(mController.isChecked()).isFalse();
assertThat(mSwitchPreference.isChecked()).isFalse();
mController.updateState(mSwitchPreference);
reset(mSwitchPreference);
}
@Test
public void performClick_switchDefaultStateForAlwaysOn_shouldReturnFalse() {
mController.onResume();
mSwitchPreference.performClick();
verify(mSwitchPreference).setChecked(false);
@@ -99,7 +74,7 @@ public class MagnificationAlwaysOnPreferenceControllerTest {
public void updateState_disableAlwaysOn_shouldReturnFalse() {
Settings.Secure.putInt(mContext.getContentResolver(), KEY_ALWAYS_ON, OFF);
mController.updateState();
mController.updateState(mSwitchPreference);
verify(mSwitchPreference).setChecked(false);
assertThat(mController.isChecked()).isFalse();

View File

@@ -17,10 +17,10 @@
package com.android.settings.accessibility;
import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
@@ -56,38 +56,13 @@ public class MagnificationFollowTypingPreferenceControllerTest {
mSwitchPreference.setKey(MagnificationFollowTypingPreferenceController.PREF_KEY);
screen.addPreference(mSwitchPreference);
mController.displayPreference(screen);
}
@Test
public void isChecked_defaultStateForFollowTyping_onResumeShouldReturnTrue() {
mController.onResume();
assertThat(mController.isChecked()).isTrue();
assertThat(mSwitchPreference.isChecked()).isTrue();
}
@Test
public void isChecked_enableFollowTyping_onResumeShouldReturnTrue() {
Settings.Secure.putInt(mContext.getContentResolver(), KEY_FOLLOW_TYPING, ON);
mController.onResume();
assertThat(mController.isChecked()).isTrue();
assertThat(mSwitchPreference.isChecked()).isTrue();
}
@Test
public void isChecked_disableFollowTyping_onResumeShouldReturnFalse() {
Settings.Secure.putInt(mContext.getContentResolver(), KEY_FOLLOW_TYPING, OFF);
mController.onResume();
assertThat(mController.isChecked()).isFalse();
assertThat(mSwitchPreference.isChecked()).isFalse();
mController.updateState(mSwitchPreference);
reset(mSwitchPreference);
}
@Test
public void performClick_switchDefaultStateForFollowTyping_shouldReturnFalse() {
mController.onResume();
mSwitchPreference.performClick();
verify(mSwitchPreference).setChecked(false);
@@ -99,7 +74,7 @@ public class MagnificationFollowTypingPreferenceControllerTest {
public void updateState_disableFollowTyping_shouldReturnFalse() {
Settings.Secure.putInt(mContext.getContentResolver(), KEY_FOLLOW_TYPING, OFF);
mController.updateState();
mController.updateState(mSwitchPreference);
verify(mSwitchPreference).setChecked(false);
assertThat(mController.isChecked()).isFalse();

View File

@@ -17,10 +17,10 @@
package com.android.settings.accessibility;
import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
@@ -56,38 +56,13 @@ public class MagnificationJoystickPreferenceControllerTest {
mSwitchPreference.setKey(MagnificationJoystickPreferenceController.PREF_KEY);
screen.addPreference(mSwitchPreference);
mController.displayPreference(screen);
}
@Test
public void isChecked_defaultStateForJoystick_onResumeShouldReturnFalse() {
mController.onResume();
assertThat(mController.isChecked()).isFalse();
assertThat(mSwitchPreference.isChecked()).isFalse();
}
@Test
public void isChecked_enableJoystick_onResumeShouldReturnTrue() {
Settings.Secure.putInt(mContext.getContentResolver(), KEY_JOYSTICK, ON);
mController.onResume();
assertThat(mController.isChecked()).isTrue();
assertThat(mSwitchPreference.isChecked()).isTrue();
}
@Test
public void isChecked_disableJoystick_onResumeShouldReturnFalse() {
Settings.Secure.putInt(mContext.getContentResolver(), KEY_JOYSTICK, OFF);
mController.onResume();
assertThat(mController.isChecked()).isFalse();
assertThat(mSwitchPreference.isChecked()).isFalse();
mController.updateState(mSwitchPreference);
reset(mSwitchPreference);
}
@Test
public void performClick_switchDefaultStateForJoystick_shouldReturnTrue() {
mController.onResume();
mSwitchPreference.performClick();
verify(mSwitchPreference).setChecked(true);
@@ -99,7 +74,7 @@ public class MagnificationJoystickPreferenceControllerTest {
public void updateState_disableJoystick_shouldReturnFalse() {
Settings.Secure.putInt(mContext.getContentResolver(), KEY_JOYSTICK, OFF);
mController.updateState();
mController.updateState(mSwitchPreference);
verify(mSwitchPreference).setChecked(false);
assertThat(mController.isChecked()).isFalse();

View File

@@ -90,7 +90,6 @@ public class MagnificationModePreferenceControllerTest {
mModePreference.getOnPreferenceClickListener().onPreferenceClick(mModePreference);
assertThat(getCheckedModeFromDialog()).isEqualTo(MAGNIFICATION_MODE_DEFAULT);
}
@Test

View File

@@ -19,6 +19,7 @@ package com.android.settings.accessibility;
import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
import static com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
import static com.android.settings.accessibility.MagnificationCapabilities.MagnificationMode;
import static com.android.settings.accessibility.ToggleFeaturePreferenceFragment.KEY_SAVED_USER_SHORTCUT_TYPE;
import static com.google.common.truth.Truth.assertThat;
@@ -43,9 +44,11 @@ import android.os.Bundle;
import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
import android.provider.DeviceConfig;
import android.provider.Settings;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference;
import androidx.preference.TwoStatePreference;
import androidx.test.core.app.ApplicationProvider;
@@ -54,12 +57,14 @@ import com.android.settings.DialogCreatable;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.accessibility.AccessibilityDialogUtils.DialogType;
import com.android.settings.testutils.shadow.ShadowDeviceConfig;
import com.android.settings.testutils.shadow.ShadowStorageManager;
import com.android.settings.testutils.shadow.ShadowUserManager;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.google.common.truth.Correspondence;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -82,6 +87,7 @@ import java.util.List;
ShadowUserManager.class,
ShadowStorageManager.class,
ShadowSettings.ShadowSecure.class,
ShadowDeviceConfig.class,
})
public class ToggleScreenMagnificationPreferenceFragmentTest {
@@ -109,6 +115,11 @@ public class ToggleScreenMagnificationPreferenceFragmentTest {
private static final String KEY_FOLLOW_TYPING =
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_FOLLOW_TYPING_ENABLED;
private static final String KEY_ALWAYS_ON =
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_ALWAYS_ON_ENABLED;
private static final String KEY_JOYSTICK =
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_JOYSTICK_ENABLED;
private FragmentController<ToggleScreenMagnificationPreferenceFragment> mFragController;
private Context mContext;
private Resources mSpyResources;
@@ -137,15 +148,48 @@ public class ToggleScreenMagnificationPreferenceFragmentTest {
mFragController = FragmentController.of(fragment, SettingsActivity.class);
}
@After
public void tearDown() {
ShadowDeviceConfig.reset();
}
@Test
public void onResume_defaultStateForMagnificationMode_preferenceShouldReturnFullScreen() {
mFragController.create(R.id.main_content, /* bundle= */ null).start().resume();
// Default is MagnificationMode.FULLSCREEN
final String expected =
MagnificationCapabilities.getSummary(mContext, MagnificationMode.FULLSCREEN);
final Preference preference = mFragController.get().findPreference(
MagnificationModePreferenceController.PREF_KEY);
assertThat(preference).isNotNull();
assertThat(preference.getSummary()).isEqualTo(expected);
}
@Test
public void onResume_setMagnificationModeToAll_preferenceShouldReturnAll() {
setKeyMagnificationMode(MagnificationMode.ALL);
mFragController.create(R.id.main_content, /* bundle= */ null).start().resume();
final String expected =
MagnificationCapabilities.getSummary(mContext, MagnificationMode.ALL);
final Preference preference = mFragController.get().findPreference(
MagnificationModePreferenceController.PREF_KEY);
assertThat(preference).isNotNull();
assertThat(preference.getSummary()).isEqualTo(expected);
}
@Test
public void onResume_defaultStateForFollowingTyping_switchPreferenceShouldReturnTrue() {
setKeyFollowTypingEnabled(true);
mFragController.create(R.id.main_content, /* bundle= */ null).start().resume();
final TwoStatePreference switchPreference =
mFragController.get().findPreference(
MagnificationFollowTypingPreferenceController.PREF_KEY);
final TwoStatePreference switchPreference = mFragController.get().findPreference(
MagnificationFollowTypingPreferenceController.PREF_KEY);
assertThat(switchPreference).isNotNull();
assertThat(switchPreference.isChecked()).isTrue();
}
@@ -156,9 +200,84 @@ public class ToggleScreenMagnificationPreferenceFragmentTest {
mFragController.create(R.id.main_content, /* bundle= */ null).start().resume();
final TwoStatePreference switchPreference =
mFragController.get().findPreference(
MagnificationFollowTypingPreferenceController.PREF_KEY);
final TwoStatePreference switchPreference = mFragController.get().findPreference(
MagnificationFollowTypingPreferenceController.PREF_KEY);
assertThat(switchPreference).isNotNull();
assertThat(switchPreference.isChecked()).isFalse();
}
@Test
public void onResume_defaultStateForAlwaysOn_switchPreferenceShouldReturnTrue() {
setAlwaysOnSupported(true);
mFragController.create(R.id.main_content, /* bundle= */ null).start().resume();
final TwoStatePreference switchPreference = mFragController.get().findPreference(
MagnificationAlwaysOnPreferenceController.PREF_KEY);
assertThat(switchPreference).isNotNull();
assertThat(switchPreference.isChecked()).isTrue();
}
@Test
public void onResume_enableAlwaysOn_switchPreferenceShouldReturnTrue() {
setAlwaysOnSupported(true);
setKeyAlwaysOnEnabled(true);
mFragController.create(R.id.main_content, /* bundle= */ null).start().resume();
final TwoStatePreference switchPreference = mFragController.get().findPreference(
MagnificationAlwaysOnPreferenceController.PREF_KEY);
assertThat(switchPreference).isNotNull();
assertThat(switchPreference.isChecked()).isTrue();
}
@Test
public void onResume_disableAlwaysOn_switchPreferenceShouldReturnFalse() {
setAlwaysOnSupported(true);
setKeyAlwaysOnEnabled(false);
mFragController.create(R.id.main_content, /* bundle= */ null).start().resume();
final TwoStatePreference switchPreference = mFragController.get().findPreference(
MagnificationAlwaysOnPreferenceController.PREF_KEY);
assertThat(switchPreference).isNotNull();
assertThat(switchPreference.isChecked()).isFalse();
}
@Test
public void onResume_defaultStateForJoystick_switchPreferenceShouldReturnFalse() {
setJoystickSupported(true);
mFragController.create(R.id.main_content, /* bundle= */ null).start().resume();
final TwoStatePreference switchPreference = mFragController.get().findPreference(
MagnificationJoystickPreferenceController.PREF_KEY);
assertThat(switchPreference).isNotNull();
assertThat(switchPreference.isChecked()).isFalse();
}
@Test
public void onResume_enableJoystick_switchPreferenceShouldReturnTrue() {
setJoystickSupported(true);
setKeyJoystickEnabled(true);
mFragController.create(R.id.main_content, /* bundle= */ null).start().resume();
final TwoStatePreference switchPreference = mFragController.get().findPreference(
MagnificationJoystickPreferenceController.PREF_KEY);
assertThat(switchPreference).isNotNull();
assertThat(switchPreference.isChecked()).isTrue();
}
@Test
public void onResume_disableJoystick_switchPreferenceShouldReturnFalse() {
setJoystickSupported(true);
setKeyJoystickEnabled(false);
mFragController.create(R.id.main_content, /* bundle= */ null).start().resume();
final TwoStatePreference switchPreference = mFragController.get().findPreference(
MagnificationJoystickPreferenceController.PREF_KEY);
assertThat(switchPreference).isNotNull();
assertThat(switchPreference.isChecked()).isFalse();
}
@@ -556,6 +675,28 @@ public class ToggleScreenMagnificationPreferenceFragmentTest {
assertThat(mFragController.get().mSettingsPreference).isNull();
}
@Test
public void onCreateView_alwaysOnNotSupported_settingsPreferenceIsNull() {
setAlwaysOnSupported(false);
mFragController.create(R.id.main_content, /* bundle= */ null).start().resume();
final TwoStatePreference switchPreference = mFragController.get().findPreference(
MagnificationAlwaysOnPreferenceController.PREF_KEY);
assertThat(switchPreference).isNull();
}
@Test
public void onCreateView_joystickNotSupported_settingsPreferenceIsNull() {
setJoystickSupported(false);
mFragController.create(R.id.main_content, /* bundle= */ null).start().resume();
final TwoStatePreference switchPreference = mFragController.get().findPreference(
MagnificationJoystickPreferenceController.PREF_KEY);
assertThat(switchPreference).isNull();
}
@Test
public void onCreateView_setDialogDelegateAndAddTheControllerToLifeCycleObserver() {
Correspondence instanceOf = Correspondence.transforming(
@@ -690,11 +831,41 @@ public class ToggleScreenMagnificationPreferenceFragmentTest {
enabled ? ON : OFF);
}
private void setKeyMagnificationMode(@MagnificationMode int mode) {
MagnificationCapabilities.setCapabilities(mContext, mode);
}
private void setKeyFollowTypingEnabled(boolean enabled) {
Settings.Secure.putInt(mContext.getContentResolver(), KEY_FOLLOW_TYPING,
enabled ? ON : OFF);
}
private void setAlwaysOnSupported(boolean supported) {
ShadowDeviceConfig.setProperty(
DeviceConfig.NAMESPACE_WINDOW_MANAGER,
"AlwaysOnMagnifier__enable_always_on_magnifier",
supported ? "true" : "false",
/* makeDefault= */ false);
}
private void setKeyAlwaysOnEnabled(boolean enabled) {
Settings.Secure.putInt(mContext.getContentResolver(), KEY_ALWAYS_ON,
enabled ? ON : OFF);
}
private void setJoystickSupported(boolean supported) {
ShadowDeviceConfig.setProperty(
DeviceConfig.NAMESPACE_WINDOW_MANAGER,
"MagnificationJoystick__enable_magnification_joystick",
supported ? "true" : "false",
/* makeDefault= */ false);
}
private void setKeyJoystickEnabled(boolean enabled) {
Settings.Secure.putInt(mContext.getContentResolver(), KEY_JOYSTICK,
enabled ? ON : OFF);
}
private String getStringFromSettings(String key) {
return Settings.Secure.getString(mContext.getContentResolver(), key);
}

View File

@@ -0,0 +1,189 @@
/*
* Copyright (C) 2024 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.location;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.pm.UserInfo;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import androidx.lifecycle.LifecycleOwner;
import androidx.preference.PreferenceScreen;
import androidx.test.core.app.ApplicationProvider;
import com.android.settings.R;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import com.android.settingslib.RestrictedSwitchPreference;
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.util.ReflectionHelpers;
import java.util.ArrayList;
import java.util.List;
@RunWith(RobolectricTestRunner.class)
public class LocationForPrivateProfilePreferenceControllerTest {
@Mock
private RestrictedSwitchPreference mPreference;
@Mock
private PreferenceScreen mScreen;
@Mock
private UserManager mUserManager;
@Mock
private LocationEnabler mEnabler;
@Mock
private UserHandle mUserHandle;
private Context mContext;
private LocationForPrivateProfilePreferenceController mController;
private LifecycleOwner mLifecycleOwner;
private Lifecycle mLifecycle;
private LocationSettings mLocationSettings;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
doReturn(mUserManager).when(mContext).getSystemService(Context.USER_SERVICE);
mockPrivateProfile();
mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
mLocationSettings = spy(new LocationSettings());
when(mLocationSettings.getSettingsLifecycle()).thenReturn(mLifecycle);
mController = new LocationForPrivateProfilePreferenceController(mContext, "key");
mController.init(mLocationSettings);
ReflectionHelpers.setField(mController, "mLocationEnabler", mEnabler);
when(mScreen.findPreference(any())).thenReturn(mPreference);
final String key = mController.getPreferenceKey();
when(mPreference.getKey()).thenReturn(key);
when(mPreference.isVisible()).thenReturn(true);
}
@Test
public void handlePreferenceTreeClick_preferenceChecked_shouldSetRestrictionAndOnSummary() {
mController.displayPreference(mScreen);
when(mPreference.isChecked()).thenReturn(true);
mController.handlePreferenceTreeClick(mPreference);
verify(mUserManager)
.setUserRestriction(UserManager.DISALLOW_SHARE_LOCATION, false, mUserHandle);
verify(mPreference).setSummary(R.string.switch_on_text);
}
@Test
public void handlePreferenceTreeClick_preferenceUnchecked_shouldSetRestritionAndOffSummary() {
mController.displayPreference(mScreen);
when(mPreference.isChecked()).thenReturn(false);
mController.handlePreferenceTreeClick(mPreference);
verify(mUserManager)
.setUserRestriction(UserManager.DISALLOW_SHARE_LOCATION, true, mUserHandle);
verify(mPreference).setSummary(R.string.switch_off_text);
}
@Test
public void onLocationModeChanged_disabledByAdmin_shouldDisablePreference() {
mController.displayPreference(mScreen);
final EnforcedAdmin admin = mock(EnforcedAdmin.class);
doReturn(admin).when(mEnabler).getShareLocationEnforcedAdmin(anyInt());
doReturn(false).when(mEnabler).hasShareLocationRestriction(anyInt());
mController.onLocationModeChanged(Settings.Secure.LOCATION_MODE_BATTERY_SAVING, false);
verify(mPreference).setDisabledByAdmin(any());
}
@Test
public void onLocationModeChanged_locationOff_shouldDisablePreference() {
mController.displayPreference(mScreen);
doReturn(null).when(mEnabler).getShareLocationEnforcedAdmin(anyInt());
doReturn(false).when(mEnabler).hasShareLocationRestriction(anyInt());
mController.onLocationModeChanged(Settings.Secure.LOCATION_MODE_OFF, false);
verify(mPreference).setEnabled(false);
verify(mPreference).setChecked(false);
verify(mPreference).setSummary(R.string.location_app_permission_summary_location_off);
}
@Test
public void onLocationModeChanged_locationOn_shouldEnablePreference() {
mController.displayPreference(mScreen);
doReturn(null).when(mEnabler).getShareLocationEnforcedAdmin(anyInt());
doReturn(false).when(mEnabler).hasShareLocationRestriction(anyInt());
doReturn(true).when(mEnabler).isEnabled(anyInt());
mController.onLocationModeChanged(Settings.Secure.LOCATION_MODE_BATTERY_SAVING, false);
verify(mPreference, times(2)).setEnabled(true);
verify(mPreference).setSummary(R.string.switch_on_text);
}
@Test
public void onLocationModeChanged_noRestriction_shouldCheckedPreference() {
mController.displayPreference(mScreen);
doReturn(null).when(mEnabler).getShareLocationEnforcedAdmin(anyInt());
doReturn(false).when(mEnabler).hasShareLocationRestriction(anyInt());
doReturn(true).when(mEnabler).isEnabled(anyInt());
mController.onLocationModeChanged(Settings.Secure.LOCATION_MODE_BATTERY_SAVING, false);
verify(mPreference).setChecked(true);
}
@Test
public void onLocationModeChanged_hasRestriction_shouldCheckedPreference() {
mController.displayPreference(mScreen);
doReturn(null).when(mEnabler).getShareLocationEnforcedAdmin(anyInt());
doReturn(true).when(mEnabler).hasShareLocationRestriction(anyInt());
mController.onLocationModeChanged(Settings.Secure.LOCATION_MODE_BATTERY_SAVING, false);
verify(mPreference).setChecked(false);
}
private void mockPrivateProfile() {
final List<UserHandle> userProfiles = new ArrayList<>();
doReturn(9).when(mUserHandle).getIdentifier();
userProfiles.add(mUserHandle);
doReturn(userProfiles).when(mUserManager).getUserProfiles();
doReturn(new UserInfo(
9,
"user 9",
"",
0,
UserManager.USER_TYPE_PROFILE_PRIVATE)).when(mUserManager).getUserInfo(9);
}
}

View File

@@ -34,18 +34,18 @@ import com.android.settings.testutils.shadow.ShadowDevicePolicyManager;
import com.android.settings.testutils.shadow.ShadowUserManager;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;
import java.util.ArrayList;
import java.util.List;
@Ignore("b/315133235")
@RunWith(RobolectricTestRunner.class)
@LooperMode(LooperMode.Mode.LEGACY)
@Config(shadows = {ShadowUserManager.class, ShadowDevicePolicyManager.class})
public class RestrictedButtonTest {

View File

@@ -40,7 +40,6 @@ import com.android.settings.R;
import com.android.settings.testutils.shadow.ShadowSettingsMediaPlayer;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -48,6 +47,7 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;
import org.robolectric.shadows.androidx.fragment.FragmentController;
@RunWith(RobolectricTestRunner.class)
@@ -141,7 +141,7 @@ public class VideoPreferenceTest {
assertThat(mAnimationController.isPlaying()).isTrue();
}
@Ignore("b/315133235")
@LooperMode(LooperMode.Mode.LEGACY)
@Test
@Config(qualifiers = "mcc999")
public void onViewVisible_createAnimationController() {

View File

@@ -19,21 +19,21 @@ package com.android.settings.applications.credentials;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.Intent;
import android.content.pm.UserInfo;
import android.os.UserHandle;
import android.os.Flags;
import android.os.UserManager;
import android.platform.test.flag.junit.SetFlagsRule;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.common.collect.Lists;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -41,6 +41,7 @@ import org.mockito.MockitoAnnotations;
@RunWith(AndroidJUnit4.class)
public class CredentialsPickerActivityTest {
@Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
@Mock private UserManager mUserManager;
@@ -76,13 +77,11 @@ public class CredentialsPickerActivityTest {
@Test
public void testInjectFragmentIntoIntent_privateProfile() {
mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE);
Intent intent = new Intent();
// Simulate private profile.
UserHandle privateUser = new UserHandle(100);
when(mUserManager.getUserInfo(100))
.thenReturn(new UserInfo(100, "", "", 0, UserManager.USER_TYPE_PROFILE_PRIVATE));
when(mUserManager.getUserProfiles()).thenReturn(Lists.newArrayList(privateUser));
doReturn(true).when(mUserManager).isPrivateProfile();
assertThat(DefaultCombinedPickerPrivate.isUserHandledByFragment(mUserManager)).isTrue();
CredentialsPickerActivity.injectFragmentIntoIntent(mMockContext, intent);

View File

@@ -117,7 +117,7 @@ public class DefaultCombinedPreferenceControllerTest {
// Set the preference back to none and make sure the view was updated.
dcpc.updatePreferenceForProvider(ppp, null, null, null, null, null);
assertThat(ppp.getTitle().toString()).isEqualTo("None");
assertThat(ppp.getTitle().toString()).isEqualTo("None selected");
assertThat(ppp.getSummary()).isNull();
assertThat(ppp.getIcon()).isNull();
}

View File

@@ -22,12 +22,16 @@ import static org.mockito.Mockito.spy;
import android.content.Context;
import android.os.Looper;
import android.platform.test.flag.junit.SetFlagsRule;
import androidx.test.annotation.UiThreadTest;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.android.settings.flags.Flags;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
@@ -36,7 +40,8 @@ import java.util.List;
@RunWith(AndroidJUnit4.class)
public class NetworkProviderCallsSmsFragmentTest {
@Rule
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
private Context mContext;
private List<String> mPreferenceKeyList;
@@ -49,6 +54,7 @@ public class NetworkProviderCallsSmsFragmentTest {
if (Looper.myLooper() == null) {
Looper.prepare();
}
mSetFlagsRule.disableFlags(Flags.FLAG_IS_DUAL_SIM_ONBOARDING_ENABLED);
}
@Test

View File

@@ -148,6 +148,7 @@ public class SubscriptionsPreferenceControllerTest {
when(mUserManager.isAdminUser()).thenReturn(true);
when(mContext.getSystemService(WifiManager.class)).thenReturn(mWifiManager);
when(mLifecycleOwner.getLifecycle()).thenReturn(mLifecycleRegistry);
when(mSubscriptionManager.createForAllUserProfiles()).thenReturn(mSubscriptionManager);
mPreferenceManager = new PreferenceManager(mContext);
mPreferenceScreen = mPreferenceManager.createPreferenceScreen(mContext);

View File

@@ -26,6 +26,7 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.os.Looper;
import android.platform.test.flag.junit.SetFlagsRule;
import android.telecom.TelecomManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
@@ -40,6 +41,7 @@ import androidx.test.annotation.UiThreadTest;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.android.settings.flags.Flags;
import com.android.settings.network.SubscriptionUtil;
import com.android.settings.testutils.ResourcesUtils;
import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -47,6 +49,7 @@ import com.android.settingslib.mobile.dataservice.SubscriptionInfoEntity;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -58,6 +61,8 @@ import java.util.List;
@RunWith(AndroidJUnit4.class)
public class DefaultSubscriptionControllerTest {
@Rule
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
private static final String SUB_ID_1 = "1";
private static final String SUB_ID_2 = "2";
@@ -105,10 +110,11 @@ public class DefaultSubscriptionControllerTest {
if (Looper.myLooper() == null) {
Looper.prepare();
}
mSetFlagsRule.disableFlags(Flags.FLAG_IS_DUAL_SIM_ONBOARDING_ENABLED);
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubMgr);
when(mContext.getSystemService(TelecomManager.class)).thenReturn(mTelecomManager);
when(mSubMgr.createForAllUserProfiles()).thenReturn(mSubMgr);
final String key = "prefkey";
mController = new TestDefaultSubscriptionController(mContext, key, mLifecycle,
@@ -312,9 +318,9 @@ public class DefaultSubscriptionControllerTest {
mController.setDefaultSubscription(Integer.parseInt(mSubInfo1.subId));
mSubscriptionInfoEntityList.add(mSubInfo1);
mSubscriptionInfoEntityList.add(mSubInfo2);
mController.onActiveSubInfoChanged(mSubscriptionInfoEntityList);
mController.displayPreference(mScreen);
mController.onActiveSubInfoChanged(mSubscriptionInfoEntityList);
assertThat(mListPreference.getEntries().length).isEqualTo(3);
mSubscriptionInfoEntityList.add(mSubInfo3);

View File

@@ -57,6 +57,8 @@ public class DisableSimFooterPreferenceControllerTest {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
when(mSubscriptionManager.createForAllUserProfiles()).thenReturn(mSubscriptionManager);
when(mInfo.getSubscriptionId()).thenReturn(SUB_ID);
SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mInfo));
mController = new DisableSimFooterPreferenceController(mContext, PREF_KEY);

View File

@@ -28,6 +28,7 @@ import static org.mockito.Mockito.when;
import android.app.Instrumentation;
import android.content.Context;
import android.os.Looper;
import android.platform.test.flag.junit.SetFlagsRule;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -41,12 +42,14 @@ import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import com.android.settings.flags.Flags;
import com.android.settings.testutils.ResourcesUtils;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.mobile.dataservice.MobileNetworkInfoEntity;
import com.android.settingslib.mobile.dataservice.SubscriptionInfoEntity;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -54,6 +57,8 @@ import org.mockito.MockitoAnnotations;
@RunWith(AndroidJUnit4.class)
public class MobileDataPreferenceControllerTest {
@Rule
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
private static final String SUB_ID_1 = "1";
private static final String SUB_ID_2 = "2";
private static final String DISPLAY_NAME_1 = "Sub 1";
@@ -93,6 +98,7 @@ public class MobileDataPreferenceControllerTest {
if (Looper.myLooper() == null) {
Looper.prepare();
}
mSetFlagsRule.disableFlags(Flags.FLAG_IS_DUAL_SIM_ONBOARDING_ENABLED);
mContext = spy(ApplicationProvider.getApplicationContext());
doReturn(mTelephonyManager).when(mContext).getSystemService(Context.TELEPHONY_SERVICE);

View File

@@ -33,6 +33,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Looper;
import android.platform.test.flag.junit.SetFlagsRule;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyCallback;
@@ -47,6 +48,7 @@ import androidx.preference.PreferenceViewHolder;
import androidx.test.annotation.UiThreadTest;
import androidx.test.core.app.ApplicationProvider;
import com.android.settings.flags.Flags;
import com.android.settings.network.SubscriptionUtil;
import com.android.settings.widget.SettingsMainSwitchPreference;
@@ -63,6 +65,8 @@ import java.util.Arrays;
import java.util.concurrent.Executor;
public class MobileNetworkSwitchControllerTest {
@Rule
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
@Rule
public final MockitoRule mMockitoRule = MockitoJUnit.rule();
@@ -82,6 +86,8 @@ public class MobileNetworkSwitchControllerTest {
@Before
public void setUp() {
mSetFlagsRule.disableFlags(Flags.FLAG_IS_DUAL_SIM_ONBOARDING_ENABLED);
if (Looper.myLooper() == null) {
Looper.prepare();
}

View File

@@ -134,6 +134,10 @@ public class MobileNetworkUtilsTest {
when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(
Arrays.asList(mSubscriptionInfo1, mSubscriptionInfo2));
when(mSubscriptionManager.getActiveSubscriptionInfo(SUB_ID_1)).thenReturn(
mSubscriptionInfo1);
when(mSubscriptionManager.getActiveSubscriptionInfo(SUB_ID_2)).thenReturn(
mSubscriptionInfo2);
when(mTelephonyManager.getNetworkOperatorName()).thenReturn(
PLMN_FROM_TELEPHONY_MANAGER_API);

View File

@@ -109,7 +109,9 @@ public class NetworkSelectSettingsTest {
PersistableBundle config = new PersistableBundle();
config.putBoolean(CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL, true);
doReturn(config).when(mCarrierConfigManager).getConfigForSubId(SUB_ID);
doReturn(config).when(mCarrierConfigManager).getConfigForSubId(SUB_ID,
CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL,
CarrierConfigManager.KEY_REMOVE_SATELLITE_PLMN_IN_MANUAL_NETWORK_SCAN_BOOL);
doReturn(TelephonyManager.DATA_CONNECTED).when(mTelephonyManager).getDataState();
}
@@ -267,6 +269,13 @@ public class NetworkSelectSettingsTest {
@Test
public void doAggregation_hasDuplicateItemsDiffMccMncCase3_removeSamePlmnRatItem() {
PersistableBundle config = new PersistableBundle();
config.putBoolean(
CarrierConfigManager.KEY_REMOVE_SATELLITE_PLMN_IN_MANUAL_NETWORK_SCAN_BOOL, false);
doReturn(config).when(mCarrierConfigManager).getConfigForSubId(eq(SUB_ID),
eq(CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL),
eq(CarrierConfigManager.KEY_REMOVE_SATELLITE_PLMN_IN_MANUAL_NETWORK_SCAN_BOOL));
mNetworkSelectSettings.onCreateInitialization();
List<CellInfo> testList = Arrays.asList(
createLteCellInfo(false, 123, "123", "232", "CarrierA"),