Merge "Revert "Add a cancel string for ToggleSubscriptionDialog to handle Tamil"" into sc-dev
diff --git a/res/drawable-night/ic_enhanced_connectivity.xml b/res/drawable-night/ic_enhanced_connectivity.xml
new file mode 100644
index 0000000..cd25667
--- /dev/null
+++ b/res/drawable-night/ic_enhanced_connectivity.xml
@@ -0,0 +1,91 @@
+<!--
+ ~ Copyright (C) 2021 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="412dp"
+ android:height="300dp"
+ android:viewportWidth="412"
+ android:viewportHeight="300">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M28.1,0L383.9,0A28.1,28.1 0,0 1,412 28.1L412,271.9A28.1,28.1 0,0 1,383.9 300L28.1,300A28.1,28.1 0,0 1,0 271.9L0,28.1A28.1,28.1 0,0 1,28.1 0z"/>
+ <path
+ android:pathData="M206,150m-108.79,0a108.79,108.79 0,1 1,217.58 0a108.79,108.79 0,1 1,-217.58 0"
+ android:strokeAlpha="0.2"
+ android:fillColor="#d2e3fc"
+ android:fillAlpha="0.2"/>
+ <path
+ android:pathData="M206,150m-93.27,0a93.27,93.27 0,1 1,186.54 0a93.27,93.27 0,1 1,-186.54 0"
+ android:strokeAlpha="0.2"
+ android:fillColor="#d2e3fc"
+ android:fillAlpha="0.2"/>
+ <path
+ android:pathData="M206,150m-77.85,0a77.85,77.85 0,1 1,155.7 0a77.85,77.85 0,1 1,-155.7 0"
+ android:strokeAlpha="0.2"
+ android:fillColor="#d2e3fc"
+ android:fillAlpha="0.2"/>
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M153.7,35.5H256.88A7.09,7.09 0,0 1,264 42.57V257.19a7.09,7.09 0,0 1,-7.12 7.06H153.7a7.09,7.09 0,0 1,-7.13 -7.06V42.57A7.1,7.1 0,0 1,153.7 35.5Z"/>
+ <path
+ android:pathData="M267.85,102.26L267.85,93.58a2.17,2.17 0,0 0,-2.17 -2.17L265.68,45.83A10.87,10.87 0,0 0,254.83 35L155,35a10.87,10.87 0,0 0,-10.85 10.85L144.15,254.17A10.87,10.87 0,0 0,155 265h99.83a10.87,10.87 0,0 0,10.85 -10.85L265.68,147.83a2.17,2.17 0,0 0,2.17 -2.17L267.85,124a2.17,2.17 0,0 0,-2.17 -2.17L265.68,104.43A2.17,2.17 0,0 0,267.85 102.26ZM263.51,254.17a8.7,8.7 0,0 1,-8.68 8.68L155,262.85a8.7,8.7 0,0 1,-8.68 -8.68L146.32,45.83A8.7,8.7 0,0 1,155 37.15h99.83a8.7,8.7 0,0 1,8.68 8.68Z"
+ android:fillColor="#80868b"/>
+ <path
+ android:pathData="M199.72,230.82h14a4.45,4.45 0,0 1,4.45 4.45h0a4.46,4.46 0,0 1,-4.45 4.46h-14a4.46,4.46 0,0 1,-4.45 -4.46h0a4.45,4.45 0,0 1,4.45 -4.45Z"
+ android:fillColor="#3c4043"/>
+ <path
+ android:pathData="M211.83,228.91h0a6.36,6.36 0,0 1,6.36 6.36h0a6.36,6.36 0,0 1,-6.35 6.37h0a6.37,6.37 0,0 1,-6.37 -6.37h0a6.36,6.36 0,0 1,6.36 -6.36Z"
+ android:fillColor="#669df6"/>
+ <path
+ android:pathData="M206.59,179.58m-15.27,0a15.27,15.27 0,1 1,30.54 0a15.27,15.27 0,1 1,-30.54 0"
+ android:fillColor="#f1f3f4"/>
+ <path
+ android:pathData="M191.32,179.58a15.27,15.24 0,1 0,30.54 0a15.27,15.24 0,1 0,-30.54 0z"
+ android:fillColor="#feefc3"/>
+ <path
+ android:pathData="M206.59,172.63l-5.72,4.29l0,8.59l3.57,0l0,-5.01l4.3,0l0,5.01l3.57,0l0,-8.59l-5.72,-4.29z"
+ android:fillColor="#fcc934"/>
+ <path
+ android:pathData="M168.97,105.11m-15.24,0a15.24,15.24 0,1 1,30.48 0a15.24,15.24 0,1 1,-30.48 0"
+ android:fillColor="#fad2cf"/>
+ <path
+ android:pathData="M172.6,111.39L172.6,100.28a0.92,0.92 0,0 0,-0.92 -0.92h-1.22L170.46,97.87h-2.9v1.42h-1.2a0.93,0.93 0,0 0,-0.93 0.92v11.07a0.93,0.93 0,0 0,0.93 0.92h5.31A0.92,0.92 0,0 0,172.6 111.39ZM171.15,100.77L171.15,106h-4.34v-5.2Z"
+ android:fillColor="#ee675c"/>
+ <path
+ android:pathData="M243.03,151.92m-15.27,0a15.27,15.27 0,1 1,30.54 0a15.27,15.27 0,1 1,-30.54 0"
+ android:fillColor="#fad2cf"/>
+ <path
+ android:pathData="M248.3,146.31a1.09,1.09 0,0 0,-1 -0.73h-8a1.1,1.1 0,0 0,-1 0.73l-1.5,4.34v5.8a0.71,0.71 0,0 0,0.71 0.73h0.79a0.72,0.72 0,0 0,0.72 -0.72h0v-0.72h8.68v0.72a0.73,0.73 0,0 0,0.73 0.73h0.72a0.73,0.73 0,0 0,0.73 -0.73v-5.79ZM240,153.54a1.09,1.09 0,1 1,1.09 -1.09h0a1.08,1.08 0,0 1,-1 1.12h0ZM246.52,153.54a1.09,1.09 0,1 1,1.08 -1.1v0a1.09,1.09 0,0 1,-1 1.12ZM238.75,149.28 L239.53,147.03L247,147.03l0.78,2.25Z"
+ android:fillColor="#ee675c"/>
+ <path
+ android:pathData="M168.97,151.92m-15.27,0a15.27,15.27 0,1 1,30.54 0a15.27,15.27 0,1 1,-30.54 0"
+ android:fillColor="#d2e3fc"/>
+ <path
+ android:pathData="M175.8,149.23a3.68,3.68 0,0 0,-3.69 -3.08h-5.63a3.73,3.73 0,0 0,-3.69 3.08s-1.17,6.76 -1.17,6.86a1.61,1.61 0,0 0,2.72 1.15l2.66,-2.63h4.61l2.66,2.63a1.61,1.61 0,0 0,2.73 -1.15C177,156 175.8,149.23 175.8,149.23ZM168.51,150.77L167,150.77v1.53h-0.77v-1.53h-1.53L164.7,150h1.53v-1.54L167,148.46L167,150h1.54ZM170.67,151a0.62,0.62 0,1 1,0.61 -0.63h0a0.62,0.62 0,0 1,-0.61 0.62ZM171.97,152.3a0.61,0.61 0,0 1,-0.63 -0.6,0.62 0.62,0 0,1 1.24,0h0a0.61,0.61 0,0 1,-0.61 0.61ZM171.97,149.69a0.62,0.62 0,1 1,0.61 -0.63h0a0.62,0.62 0,0 1,-0.61 0.62ZM173.28,151a0.62,0.62 0,1 1,0.62 -0.62h0a0.62,0.62 0,0 1,-0.62 0.62Z"
+ android:fillColor="#669df6"/>
+ <path
+ android:pathData="M243.03,105.11m-15.24,0a15.24,15.24 0,1 1,30.48 0a15.24,15.24 0,1 1,-30.48 0"
+ android:fillColor="#d2e3fc"/>
+ <path
+ android:pathData="M240,100.65a4.16,4.16 0,0 0,-0.1 5.88l0.1,0.1 0.76,-0.76a3.28,3.28 0,0 1,-0.92 -2.24,3 3,0 0,1 0.92,-2.22ZM247.51,99.12 L246.75,99.88a5.39,5.39 0,0 1,0 7.51l0.76,0.76a6.22,6.22 0,0 0,1.85 -4.52A6.52,6.52 0,0 0,247.54 99.12ZM239.22,99.88 L238.46,99.12a6.45,6.45 0,0 0,0 9l0.76,-0.76A5.39,5.39 0,0 1,239.25 99.88ZM245.96,100.65 L245.2,101.41a3.18,3.18 0,0 1,0.92 2.22,3 3,0 0,1 -0.92,2.24l0.76,0.76a4.24,4.24 0,0 0,1.28 -3,4.55 4.55,0 0,0 -1.26,-3ZM242.96,102.06a1.58,1.58 0,0 0,-1.6 1.56v0a1.63,1.63 0,0 0,0.92 1.47v5.53h1.28v-5.53a1.63,1.63 0,0 0,0.92 -1.47A1.58,1.58 0,0 0,243 102.06Z"
+ android:fillColor="#669df6"/>
+ <path
+ android:pathData="M206.59,77.45m-15.21,0a15.21,15.21 0,1 1,30.42 0a15.21,15.21 0,1 1,-30.42 0"
+ android:fillColor="#ceead6"/>
+ <path
+ android:pathData="M211.66,72.38h-1.9L211,74.92h-1.9l-1.29,-2.54h-1.27l1.27,2.54L206,74.92l-1.26,-2.54h-1.32l1.27,2.54h-1.9l-1.27,-2.54a1.26,1.26 0,0 0,-1.26 1.26h0v7.61a1.25,1.25 0,0 0,1.26 1.26h10.14a1.26,1.26 0,0 0,1.27 -1.26L212.93,73.65a1.27,1.27 0,0 0,-1.27 -1.27ZM211.66,81.26L201.52,81.26L201.52,76.19h10.14Z"
+ android:fillColor="#5bb974"/>
+</vector>
diff --git a/res/drawable/ic_enhanced_connectivity.xml b/res/drawable/ic_enhanced_connectivity.xml
new file mode 100644
index 0000000..45767bd
--- /dev/null
+++ b/res/drawable/ic_enhanced_connectivity.xml
@@ -0,0 +1,91 @@
+<!--
+ ~ Copyright (C) 2021 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="412dp"
+ android:height="300dp"
+ android:viewportWidth="412"
+ android:viewportHeight="300">
+ <path
+ android:pathData="M28.1,0L383.9,0A28.1,28.1 0,0 1,412 28.1L412,271.9A28.1,28.1 0,0 1,383.9 300L28.1,300A28.1,28.1 0,0 1,0 271.9L0,28.1A28.1,28.1 0,0 1,28.1 0z"
+ android:fillColor="#fff"/>
+ <path
+ android:pathData="M206,150m-108.79,0a108.79,108.79 0,1 1,217.58 0a108.79,108.79 0,1 1,-217.58 0"
+ android:strokeAlpha="0.2"
+ android:fillColor="#669df6"
+ android:fillAlpha="0.2"/>
+ <path
+ android:pathData="M206,150m-93.27,0a93.27,93.27 0,1 1,186.54 0a93.27,93.27 0,1 1,-186.54 0"
+ android:strokeAlpha="0.2"
+ android:fillColor="#669df6"
+ android:fillAlpha="0.2"/>
+ <path
+ android:pathData="M206,150m-77.85,0a77.85,77.85 0,1 1,155.7 0a77.85,77.85 0,1 1,-155.7 0"
+ android:strokeAlpha="0.2"
+ android:fillColor="#669df6"
+ android:fillAlpha="0.2"/>
+ <path
+ android:pathData="M153.7,35.5H256.88A7.09,7.09 0,0 1,264 42.57V257.19a7.09,7.09 0,0 1,-7.12 7.06H153.7a7.09,7.09 0,0 1,-7.13 -7.06V42.57A7.1,7.1 0,0 1,153.7 35.5Z"
+ android:fillColor="#fff"/>
+ <path
+ android:pathData="M267.85,102.26L267.85,93.58a2.17,2.17 0,0 0,-2.17 -2.17L265.68,45.83A10.87,10.87 0,0 0,254.83 35L155,35a10.87,10.87 0,0 0,-10.85 10.85L144.15,254.17A10.87,10.87 0,0 0,155 265h99.83a10.87,10.87 0,0 0,10.85 -10.85L265.68,147.83a2.17,2.17 0,0 0,2.17 -2.17L267.85,124a2.17,2.17 0,0 0,-2.17 -2.17L265.68,104.43A2.17,2.17 0,0 0,267.85 102.26ZM263.51,254.17a8.7,8.7 0,0 1,-8.68 8.68L155,262.85a8.7,8.7 0,0 1,-8.68 -8.68L146.32,45.83A8.7,8.7 0,0 1,155 37.15h99.83a8.7,8.7 0,0 1,8.68 8.68Z"
+ android:fillColor="#dadce0"/>
+ <path
+ android:pathData="M199.72,230.82h14a4.45,4.45 0,0 1,4.45 4.45h0a4.46,4.46 0,0 1,-4.45 4.46h-14a4.46,4.46 0,0 1,-4.45 -4.46h0a4.45,4.45 0,0 1,4.45 -4.45Z"
+ android:fillColor="#e8f0fe"/>
+ <path
+ android:pathData="M211.83,228.91h0a6.36,6.36 0,0 1,6.36 6.36h0a6.36,6.36 0,0 1,-6.35 6.37h0a6.37,6.37 0,0 1,-6.37 -6.37h0a6.36,6.36 0,0 1,6.36 -6.36Z"
+ android:fillColor="#1a73e8"/>
+ <path
+ android:pathData="M206.59,179.58m-15.27,0a15.27,15.27 0,1 1,30.54 0a15.27,15.27 0,1 1,-30.54 0"
+ android:fillColor="#f1f3f4"/>
+ <path
+ android:pathData="M191.32,179.58a15.27,15.24 0,1 0,30.54 0a15.27,15.24 0,1 0,-30.54 0z"
+ android:fillColor="#feefc3"/>
+ <path
+ android:pathData="M206.59,172.63l-5.72,4.29l0,8.59l3.57,0l0,-5.01l4.3,0l0,5.01l3.57,0l0,-8.59l-5.72,-4.29z"
+ android:fillColor="#f9ab00"/>
+ <path
+ android:pathData="M168.97,105.11m-15.24,0a15.24,15.24 0,1 1,30.48 0a15.24,15.24 0,1 1,-30.48 0"
+ android:fillColor="#fad2cf"/>
+ <path
+ android:pathData="M172.6,111.39L172.6,100.28a0.92,0.92 0,0 0,-0.92 -0.92h-1.22L170.46,97.87h-2.9v1.42h-1.2a0.93,0.93 0,0 0,-0.93 0.92v11.07a0.93,0.93 0,0 0,0.93 0.92h5.31A0.92,0.92 0,0 0,172.6 111.39ZM171.15,100.77L171.15,106h-4.34v-5.2Z"
+ android:fillColor="#d93025"/>
+ <path
+ android:pathData="M243.03,151.92m-15.27,0a15.27,15.27 0,1 1,30.54 0a15.27,15.27 0,1 1,-30.54 0"
+ android:fillColor="#fad2cf"/>
+ <path
+ android:pathData="M248.3,146.31a1.09,1.09 0,0 0,-1 -0.73h-8a1.1,1.1 0,0 0,-1 0.73l-1.5,4.34v5.8a0.71,0.71 0,0 0,0.71 0.73h0.79a0.72,0.72 0,0 0,0.72 -0.72h0v-0.72h8.68v0.72a0.73,0.73 0,0 0,0.73 0.73h0.72a0.73,0.73 0,0 0,0.73 -0.73v-5.79ZM240,153.54a1.09,1.09 0,1 1,1.09 -1.09h0a1.08,1.08 0,0 1,-1 1.12h0ZM246.52,153.54a1.09,1.09 0,1 1,1.08 -1.1v0a1.09,1.09 0,0 1,-1 1.12ZM238.75,149.28 L239.53,147.03L247,147.03l0.78,2.25Z"
+ android:fillColor="#d93025"/>
+ <path
+ android:pathData="M168.97,151.92m-15.27,0a15.27,15.27 0,1 1,30.54 0a15.27,15.27 0,1 1,-30.54 0"
+ android:fillColor="#d2e3fc"/>
+ <path
+ android:pathData="M175.8,149.23a3.68,3.68 0,0 0,-3.69 -3.08h-5.63a3.73,3.73 0,0 0,-3.69 3.08s-1.17,6.76 -1.17,6.86a1.61,1.61 0,0 0,2.72 1.15l2.66,-2.63h4.61l2.66,2.63a1.61,1.61 0,0 0,2.73 -1.15C177,156 175.8,149.23 175.8,149.23ZM168.51,150.77L167,150.77v1.53h-0.77v-1.53h-1.53L164.7,150h1.53v-1.54L167,148.46L167,150h1.54ZM170.67,151a0.62,0.62 0,1 1,0.61 -0.63h0a0.62,0.62 0,0 1,-0.61 0.62ZM171.97,152.3a0.61,0.61 0,0 1,-0.63 -0.6,0.62 0.62,0 0,1 1.24,0h0a0.61,0.61 0,0 1,-0.61 0.61ZM171.97,149.69a0.62,0.62 0,1 1,0.61 -0.63h0a0.62,0.62 0,0 1,-0.61 0.62ZM173.28,151a0.62,0.62 0,1 1,0.62 -0.62h0a0.62,0.62 0,0 1,-0.62 0.62Z"
+ android:fillColor="#1a73e8"/>
+ <path
+ android:pathData="M243.03,105.11m-15.24,0a15.24,15.24 0,1 1,30.48 0a15.24,15.24 0,1 1,-30.48 0"
+ android:fillColor="#d2e3fc"/>
+ <path
+ android:pathData="M240,100.65a4.16,4.16 0,0 0,-0.1 5.88l0.1,0.1 0.76,-0.76a3.28,3.28 0,0 1,-0.92 -2.24,3 3,0 0,1 0.92,-2.22ZM247.51,99.12 L246.75,99.88a5.39,5.39 0,0 1,0 7.51l0.76,0.76a6.22,6.22 0,0 0,1.85 -4.52A6.52,6.52 0,0 0,247.54 99.12ZM239.22,99.88 L238.46,99.12a6.45,6.45 0,0 0,0 9l0.76,-0.76A5.39,5.39 0,0 1,239.25 99.88ZM245.96,100.65 L245.2,101.41a3.18,3.18 0,0 1,0.92 2.22,3 3,0 0,1 -0.92,2.24l0.76,0.76a4.24,4.24 0,0 0,1.28 -3,4.55 4.55,0 0,0 -1.26,-3ZM242.96,102.06a1.58,1.58 0,0 0,-1.6 1.56v0a1.63,1.63 0,0 0,0.92 1.47v5.53h1.28v-5.53a1.63,1.63 0,0 0,0.92 -1.47A1.58,1.58 0,0 0,243 102.06Z"
+ android:fillColor="#1a73e8"/>
+ <path
+ android:pathData="M206.59,77.45m-15.21,0a15.21,15.21 0,1 1,30.42 0a15.21,15.21 0,1 1,-30.42 0"
+ android:fillColor="#ceead6"/>
+ <path
+ android:pathData="M211.66,72.38h-1.9L211,74.92h-1.9l-1.29,-2.54h-1.27l1.27,2.54L206,74.92l-1.26,-2.54h-1.32l1.27,2.54h-1.9l-1.27,-2.54a1.26,1.26 0,0 0,-1.26 1.26h0v7.61a1.25,1.25 0,0 0,1.26 1.26h10.14a1.26,1.26 0,0 0,1.27 -1.26L212.93,73.65a1.27,1.27 0,0 0,-1.27 -1.27ZM211.66,81.26L201.52,81.26L201.52,76.19h10.14Z"
+ android:fillColor="#1e8e3e"/>
+</vector>
diff --git a/res/layout/accessibility_autoclick_preview.xml b/res/layout/accessibility_autoclick_preview.xml
deleted file mode 100644
index 4fa3f8f..0000000
--- a/res/layout/accessibility_autoclick_preview.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2019 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <ImageView
- android:layout_width="match_parent"
- android:layout_height="@dimen/autoclick_preview_height"
- android:contentDescription="@null"
- android:scaleType="fitCenter"
- android:src="@drawable/accessibility_dwell"/>
-
-</FrameLayout>
diff --git a/res/layout/fingerprint_enroll_introduction.xml b/res/layout/fingerprint_enroll_introduction.xml
index 65c1497..5f82879 100644
--- a/res/layout/fingerprint_enroll_introduction.xml
+++ b/res/layout/fingerprint_enroll_introduction.xml
@@ -98,7 +98,7 @@
android:paddingTop="24dp">
<ImageView
- android:id="@+id/icon_fingerprint"
+ android:id="@+id/icon_device_locked"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
@@ -133,7 +133,7 @@
android:paddingTop="24dp">
<ImageView
- android:id="@+id/icon_fingerprint"
+ android:id="@+id/icon_trash_can"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
diff --git a/res/layout/manage_applications_apps.xml b/res/layout/manage_applications_apps.xml
index d814164..f8f4a76 100644
--- a/res/layout/manage_applications_apps.xml
+++ b/res/layout/manage_applications_apps.xml
@@ -14,50 +14,48 @@
limitations under the License.
-->
-<FrameLayout
+<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/apps_list"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipToPadding="false"
+ android:scrollbars="none"
+ android:visibility="invisible"
+ settings:fastScrollEnabled="true"
+ settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
+ settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
+ settings:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
+ settings:fastScrollVerticalTrackDrawable="@drawable/line_drawable"
+ settings:layout_constraintTop_toBottomOf="@id/pinned_header"/>
+
+ <TextView
+ android:id="@android:id/empty"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:gravity="center"
+ android:textAlignment="gravity"
+ android:text="@string/no_applications"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:visibility="invisible"
+ settings:layout_constraintTop_toBottomOf="@id/pinned_header"
+ settings:layout_constraintBottom_toBottomOf="parent"/>
+
+ <include layout="@layout/loading_container"
+ settings:layout_constraintTop_toBottomOf="@id/pinned_header"
+ settings:layout_constraintBottom_toBottomOf="parent"/>
+
<FrameLayout
android:id="@+id/pinned_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:elevation="2dp"/>
+ android:background="?android:colorBackground"
+ settings:layout_constraintTop_toTopOf="parent"/>
- <FrameLayout
- android:id="@+id/list_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="gone">
-
- <androidx.recyclerview.widget.RecyclerView
- android:id="@+id/apps_list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:clipToPadding="false"
- android:scrollbars="none"
- settings:fastScrollEnabled="true"
- settings:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
- settings:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
- settings:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
- settings:fastScrollVerticalTrackDrawable="@drawable/line_drawable"/>
-
- <TextView
- android:id="@android:id/empty"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="bottom|center_horizontal"
- android:layout_gravity="center"
- android:text="@string/no_applications"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:visibility="invisible"/>
-
- </FrameLayout>
-
- <include layout="@layout/loading_container"/>
-
-</FrameLayout>
-
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/layout/preference_animated_image.xml b/res/layout/preference_animated_image.xml
deleted file mode 100644
index 64cfc98..0000000
--- a/res/layout/preference_animated_image.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2019 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="@dimen/settingslib_illustration_height"
- android:gravity="center"
- android:padding="@dimen/settingslib_illustration_padding"
- android:orientation="vertical"
- android:importantForAccessibility="noHideDescendants">
-
- <ImageView
- android:id="@+id/animated_img"
- android:maxWidth="@dimen/settingslib_illustration_width"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:background="@drawable/protection_background"
- android:scaleType="fitCenter"
- android:adjustViewBounds="true"/>
-
- <com.airbnb.lottie.LottieAnimationView
- android:id="@+id/lottie_view"
- android:maxWidth="@dimen/settingslib_illustration_width"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:background="@drawable/protection_background"
- android:scaleType="fitCenter"
- android:adjustViewBounds="true"
- android:clipToOutline="true"/>
-</LinearLayout>
\ No newline at end of file
diff --git a/res/raw/lottie_swipe_for_notifications.json b/res/raw/lottie_swipe_for_notifications.json
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/res/raw/lottie_swipe_for_notifications.json
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 00577cd..3450665 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -1575,14 +1575,6 @@
<item>@string/rtt_settings_always_visible</item>
</string-array>
- <!-- Array of titles list for one-handed timeout options. [DO NOT TRANSLATE] -->
- <string-array name="one_handed_timeout_title" translatable="false">
- <item>@string/screensaver_settings_summary_never</item>
- <item>@string/one_handed_timeout_short</item>
- <item>@string/one_handed_timeout_medium</item>
- <item>@string/one_handed_timeout_long</item>
- </string-array>
-
<!-- Values of list for one-handed timeout options. [DO NOT TRANSLATE] -->
<string-array name="one_handed_timeout_values" translatable="false">
<item>0</item>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index fe0ada0..1b8179a 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -149,8 +149,6 @@
<dimen name="wifi_assistant_height">182dp</dimen>
<dimen name="wifi_assistant_image_top">32dp</dimen>
<dimen name="wifi_assistant_image_start">24dp</dimen>
- <!-- appbar height is equal search bar height (48dp) plus search bar top and bottom margin -->
- <dimen name="app_bar_height">80dp</dimen>
<!-- CryptKeeper top margin for password/pin screen -->
<dimen name="crypt_keeper_password_top_margin">88dip</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index aeaea61..62c59e1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -926,16 +926,8 @@
<string name="security_settings_fingerprint_enroll_introduction_cancel">Cancel</string>
<!-- Button text to cancel enrollment [CHAR LIMIT=30] -->
<string name="security_settings_fingerprint_enroll_introduction_no_thanks">No thanks</string>
- <!-- Button text to skip enrollment [CHAR LIMIT=30] -->
- <string name="security_settings_fingerprint_enroll_introduction_skip">No thanks</string>
- <!-- Button text to continue to the next screen from the introduction [CHAR LIMIT=22] -->
- <string name="security_settings_fingerprint_enroll_introduction_continue">Continue</string>
<!-- Button text to agree the consent and continue to the next screen from the introduction [CHAR LIMIT=22] -->
<string name="security_settings_fingerprint_enroll_introduction_agree">I agree</string>
- <!-- Button text to cancel enrollment from the introduction (this string variant is used while in setup wizard) [CHAR LIMIT=22] -->
- <string name="security_settings_fingerprint_enroll_introduction_cancel_setup">Skip</string>
- <!-- Button text to continue to the next screen from the introduction (this string variant is used while in setup wizard) [CHAR LIMIT=22] -->
- <string name="security_settings_fingerprint_enroll_introduction_continue_setup">Next</string>
<!-- Title of dialog shown when the user tries to skip setting up fingerprint after adding lock screen during initial setup. [CHAR LIMIT=30] -->
<string name="setup_fingerprint_enroll_skip_title">Skip fingerprint?</string>
<!-- Body text of dialog shown when the user tries to skip setting up fingerprint after adding lock screen during initial setup [CHAR LIMIT=NONE] -->
@@ -6163,11 +6155,11 @@
<!-- Summary for the battery limited temporarily tip [CHAR LIMIT=NONE] -->
<string name="battery_tip_limited_temporarily_summary">To preserve your battery. Learn more.</string>
<!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
- <string name="battery_tip_dialog_message" product="default">Your phone has been used more than usual. Your battery may run out sooner than expected.\n\nTop apps by battery usage:</string>
+ <string name="battery_tip_dialog_message" product="default">Because you’ve used your phone more than usual, your battery may run out sooner than it normally would.\n\nApps using most battery:</string>
<!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
- <string name="battery_tip_dialog_message" product="tablet">Your tablet has been used more than usual. Your battery may run out sooner than expected.\n\nTop apps by battery usage:</string>
+ <string name="battery_tip_dialog_message" product="tablet">Because you’ve used your tablet more than usual, your battery may run out sooner than it normally would.\n\nApps using most battery:</string>
<!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
- <string name="battery_tip_dialog_message" product="device">Your device has been used more than usual. Your battery may run out sooner than expected.\n\nTop apps by battery usage:</string>
+ <string name="battery_tip_dialog_message" product="device">Because you’ve used your device more than usual, your battery may run out sooner than it normally would.\n\nApps using most battery:</string>
<!-- Footer message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
<string name="battery_tip_dialog_message_footer">Includes high-power background activity</string>
<!-- Title for restricted app preference, showing how many app need to be restricted [CHAR LIMIT=NONE] -->
@@ -6796,6 +6788,10 @@
<string name="adaptive_connectivity_title">Adaptive connectivity</string>
<!-- Summary of Adaptive connectivity preference. [CHAR LIMIT=NONE] -->
<string name="adaptive_connectivity_summary">Extends battery life and improves device performance by automatically managing your network connections</string>
+ <!-- Switch on text of Adaptive connectivity preference. [CHAR LIMIT=NONE]-->
+ <string name="adaptive_connectivity_switch_on">On</string>
+ <!-- Switch off text of Adaptive connectivity preference. [CHAR LIMIT=NONE]-->
+ <string name="adaptive_connectivity_switch_off">Off</string>
<!-- Title of preference group for credential storage settings [CHAR LIMIT=30] -->
<string name="credentials_title">Credential storage</string>
@@ -11593,10 +11589,10 @@
<!-- [CHAR LIMIT=60] Title of work profile setting page -->
<string name="managed_profile_settings_title">Work profile settings</string>
- <!-- [CHAR LIMIT=60] The preference title for enabling cross-profile remote contact search -->
- <string name="managed_profile_contact_search_title">Contact search</string>
- <!-- [CHAR LIMIT=NONE] The preference summary for enabling cross-profile remote contact search -->
- <string name="managed_profile_contact_search_summary">Allow contact searches by your organization to identify callers and contacts</string>
+ <!-- [CHAR LIMIT=NONE] Settings toggle. This setting lets a user's personal apps identify contacts using the user's work directory. -->
+ <string name="managed_profile_contact_search_title">Let personal apps identify contacts using work directory</string>
+ <!-- [CHAR LIMIT=NONE] Settings toggle description. This setting lets a user's personal apps identify contacts using the user's work directory. "Searches" is a noun. -->
+ <string name="managed_profile_contact_search_summary">Searches and incoming calls may be visible to your IT admin</string>
<!-- [CHAR LIMIT=NONE] Settings label. This setting lets the user show their work events on their personal calendar. The adjective 'Cross-profile' is referring to the work and personal profiles a user has on their phone. -->
<string name="cross_profile_calendar_title">Cross-profile calendar</string>
<!-- [CHAR LIMIT=NONE] Setting description. If the user turns on this setting, they can see their work events on their personal calendar. -->
@@ -11748,29 +11744,16 @@
<!-- Preference and settings suggestion title text for ambient display double tap (device) [CHAR LIMIT=60]-->
<string name="ambient_display_title" product="device">Double-tap to check device</string>
- <!-- Title text for swiping downwards on the bottom of the screen for notifications [CHAR LIMIT=60]-->
- <string name="swipe_bottom_to_notifications_title">Swipe for notifications</string>
- <!-- Summary text for swiping downwards on the bottom of the screen for notifications [CHAR LIMIT=NONE]-->
- <string name="swipe_bottom_to_notifications_summary">Swipe down on the bottom edge of the screen to show your notifications.\nYou can\'t use one-handed mode when this feature is turned on.</string>
-
<!-- Preference and settings suggestion title text for one handed [CHAR LIMIT=60] -->
<string name="one_handed_title">One-handed mode</string>
<!-- Preference Switch for enabling one handed [CHAR LIMIT=60] -->
<string name="one_handed_mode_enabled">Use one-handed mode</string>
- <!-- Preference Switch for app taps to exit one handed [CHAR LIMIT=60] -->
- <string name="one_handed_app_taps_to_exit">Exit when switching apps</string>
- <!-- Timeout(Never) title for one handed [CHAR LIMIT=60] -->
- <string name="one_handed_timeout_title">Timeout</string>
- <!-- Timeout(Short) title for one handed [CHAR LIMIT=60] -->
- <string name="one_handed_timeout_short">4 seconds</string>
- <!-- Timeout(Medium) title for one handed [CHAR LIMIT=60] -->
- <string name="one_handed_timeout_medium">8 seconds</string>
- <!-- Timeout(Long) title for one handed [CHAR LIMIT=60] -->
- <string name="one_handed_timeout_long">12 seconds</string>
<!-- Search keywords for "One-Handed" settings [CHAR_LIMIT=NONE] -->
<string name="keywords_one_handed">reachability</string>
<!-- Category title for one handed swipe down [CHAR_LIMIT=60] -->
<string name="one_handed_mode_swipe_down_category">Swipe down to</string>
+ <!-- Category title for one handed use the shortcut [CHAR_LIMIT=60] -->
+ <string name="one_handed_mode_use_shortcut_category">Use the shortcut to</string>
<!-- One-handed mode Intro Text [CHAR_LIMIT=NONE] -->
<string name="one_handed_mode_intro_text">To use one handed mode, swipe down from the bottom edge of the screen. To use this feature, make sure gesture navigation is turned on in system navigation settings.</string>
<!-- One-handed mode pull down screen into reach action title [CHAR_LIMIT=60] -->
@@ -13389,7 +13372,7 @@
<string name="mobile_data_no_connection">No connection</string>
<!-- Provider Model:
Summary indicating that a SIM has no mobile data connection [CHAR LIMIT=50] -->
- <string name="mobile_data_off_summary">Internet won\u0027t auto\u2011connect</string>
+ <string name="mobile_data_off_summary">Mobile data won\u0027t auto\u2011connect</string>
<!-- Provider Model: Summary indicating that no other networks available [CHAR LIMIT=50] -->
<string name="non_carrier_network_unavailable">No other networks available</string>
<!-- Provider Model: Summary indicating that no networks available [CHAR LIMIT=50] -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 63ea86e..e25c7fa 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -394,6 +394,7 @@
<style name="BiometricHeaderStyle" parent="@*android:style/TextAppearance.DeviceDefault.Subhead">
<item name="android:paddingTop">16dp</item>
+ <item name="android:paddingBottom">24dp</item>
<item name="android:lineSpacingMultiplier">1.2</item>
</style>
diff --git a/res/xml/accessibility_autoclick_settings.xml b/res/xml/accessibility_autoclick_settings.xml
index ee27cea..06b3dce 100644
--- a/res/xml/accessibility_autoclick_settings.xml
+++ b/res/xml/accessibility_autoclick_settings.xml
@@ -19,14 +19,13 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/accessibility_autoclick_preference_title">
- <com.android.settingslib.widget.LayoutPreference
- android:key="accessibility_autoclick_preview"
- android:layout="@layout/accessibility_autoclick_preview"
+ <com.android.settingslib.widget.IllustrationPreference
+ android:key="accessibility_autoclick_banner"
android:persistent="false"
android:selectable="false"
- android:title="@string/summary_placeholder"
settings:allowDividerBelow="true"
- settings:searchable="false" />
+ settings:searchable="false"
+ settings:lottie_rawRes="@drawable/accessibility_dwell" />
<com.android.settingslib.widget.RadioButtonPreference
android:key="accessibility_control_autoclick_default"
diff --git a/res/xml/accounts_dashboard_settings.xml b/res/xml/accounts_dashboard_settings.xml
index c8627e7..71bfc18 100644
--- a/res/xml/accounts_dashboard_settings.xml
+++ b/res/xml/accounts_dashboard_settings.xml
@@ -37,7 +37,6 @@
<com.android.settings.widget.GearPreference
android:fragment="com.android.settings.applications.defaultapps.DefaultAutofillPicker"
android:key="default_autofill_main"
- android:title="@string/autofill_app"
settings:keywords="@string/autofill_keywords">
<extra
android:name="for_work"
diff --git a/res/xml/accounts_personal_dashboard_settings.xml b/res/xml/accounts_personal_dashboard_settings.xml
index e0ba71b..b01c235 100644
--- a/res/xml/accounts_personal_dashboard_settings.xml
+++ b/res/xml/accounts_personal_dashboard_settings.xml
@@ -38,7 +38,6 @@
<com.android.settings.widget.GearPreference
android:fragment="com.android.settings.applications.defaultapps.DefaultAutofillPicker"
android:key="default_autofill_main"
- android:title="@string/autofill_app"
settings:keywords="@string/autofill_keywords">
<extra
android:name="for_work"
diff --git a/res/xml/accounts_work_dashboard_settings.xml b/res/xml/accounts_work_dashboard_settings.xml
index 1c4c6aa..c24ea6f 100644
--- a/res/xml/accounts_work_dashboard_settings.xml
+++ b/res/xml/accounts_work_dashboard_settings.xml
@@ -38,7 +38,6 @@
<com.android.settings.widget.GearPreference
android:fragment="com.android.settings.applications.defaultapps.DefaultAutofillPicker"
android:key="default_autofill_work"
- android:title="@string/autofill_app"
settings:searchable="false">
<extra
android:name="for_work"
diff --git a/res/xml/adaptive_connectivity_settings.xml b/res/xml/adaptive_connectivity_settings.xml
index ff9bdb0..d5941ad 100644
--- a/res/xml/adaptive_connectivity_settings.xml
+++ b/res/xml/adaptive_connectivity_settings.xml
@@ -19,20 +19,18 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/adaptive_connectivity_title">
- <com.android.settingslib.widget.LayoutPreference
- android:key="adaptive_connectivity_header"
- android:layout="@layout/adaptive_connectivity_header"
- android:persistent="false"
- android:selectable="false"
- android:title="@string/summary_placeholder"
- settings:allowDividerBelow="true"
- settings:searchable="false"/>
+ <com.android.settingslib.widget.TopIntroPreference
+ settings:searchable="false"
+ android:title="@string/adaptive_connectivity_summary"/>
- <SwitchPreference
+ <com.android.settingslib.widget.IllustrationPreference
+ android:key="adaptive_connectivity_header"
+ settings:searchable="false"
+ settings:lottie_rawRes="@drawable/ic_enhanced_connectivity"/>
+
+ <com.android.settingslib.widget.MainSwitchPreference
android:key="adaptive_connectivity"
android:title="@string/adaptive_connectivity_title"
- android:summary="@string/adaptive_connectivity_summary"
- settings:allowDividerAbove="true"
settings:controller="com.android.settings.network.AdaptiveConnectivityTogglePreferenceController"/>
</PreferenceScreen>
diff --git a/res/xml/location_services.xml b/res/xml/location_services.xml
index 516491c..2de4e7b 100644
--- a/res/xml/location_services.xml
+++ b/res/xml/location_services.xml
@@ -16,7 +16,7 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:title="@string/location_services_screen_title">
+ android:title="@string/location_services_preference_title">
<PreferenceCategory
android:key="location_services"
diff --git a/res/xml/one_handed_settings.xml b/res/xml/one_handed_settings.xml
index 8893e1e..2f5c091 100644
--- a/res/xml/one_handed_settings.xml
+++ b/res/xml/one_handed_settings.xml
@@ -39,7 +39,8 @@
<PreferenceCategory
android:key="gesture_one_handed_mode_swipe_down"
- android:title="@string/one_handed_mode_swipe_down_category">
+ android:title="@string/one_handed_mode_swipe_down_category"
+ settings:controller="com.android.settings.gestures.OneHandedPreferenceCategoryController">
<com.android.settingslib.widget.RadioButtonPreference
android:key="gesture_one_handed_action_pull_screen_down"
@@ -54,5 +55,4 @@
settings:controller="com.android.settings.gestures.OneHandedActionShowNotificationPrefController"/>
</PreferenceCategory>
-
</PreferenceScreen>
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 12f63ea..f3cdd6c 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -574,7 +574,7 @@
/**
* Switch to a specific Fragment with taking care of validation, Title and BackStack
*/
- private Fragment switchToFragment(String fragmentName, Bundle args, boolean validate,
+ private void switchToFragment(String fragmentName, Bundle args, boolean validate,
int titleResId, CharSequence title) {
Log.d(LOG_TAG, "Switching to fragment " + fragmentName);
if (validate && !isValidFragment(fragmentName)) {
@@ -582,6 +582,9 @@
+ fragmentName);
}
Fragment f = Utils.getTargetFragment(this, fragmentName, args);
+ if (f == null) {
+ return;
+ }
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.main_content, f);
if (titleResId > 0) {
@@ -592,7 +595,6 @@
transaction.commitAllowingStateLoss();
getSupportFragmentManager().executePendingTransactions();
Log.d(LOG_TAG, "Executed frag manager pendingTransactions");
- return f;
}
private void updateTilesList() {
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 708dbed..e79852b 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -1158,13 +1158,17 @@
== ProfileSelectFragment.ProfileType.PERSONAL : false;
final boolean isWork = args != null ? args.getInt(ProfileSelectFragment.EXTRA_PROFILE)
== ProfileSelectFragment.ProfileType.WORK : false;
- if (activity.getSystemService(UserManager.class).getUserProfiles().size() > 1
- && ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName) != null
- && !isWork && !isPersonal) {
- f = Fragment.instantiate(activity, ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName),
- args);
- } else {
- f = Fragment.instantiate(activity, fragmentName, args);
+ try {
+ if (activity.getSystemService(UserManager.class).getUserProfiles().size() > 1
+ && ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName) != null
+ && !isWork && !isPersonal) {
+ f = Fragment.instantiate(activity,
+ ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName), args);
+ } else {
+ f = Fragment.instantiate(activity, fragmentName, args);
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "Unable to get target fragment", e);
}
return f;
}
diff --git a/src/com/android/settings/accessibility/AnimatedImagePreference.java b/src/com/android/settings/accessibility/AnimatedImagePreference.java
deleted file mode 100644
index c707e5c..0000000
--- a/src/com/android/settings/accessibility/AnimatedImagePreference.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import android.content.Context;
-import android.graphics.drawable.Animatable;
-import android.graphics.drawable.Animatable2;
-import android.graphics.drawable.AnimationDrawable;
-import android.graphics.drawable.Drawable;
-import android.net.Uri;
-import android.util.Log;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-
-import androidx.preference.Preference;
-import androidx.preference.PreferenceViewHolder;
-
-import com.android.settings.R;
-
-import com.airbnb.lottie.LottieAnimationView;
-import com.airbnb.lottie.LottieDrawable;
-
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.Objects;
-
-/**
- * A custom {@link ImageView} preference for showing animated or static image, such as <a
- * href="https://developers.google.com/speed/webp/">animated webp</a> and static png.
- */
-public class AnimatedImagePreference extends Preference {
-
- private static final String TAG = "AnimatedImagePreference";
- private Uri mImageUri;
- private int mMaxHeight = -1;
-
- private final Animatable2.AnimationCallback mAnimationCallback =
- new Animatable2.AnimationCallback() {
- @Override
- public void onAnimationEnd(Drawable drawable) {
- ((Animatable2) drawable).start();
- }
- };
-
- AnimatedImagePreference(Context context) {
- super(context);
- setLayoutResource(R.layout.preference_animated_image);
- }
-
- @Override
- public void onBindViewHolder(PreferenceViewHolder holder) {
- super.onBindViewHolder(holder);
-
- final ImageView imageView = holder.itemView.findViewById(R.id.animated_img);
- final LottieAnimationView lottieView = holder.itemView.findViewById(R.id.lottie_view);
- if (imageView == null || lottieView == null) {
- return;
- }
-
- if (mImageUri != null) {
- resetAnimations(imageView, lottieView);
- hideAllChildViews(holder.itemView);
-
- imageView.setImageURI(mImageUri);
- if (imageView.getDrawable() != null) {
- startAnimationWith(imageView);
- } else {
- // The lottie image from the raw folder also returns null.
- startLottieAnimationWith(lottieView);
- }
- }
-
- if (mMaxHeight > -1) {
- imageView.setMaxHeight(mMaxHeight);
- lottieView.setMaxHeight(mMaxHeight);
- }
- }
-
- /**
- * Sets image uri to display image in {@link ImageView}
- *
- * @param imageUri the Uri of an image
- */
- public void setImageUri(Uri imageUri) {
- if (imageUri != null && !imageUri.equals(mImageUri)) {
- mImageUri = imageUri;
- notifyChanged();
- }
- }
-
- /**
- * Sets the maximum height of the view.
- *
- * @param maxHeight the maximum height of ImageView in terms of pixels.
- */
- public void setMaxHeight(int maxHeight) {
- if (maxHeight != mMaxHeight) {
- mMaxHeight = maxHeight;
- notifyChanged();
- }
- }
-
- private void startAnimationWith(ImageView imageView) {
- startAnimation(imageView.getDrawable());
-
- imageView.setVisibility(View.VISIBLE);
- }
-
- private void startLottieAnimationWith(LottieAnimationView lottieView) {
- final InputStream inputStream = getInputStreamFromUri(mImageUri);
- Objects.requireNonNull(inputStream, "Invalid resource.");
- lottieView.setAnimation(inputStream, /* cacheKey= */ null);
- lottieView.setRepeatCount(LottieDrawable.INFINITE);
- lottieView.playAnimation();
-
- lottieView.setVisibility(View.VISIBLE);
- }
-
- private void startAnimation(Drawable drawable) {
- if (!(drawable instanceof Animatable)) {
- return;
- }
-
- if (drawable instanceof Animatable2) {
- ((Animatable2) drawable).registerAnimationCallback(mAnimationCallback);
- } else if (drawable instanceof AnimationDrawable) {
- ((AnimationDrawable) drawable).setOneShot(false);
- }
-
- ((Animatable) drawable).start();
- }
-
- private void resetAnimations(ImageView imageView, LottieAnimationView lottieView) {
- resetAnimation(imageView.getDrawable());
-
- lottieView.cancelAnimation();
- }
-
- private void resetAnimation(Drawable drawable) {
- if (!(drawable instanceof Animatable)) {
- return;
- }
-
- if (drawable instanceof Animatable2) {
- ((Animatable2) drawable).clearAnimationCallbacks();
- }
-
- ((Animatable) drawable).stop();
- }
-
- private InputStream getInputStreamFromUri(Uri uri) {
- try {
- return getContext().getContentResolver().openInputStream(uri);
- } catch (FileNotFoundException e) {
- Log.w(TAG, "Cannot find content uri: " + uri, e);
- return null;
- }
- }
-
- private void hideAllChildViews(View itemView) {
- final ViewGroup viewGroup = (ViewGroup) itemView;
- for (int i = 0; i < viewGroup.getChildCount(); i++) {
- viewGroup.getChildAt(i).setVisibility(View.GONE);
- }
- }
-}
diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
index 640ae53..510f8d3 100644
--- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
@@ -59,6 +59,7 @@
import com.android.settings.widget.SettingsMainSwitchPreference;
import com.android.settingslib.HelpUtils;
import com.android.settingslib.accessibility.AccessibilityUtils;
+import com.android.settingslib.widget.IllustrationPreference;
import com.android.settingslib.widget.OnMainSwitchChangeListener;
import com.google.android.setupcompat.util.WizardManagerHelper;
@@ -398,15 +399,13 @@
return;
}
- final int screenHalfHeight = AccessibilityUtil.getScreenHeightPixels(getPrefContext()) / 2;
- final AnimatedImagePreference animatedImagePreference =
- new AnimatedImagePreference(getPrefContext());
- animatedImagePreference.setImageUri(mImageUri);
- animatedImagePreference.setSelectable(false);
- animatedImagePreference.setMaxHeight(screenHalfHeight);
- animatedImagePreference.setKey(KEY_ANIMATED_IMAGE);
+ final IllustrationPreference illustrationPreference =
+ new IllustrationPreference(getPrefContext());
+ illustrationPreference.setImageUri(mImageUri);
+ illustrationPreference.setSelectable(false);
+ illustrationPreference.setKey(KEY_ANIMATED_IMAGE);
- getPreferenceScreen().addPreference(animatedImagePreference);
+ getPreferenceScreen().addPreference(illustrationPreference);
}
private void initToggleServiceSwitchPreference() {
diff --git a/src/com/android/settings/applications/RunningServices.java b/src/com/android/settings/applications/RunningServices.java
index 4d13241..b1689d5 100644
--- a/src/com/android/settings/applications/RunningServices.java
+++ b/src/com/android/settings/applications/RunningServices.java
@@ -72,7 +72,11 @@
public void onResume() {
super.onResume();
boolean haveData = mRunningProcessesView.doResume(this, mRunningProcessesAvail);
- mLoadingViewController.handleLoadingContainer(haveData /* done */, false /* animate */);
+ if (haveData) {
+ mLoadingViewController.showContent(false /* animate */);
+ } else {
+ mLoadingViewController.showLoadingView();
+ }
}
@Override
diff --git a/src/com/android/settings/applications/appinfo/AppBatteryPreferenceController.java b/src/com/android/settings/applications/appinfo/AppBatteryPreferenceController.java
index 89c3478..f0285bc 100644
--- a/src/com/android/settings/applications/appinfo/AppBatteryPreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/AppBatteryPreferenceController.java
@@ -78,6 +78,7 @@
private String mBatteryPercent;
private final String mPackageName;
private final int mUid;
+ private final int mUserId;
private boolean mBatteryUsageStatsLoaded = false;
private boolean mBatteryDiffEntriesLoaded = false;
@@ -88,6 +89,7 @@
mBatteryUtils = BatteryUtils.getInstance(mContext);
mPackageName = packageName;
mUid = uid;
+ mUserId = mContext.getUserId();
refreshFeatureFlag(mContext);
if (lifecycle != null) {
lifecycle.addObserver(this);
@@ -173,16 +175,29 @@
protected BatteryDiffEntry doInBackground(Void... unused) {
final List<BatteryDiffEntry> batteryDiffEntries =
BatteryChartPreferenceController.getBatteryLast24HrUsageData(mContext);
- if (batteryDiffEntries != null) {
- for (BatteryDiffEntry batteryDiffEntry : batteryDiffEntries) {
- if (batteryDiffEntry.mBatteryHistEntry.mUid == mUid
- && batteryDiffEntry.mBatteryHistEntry.mConsumerType
- == ConvertUtils.CONSUMER_TYPE_UID_BATTERY) {
- return batteryDiffEntry;
- }
- }
+ if (batteryDiffEntries == null) {
+ return null;
}
- return null;
+ // Filter entry with consumer type to avoid system app,
+ // then use user id to divide normal app and work profile app,
+ // return target application from filter list by package name.
+ return batteryDiffEntries.stream()
+ .filter(entry -> entry.mBatteryHistEntry.mConsumerType
+ == ConvertUtils.CONSUMER_TYPE_UID_BATTERY)
+ .filter(entry -> entry.mBatteryHistEntry.mUserId == mUserId)
+ .filter(entry -> {
+ if (entry.mBatteryHistEntry.mPackageName
+ .equals(mPackageName)) {
+ Log.i(TAG, "Return target application: "
+ + entry.mBatteryHistEntry.mPackageName
+ + " | uid: " + entry.mBatteryHistEntry.mUid
+ + " | userId: " + entry.mBatteryHistEntry.mUserId);
+ return true;
+ }
+ return false;
+ })
+ .findFirst()
+ .orElse(/* other */null);
}
@Override
diff --git a/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceController.java b/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceController.java
index fd6f4c2..d962692 100644
--- a/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceController.java
+++ b/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceController.java
@@ -65,11 +65,19 @@
((TwoTargetPreference) preference).setIconSize(ICON_SIZE_MEDIUM);
}
if (!TextUtils.isEmpty(defaultAppLabel)) {
- preference.setSummary(defaultAppLabel);
+ if (showLabelAsTitle()) {
+ preference.setTitle(defaultAppLabel);
+ } else {
+ preference.setSummary(defaultAppLabel);
+ }
preference.setIcon(Utils.getSafeIcon(getDefaultAppIcon()));
} else {
Log.d(TAG, "No default app");
- preference.setSummary(R.string.app_list_preference_none);
+ if (showLabelAsTitle()) {
+ preference.setTitle(R.string.app_list_preference_none);
+ } else {
+ preference.setSummary(R.string.app_list_preference_none);
+ }
preference.setIcon(null);
}
mayUpdateGearIcon(app, preference);
@@ -102,6 +110,13 @@
return null;
}
+ /**
+ * Whether to show the default app label as the title, instead of as the summary.
+ */
+ protected boolean showLabelAsTitle() {
+ return false;
+ }
+
public Drawable getDefaultAppIcon() {
if (!isAvailable()) {
return null;
diff --git a/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceController.java b/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceController.java
index d32322b..1493e30 100644
--- a/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceController.java
+++ b/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceController.java
@@ -69,4 +69,9 @@
}
return null;
}
+
+ @Override
+ protected boolean showLabelAsTitle() {
+ return true;
+ }
}
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index 6d67524..43e929b 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -208,7 +208,6 @@
private ApplicationsAdapter mApplications;
private View mLoadingContainer;
- private View mListContainer;
private SearchView mSearchView;
// Size resource used for packages whose size computation failed for some reason
@@ -402,25 +401,21 @@
mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
mLoadingContainer = mRootView.findViewById(R.id.loading_container);
- mListContainer = mRootView.findViewById(R.id.list_container);
- if (mListContainer != null) {
- // Create adapter and list view here
- mEmptyView = mListContainer.findViewById(android.R.id.empty);
+ mEmptyView = mRootView.findViewById(android.R.id.empty);
+ mRecyclerView = mRootView.findViewById(R.id.apps_list);
- mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter,
- savedInstanceState);
- if (savedInstanceState != null) {
- mApplications.mHasReceivedLoadEntries =
- savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
- mApplications.mHasReceivedBridgeCallback =
- savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
- }
- mRecyclerView = mListContainer.findViewById(R.id.apps_list);
- mRecyclerView.setItemAnimator(null);
- mRecyclerView.setLayoutManager(new LinearLayoutManager(
- getContext(), RecyclerView.VERTICAL, false /* reverseLayout */));
- mRecyclerView.setAdapter(mApplications);
+ mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter,
+ savedInstanceState);
+ if (savedInstanceState != null) {
+ mApplications.mHasReceivedLoadEntries =
+ savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
+ mApplications.mHasReceivedBridgeCallback =
+ savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
}
+ mRecyclerView.setItemAnimator(null);
+ mRecyclerView.setLayoutManager(new LinearLayoutManager(
+ getContext(), RecyclerView.VERTICAL, false /* reverseLayout */));
+ mRecyclerView.setAdapter(mApplications);
// We have to do this now because PreferenceFrameLayout looks at it
// only when the view is added.
@@ -985,16 +980,8 @@
// overlapped by floating filter.
if (hasFilter) {
mManageApplications.mSpinnerHeader.setVisibility(View.VISIBLE);
- mManageApplications.mRecyclerView.setPadding(0 /* left */,
- mContext.getResources().getDimensionPixelSize(
- R.dimen.app_bar_height) /* top */,
- 0 /* right */,
- 0 /* bottom */);
} else {
mManageApplications.mSpinnerHeader.setVisibility(View.GONE);
- mManageApplications.mRecyclerView.setPadding(0 /* left */, 0 /* top */,
- 0 /* right */,
- 0 /* bottom */);
}
}
}
@@ -1044,7 +1031,8 @@
mManageApplications = manageApplications;
mLoadingViewController = new LoadingViewController(
mManageApplications.mLoadingContainer,
- mManageApplications.mListContainer
+ mManageApplications.mRecyclerView,
+ mManageApplications.mEmptyView
);
mContext = manageApplications.getActivity();
mIconDrawableFactory = IconDrawableFactory.newInstance(mContext);
@@ -1303,11 +1291,9 @@
mOriginalEntries = entries;
notifyDataSetChanged();
if (getItemCount() == 0) {
- mManageApplications.mRecyclerView.setVisibility(View.GONE);
- mManageApplications.mEmptyView.setVisibility(View.VISIBLE);
+ mLoadingViewController.showEmpty(false /* animate */);
} else {
- mManageApplications.mEmptyView.setVisibility(View.GONE);
- mManageApplications.mRecyclerView.setVisibility(View.VISIBLE);
+ mLoadingViewController.showContent(false /* animate */);
if (mManageApplications.mSearchView != null
&& mManageApplications.mSearchView.isVisibleToUser()) {
@@ -1324,10 +1310,6 @@
mLastIndex = -1;
}
- if (mSession.getAllApps().size() != 0
- && mManageApplications.mListContainer.getVisibility() != View.VISIBLE) {
- mLoadingViewController.showContent(true /* animate */);
- }
if (mManageApplications.mListType == LIST_TYPE_USAGE_ACCESS) {
// No enabled or disabled filters for usage access.
return;
diff --git a/src/com/android/settings/biometrics/BiometricEnrollActivity.java b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
index 3b8f255..26d8a45 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollActivity.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
@@ -242,6 +242,7 @@
// This will need to be updated if the device has sensors other than BIOMETRIC_STRONG
if (!setupWizard && authenticators == BiometricManager.Authenticators.DEVICE_CREDENTIAL) {
launchCredentialOnlyEnroll();
+ finish();
} else if (canUseFace && canUseFingerprint) {
if (mParentalOptionsRequired && mGkPwHandle != null) {
launchFaceAndFingerprintEnroll();
@@ -405,22 +406,6 @@
super.onApplyThemeResource(theme, newResid, first);
}
- @Override
- protected void onStop() {
- super.onStop();
-
- if (mConfirmingCredentials
- || mParentalOptionsRequired
- || mMultiBiometricEnrollHelper != null) {
- return;
- }
-
- if (!isChangingConfigurations()) {
- Log.d(TAG, "Finishing in onStop");
- finish();
- }
- }
-
private void setOrConfirmCredentialsNow() {
if (!mConfirmingCredentials) {
mConfirmingCredentials = true;
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java
index 8c3b1ce..a75fb0f 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollIntroduction.java
@@ -64,9 +64,13 @@
super.onCreate(savedInstanceState);
final ImageView iconFingerprint = findViewById(R.id.icon_fingerprint);
+ final ImageView iconDeviceLocked = findViewById(R.id.icon_device_locked);
+ final ImageView iconTrashCan = findViewById(R.id.icon_trash_can);
final ImageView iconInfo = findViewById(R.id.icon_info);
final ImageView iconLink = findViewById(R.id.icon_link);
iconFingerprint.getDrawable().setColorFilter(getIconColorFilter());
+ iconDeviceLocked.getDrawable().setColorFilter(getIconColorFilter());
+ iconTrashCan.getDrawable().setColorFilter(getIconColorFilter());
iconInfo.getDrawable().setColorFilter(getIconColorFilter());
iconLink.getDrawable().setColorFilter(getIconColorFilter());
@@ -87,7 +91,7 @@
@StringRes
int getNegativeButtonTextId() {
- return R.string.security_settings_fingerprint_enroll_introduction_skip;
+ return R.string.security_settings_fingerprint_enroll_introduction_no_thanks;
}
@StringRes
diff --git a/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollIntroduction.java b/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollIntroduction.java
index e105911..4bd8afd 100644
--- a/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollIntroduction.java
@@ -26,7 +26,6 @@
import android.view.View;
import com.android.internal.widget.LockPatternUtils;
-import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
import com.android.settings.Utils;
import com.android.settings.biometrics.BiometricUtils;
@@ -34,8 +33,6 @@
import com.android.settings.password.SetupChooseLockGeneric;
import com.android.settings.password.SetupSkipDialog;
-import com.google.android.setupcompat.template.FooterButton;
-
public class SetupFingerprintEnrollIntroduction extends FingerprintEnrollIntroduction {
/**
* Returns the number of fingerprint enrolled.
@@ -57,11 +54,6 @@
}
@Override
- int getNegativeButtonTextId() {
- return R.string.security_settings_face_enroll_introduction_cancel;
- }
-
- @Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(KEY_LOCK_SCREEN_PRESENT, mAlreadyHadLockScreenSetup);
@@ -79,19 +71,6 @@
}
@Override
- protected void initViews() {
- super.initViews();
-
- FooterButton nextButton = getNextButton();
- nextButton.setText(
- this, R.string.security_settings_fingerprint_enroll_introduction_continue_setup);
-
- final FooterButton cancelButton = getCancelButton();
- cancelButton.setText(
- this, R.string.security_settings_fingerprint_enroll_introduction_cancel_setup);
- }
-
- @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// if lock was already present, do not return intent data since it must have been
// reported in previous attempts
diff --git a/src/com/android/settings/connecteddevice/usb/UsbDetailsFragment.java b/src/com/android/settings/connecteddevice/usb/UsbDetailsFragment.java
index 8d14cf9..8850acd 100644
--- a/src/com/android/settings/connecteddevice/usb/UsbDetailsFragment.java
+++ b/src/com/android/settings/connecteddevice/usb/UsbDetailsFragment.java
@@ -107,7 +107,7 @@
@Override
protected boolean isPageSearchEnabled(Context context) {
return checkIfUsbDataSignalingIsDisabled(
- context, UserHandle.myUserId()) != null;
+ context, UserHandle.myUserId()) == null;
}
@Override
diff --git a/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelper.java b/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelper.java
index ccc7436..f898ab2 100644
--- a/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelper.java
+++ b/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelper.java
@@ -65,7 +65,8 @@
R.layout.admin_support_details_dialog, null);
mActionDisabledByAdminController = ActionDisabledByAdminControllerFactory
.createInstance(mActivity, restriction,
- new DeviceAdminStringProviderImpl(mActivity));
+ new DeviceAdminStringProviderImpl(mActivity),
+ UserHandle.SYSTEM);
}
private @UserIdInt int getEnforcementAdminUserId(@NonNull EnforcedAdmin admin) {
diff --git a/src/com/android/settings/gestures/OneHandedActionPullDownPrefController.java b/src/com/android/settings/gestures/OneHandedActionPullDownPrefController.java
index 84ea8b6..e17165b 100644
--- a/src/com/android/settings/gestures/OneHandedActionPullDownPrefController.java
+++ b/src/com/android/settings/gestures/OneHandedActionPullDownPrefController.java
@@ -92,7 +92,8 @@
if (mPreference == null) {
return;
}
- if (uri.equals(OneHandedSettingsUtils.ONE_HANDED_MODE_ENABLED_URI)) {
+ if (uri.equals(OneHandedSettingsUtils.ONE_HANDED_MODE_ENABLED_URI)
+ || uri.equals(OneHandedSettingsUtils.SHORTCUT_ENABLED_URI)) {
mPreference.setEnabled(OneHandedSettingsUtils.canEnableController(mContext));
} else if (uri.equals(OneHandedSettingsUtils.SHOW_NOTIFICATION_ENABLED_URI)) {
updateState(mPreference);
diff --git a/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefController.java b/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefController.java
index 5644299..9f56a14 100644
--- a/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefController.java
+++ b/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefController.java
@@ -92,7 +92,8 @@
if (mPreference == null) {
return;
}
- if (uri.equals(OneHandedSettingsUtils.ONE_HANDED_MODE_ENABLED_URI)) {
+ if (uri.equals(OneHandedSettingsUtils.ONE_HANDED_MODE_ENABLED_URI)
+ || uri.equals(OneHandedSettingsUtils.SHORTCUT_ENABLED_URI)) {
mPreference.setEnabled(OneHandedSettingsUtils.canEnableController(mContext));
} else if (uri.equals(OneHandedSettingsUtils.SHOW_NOTIFICATION_ENABLED_URI)) {
updateState(mPreference);
diff --git a/src/com/android/settings/gestures/OneHandedEnablePreferenceController.java b/src/com/android/settings/gestures/OneHandedEnablePreferenceController.java
index bd8de9f..29004c8 100644
--- a/src/com/android/settings/gestures/OneHandedEnablePreferenceController.java
+++ b/src/com/android/settings/gestures/OneHandedEnablePreferenceController.java
@@ -17,7 +17,6 @@
package com.android.settings.gestures;
import android.content.Context;
-import android.provider.Settings;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
@@ -27,8 +26,6 @@
*/
public class OneHandedEnablePreferenceController extends BasePreferenceController {
- private static final String ONE_HANDED_ENABLED = Settings.Secure.ONE_HANDED_MODE_ENABLED;
-
public OneHandedEnablePreferenceController(Context context, String preferenceKey) {
super(context, preferenceKey);
}
@@ -44,5 +41,4 @@
OneHandedSettingsUtils.isOneHandedModeEnabled(mContext)
? R.string.gesture_setting_on : R.string.gesture_setting_off);
}
-
}
diff --git a/src/com/android/settings/gestures/OneHandedPreferenceCategoryController.java b/src/com/android/settings/gestures/OneHandedPreferenceCategoryController.java
new file mode 100644
index 0000000..9623299
--- /dev/null
+++ b/src/com/android/settings/gestures/OneHandedPreferenceCategoryController.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.gestures;
+
+import android.content.Context;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+
+/**
+ * Category Preference controller for One-handed mode category
+ */
+public class OneHandedPreferenceCategoryController extends BasePreferenceController {
+
+ private Preference mPreference;
+
+ public OneHandedPreferenceCategoryController(Context context, String preferenceKey) {
+ super(context, preferenceKey);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return AVAILABLE;
+ }
+
+ @Override
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
+ mPreference = screen.findPreference(getPreferenceKey());
+ mPreference.setTitle(
+ OneHandedSettingsUtils.getNavigationBarMode(mContext) == 0 /* 3 button */
+ ? R.string.one_handed_mode_use_shortcut_category
+ : R.string.one_handed_mode_swipe_down_category);
+ }
+}
diff --git a/src/com/android/settings/gestures/OneHandedSettings.java b/src/com/android/settings/gestures/OneHandedSettings.java
index 6d1cbfd..51c6b66 100644
--- a/src/com/android/settings/gestures/OneHandedSettings.java
+++ b/src/com/android/settings/gestures/OneHandedSettings.java
@@ -16,19 +16,18 @@
package com.android.settings.gestures;
+import android.app.Activity;
import android.app.settings.SettingsEnums;
import android.content.ComponentName;
import android.content.Context;
import android.os.Bundle;
import android.os.UserHandle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
import com.android.internal.accessibility.AccessibilityShortcutController;
import com.android.settings.R;
import com.android.settings.accessibility.AccessibilityShortcutPreferenceFragment;
import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.widget.IllustrationPreference;
/**
* Fragment for One-handed mode settings
@@ -37,13 +36,27 @@
* providing basic accessibility shortcut service setup.
*/
public class OneHandedSettings extends AccessibilityShortcutPreferenceFragment {
+
private static final String ONE_HANDED_SHORTCUT_KEY = "one_handed_shortcuts_preference";
+ private static final String ONE_HANDED_ILLUSTRATION_KEY = "one_handed_header";
private String mFeatureName;
+ private OneHandedSettingsUtils mUtils;
@Override
protected void updatePreferenceStates() {
OneHandedSettingsUtils.setUserId(UserHandle.myUserId());
super.updatePreferenceStates();
+
+ final IllustrationPreference preference =
+ (IllustrationPreference) getPreferenceScreen().findPreference(
+ ONE_HANDED_ILLUSTRATION_KEY);
+ if (preference != null) {
+ final boolean isSwipeDownNotification =
+ OneHandedSettingsUtils.isSwipeDownNotificationEnabled(getContext());
+ preference.setLottieAnimationResId(
+ isSwipeDownNotification ? R.raw.lottie_swipe_for_notifications
+ : R.raw.lottie_one_hand_mode);
+ }
}
@Override
@@ -69,9 +82,21 @@
}
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- return super.onCreateView(inflater, container, savedInstanceState);
+ public void onStart() {
+ super.onStart();
+ mUtils = new OneHandedSettingsUtils(this.getContext());
+ mUtils.registerToggleAwareObserver(uri -> {
+ Activity activity = getActivity();
+ if (activity != null) {
+ activity.runOnUiThread(() -> updatePreferenceStates());
+ }
+ });
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ mUtils.unregisterToggleAwareObserver();
}
@Override
diff --git a/src/com/android/settings/gestures/OneHandedSettingsUtils.java b/src/com/android/settings/gestures/OneHandedSettingsUtils.java
index a931129..f058689 100644
--- a/src/com/android/settings/gestures/OneHandedSettingsUtils.java
+++ b/src/com/android/settings/gestures/OneHandedSettingsUtils.java
@@ -16,6 +16,8 @@
package com.android.settings.gestures;
+import static com.android.internal.accessibility.AccessibilityShortcutController.ONE_HANDED_COMPONENT_NAME;
+
import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
@@ -33,6 +35,9 @@
*/
public class OneHandedSettingsUtils {
+ static final String ONE_HANDED_MODE_TARGET_NAME =
+ ONE_HANDED_COMPONENT_NAME.getShortClassName();
+
static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode";
static final int OFF = 0;
static final int ON = 1;
@@ -40,6 +45,8 @@
Settings.Secure.getUriFor(Settings.Secure.ONE_HANDED_MODE_ENABLED);
static final Uri SHOW_NOTIFICATION_ENABLED_URI =
Settings.Secure.getUriFor(Settings.Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED);
+ static final Uri SHORTCUT_ENABLED_URI =
+ Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
public enum OneHandedTimeout {
NEVER(0), SHORT(4), MEDIUM(8), LONG(12);
@@ -220,8 +227,30 @@
* navigation settings.
*/
public static boolean canEnableController(Context context) {
- return (OneHandedSettingsUtils.isOneHandedModeEnabled(context)
- && OneHandedSettingsUtils.getNavigationBarMode(context) != 0 /* 3-button mode */);
+ return ((OneHandedSettingsUtils.isOneHandedModeEnabled(context)
+ && getNavigationBarMode(context) != 0 /* 3-button */)
+ || getShortcutEnabled(context));
+ }
+
+ /**
+ * Queries one-handed mode shortcut enabled in settings or not.
+ *
+ * @return true if user enabled one-handed shortcut in settings, false otherwise.
+ */
+ public static boolean getShortcutEnabled(Context context) {
+ final String targets = Settings.Secure.getStringForUser(context.getContentResolver(),
+ Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS, sCurrentUserId);
+ return targets != null ? targets.contains(ONE_HANDED_MODE_TARGET_NAME) : false;
+ }
+
+ /**
+ * This is a test only API for set Shortcut enabled or not.
+ */
+ @VisibleForTesting
+ public void setShortcutEnabled(Context context, boolean enabled) {
+ final String targetName = enabled ? ONE_HANDED_MODE_TARGET_NAME : "";
+ Settings.Secure.putStringForUser(context.getContentResolver(),
+ Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS, targetName, sCurrentUserId);
}
/**
@@ -256,6 +285,7 @@
final ContentResolver resolver = mContext.getContentResolver();
resolver.registerContentObserver(ONE_HANDED_MODE_ENABLED_URI, true, this);
resolver.registerContentObserver(SHOW_NOTIFICATION_ENABLED_URI, true, this);
+ resolver.registerContentObserver(SHORTCUT_ENABLED_URI, true, this);
}
@Override
diff --git a/src/com/android/settings/network/AdaptiveConnectivityPreferenceController.java b/src/com/android/settings/network/AdaptiveConnectivityPreferenceController.java
index 33d1d5b..a938515 100644
--- a/src/com/android/settings/network/AdaptiveConnectivityPreferenceController.java
+++ b/src/com/android/settings/network/AdaptiveConnectivityPreferenceController.java
@@ -48,7 +48,7 @@
public CharSequence getSummary() {
return Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.ADAPTIVE_CONNECTIVITY_ENABLED, 1) == 1
- ? mContext.getString(R.string.switch_on_text)
- : mContext.getString(R.string.switch_off_text);
+ ? mContext.getString(R.string.adaptive_connectivity_switch_on)
+ : mContext.getString(R.string.adaptive_connectivity_switch_off);
}
}
diff --git a/src/com/android/settings/network/AdaptiveConnectivityTogglePreferenceController.java b/src/com/android/settings/network/AdaptiveConnectivityTogglePreferenceController.java
index e1e56a8..e3d779c 100644
--- a/src/com/android/settings/network/AdaptiveConnectivityTogglePreferenceController.java
+++ b/src/com/android/settings/network/AdaptiveConnectivityTogglePreferenceController.java
@@ -22,12 +22,14 @@
import androidx.preference.PreferenceScreen;
-import com.android.settings.core.TogglePreferenceController;
+import com.android.settings.widget.SettingsMainSwitchPreferenceController;
/**
- * {@link TogglePreferenceController} that controls whether Adaptive connectivity option is enabled.
+ * {@link SettingsMainSwitchPreferenceController}
+ * that controls whether Adaptive connectivity option is enabled.
*/
-public class AdaptiveConnectivityTogglePreferenceController extends TogglePreferenceController {
+public class AdaptiveConnectivityTogglePreferenceController extends
+ SettingsMainSwitchPreferenceController {
private final WifiManager mWifiManager;
diff --git a/src/com/android/settings/network/ProviderModelSliceHelper.java b/src/com/android/settings/network/ProviderModelSliceHelper.java
index 16d5c92..6ecaae5 100644
--- a/src/com/android/settings/network/ProviderModelSliceHelper.java
+++ b/src/com/android/settings/network/ProviderModelSliceHelper.java
@@ -80,8 +80,7 @@
public boolean hasCarrier() {
if (isAirplaneModeEnabled()
|| mSubscriptionManager == null || mTelephonyManager == null
- || mSubscriptionManager.getDefaultDataSubscriptionId()
- == mSubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ || mSubscriptionManager.getActiveSubscriptionIdList().length <= 0) {
return false;
}
return true;
diff --git a/src/com/android/settings/notification/history/NotificationSbnViewHolder.java b/src/com/android/settings/notification/history/NotificationSbnViewHolder.java
index c98b036..166ee5d 100644
--- a/src/com/android/settings/notification/history/NotificationSbnViewHolder.java
+++ b/src/com/android/settings/notification/history/NotificationSbnViewHolder.java
@@ -65,9 +65,6 @@
}
void setTitle(CharSequence title) {
- if (title == null) {
- return;
- }
mTitle.setText(title);
}
diff --git a/src/com/android/settings/widget/LoadingViewController.java b/src/com/android/settings/widget/LoadingViewController.java
index 294e55e..66eebf3 100644
--- a/src/com/android/settings/widget/LoadingViewController.java
+++ b/src/com/android/settings/widget/LoadingViewController.java
@@ -22,34 +22,66 @@
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
+import androidx.annotation.Nullable;
+
/**
- * A helper class that manages show/hide loading spinner.
+ * A helper class that manages show/hide loading spinner, content view and empty view (optional).
*/
public class LoadingViewController {
private static final long DELAY_SHOW_LOADING_CONTAINER_THRESHOLD_MS = 100L;
- public final Handler mFgHandler;
- public final View mLoadingView;
- public final View mContentView;
+ private final Handler mFgHandler;
+ private final View mLoadingView;
+ private final View mContentView;
+ private final View mEmptyView;
public LoadingViewController(View loadingView, View contentView) {
+ this(loadingView, contentView, null /* emptyView*/);
+ }
+
+ public LoadingViewController(View loadingView, View contentView, @Nullable View emptyView) {
mLoadingView = loadingView;
mContentView = contentView;
+ mEmptyView = emptyView;
mFgHandler = new Handler(Looper.getMainLooper());
}
private Runnable mShowLoadingContainerRunnable = new Runnable() {
public void run() {
- handleLoadingContainer(false /* done */, false /* animate */);
+ showLoadingView();
}
};
+ /**
+ * Shows content view and hides loading view & empty view.
+ */
public void showContent(boolean animate) {
// Cancel any pending task to show the loading animation and show the list of
// apps directly.
mFgHandler.removeCallbacks(mShowLoadingContainerRunnable);
- handleLoadingContainer(true /* show */, animate);
+ handleLoadingContainer(true /* showContent */, false /* showEmpty*/, animate);
+ }
+
+ /**
+ * Shows empty view and hides loading view & content view.
+ */
+ public void showEmpty(boolean animate) {
+ if (mEmptyView == null) {
+ return;
+ }
+
+ // Cancel any pending task to show the loading animation and show the list of
+ // apps directly.
+ mFgHandler.removeCallbacks(mShowLoadingContainerRunnable);
+ handleLoadingContainer(false /* showContent */, true /* showEmpty */, animate);
+ }
+
+ /**
+ * Shows loading view and hides content view & empty view.
+ */
+ public void showLoadingView() {
+ handleLoadingContainer(false /* showContent */, false /* showEmpty */, false /* animate */);
}
public void showLoadingViewDelayed() {
@@ -57,8 +89,9 @@
mShowLoadingContainerRunnable, DELAY_SHOW_LOADING_CONTAINER_THRESHOLD_MS);
}
- public void handleLoadingContainer(boolean done, boolean animate) {
- handleLoadingContainer(mLoadingView, mContentView, done, animate);
+ private void handleLoadingContainer(boolean showContent, boolean showEmpty, boolean animate) {
+ handleLoadingContainer(mLoadingView, mContentView, mEmptyView,
+ showContent, showEmpty, animate);
}
/**
@@ -75,6 +108,25 @@
setViewShown(content, done, animate);
}
+ /**
+ * Show/hide loading view and content view and empty view.
+ *
+ * @param loading The loading spinner view
+ * @param content The content view
+ * @param empty The empty view shows no item summary to users.
+ * @param showContent If true, content is set visible and loading is set invisible.
+ * @param showEmpty If true, empty is set visible and loading is set invisible.
+ * @param animate Whether or not content/loading views should animate in/out.
+ */
+ public static void handleLoadingContainer(View loading, View content, View empty,
+ boolean showContent, boolean showEmpty, boolean animate) {
+ if (empty != null) {
+ setViewShown(empty, showEmpty, animate);
+ }
+ setViewShown(content, showContent, animate);
+ setViewShown(loading, !showContent && !showEmpty, animate);
+ }
+
private static void setViewShown(final View view, boolean shown, boolean animate) {
if (animate) {
Animation animation = AnimationUtils.loadAnimation(view.getContext(),
diff --git a/tests/robotests/src/com/android/settings/accessibility/AnimatedImagePreferenceTest.java b/tests/robotests/src/com/android/settings/accessibility/AnimatedImagePreferenceTest.java
deleted file mode 100644
index c7e5b13..0000000
--- a/tests/robotests/src/com/android/settings/accessibility/AnimatedImagePreferenceTest.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.graphics.drawable.AnimatedImageDrawable;
-import android.graphics.drawable.AnimatedVectorDrawable;
-import android.graphics.drawable.AnimationDrawable;
-import android.net.Uri;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-
-import androidx.preference.PreferenceViewHolder;
-
-import com.android.settings.R;
-
-import com.airbnb.lottie.LottieAnimationView;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.mockito.Spy;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-import java.io.InputStream;
-
-/** Tests for {@link AnimatedImagePreference}. */
-@RunWith(RobolectricTestRunner.class)
-public class AnimatedImagePreferenceTest {
- private final Context mContext = RuntimeEnvironment.application;
- private Uri mImageUri;
- private PreferenceViewHolder mViewHolder;
- private AnimatedImagePreference mAnimatedImagePreference;
-
- @Mock
- private ViewGroup mRootView;
-
- @Spy
- private ImageView mImageView;
-
- @Before
- public void init() {
- MockitoAnnotations.initMocks(this);
-
- mViewHolder = spy(PreferenceViewHolder.createInstanceForTests(mRootView));
- doReturn(new LottieAnimationView(mContext)).when(mRootView).findViewById(R.id.lottie_view);
- mImageView = spy(new ImageView(mContext));
-
- mAnimatedImagePreference = new AnimatedImagePreference(mContext);
- mImageUri = new Uri.Builder().build();
- }
-
- @Test
- public void playAnimation_animatedImageDrawable_success() {
- final AnimatedImageDrawable drawable = mock(AnimatedImageDrawable.class);
- doReturn(mImageView).when(mRootView).findViewById(R.id.animated_img);
- doReturn(drawable).when(mImageView).getDrawable();
-
- mAnimatedImagePreference.setImageUri(mImageUri);
- mAnimatedImagePreference.onBindViewHolder(mViewHolder);
-
- verify(drawable).start();
- }
-
- @Test
- public void playAnimation_animatedVectorDrawable_success() {
- final AnimatedVectorDrawable drawable = mock(AnimatedVectorDrawable.class);
- doReturn(mImageView).when(mRootView).findViewById(R.id.animated_img);
- doReturn(drawable).when(mImageView).getDrawable();
-
- mAnimatedImagePreference.setImageUri(mImageUri);
- mAnimatedImagePreference.onBindViewHolder(mViewHolder);
-
- verify(drawable).start();
- }
-
- @Test
- public void playAnimation_animationDrawable_success() {
- final AnimationDrawable drawable = mock(AnimationDrawable.class);
- doReturn(mImageView).when(mRootView).findViewById(R.id.animated_img);
- doReturn(drawable).when(mImageView).getDrawable();
-
- mAnimatedImagePreference.setImageUri(mImageUri);
- mAnimatedImagePreference.onBindViewHolder(mViewHolder);
-
- verify(drawable).start();
- }
-
- @Test
- public void setImageUri_viewNotExist_setFail() {
- doReturn(null).when(mRootView).findViewById(R.id.animated_img);
-
- mAnimatedImagePreference.setImageUri(mImageUri);
- mAnimatedImagePreference.onBindViewHolder(mViewHolder);
-
- verify(mImageView, never()).setImageURI(mImageUri);
- }
-
- @Test
- public void setMaxHeight_success() {
- final int maxHeight = 100;
- doReturn(mImageView).when(mRootView).findViewById(R.id.animated_img);
-
- mAnimatedImagePreference.setMaxHeight(maxHeight);
- mAnimatedImagePreference.onBindViewHolder(mViewHolder);
-
- assertThat(mImageView.getMaxHeight()).isEqualTo(maxHeight);
- }
-
- @Test
- public void setImageUriAndRebindViewHolder_lottieImageFromRawFolder_setAnimation() {
- final int fakeLottieResId = 111111;
- final Uri lottieImageUri =
- new Uri.Builder().scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
- .authority(mContext.getPackageName())
- .appendPath(String.valueOf(fakeLottieResId))
- .build();
- final LottieAnimationView lottieView = spy(new LottieAnimationView(mContext));
- doReturn(mImageView).when(mRootView).findViewById(R.id.animated_img);
- doReturn(lottieView).when(mRootView).findViewById(R.id.lottie_view);
-
- mAnimatedImagePreference.setImageUri(lottieImageUri);
- mAnimatedImagePreference.onBindViewHolder(mViewHolder);
-
- verify(lottieView).setAnimation(any(InputStream.class), eq(null));
- }
-}
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
index 86f5fe8..25eca7a 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
@@ -28,7 +28,6 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
@@ -49,7 +48,6 @@
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
-import android.view.ViewGroup;
import android.widget.SearchView;
import androidx.fragment.app.FragmentActivity;
@@ -156,22 +154,6 @@
}
@Test
- public void onCreateView_shouldNotShowLoadingContainer() {
- ReflectionHelpers.setField(mFragment, "mResetAppsHelper", mock(ResetAppsHelper.class));
- doNothing().when(mFragment).createHeader();
-
- final LayoutInflater layoutInflater = mock(LayoutInflater.class);
- final View view = mock(View.class);
- final View loadingContainer = mock(View.class);
- when(layoutInflater.inflate(anyInt(), eq(null))).thenReturn(view);
- when(view.findViewById(R.id.loading_container)).thenReturn(loadingContainer);
-
- mFragment.onCreateView(layoutInflater, mock(ViewGroup.class), null);
-
- verify(loadingContainer, never()).setVisibility(View.VISIBLE);
- }
-
- @Test
public void onCreateOptionsMenu_shouldSetSearchQueryListener() {
final SearchView searchView = mock(SearchView.class);
final MenuItem searchMenu = mock(MenuItem.class);
@@ -221,7 +203,6 @@
@Test
public void updateLoading_appLoaded_shouldNotDelayCallToHandleLoadingContainer() {
ReflectionHelpers.setField(mFragment, "mLoadingContainer", mock(View.class));
- ReflectionHelpers.setField(mFragment, "mListContainer", mock(View.class));
final ManageApplications.ApplicationsAdapter adapter =
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
@@ -243,7 +224,6 @@
@Test
public void updateLoading_appNotLoaded_shouldDelayCallToHandleLoadingContainer() {
ReflectionHelpers.setField(mFragment, "mLoadingContainer", mock(View.class));
- ReflectionHelpers.setField(mFragment, "mListContainer", mock(View.class));
final ManageApplications.ApplicationsAdapter adapter =
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
@@ -272,7 +252,6 @@
when(listContainer.getVisibility()).thenReturn(View.INVISIBLE);
when(listContainer.getContext()).thenReturn(context);
ReflectionHelpers.setField(mFragment, "mLoadingContainer", loadingContainer);
- ReflectionHelpers.setField(mFragment, "mListContainer", listContainer);
final ManageApplications.ApplicationsAdapter adapter =
spy(new ManageApplications.ApplicationsAdapter(mState, mFragment,
AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
@@ -296,7 +275,7 @@
adapter.onRebuildComplete(null);
- verify(loadingViewController).showContent(true /* animate */);
+ verify(loadingViewController).showEmpty(false /* animate */);
}
@Test
@@ -304,15 +283,16 @@
final String query = "Test";
final RecyclerView recyclerView = mock(RecyclerView.class);
final View emptyView = mock(View.class);
+ final View loadingContainer = mock(View.class);
ReflectionHelpers.setField(mFragment, "mRecyclerView", recyclerView);
ReflectionHelpers.setField(mFragment, "mEmptyView", emptyView);
+ ReflectionHelpers.setField(mFragment, "mLoadingContainer", loadingContainer);
final SearchView searchView = mock(SearchView.class);
ReflectionHelpers.setField(mFragment, "mSearchView", searchView);
when(searchView.isVisibleToUser()).thenReturn(true);
when(searchView.getQuery()).thenReturn(query);
final View listContainer = mock(View.class);
when(listContainer.getVisibility()).thenReturn(View.VISIBLE);
- ReflectionHelpers.setField(mFragment, "mListContainer", listContainer);
ReflectionHelpers.setField(
mFragment, "mFilterAdapter", mock(ManageApplications.FilterSpinnerAdapter.class));
final ArrayList<ApplicationsState.AppEntry> appList = new ArrayList<>();
@@ -491,8 +471,6 @@
mFragment.mFilterAdapter.updateFilterView(true);
assertThat(mFragment.mSpinnerHeader.getVisibility()).isEqualTo(View.VISIBLE);
- assertThat(mFragment.mRecyclerView.getPaddingTop()).isEqualTo(
- mContext.getResources().getDimensionPixelSize(R.dimen.app_bar_height));
}
@Test
diff --git a/tests/robotests/src/com/android/settings/gestures/OneHandedActionPullDownPrefControllerTest.java b/tests/robotests/src/com/android/settings/gestures/OneHandedActionPullDownPrefControllerTest.java
index 60398de..36938c2 100644
--- a/tests/robotests/src/com/android/settings/gestures/OneHandedActionPullDownPrefControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/OneHandedActionPullDownPrefControllerTest.java
@@ -105,4 +105,26 @@
assertThat(mController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING);
}
+
+ @Test
+ public void getAvailabilityStatus_setShortcutEnabled_shouldEnabled() {
+ SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
+ OneHandedSettingsUtils.setOneHandedModeEnabled(mContext, false);
+ mUtils.setNavigationBarMode(mContext, "0" /* 3-button mode */);
+ mUtils.setShortcutEnabled(mContext, true);
+
+ assertThat(mController.getAvailabilityStatus())
+ .isEqualTo(BasePreferenceController.AVAILABLE);
+ }
+
+ @Test
+ public void getAvailabilityStatus_setShortcutDisabled_shouldDisabled() {
+ SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
+ OneHandedSettingsUtils.setOneHandedModeEnabled(mContext, false);
+ mUtils.setNavigationBarMode(mContext, "0" /* 3-button mode */);
+ mUtils.setShortcutEnabled(mContext, false);
+
+ assertThat(mController.getAvailabilityStatus())
+ .isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING);
+ }
}
diff --git a/tests/robotests/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefControllerTest.java b/tests/robotests/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefControllerTest.java
index b56a4f7..a7afccd 100644
--- a/tests/robotests/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefControllerTest.java
@@ -104,4 +104,26 @@
assertThat(mController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING);
}
+
+ @Test
+ public void getAvailabilityStatus_setShortcutEnabled_shouldEnabled() {
+ SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
+ OneHandedSettingsUtils.setOneHandedModeEnabled(mContext, false);
+ mUtils.setNavigationBarMode(mContext, "0" /* 3-button mode */);
+ mUtils.setShortcutEnabled(mContext, true);
+
+ assertThat(mController.getAvailabilityStatus())
+ .isEqualTo(BasePreferenceController.AVAILABLE);
+ }
+
+ @Test
+ public void getAvailabilityStatus_setShortcutDisabled_shouldDisabled() {
+ SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
+ OneHandedSettingsUtils.setOneHandedModeEnabled(mContext, false);
+ mUtils.setNavigationBarMode(mContext, "0" /* 3-button mode */);
+ mUtils.setShortcutEnabled(mContext, false);
+
+ assertThat(mController.getAvailabilityStatus())
+ .isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING);
+ }
}
diff --git a/tests/robotests/src/com/android/settings/gestures/OneHandedPreferenceCategoryControllerTest.java b/tests/robotests/src/com/android/settings/gestures/OneHandedPreferenceCategoryControllerTest.java
new file mode 100644
index 0000000..112e04a
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/gestures/OneHandedPreferenceCategoryControllerTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.gestures;
+
+import static junit.framework.TestCase.assertTrue;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.os.UserHandle;
+import android.text.TextUtils;
+
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.R;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class OneHandedPreferenceCategoryControllerTest {
+
+ private static final String KEY = "gesture_one_handed_mode_swipe_down";
+
+ private Context mContext;
+ private OneHandedSettingsUtils mUtils;
+ private OneHandedPreferenceCategoryController mController;
+ @Mock
+ private PreferenceCategory mPreference;
+ @Mock
+ private PreferenceScreen mScreen;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ mContext = RuntimeEnvironment.application;
+ mUtils = new OneHandedSettingsUtils(mContext);
+ mController = new OneHandedPreferenceCategoryController(mContext, KEY);
+ OneHandedSettingsUtils.setUserId(UserHandle.myUserId());
+ mPreference = new PreferenceCategory(mContext);
+ when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
+ }
+
+ @Test
+ public void getTitle_set3ButtonMode_shouldReturnSetShortcutTo() {
+ mUtils.setNavigationBarMode(mContext, "0" /* 3 button */);
+ mController.displayPreference(mScreen);
+
+ assertTrue(TextUtils.equals(mPreference.getTitle(), mContext.getText(
+ R.string.one_handed_mode_use_shortcut_category)));
+ }
+
+ @Test
+ public void getTitle_setGestureMode_shouldReturnSwipeDownTo() {
+ mUtils.setNavigationBarMode(mContext, "2" /* fully gestural */);
+ mController.displayPreference(mScreen);
+
+ assertTrue(TextUtils.equals(mPreference.getTitle(), mContext.getText(
+ R.string.one_handed_mode_swipe_down_category)));
+ }
+}
diff --git a/tests/unit/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImplTest.java b/tests/unit/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImplTest.java
index 4f7ecc8..0b0b8e5 100644
--- a/tests/unit/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImplTest.java
+++ b/tests/unit/src/com/android/settings/enterprise/ActionDisabledLearnMoreButtonLauncherImplTest.java
@@ -111,7 +111,7 @@
@Test
public void showHelpPage_works() {
- mImpl.showHelpPage(mActivity, URL);
+ mImpl.showHelpPage(mActivity, URL, CONTEXT_USER);
verify(mActivity).startActivityAsUser(mIntentCaptor.capture(), eq(CONTEXT_USER));
assertActionViewIntent(mIntentCaptor.getValue());