Merge "Import translations. DO NOT MERGE" into pi-dev
diff --git a/res/drawable-nodpi/fingerprint_enroll_introduction.png b/res/drawable-nodpi/fingerprint_enroll_introduction.png
deleted file mode 100644
index 268ca43..0000000
--- a/res/drawable-nodpi/fingerprint_enroll_introduction.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-nodpi/fp_app_indicator.png b/res/drawable-nodpi/fp_app_indicator.png
deleted file mode 100644
index d4d6ea1..0000000
--- a/res/drawable-nodpi/fp_app_indicator.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/fingerprint_enroll_finish.xml b/res/drawable/fingerprint_enroll_finish.xml
new file mode 100644
index 0000000..9bc7283
--- /dev/null
+++ b/res/drawable/fingerprint_enroll_finish.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2018 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="228dp"
+ android:height="228dp"
+ android:viewportHeight="228.0"
+ android:viewportWidth="228.0">
+ <path
+ android:fillColor="#4285F4"
+ android:pathData="M114,4c29.38,0 57.01,11.44 77.78,32.22C212.56,56.99 224,84.62 224,114s-11.44,57.01 -32.22,77.78S143.38,224 114,224s-57.01,-11.44 -77.78,-32.22C15.44,171.01 4,143.38 4,114s11.44,-57.01 32.22,-77.78C56.99,15.44 84.62,4 114,4M114,0C51.04,0 0,51.04 0,114s51.04,114 114,114s114,-51.04 114,-114S176.96,0 114,0L114,0z" />
+ <path
+ android:fillAlpha="0.25"
+ android:fillColor="#FF000000"
+ android:pathData="M152.18,156.55c0.11,1.46 -0.89,2.8 -2.42,3.07c-3.32,0.64 -6.24,0.7 -7.06,0.7c-6.94,0 -13.07,-1.75 -18.08,-5.19c-8.48,-5.74 -13.61,-14.99 -13.86,-24.85c-0.01,0.08 -0.02,0.16 -0.02,0.25c0,10.15 5.19,19.72 13.88,25.61c5.02,3.44 11.14,5.19 18.08,5.19c0.82,0 3.73,-0.06 7.06,-0.7c1.97,-0.4 2.67,-1.8 2.44,-3.99C152.19,156.6 152.18,156.58 152.18,156.55z"
+ android:strokeAlpha="0.25" />
+ <path
+ android:fillAlpha="0.25"
+ android:fillColor="#FF000000"
+ android:pathData="M81.57,70.73c9.98,-5.48 20.94,-8.23 32.49,-8.23c11.61,0 21.29,2.45 32.49,8.23c0.41,0.23 0.88,0.35 1.34,0.35c1.05,0 2.04,-0.58 2.57,-1.63c0.32,-0.59 0.46,-2.04 0.35,-2.66c-0.02,-0.09 -0.04,-0.17 -0.07,-0.24c0.12,0.63 0.05,1.29 -0.28,1.9c-0.53,1.05 -1.52,1.63 -2.57,1.63c-0.47,0 -0.93,-0.12 -1.34,-0.35c-11.2,-5.77 -20.88,-8.22 -32.49,-8.22c-11.55,0 -22.52,2.74 -32.49,8.22c-1.4,0.76 -3.15,0.23 -3.97,-1.17c-0.36,-0.66 -0.42,-1.41 -0.25,-2.1c-0.01,0.02 -0.01,0.03 -0.02,0.04c-0.25,0.75 -0.13,2.32 0.27,3.05C78.42,70.96 80.17,71.48 81.57,70.73z"
+ android:strokeAlpha="0.25" />
+ <path
+ android:fillAlpha="0.25"
+ android:fillColor="#FF000000"
+ android:pathData="M166.41,97.07c0,-0.02 -0.01,-0.03 -0.01,-0.05c0.22,1.1 -0.19,2.29 -1.18,2.98c-1.34,0.93 -3.15,0.64 -4.08,-0.7c-5.25,-7.35 -11.9,-13.12 -19.77,-17.15c-16.74,-8.57 -38.15,-8.57 -54.83,0.06c-7.93,4.08 -14.58,9.92 -19.83,17.27c-0.47,0.82 -1.34,1.23 -2.27,1.23c-0.58,0 -1.17,-0.18 -1.69,-0.53c-0.9,-0.63 -1.32,-1.65 -1.22,-2.66c-0.01,0.03 -0.02,0.05 -0.02,0.1c-0.18,1.57 0.27,2.89 1.24,3.56c0.52,0.35 1.11,0.52 1.69,0.52c0.93,0 1.81,-0.41 2.27,-1.22c5.25,-7.35 11.9,-13.18 19.83,-17.27c16.68,-8.63 38.09,-8.63 54.83,-0.06c7.88,4.02 14.52,9.8 19.77,17.15c0.93,1.34 2.74,1.63 4.08,0.7C166.18,100.33 166.75,98.98 166.41,97.07z"
+ android:strokeAlpha="0.25" />
+ <path
+ android:fillAlpha="0.25"
+ android:fillColor="#FF000000"
+ android:pathData="M144.1,132.43c-1.63,0 -2.92,-1.28 -2.92,-2.92c0,-14.12 -12.19,-25.61 -27.18,-25.61s-27.18,11.49 -27.18,25.61c0,0.17 0.01,0.33 0.01,0.49c0.29,-13.88 12.36,-25.1 27.17,-25.1c14.99,0 27.18,11.49 27.18,25.61c0,1.63 1.28,2.92 2.92,2.92c1.63,0 2.92,-1.28 2.92,-2.92c0,-0.26 -0.01,-0.52 -0.02,-0.79C146.89,131.26 145.66,132.43 144.1,132.43z"
+ android:strokeAlpha="0.25" />
+ <path
+ android:fillAlpha="0.25"
+ android:fillColor="#FF000000"
+ android:pathData="M103.82,167.68c0.15,0.9 -0.11,1.85 -0.79,2.56c-0.64,0.58 -1.4,0.88 -2.16,0.88s-1.52,-0.29 -2.04,-0.88c-5.08,-5.08 -7.82,-8.34 -11.72,-15.4c-3.95,-7.05 -6.04,-15.62 -6.11,-24.83c0,0.17 -0.01,0.34 -0.01,0.51c0,9.39 2.1,18.14 6.12,25.32c3.91,7.06 6.65,10.32 11.72,15.4c0.53,0.58 1.28,0.88 2.04,0.88s1.52,-0.29 2.16,-0.88c0.69,-0.73 1.21,-1.88 0.79,-3.53C103.82,167.69 103.82,167.69 103.82,167.68z"
+ android:strokeAlpha="0.25" />
+ <path
+ android:fillAlpha="0.25"
+ android:fillColor="#FF000000"
+ android:pathData="M133.72,170.12c-0.29,1.34 -1.52,2.22 -2.74,2.22c-0.23,0 -0.53,-0.06 -0.76,-0.12c-9.28,-2.57 -15.34,-6.01 -21.7,-12.25c-8,-7.95 -12.47,-18.47 -12.64,-29.76c0,0.11 -0.02,0.21 -0.02,0.31c0,11.55 4.49,22.34 12.66,30.45c6.36,6.24 12.43,9.68 21.7,12.25c0.23,0.06 0.53,0.12 0.76,0.12c1.22,0 2.45,-0.88 2.74,-2.22c0.11,-0.42 0.24,-1.49 0.07,-2.13C133.84,169.35 133.82,169.74 133.72,170.12z"
+ android:strokeAlpha="0.25" />
+ <path
+ android:fillAlpha="0.25"
+ android:fillColor="#FF000000"
+ android:pathData="M143.93,146.61c-9.92,0 -17.97,-7.7 -17.97,-17.15c0,-6.24 -5.43,-11.32 -12.13,-11.32c-6.71,0 -12.13,5.08 -12.13,11.32c0,0.23 0.01,0.46 0.02,0.69c0.18,-6.1 5.52,-11.01 12.12,-11.01c6.71,0 12.13,5.08 12.13,11.32c0,9.45 8.05,17.15 17.97,17.15s17.97,-7.7 17.97,-17.15c0,-0.22 -0.01,-0.44 -0.02,-0.67C161.68,139.09 153.72,146.61 143.93,146.61z"
+ android:strokeAlpha="0.25" />
+ <path
+ android:fillAlpha="0.25"
+ android:fillColor="#FF000000"
+ android:pathData="M65.99,130.52c0,7.88 1.4,14.46 4.26,22.1c-2.8,-7.47 -4.19,-14.89 -4.25,-22.58C66,130.2 65.99,130.36 65.99,130.52z"
+ android:strokeAlpha="0.25" />
+ <path
+ android:fillAlpha="0.25"
+ android:fillColor="#FF000000"
+ android:pathData="M113.77,89.67c-16.57,0 -31.73,9.22 -38.56,23.51c-2.28,4.72 -3.44,10.27 -3.44,16.33c0,0.26 0,0.52 0,0.8c0.03,-5.99 1.19,-11.46 3.44,-16.13c6.82,-14.29 21.99,-23.51 38.56,-23.51c23.1,0 41.89,17.49 42.27,39.17c0,-0.11 0.02,-0.22 0.02,-0.33C156.06,107.52 137.1,89.67 113.77,89.67z"
+ android:strokeAlpha="0.25" />
+ <path
+ android:fillAlpha="0.25"
+ android:fillColor="#FF000000"
+ android:pathData="M73.98,154.31c-1.52,0.58 -3.21,-0.23 -3.73,-1.69c0.6,1.81 2.09,3.08 3.73,2.69c1.52,-0.53 2.85,-1.63 1.81,-4.34c-0.02,-0.04 -0.03,-0.09 -0.05,-0.13C76.15,152.28 75.41,153.81 73.98,154.31z"
+ android:strokeAlpha="0.25" />
+ <path
+ android:fillColor="#F9BB00"
+ android:pathData="M147.89,70.07c-0.47,0 -0.93,-0.12 -1.34,-0.35c-11.2,-5.78 -20.88,-8.23 -32.49,-8.23c-11.55,0 -22.52,2.74 -32.49,8.23c-1.4,0.76 -3.15,0.23 -3.97,-1.17c-0.76,-1.4 -0.23,-3.21 1.17,-3.97c10.85,-5.89 22.75,-8.93 35.29,-8.93c12.43,0 23.27,2.74 35.18,8.87c1.46,0.76 1.98,2.51 1.22,3.91C149.93,69.49 148.94,70.07 147.89,70.07z" />
+ <path
+ android:fillColor="#E74133"
+ android:pathData="M64.42,100.7c-0.58,0 -1.17,-0.17 -1.69,-0.53c-1.34,-0.93 -1.63,-2.74 -0.7,-4.08c5.78,-8.17 13.12,-14.58 21.88,-19.08c18.32,-9.45 41.77,-9.51 60.14,-0.06c8.75,4.49 16.1,10.85 21.88,18.96c0.93,1.28 0.64,3.15 -0.7,4.08s-3.15,0.64 -4.08,-0.7c-5.25,-7.35 -11.9,-13.12 -19.77,-17.15c-16.74,-8.57 -38.15,-8.57 -54.83,0.06c-7.93,4.08 -14.58,9.92 -19.83,17.27C66.22,100.29 65.35,100.7 64.42,100.7z" />
+ <path
+ android:fillColor="#32A753"
+ android:pathData="M100.87,171.11c-0.76,0 -1.52,-0.29 -2.04,-0.88c-5.08,-5.07 -7.82,-8.34 -11.72,-15.4c-4.03,-7.17 -6.12,-15.92 -6.12,-25.32c0,-17.32 14.82,-31.44 33.02,-31.44s33.02,14.12 33.02,31.44c0,1.63 -1.28,2.92 -2.92,2.92c-1.63,0 -2.92,-1.28 -2.92,-2.92c0,-14.12 -12.19,-25.61 -27.18,-25.61s-27.18,11.49 -27.18,25.61c0,8.4 1.87,16.16 5.43,22.46c3.73,6.71 6.3,9.57 10.79,14.12c1.11,1.17 1.11,2.98 0,4.14C102.39,170.82 101.63,171.11 100.87,171.11z" />
+ <path
+ android:fillColor="#F9BB00"
+ android:pathData="M142.7,160.32c-6.94,0 -13.07,-1.75 -18.08,-5.19c-8.69,-5.89 -13.88,-15.46 -13.88,-25.61c0,-1.63 1.28,-2.92 2.92,-2.92s2.92,1.28 2.92,2.92c0,8.22 4.2,15.98 11.32,20.77c4.14,2.8 8.98,4.14 14.82,4.14c1.4,0 3.73,-0.18 6.07,-0.58c1.57,-0.29 3.09,0.76 3.38,2.39c0.29,1.58 -0.76,3.09 -2.39,3.38C146.43,160.26 143.52,160.32 142.7,160.32z" />
+ <path
+ android:fillColor="#4285F4"
+ android:pathData="M130.97,172.33c-0.23,0 -0.53,-0.06 -0.76,-0.12c-9.27,-2.57 -15.34,-6.01 -21.7,-12.25c-8.17,-8.11 -12.66,-18.9 -12.66,-30.45c0,-9.45 8.05,-17.15 17.97,-17.15s17.97,7.7 17.97,17.15c0,6.24 5.43,11.32 12.13,11.32c6.71,0 12.13,-5.07 12.13,-11.32c0,-21.99 -18.96,-39.84 -42.29,-39.84c-16.57,0 -31.73,9.22 -38.56,23.51c-2.28,4.73 -3.44,10.27 -3.44,16.33c0,4.55 0.41,11.73 3.91,21.06c0.58,1.52 -0.18,3.21 -1.69,3.73c-1.52,0.58 -3.21,-0.23 -3.73,-1.69c-2.86,-7.64 -4.26,-15.23 -4.26,-23.1c0,-7 1.34,-13.36 3.97,-18.9c7.76,-16.28 24.97,-26.83 43.81,-26.83c26.54,0 48.12,20.47 48.12,45.68c0,9.45 -8.05,17.15 -17.97,17.15s-17.97,-7.7 -17.97,-17.15c0,-6.24 -5.43,-11.32 -12.13,-11.32s-12.13,5.07 -12.13,11.32c0,9.98 3.85,19.31 10.91,26.31c5.54,5.48 10.85,8.52 19.07,10.79c1.58,0.41 2.45,2.04 2.04,3.56C133.42,171.46 132.2,172.33 130.97,172.33z" />
+ <path
+ android:fillColor="#FFFFFF"
+ android:pathData="M192.86,217.88c-13.8,0 -25.02,-11.22 -25.02,-25.02s11.22,-25.02 25.02,-25.02s25.02,11.22 25.02,25.02S206.66,217.88 192.86,217.88z" />
+ <path
+ android:fillColor="#32A753"
+ android:pathData="M192.86,169.83c12.7,0 23.04,10.33 23.04,23.04s-10.33,23.04 -23.04,23.04s-23.04,-10.33 -23.04,-23.04S180.16,169.83 192.86,169.83M192.86,165.86c-14.91,0 -27,12.09 -27,27s12.09,27 27,27c14.91,0 27,-12.09 27,-27S207.77,165.86 192.86,165.86L192.86,165.86z" />
+ <path
+ android:fillColor="#32A753"
+ android:pathData="M188.45,205.22l-12.67,-12.67l2.83,-2.83l9.84,9.84l18.15,-18.15l2.83,2.83z" />
+</vector>
diff --git a/res/drawable/fingerprint_enroll_introduction.xml b/res/drawable/fingerprint_enroll_introduction.xml
new file mode 100644
index 0000000..2a5c62a
--- /dev/null
+++ b/res/drawable/fingerprint_enroll_introduction.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2018 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="210dp"
+ android:height="210dp"
+ android:viewportHeight="210.0"
+ android:viewportWidth="210.0">
+ <path
+ android:fillColor="#34A853"
+ android:pathData="M73.79,58.17h-7V38.96c0,-15.39 9.16,-29.21 23.34,-35.21l2.73,6.45c-11.58,4.9 -19.06,16.19 -19.06,28.76V58.17z" />
+ <path
+ android:fillColor="#FBBC05"
+ android:pathData="M131.29,22.13C125.51,13.12 115.68,7.75 105,7.75c-4.21,0 -8.3,0.82 -12.15,2.45l-2.73,-6.45c4.71,-1.99 9.72,-3 14.87,-3c13.08,0 25.11,6.58 32.18,17.6L131.29,22.13z" />
+ <path
+ android:fillColor="#EA4335"
+ android:pathData="M143.21,62.11h-7V38.96c0,-5.99 -1.7,-11.81 -4.92,-16.83l5.89,-3.78c3.94,6.15 6.03,13.27 6.03,20.6V62.11z" />
+ <path
+ android:fillColor="#3E82F1"
+ android:pathData="M136.21,62.11h7v19.4h-7z" />
+ <path
+ android:fillColor="#FBBC05"
+ android:pathData="M125.03,118.78c-0.28,0 -0.55,-0.07 -0.79,-0.2c-6.61,-3.37 -12.33,-4.79 -19.19,-4.79c-6.82,0 -13.3,1.6 -19.19,4.79c-0.83,0.44 -1.86,0.14 -2.34,-0.68c-0.45,-0.82 -0.14,-1.87 0.69,-2.31c6.41,-3.43 13.44,-5.2 20.84,-5.2c7.34,0 13.75,1.6 20.77,5.17c0.86,0.44 1.17,1.46 0.72,2.28C126.24,118.44 125.65,118.78 125.03,118.78z" />
+ <path
+ android:fillColor="#E74133"
+ android:pathData="M75.73,136.63c-0.34,0 -0.69,-0.1 -1,-0.31c-0.79,-0.54 -0.96,-1.6 -0.41,-2.38c3.41,-4.76 7.75,-8.5 12.92,-11.12c10.82,-5.51 24.67,-5.54 35.52,-0.03c5.17,2.62 9.51,6.32 12.92,11.05c0.55,0.75 0.38,1.84 -0.41,2.38c-0.79,0.54 -1.86,0.37 -2.41,-0.41c-3.1,-4.28 -7.03,-7.65 -11.68,-10c-9.89,-5 -22.53,-5 -32.38,0.03c-4.69,2.38 -8.61,5.78 -11.71,10.06C76.8,136.39 76.28,136.63 75.73,136.63z" />
+ <path
+ android:fillColor="#32A753"
+ android:pathData="M97.27,177.67c-0.45,0 -0.9,-0.17 -1.21,-0.51c-3,-2.96 -4.62,-4.86 -6.92,-8.98c-2.38,-4.18 -3.62,-9.28 -3.62,-14.76c0,-10.1 8.75,-18.33 19.5,-18.33s19.5,8.23 19.5,18.33c0,0.95 -0.76,1.7 -1.72,1.7s-1.72,-0.75 -1.72,-1.7c0,-8.23 -7.2,-14.93 -16.05,-14.93s-16.05,6.7 -16.05,14.93c0,4.9 1.1,9.42 3.2,13.09c2.2,3.91 3.72,5.58 6.37,8.23c0.65,0.68 0.65,1.73 0,2.41C98.16,177.5 97.71,177.67 97.27,177.67z" />
+ <path
+ android:fillColor="#FBBC05"
+ android:pathData="M121.97,171.38c-4.1,0 -7.72,-1.02 -10.68,-3.03c-5.13,-3.43 -8.2,-9.01 -8.2,-14.93c0,-0.95 0.76,-1.7 1.72,-1.7s1.72,0.75 1.72,1.7c0,4.79 2.48,9.32 6.68,12.1c2.45,1.63 5.31,2.41 8.75,2.41c0.83,0 2.2,-0.1 3.58,-0.34c0.93,-0.17 1.83,0.44 2,1.39c0.17,0.92 -0.45,1.8 -1.41,1.97C124.17,171.34 122.45,171.38 121.97,171.38z" />
+ <path
+ android:fillColor="#3E82F1"
+ android:pathData="M115.04,178.38c-0.14,0 -0.31,-0.03 -0.45,-0.07c-5.48,-1.5 -9.06,-3.5 -12.82,-7.14c-4.82,-4.73 -7.48,-11.02 -7.48,-17.75c0,-5.51 4.75,-10 10.61,-10c5.86,0 10.61,4.49 10.61,10c0,3.64 3.2,6.6 7.17,6.6s7.17,-2.96 7.17,-6.6c0,-12.82 -11.2,-23.22 -24.98,-23.22c-9.78,0 -18.74,5.37 -22.77,13.7c-1.34,2.75 -2.03,5.98 -2.03,9.52c0,2.65 0.24,6.83 2.31,12.27c0.34,0.88 -0.1,1.87 -1,2.18c-0.9,0.34 -1.89,-0.14 -2.2,-0.99c-1.69,-4.45 -2.51,-8.87 -2.51,-13.46c0,-4.08 0.79,-7.79 2.34,-11.02c4.58,-9.49 14.75,-15.64 25.87,-15.64c15.68,0 28.42,11.93 28.42,26.62c0,5.51 -4.75,10 -10.61,10c-5.86,0 -10.61,-4.49 -10.61,-10c0,-3.64 -3.2,-6.6 -7.17,-6.6s-7.17,2.96 -7.17,6.6c0,5.81 2.27,11.25 6.44,15.33c3.27,3.2 6.41,4.96 11.27,6.29c0.93,0.24 1.45,1.19 1.21,2.07C116.49,177.87 115.77,178.38 115.04,178.38z" />
+ <path
+ android:fillColor="#DADCE0"
+ android:pathData="M170.77,209.25H39.23c-7.72,0 -14,-6.28 -14,-14V93.51c0,-7.72 6.28,-14 14,-14h131.54c7.72,0 14,6.28 14,14v101.74C184.77,202.97 178.49,209.25 170.77,209.25zM39.23,83.51c-5.51,0 -10,4.49 -10,10v101.74c0,5.51 4.49,10 10,10h131.54c5.51,0 10,-4.49 10,-10V93.51c0,-5.51 -4.49,-10 -10,-10H39.23z" />
+</vector>
diff --git a/res/layout-land/fingerprint_enroll_finish.xml b/res/layout-land/fingerprint_enroll_finish.xml
index 981fe65..04ed540 100644
--- a/res/layout-land/fingerprint_enroll_finish.xml
+++ b/res/layout-land/fingerprint_enroll_finish.xml
@@ -118,7 +118,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@android:string/fingerprint_icon_content_description"
- android:src="@drawable/fp_app_indicator" />
+ android:src="@drawable/fingerprint_enroll_finish" />
</com.android.setupwizardlib.view.FillContentLayout>
diff --git a/res/layout/fingerprint_enroll_finish_base.xml b/res/layout/fingerprint_enroll_finish_base.xml
index cf9f759..819bf4e 100644
--- a/res/layout/fingerprint_enroll_finish_base.xml
+++ b/res/layout/fingerprint_enroll_finish_base.xml
@@ -63,7 +63,7 @@
android:layout_height="match_parent"
android:padding="7dp"
android:contentDescription="@android:string/fingerprint_icon_content_description"
- android:src="@drawable/fp_app_indicator" />
+ android:src="@drawable/fingerprint_enroll_finish" />
</com.android.setupwizardlib.view.FillContentLayout>
<!-- Added to align elements with fingerprint_enroll_enrolling_base -->
diff --git a/res/layout/zen_onboarding.xml b/res/layout/zen_onboarding.xml
index 05b38f2..6840443 100644
--- a/res/layout/zen_onboarding.xml
+++ b/res/layout/zen_onboarding.xml
@@ -112,7 +112,7 @@
android:id="@+id/screen_on_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/zen_onboarding_screen_off_title"
+ android:text="@string/zen_onboarding_screen_on_title"
android:textAppearance="?android:attr/textAppearanceListItem" />
<TextView
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f1795a2..44e7e98 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1613,6 +1613,8 @@
<string name="bluetooth_advanced_titlebar">Advanced Bluetooth</string>
<!-- Bluetooth settings. Text displayed when Bluetooth is off and device list is empty [CHAR LIMIT=50]-->
<string name="bluetooth_empty_list_bluetooth_off">When Bluetooth is turned on, your device can communicate with other nearby Bluetooth devices.</string>
+ <!-- Bluetooth settings. Text displayed when Bluetooth is off and bluetooth scanning is turned on [CHAR LIMIT=NONE] -->
+ <string name="bluetooth_scanning_on_info_message">When Bluetooth is turned on, your device can communicate with other nearby Bluetooth devices.\n\nTo improve device experience, apps and services can still scan for nearby devices at any time, even when Bluetooth is off. This can be used, for example, to improve location-based features and services. you can change this in <annotation id="link">scanning settings</annotation>.</string>
<!-- Message to describe "BLE scan always available feature" when Bluetooth is off. The
place-holders "LINK_BEGIN" and "LINK_END" must NOT be translated. They mark a link to bring
the user to "scanning settings" screen. -->
@@ -3250,9 +3252,11 @@
<string name="storage_wizard_slow_v2_continue">Continue</string>
<!-- Title of a full-screen message. This text lets the user know how to manage the storage device moving forward. The placeholder is for the name of the device (e.g. brand name of the SD card). [CHAR LIMIT=NONE] -->
- <string name="storage_wizard_ready_v2_external_body">To move content to <xliff:g id="name" example="SanDisk SD card">^1</xliff:g>, go to <b>Settings > Storage</b></string>
+ <string name="storage_wizard_ready_v2_external_body">You can move content to <xliff:g id="name" example="SanDisk SD card">^1</xliff:g></string>
<!-- Title of a full-screen message. This text lets the user know that their content was moved to their storage device and how to manage the storage device moving forward. The placeholder is for the name of the device (e.g. brand name of the SD card). [CHAR LIMIT=NONE] -->
- <string name="storage_wizard_ready_v2_internal_body">Your content was moved to <xliff:g id="name" example="SanDisk SD card">^1</xliff:g>.
+ <string name="storage_wizard_ready_v2_internal_body">To move content to <xliff:g id="name" example="SanDisk SD card">^1</xliff:g>, go to <b>Settings > Storage</b></string>
+ <!-- Title of a full-screen message. This text lets the user know that their content was moved to their storage device and how to manage the storage device moving forward. The placeholder is for the name of the device (e.g. brand name of the SD card). [CHAR LIMIT=NONE] -->
+ <string name="storage_wizard_ready_v2_internal_moved_body">Your content was moved to <xliff:g id="name" example="SanDisk SD card">^1</xliff:g>.
\n\nTo manage this <xliff:g id="name" example="SD card">^2</xliff:g>, go to <b>Settings > Storage</b>.</string>
<!-- Phone info screen, section titles: -->
@@ -6694,6 +6698,8 @@
<string name="help_uri_wifi_calling" translatable="false"></string>
<!-- url for the wifi scanning required dialog help page -->
<string name="help_uri_wifi_scanning_required" translatable="false"></string>
+ <!-- url for the bluetooth toggle required dialog help page -->
+ <string name="help_uri_bluetooth_screen" translatable="false"></string>
<!-- User account title [CHAR LIMIT=30] -->
<string name="user_account_title">Account for content</string>
diff --git a/res/xml/bluetooth_screen.xml b/res/xml/bluetooth_screen.xml
new file mode 100644
index 0000000..ec25520
--- /dev/null
+++ b/res/xml/bluetooth_screen.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:key="bluetooth_switchbar_screen"
+ android:title="@string/bluetooth_settings_title" />
\ No newline at end of file
diff --git a/res/xml/connected_devices.xml b/res/xml/connected_devices.xml
index 030428f..390a33d 100644
--- a/res/xml/connected_devices.xml
+++ b/res/xml/connected_devices.xml
@@ -42,14 +42,12 @@
android:fragment="com.android.settings.connecteddevice.PreviouslyConnectedDeviceDashboardFragment"
settings:allowDividerAbove="true"/>
- <com.android.settingslib.RestrictedSwitchPreference
- android:key="toggle_bluetooth_switch"
+ <Preference
+ android:fragment="com.android.settings.connecteddevice.BluetoothDashboardFragment"
+ android:key="bluetooth_settings"
android:title="@string/bluetooth_settings_title"
android:icon="@drawable/ic_settings_bluetooth"
- android:summary="@string/bluetooth_pref_summary"
- settings:controller="com.android.settings.bluetooth.BluetoothSwitchPreferenceController"
- settings:userRestriction="no_bluetooth"
- settings:platform_slice="true"/>
+ settings:allowDividerAbove="true"/>
<SwitchPreference
android:key="toggle_nfc"
diff --git a/src/com/android/settings/bluetooth/BluetoothEnabler.java b/src/com/android/settings/bluetooth/BluetoothEnabler.java
index 0f294bd..c1bcf50 100644
--- a/src/com/android/settings/bluetooth/BluetoothEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothEnabler.java
@@ -47,6 +47,7 @@
private final LocalBluetoothAdapter mLocalAdapter;
private final IntentFilter mIntentFilter;
private final RestrictionUtils mRestrictionUtils;
+ private SwitchWidgetController.OnSwitchChangeListener mCallback;
private static final String EVENT_DATA_IS_BT_ON = "is_bluetooth_on";
private static final int EVENT_UPDATE_INDEX = 0;
@@ -170,6 +171,7 @@
@Override
public boolean onSwitchToggled(boolean isChecked) {
if (maybeEnforceRestrictions()) {
+ triggerParentPreferenceCallback(isChecked);
return true;
}
@@ -179,6 +181,7 @@
Toast.makeText(mContext, R.string.wifi_in_airplane_mode, Toast.LENGTH_SHORT).show();
// Reset switch to off
mSwitchController.setChecked(false);
+ triggerParentPreferenceCallback(false);
return false;
}
@@ -193,14 +196,25 @@
mSwitchController.setChecked(false);
mSwitchController.setEnabled(true);
mSwitchController.updateTitle(false);
+ triggerParentPreferenceCallback(false);
return false;
}
}
mSwitchController.setEnabled(false);
+ triggerParentPreferenceCallback(isChecked);
return true;
}
/**
+ * Sets a callback back that this enabler will trigger in case the preference using the enabler
+ * still needed the callback on the SwitchController (which we now use).
+ * @param listener The listener with a callback to trigger.
+ */
+ public void setToggleCallback(SwitchWidgetController.OnSwitchChangeListener listener) {
+ mCallback = listener;
+ }
+
+ /**
* Enforces user restrictions disallowing Bluetooth (or its configuration) if there are any.
*
* @return if there was any user restriction to enforce.
@@ -227,4 +241,11 @@
return admin;
}
+ // This triggers the callback which was manually set for this enabler since the enabler will
+ // take over the switch controller callback
+ private void triggerParentPreferenceCallback(boolean isChecked) {
+ if (mCallback != null) {
+ mCallback.onSwitchToggled(isChecked);
+ }
+ }
}
diff --git a/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceController.java b/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceController.java
index c0fa884..bbc90c4 100644
--- a/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceController.java
+++ b/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceController.java
@@ -16,75 +16,79 @@
package com.android.settings.bluetooth;
import android.content.Context;
-import android.support.v14.preference.SwitchPreference;
-import android.support.v7.preference.Preference;
-import android.support.v7.preference.PreferenceScreen;
+import android.view.View;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.logging.nano.MetricsProto;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.core.TogglePreferenceController;
+import com.android.settings.R;
+import com.android.settings.core.SubSettingLauncher;
+import com.android.settings.location.ScanningSettings;
import com.android.settings.overlay.FeatureFactory;
+import com.android.settings.utils.AnnotationSpan;
import com.android.settings.widget.SwitchWidgetController;
-import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
+import com.android.settingslib.widget.FooterPreference;
/**
- * PreferenceController to update of bluetooth {@link SwitchPreference}. It will
- *
- * 1. Invoke the user toggle
- * 2. Listen to the update from {@link LocalBluetoothManager}
+ * PreferenceController to update of bluetooth state. All behavior except managing the footer text
+ * is delegated to the SwitchWidgetController it uses.
*/
-public class BluetoothSwitchPreferenceController extends TogglePreferenceController
- implements LifecycleObserver, OnStart, OnStop {
+public class BluetoothSwitchPreferenceController
+ implements LifecycleObserver, OnStart, OnStop,
+ SwitchWidgetController.OnSwitchChangeListener, View.OnClickListener {
- public static final String KEY_TOGGLE_BLUETOOTH = "toggle_bluetooth_switch";
-
- private LocalBluetoothManager mBluetoothManager;
- private SwitchPreference mBtPreference;
- private BluetoothEnabler mBluetoothEnabler;
- private RestrictionUtils mRestrictionUtils;
@VisibleForTesting
LocalBluetoothAdapter mBluetoothAdapter;
- public BluetoothSwitchPreferenceController(Context context) {
- this(context, Utils.getLocalBtManager(context), new RestrictionUtils());
+ private LocalBluetoothManager mBluetoothManager;
+ private BluetoothEnabler mBluetoothEnabler;
+ private RestrictionUtils mRestrictionUtils;
+ private SwitchWidgetController mSwitch;
+ private Context mContext;
+ private FooterPreference mFooterPreference;
+
+ public BluetoothSwitchPreferenceController(Context context,
+ SwitchWidgetController switchController,
+ FooterPreference footerPreference) {
+ this(context, Utils.getLocalBtManager(context), new RestrictionUtils(), switchController,
+ footerPreference);
}
@VisibleForTesting
public BluetoothSwitchPreferenceController(Context context,
- LocalBluetoothManager bluetoothManager, RestrictionUtils restrictionUtils) {
- super(context, KEY_TOGGLE_BLUETOOTH);
+ LocalBluetoothManager bluetoothManager, RestrictionUtils restrictionUtils,
+ SwitchWidgetController switchController, FooterPreference footerPreference) {
mBluetoothManager = bluetoothManager;
mRestrictionUtils = restrictionUtils;
+ mSwitch = switchController;
+ mContext = context;
+ mFooterPreference = footerPreference;
+
+ mSwitch.setupView();
+ updateText(mSwitch.isChecked());
if (mBluetoothManager != null) {
mBluetoothAdapter = mBluetoothManager.getBluetoothAdapter();
}
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
- mBtPreference = (SwitchPreference) screen.findPreference(KEY_TOGGLE_BLUETOOTH);
- mBluetoothEnabler = new BluetoothEnabler(mContext,
- new SwitchController(mBtPreference),
- FeatureFactory.getFactory(mContext).getMetricsFeatureProvider(), mBluetoothManager,
+ mBluetoothEnabler = new BluetoothEnabler(context,
+ switchController,
+ FeatureFactory.getFactory(context).getMetricsFeatureProvider(), mBluetoothManager,
MetricsEvent.ACTION_SETTINGS_MASTER_SWITCH_BLUETOOTH_TOGGLE,
mRestrictionUtils);
- }
-
- @Override
- public int getAvailabilityStatus() {
- return mBluetoothAdapter != null ? AVAILABLE : DISABLED_UNSUPPORTED;
+ mBluetoothEnabler.setToggleCallback(this);
}
@Override
public void onStart() {
mBluetoothEnabler.resume(mContext);
+ if (mSwitch != null) {
+ updateText(mSwitch.isChecked());
+ }
}
@Override
@@ -93,70 +97,30 @@
}
@Override
- public boolean isChecked() {
- return mBluetoothAdapter != null ? mBluetoothAdapter.isEnabled() : false;
- }
-
- @Override
- public boolean setChecked(boolean isChecked) {
- if (mBluetoothAdapter != null) {
- mBluetoothAdapter.setBluetoothEnabled(isChecked);
- }
+ public boolean onSwitchToggled(boolean isChecked) {
+ updateText(isChecked);
return true;
}
- /**
- * Control the switch inside {@link SwitchPreference}
- */
- @VisibleForTesting
- static class SwitchController extends SwitchWidgetController implements
- Preference.OnPreferenceChangeListener {
- private SwitchPreference mSwitchPreference;
+ @Override
+ public void onClick(View v) {
+ // send users to scanning settings if they click on the link in the summary text
+ new SubSettingLauncher(mContext)
+ .setDestination(ScanningSettings.class.getName())
+ .setSourceMetricsCategory(MetricsProto.MetricsEvent.BLUETOOTH_FRAGMENT)
+ .launch();
+ }
- public SwitchController(SwitchPreference switchPreference) {
- mSwitchPreference = switchPreference;
- }
-
- @Override
- public void updateTitle(boolean isChecked) {
- }
-
- @Override
- public void startListening() {
- mSwitchPreference.setOnPreferenceChangeListener(this);
- }
-
- @Override
- public void stopListening() {
- mSwitchPreference.setOnPreferenceChangeListener(null);
- }
-
- @Override
- public void setChecked(boolean checked) {
- mSwitchPreference.setChecked(checked);
- }
-
- @Override
- public boolean isChecked() {
- return mSwitchPreference.isChecked();
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- mSwitchPreference.setEnabled(enabled);
- }
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- if (mListener != null) {
- return mListener.onSwitchToggled((Boolean) newValue);
- }
- return false;
- }
-
- @Override
- public void setDisabledByAdmin(RestrictedLockUtils.EnforcedAdmin admin) {
- mSwitchPreference.setEnabled(admin == null);
+ @VisibleForTesting void updateText(boolean isChecked) {
+ if (!isChecked
+ && Utils.isBluetoothScanningEnabled(mContext)) {
+ AnnotationSpan.LinkInfo info = new AnnotationSpan.LinkInfo(
+ AnnotationSpan.LinkInfo.DEFAULT_ANNOTATION, this);
+ CharSequence text = AnnotationSpan.linkify(
+ mContext.getText(R.string.bluetooth_scanning_on_info_message), info);
+ mFooterPreference.setTitle(text);
+ } else {
+ mFooterPreference.setTitle(R.string.bluetooth_empty_list_bluetooth_off);
}
}
-}
+}
\ No newline at end of file
diff --git a/src/com/android/settings/bluetooth/Utils.java b/src/com/android/settings/bluetooth/Utils.java
index d5d4e50..f5377f5 100755
--- a/src/com/android/settings/bluetooth/Utils.java
+++ b/src/com/android/settings/bluetooth/Utils.java
@@ -21,6 +21,7 @@
import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.content.DialogInterface;
+import android.provider.Settings;
import android.support.annotation.VisibleForTesting;
import android.widget.Toast;
@@ -142,4 +143,8 @@
}
};
+ public static boolean isBluetoothScanningEnabled(Context context) {
+ return Settings.Global.getInt(context.getContentResolver(),
+ Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE, 0) == 1;
+ }
}
diff --git a/src/com/android/settings/connecteddevice/BluetoothDashboardFragment.java b/src/com/android/settings/connecteddevice/BluetoothDashboardFragment.java
new file mode 100644
index 0000000..ec616c8
--- /dev/null
+++ b/src/com/android/settings/connecteddevice/BluetoothDashboardFragment.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2018 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.connecteddevice;
+
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothManager;
+import android.content.Context;
+import android.os.Bundle;
+import android.support.annotation.VisibleForTesting;
+
+import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.R;
+import com.android.settings.SettingsActivity;
+import com.android.settings.bluetooth.BluetoothSwitchPreferenceController;
+import com.android.settings.core.SubSettingLauncher;
+import com.android.settings.core.TogglePreferenceController;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.location.ScanningSettings;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.search.SearchIndexableRaw;
+import com.android.settings.widget.SwitchBar;
+import com.android.settings.widget.SwitchBarController;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.FooterPreference;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Dedicated screen for allowing the user to toggle bluetooth which displays relevant information to
+ * the user based on related settings such as bluetooth scanning.
+ */
+public class BluetoothDashboardFragment extends DashboardFragment {
+
+ private static final String TAG = "BluetoothDashboardFrag";
+ public static final String KEY_BLUETOOTH_SCREEN = "bluetooth_switchbar_screen";
+
+ private FooterPreference mFooterPreference;
+ private SwitchBar mSwitchBar;
+ private BluetoothSwitchPreferenceController mController;
+
+ @Override
+ public int getMetricsCategory() {
+ return MetricsProto.MetricsEvent.BLUETOOTH_FRAGMENT;
+ }
+
+ @Override
+ protected String getLogTag() {
+ return TAG;
+ }
+
+ @Override
+ public int getHelpResource() {
+ return R.string.help_uri_bluetooth_screen;
+ }
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.bluetooth_screen;
+ }
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ mFooterPreference = mFooterPreferenceMixin.createFooterPreference();
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ SettingsActivity activity = (SettingsActivity) getActivity();
+ mSwitchBar = activity.getSwitchBar();
+ mController = new BluetoothSwitchPreferenceController(activity,
+ new SwitchBarController(mSwitchBar), mFooterPreference);
+ Lifecycle lifecycle = getLifecycle();
+ if (lifecycle != null) {
+ lifecycle.addObserver(mController);
+ }
+ }
+ /**
+ * For Search.
+ */
+ public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider() {
+ @Override
+ public List<SearchIndexableRaw> getRawDataToIndex(Context context,
+ boolean enabled) {
+ final List<SearchIndexableRaw> result = new ArrayList<>();
+
+ // Add the activity title
+ SearchIndexableRaw data = new SearchIndexableRaw(context);
+ data.title = context.getString(R.string.bluetooth_settings_title);
+ data.screenTitle = context.getString(R.string.settings_label);
+ data.keywords = context.getString(R.string.keywords_bluetooth_settings);
+ data.intentTargetPackage = context.getPackageName();
+ data.intentTargetClass = BluetoothDashboardFragment.class.getName();
+ data.intentAction = new SubSettingLauncher(context)
+ .setDestination(ScanningSettings.class.getName())
+ .setSourceMetricsCategory(MetricsProto.MetricsEvent.BLUETOOTH_FRAGMENT)
+ .toIntent()
+ .getAction();
+ data.key = KEY_BLUETOOTH_SCREEN;
+ result.add(data);
+
+ return result;
+ }
+
+ @Override
+ public List<String> getNonIndexableKeys(Context context) {
+ final List<String> keys = super.getNonIndexableKeys(context);
+ BluetoothManager manager =
+ (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE);
+ if (manager != null) {
+ BluetoothAdapter adapter = manager.getAdapter();
+ final int status = adapter != null
+ ? TogglePreferenceController.AVAILABLE
+ : TogglePreferenceController.DISABLED_UNSUPPORTED;
+ if (status != TogglePreferenceController.AVAILABLE) {
+ keys.add(KEY_BLUETOOTH_SCREEN);
+ }
+ }
+
+ return keys;
+ }
+ };
+}
diff --git a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
index 942fd7b..2b55ab1 100644
--- a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
+++ b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
@@ -22,7 +22,6 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
-import com.android.settings.bluetooth.BluetoothSwitchPreferenceController;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.nfc.NfcPreferenceController;
@@ -77,13 +76,8 @@
new NfcPreferenceController(context);
controllers.add(nfcPreferenceController);
- final BluetoothSwitchPreferenceController bluetoothPreferenceController =
- new BluetoothSwitchPreferenceController(context);
- controllers.add(bluetoothPreferenceController);
-
if (lifecycle != null) {
lifecycle.addObserver(nfcPreferenceController);
- lifecycle.addObserver(bluetoothPreferenceController);
}
return controllers;
diff --git a/src/com/android/settings/deviceinfo/StorageWizardReady.java b/src/com/android/settings/deviceinfo/StorageWizardReady.java
index 55f4ba1..c5c4ca2 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardReady.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardReady.java
@@ -36,10 +36,14 @@
setHeaderText(R.string.storage_wizard_ready_title, mDisk.getShortDescription());
final VolumeInfo privateVol = findFirstVolume(VolumeInfo.TYPE_PRIVATE);
- final boolean migrateSkip = getIntent().getBooleanExtra(EXTRA_MIGRATE_SKIP, false);
- if (privateVol != null && !migrateSkip) {
- setBodyText(R.string.storage_wizard_ready_v2_internal_body,
- mDisk.getDescription(), mDisk.getShortDescription());
+ if (privateVol != null) {
+ if (getIntent().getBooleanExtra(EXTRA_MIGRATE_SKIP, false)) {
+ setBodyText(R.string.storage_wizard_ready_v2_internal_body,
+ mDisk.getDescription());
+ } else {
+ setBodyText(R.string.storage_wizard_ready_v2_internal_moved_body,
+ mDisk.getDescription(), mDisk.getShortDescription());
+ }
} else {
setBodyText(R.string.storage_wizard_ready_v2_external_body,
mDisk.getDescription());
diff --git a/src/com/android/settings/search/SearchIndexableResourcesImpl.java b/src/com/android/settings/search/SearchIndexableResourcesImpl.java
index 33bc2e0..3b58c64 100644
--- a/src/com/android/settings/search/SearchIndexableResourcesImpl.java
+++ b/src/com/android/settings/search/SearchIndexableResourcesImpl.java
@@ -23,6 +23,7 @@
import com.android.settings.LegalSettings;
import com.android.settings.connecteddevice.AdvancedConnectedDeviceDashboardFragment;
import com.android.settings.connecteddevice.PreviouslyConnectedDeviceDashboardFragment;
+import com.android.settings.connecteddevice.BluetoothDashboardFragment;
import com.android.settings.datausage.DataUsageSummaryLegacy;
import com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment;
import com.android.settings.accessibility.AccessibilitySettings;
@@ -185,6 +186,7 @@
addIndex(VibrationSettings.class);
addIndex(RecentLocationRequestSeeAllFragment.class);
addIndex(PreviouslyConnectedDeviceDashboardFragment.class);
+ addIndex(BluetoothDashboardFragment.class);
}
@Override
diff --git a/src/com/android/settings/utils/AnnotationSpan.java b/src/com/android/settings/utils/AnnotationSpan.java
index c70cba5..e6457da 100644
--- a/src/com/android/settings/utils/AnnotationSpan.java
+++ b/src/com/android/settings/utils/AnnotationSpan.java
@@ -80,6 +80,7 @@
*/
public static class LinkInfo {
private static final String TAG = "AnnotationSpan.LinkInfo";
+ public static final String DEFAULT_ANNOTATION = "link";
private final String mAnnotation;
private final Boolean mActionable;
private final View.OnClickListener mListener;
diff --git a/src/com/android/settings/wifi/ConfigureWifiSettings.java b/src/com/android/settings/wifi/ConfigureWifiSettings.java
index 96b2d03..818b295 100644
--- a/src/com/android/settings/wifi/ConfigureWifiSettings.java
+++ b/src/com/android/settings/wifi/ConfigureWifiSettings.java
@@ -88,12 +88,12 @@
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (resultCode == WIFI_WAKEUP_REQUEST_CODE && mWifiWakeupPreferenceController != null) {
+ if (requestCode == WIFI_WAKEUP_REQUEST_CODE && mWifiWakeupPreferenceController != null) {
mWifiWakeupPreferenceController.onActivityResult(requestCode, resultCode);
return;
}
- if (resultCode == UseOpenWifiPreferenceController.REQUEST_CODE_OPEN_WIFI_AUTOMATICALLY
- && mUseOpenWifiPreferenceController == null) {
+ if (requestCode == UseOpenWifiPreferenceController.REQUEST_CODE_OPEN_WIFI_AUTOMATICALLY
+ && mUseOpenWifiPreferenceController != null) {
mUseOpenWifiPreferenceController.onActivityResult(requestCode, resultCode);
return;
}
diff --git a/src/com/android/settings/wifi/WifiScanningRequiredFragment.java b/src/com/android/settings/wifi/WifiScanningRequiredFragment.java
index bf24bbc..d7b6708 100644
--- a/src/com/android/settings/wifi/WifiScanningRequiredFragment.java
+++ b/src/com/android/settings/wifi/WifiScanningRequiredFragment.java
@@ -54,7 +54,6 @@
.setNegativeButton(R.string.cancel, null);
addButtonIfNeeded(builder);
-
return builder.create();
}
diff --git a/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor b/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor
index 85cf92b..7faa14a 100644
--- a/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor
+++ b/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor
@@ -5,7 +5,6 @@
com.android.settings.applications.appinfo.InstantAppButtonsPreferenceController
com.android.settings.bluetooth.BluetoothDeviceNamePreferenceController
com.android.settings.bluetooth.BluetoothDeviceRenamePreferenceController
-com.android.settings.bluetooth.BluetoothSwitchPreferenceController
com.android.settings.connecteddevice.ConnectedDeviceGroupController
com.android.settings.connecteddevice.SavedDeviceGroupController
com.android.settings.datausage.DataUsageSummaryPreferenceController
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
index 3895d42..d9e4e6b 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
@@ -37,9 +37,11 @@
import android.widget.Switch;
import com.android.settings.R;
-import com.android.settings.bluetooth.BluetoothSwitchPreferenceController.SwitchController;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowResources;
+import com.android.settings.widget.SwitchBar;
+import com.android.settings.widget.SwitchBarController;
+import com.android.settings.widget.SwitchWidgetController;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import com.android.settingslib.RestrictedSwitchPreference;
import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
@@ -77,9 +79,11 @@
private LocalBluetoothManager mBluetoothManager;
@Mock
private LocalBluetoothAdapter mBluetoothAdapter;
+ @Mock
+ private SwitchWidgetController.OnSwitchChangeListener mCallback;
private Context mContext;
- private SwitchController mSwitchController;
+ private SwitchWidgetController mSwitchController;
private BluetoothEnabler mBluetoothEnabler;
@Before
@@ -89,7 +93,7 @@
when(mBluetoothManager.getBluetoothAdapter()).thenReturn(mBluetoothAdapter);
mRestrictedSwitchPreference = new RestrictedSwitchPreference(mContext);
- mSwitchController = spy(new SwitchController(mRestrictedSwitchPreference));
+ mSwitchController = spy(new SwitchBarController(new SwitchBar(mContext)));
mBluetoothEnabler = new BluetoothEnabler(
mContext,
mSwitchController,
@@ -99,6 +103,7 @@
mRestrictionUtils);
mHolder = PreferenceViewHolder.createInstanceForTests(mock(View.class));
mRestrictedSwitchPreference.onBindViewHolder(mHolder);
+ mBluetoothEnabler.setToggleCallback(mCallback);
}
@Test
@@ -111,6 +116,15 @@
}
@Test
+ public void onSwitchToggled_shouldTriggerCallback() {
+ // WHEN the switch is toggled...
+ mBluetoothEnabler.onSwitchToggled(false);
+
+ // THEN the callback is triggered
+ verify(mCallback).onSwitchToggled(false);
+ }
+
+ @Test
public void maybeEnforceRestrictions_noRestrictions() {
// GIVEN there are no restrictions set...
when(mRestrictionUtils.checkIfRestrictionEnforced(any(Context.class), any(String.class)))
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceControllerTest.java
index a05859d..ccd57f5 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceControllerTest.java
@@ -17,21 +17,21 @@
package com.android.settings.bluetooth;
import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
+
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
import android.content.Context;
-import android.support.v14.preference.SwitchPreference;
-import android.support.v7.preference.PreferenceScreen;
+import android.provider.Settings;
-import com.android.settings.core.BasePreferenceController;
+import com.android.settings.R;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
+import com.android.settings.utils.AnnotationSpan;
+import com.android.settings.widget.SwitchWidgetController;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
+import com.android.settingslib.widget.FooterPreference;
import org.junit.Before;
import org.junit.Test;
@@ -44,17 +44,16 @@
@RunWith(SettingsRobolectricTestRunner.class)
public class BluetoothSwitchPreferenceControllerTest {
+ public static final String BLUETOOTH_INFO_STRING = "When Bluetooth is turned on, your device"
+ + " can communicate with other nearby Bluetooth devices.";
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private LocalBluetoothManager mBluetoothManager;
@Mock
- private PreferenceScreen mScreen;
- @Mock
- private SwitchPreference mPreference;
- @Mock
private RestrictionUtils mRestrictionUtils;
@Mock
- private LocalBluetoothAdapter mLocalBluetoothAdapter;
+ private SwitchWidgetController mSwitchController;
+ private FooterPreference mFooterPreference;
private Context mContext;
private BluetoothSwitchPreferenceController mController;
@@ -62,70 +61,52 @@
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application.getApplicationContext());
+ mFooterPreference = new FooterPreference(mContext);
FakeFeatureFactory.setupForTest();
mController =
- new BluetoothSwitchPreferenceController(mContext, mBluetoothManager, mRestrictionUtils);
- when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
- when(mPreference.getKey()).thenReturn(mController.getPreferenceKey());
+ new BluetoothSwitchPreferenceController(mContext, mBluetoothManager, mRestrictionUtils,
+ mSwitchController, mFooterPreference);
}
@Test
- public void testGetAvailabilityStatus_adapterNull_returnDisabled() {
- mController.mBluetoothAdapter = null;
+ public void updateText_bluetoothOffScanningOn() {
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE, 1);
+ mController.updateText(false);
+ AnnotationSpan.LinkInfo info = new AnnotationSpan.LinkInfo(
+ AnnotationSpan.LinkInfo.DEFAULT_ANNOTATION, mController);
+ CharSequence text = AnnotationSpan.linkify(
+ mContext.getText(R.string.bluetooth_scanning_on_info_message), info);
- assertThat(mController.getAvailabilityStatus())
- .isEqualTo(BasePreferenceController.DISABLED_UNSUPPORTED);
+ assertThat(mFooterPreference.getTitle()).isEqualTo(text);
}
@Test
- public void testGetAvailabilityStatus_adapterExisted_returnAvailable() {
- mController.mBluetoothAdapter = mLocalBluetoothAdapter;
+ public void updateText_bluetoothOffScanningOff() {
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE, 0);
+ mController.updateText(false);
- assertThat(mController.getAvailabilityStatus())
- .isEqualTo(BasePreferenceController.AVAILABLE);
+ assertThat(mFooterPreference.getTitle()).isEqualTo(BLUETOOTH_INFO_STRING);
+
}
@Test
- public void testOnStart_shouldRegisterPreferenceChangeListener() {
- mController.displayPreference(mScreen);
- mController.onStart();
+ public void updateText_bluetoothOnScanningOff() {
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE, 0);
+ mController.updateText(true);
- verify(mPreference).setOnPreferenceChangeListener(
- any(BluetoothSwitchPreferenceController.SwitchController.class));
+ assertThat(mFooterPreference.getTitle()).isEqualTo(BLUETOOTH_INFO_STRING);
}
@Test
- public void testOnStop_shouldRegisterPreferenceChangeListener() {
- mController.displayPreference(mScreen);
- mController.onStart();
+ public void updateText_bluetoothOnScanningOn() {
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE, 1);
+ mController.updateText(true);
- mController.onStop();
-
- verify(mPreference).setOnPreferenceChangeListener(null);
- }
-
- @Test
- public void testIsChecked_adapterNull_returnFalse() {
- mController.mBluetoothAdapter = null;
-
- assertThat(mController.isChecked()).isFalse();
- }
-
- @Test
- public void testIsChecked_adapterExisted_returnFromAdapter() {
- mController.mBluetoothAdapter = mLocalBluetoothAdapter;
- doReturn(true).when(mLocalBluetoothAdapter).isEnabled();
-
- assertThat(mController.isChecked()).isTrue();
- }
-
- @Test
- public void testSetChecked_adapterExisted() {
- mController.mBluetoothAdapter = mLocalBluetoothAdapter;
-
- mController.setChecked(true);
-
- verify(mLocalBluetoothAdapter).setBluetoothEnabled(true);
+ assertThat(mFooterPreference.getTitle()).isEqualTo(BLUETOOTH_INFO_STRING);
}
}