summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/anim/ic_dnd_disable_alpha_animation.xml26
-rw-r--r--packages/SystemUI/res/anim/ic_dnd_disable_bar01_0_animation.xml26
-rw-r--r--packages/SystemUI/res/anim/ic_dnd_disable_mask_1_animation.xml26
-rw-r--r--packages/SystemUI/res/anim/ic_dnd_total_silence_disable_alpha_animation.xml26
-rw-r--r--packages/SystemUI/res/anim/ic_dnd_total_silence_disable_mask_1_animation.xml26
-rw-r--r--packages/SystemUI/res/anim/ic_dnd_total_silence_disable_outer_ring_merged_animation.xml26
-rw-r--r--packages/SystemUI/res/drawable/ic_dnd_disable.xml48
-rw-r--r--packages/SystemUI/res/drawable/ic_dnd_disable_animation.xml29
-rw-r--r--packages/SystemUI/res/drawable/ic_dnd_total_silence_disable.xml39
-rw-r--r--packages/SystemUI/res/drawable/ic_dnd_total_silence_disable_animation.xml29
-rw-r--r--packages/SystemUI/res/values/dimens.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/assist/AssistManager.java85
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java38
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java39
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java34
22 files changed, 454 insertions, 113 deletions
diff --git a/packages/SystemUI/res/anim/ic_dnd_disable_alpha_animation.xml b/packages/SystemUI/res/anim/ic_dnd_disable_alpha_animation.xml
new file mode 100644
index 0000000..21caab4
--- /dev/null
+++ b/packages/SystemUI/res/anim/ic_dnd_disable_alpha_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+<set
+ xmlns:android="http://schemas.android.com/apk/res/android" >
+ <objectAnimator
+ android:duration="350"
+ android:propertyName="alpha"
+ android:valueFrom="1.0"
+ android:valueTo="0.3"
+ android:valueType="floatType"
+ android:interpolator="@android:interpolator/linear" />
+</set>
diff --git a/packages/SystemUI/res/anim/ic_dnd_disable_bar01_0_animation.xml b/packages/SystemUI/res/anim/ic_dnd_disable_bar01_0_animation.xml
new file mode 100644
index 0000000..a914687
--- /dev/null
+++ b/packages/SystemUI/res/anim/ic_dnd_disable_bar01_0_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+<set
+ xmlns:android="http://schemas.android.com/apk/res/android" >
+ <objectAnimator
+ android:duration="350"
+ android:propertyName="pathData"
+ android:valueFrom="M 0.680404663086,3.53039550781 c 0.0,0.0 -0.01416015625,0.00492858886719 -0.01416015625,0.00492858886719 c 0.0,0.0 1.41400146484,-1.41400146484 1.41400146484,-1.41400146484 c 0.0,0.0 0.0151519775391,-0.00492858886719 0.0151519775391,-0.00492858886719 c 0.0,0.0 -1.41499328613,1.41400146484 -1.41499328613,1.41400146484 Z"
+ android:valueTo="M 0.680404663086,3.53039550781 c 0.0,0.0 20.0110015869,20.0110015869 20.0110015869,20.0110015869 c 0.0,0.0 1.41400146484,-1.41400146484 1.41400146484,-1.41400146484 c 0.0,0.0 -20.0100097656,-20.0110015869 -20.0100097656,-20.0110015869 c 0.0,0.0 -1.41499328613,1.41400146484 -1.41499328613,1.41400146484 Z"
+ android:valueType="pathType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/packages/SystemUI/res/anim/ic_dnd_disable_mask_1_animation.xml b/packages/SystemUI/res/anim/ic_dnd_disable_mask_1_animation.xml
new file mode 100644
index 0000000..3c60c01
--- /dev/null
+++ b/packages/SystemUI/res/anim/ic_dnd_disable_mask_1_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+<set
+ xmlns:android="http://schemas.android.com/apk/res/android" >
+ <objectAnimator
+ android:duration="350"
+ android:propertyName="pathData"
+ android:valueFrom="M -9.67768859863,-9.82725524902 c 0.0,0.0 -7.8091583252,7.18409729004 -7.8091583252,7.18409729004 c 0.0,0.0 20.9320983887,20.9321136475 20.9320983887,20.9321136475 c 0.0,0.0 15.041595459,-15.0416717529 15.041595459,-15.0416717529 c 0.0,0.0 -20.5361938477,-20.536239624 -20.5361938477,-20.536239624 c 0.0,0.0 -6.20835876465,6.05171203613 -6.20835876465,6.05171203613 c 0.0,0.0 0.219390869141,0.219299316406 0.219390869141,0.219299316406 c 0.0,0.0 -1.41998291016,1.40998840332 -1.41998291016,1.40998840332 c 0.0,0.0 -0.219390869141,-0.219299316406 -0.219390869141,-0.219299316406 Z"
+ android:valueTo="M -9.67768859863,-9.82725524902 c 0.0,0.0 -7.8091583252,7.18409729004 -7.8091583252,7.18409729004 c 0.0,0.0 20.9320983887,20.9321136475 20.9320983887,20.9321136475 c 0.0,0.0 15.041595459,-15.0416717529 15.041595459,-15.0416717529 c 0.0,0.0 -20.5361938477,-20.536239624 -20.5361938477,-20.536239624 c 0.0,0.0 -6.20835876465,6.05171203613 -6.20835876465,6.05171203613 c 0.0,0.0 20.4531555176,20.4530792236 20.4531555176,20.4530792236 c 0.0,0.0 -1.41999816895,1.40995788574 -1.41999816895,1.40995788574 c 0.0,0.0 -20.4531402588,-20.4530487061 -20.4531402588,-20.4530487061 Z"
+ android:valueType="pathType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_alpha_animation.xml b/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_alpha_animation.xml
new file mode 100644
index 0000000..21caab4
--- /dev/null
+++ b/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_alpha_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+<set
+ xmlns:android="http://schemas.android.com/apk/res/android" >
+ <objectAnimator
+ android:duration="350"
+ android:propertyName="alpha"
+ android:valueFrom="1.0"
+ android:valueTo="0.3"
+ android:valueType="floatType"
+ android:interpolator="@android:interpolator/linear" />
+</set>
diff --git a/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_mask_1_animation.xml b/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_mask_1_animation.xml
new file mode 100644
index 0000000..8d3296e
--- /dev/null
+++ b/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_mask_1_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+<set
+ xmlns:android="http://schemas.android.com/apk/res/android" >
+ <objectAnimator
+ android:duration="350"
+ android:propertyName="pathData"
+ android:valueFrom="M -9.67768859863,-9.82725524902 c 0.0,0.0 -7.8091583252,7.18409729004 -7.8091583252,7.18409729004 c 0.0,0.0 20.9320983887,20.9321136475 20.9320983887,20.9321136475 c 0.0,0.0 15.041595459,-15.0416717529 15.041595459,-15.0416717529 c 0.0,0.0 -20.5361938477,-20.536239624 -20.5361938477,-20.536239624 c 0.0,0.0 -6.20835876465,6.05171203613 -6.20835876465,6.05171203613 c 0.0,0.0 0.219390869141,0.219299316406 0.219390869141,0.219299316406 c 0.0,0.0 -1.41998291016,1.40998840332 -1.41998291016,1.40998840332 c 0.0,0.0 -0.219390869141,-0.219299316406 -0.219390869141,-0.219299316406 Z"
+ android:valueTo="M -9.67768859863,-9.82725524902 c 0.0,0.0 -7.8091583252,7.18409729004 -7.8091583252,7.18409729004 c 0.0,0.0 20.9320983887,20.9321136475 20.9320983887,20.9321136475 c 0.0,0.0 15.041595459,-15.0416717529 15.041595459,-15.0416717529 c 0.0,0.0 -20.5361938477,-20.536239624 -20.5361938477,-20.536239624 c 0.0,0.0 -6.20835876465,6.05171203613 -6.20835876465,6.05171203613 c 0.0,0.0 19.8804626465,19.8695220947 19.8804626465,19.8695220947 c 0.0,0.0 -1.41999816895,1.40995788574 -1.41999816895,1.40995788574 c 0.0,0.0 -19.8804473877,-19.8694915771 -19.8804473877,-19.8694915771 Z"
+ android:valueType="pathType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_outer_ring_merged_animation.xml b/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_outer_ring_merged_animation.xml
new file mode 100644
index 0000000..2626499
--- /dev/null
+++ b/packages/SystemUI/res/anim/ic_dnd_total_silence_disable_outer_ring_merged_animation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+<set
+ xmlns:android="http://schemas.android.com/apk/res/android" >
+ <objectAnimator
+ android:duration="350"
+ android:propertyName="pathData"
+ android:valueFrom="M 0.0,-10.0 c -5.5,0.0 -10.0,4.5 -10.0,10.0 c 0.0,5.5 4.5,10.0 10.0,10.0 c 5.5,0.0 10.0,-4.5 10.0,-10.0 c 0.0,-5.5 -4.5,-10.0 -10.0,-10.0 Z M 0.0,8.5 c -4.69999694824,0.0 -8.5,-3.80000305176 -8.5,-8.5 c 0.0,-4.69999694824 3.80000305176,-8.5 8.5,-8.5 c 4.69999694824,0.0 8.5,3.80000305176 8.5,8.5 c 0.0,4.69999694824 -3.80000305176,8.5 -8.5,8.5 Z M -11.3195953369,-8.46960449219 c 0.0,0.0 -0.0141754150391,0.00492858886719 -0.014175415039,0.00492858886719 c 0.0,0.0 1.41400146484,-1.41400146484 1.41400146484,-1.41400146484 c 0.0,0.0 0.0151672363281,-0.00492858886719 0.0151672363281,-0.00492858886719 c 0.0,0.0 -1.41499328613,1.41400146484 -1.41499328613,1.41400146484 Z M 3.0,1.0 c 0.0,0.0 -6.0,0.0 -6.0,0.0 c 0.0,0.0 0.0,-2.0 0.0,-2.0 c 0.0,0.0 6.0,0.0 6.0,0.0 c 0.0,0.0 0.0,2.0 0.0,2.0 Z M 0.0,-6.0 c -3.30000305176,0.0 -6.0,2.69999694824 -6.0,6.0 c 0.0,3.30000305176 2.69999694824,6.0 6.0,6.0 c 3.30000305176,0.0 6.0,-2.69999694824 6.0,-6.0 c 0.0,-3.30000305176 -2.60000610352,-6.0 -6.0,-6.0 Z"
+ android:valueTo="M 0.0,-10.0 c -5.5,0.0 -10.0,4.5 -10.0,10.0 c 0.0,5.5 4.5,10.0 10.0,10.0 c 5.5,0.0 10.0,-4.5 10.0,-10.0 c 0.0,-5.5 -4.5,-10.0 -10.0,-10.0 Z M 0.0,8.5 c -4.69999694824,0.0 -8.5,-3.80000305176 -8.5,-8.5 c 0.0,-4.69999694824 3.80000305176,-8.5 8.5,-8.5 c 4.69999694824,0.0 8.5,3.80000305176 8.5,8.5 c 0.0,4.69999694824 -3.80000305176,8.5 -8.5,8.5 Z M -11.3195953369,-8.46960449219 c 0.0,0.0 20.0109863281,20.0110015869 20.0109863281,20.0110015869 c 0.0,0.0 1.41400146484,-1.41400146484 1.41400146484,-1.41400146484 c 0.0,0.0 -20.0099945068,-20.0110015869 -20.0099945068,-20.0110015869 c 0.0,0.0 -1.41499328613,1.41400146484 -1.41499328613,1.41400146484 Z M 5.0,1.0 c 0.0,0.0 -10.0,0.0 -10.0,0.0 c 0.0,0.0 0.0,-2.0 0.0,-2.0 c 0.0,0.0 10.0,0.0 10.0,0.0 c 0.0,0.0 0.0,2.0 0.0,2.0 Z M 0.0,-10.0 c -5.52000427246,0.0 -10.0,4.47999572754 -10.0,10.0 c 0.0,5.52000427246 4.47999572754,10.0 10.0,10.0 c 5.52000427246,0.0 10.0,-4.47999572754 10.0,-10.0 c 0.0,-5.52000427246 -4.47999572754,-10.0 -10.0,-10.0 Z"
+ android:valueType="pathType"
+ android:interpolator="@android:interpolator/fast_out_slow_in" />
+</set>
diff --git a/packages/SystemUI/res/drawable/ic_dnd_disable.xml b/packages/SystemUI/res/drawable/ic_dnd_disable.xml
new file mode 100644
index 0000000..ba4692a
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_dnd_disable.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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:name="ic_dnd_disable"
+ android:width="24dp"
+ android:viewportWidth="24"
+ android:height="24dp"
+ android:viewportHeight="24" >
+ <group
+ android:name="dnd_icon"
+ android:translateX="12"
+ android:translateY="12" >
+ <clip-path
+ android:name="mask_1"
+ android:pathData="M -9.67768859863,-9.82725524902 c 0.0,0.0 -7.8091583252,7.18409729004 -7.8091583252,7.18409729004 c 0.0,0.0 20.9320983887,20.9321136475 20.9320983887,20.9321136475 c 0.0,0.0 15.041595459,-15.0416717529 15.041595459,-15.0416717529 c 0.0,0.0 -20.5361938477,-20.536239624 -20.5361938477,-20.536239624 c 0.0,0.0 -6.20835876465,6.05171203613 -6.20835876465,6.05171203613 c 0.0,0.0 0.219390869141,0.219299316406 0.219390869141,0.219299316406 c 0.0,0.0 -1.41998291016,1.40998840332 -1.41998291016,1.40998840332 c 0.0,0.0 -0.219390869141,-0.219299316406 -0.219390869141,-0.219299316406 Z" />
+ <group
+ android:name="bar01"
+ android:translateX="-12"
+ android:translateY="-12" >
+ <path
+ android:name="bar01_0"
+ android:pathData="M 0.680404663086,3.53039550781 c 0.0,0.0 -0.01416015625,0.00492858886719 -0.01416015625,0.00492858886719 c 0.0,0.0 1.41400146484,-1.41400146484 1.41400146484,-1.41400146484 c 0.0,0.0 0.0151519775391,-0.00492858886719 0.0151519775391,-0.00492858886719 c 0.0,0.0 -1.41499328613,1.41400146484 -1.41499328613,1.41400146484 Z"
+ android:fillColor="#FFFFFFFF" />
+ </group>
+ <group
+ android:name="circle" >
+ <path
+ android:name="icon_center_merged"
+ android:pathData="M 5.0,1.0 c 0.0,0.0 -10.0,0.0 -10.0,0.0 c 0.0,0.0 0.0,-2.0 0.0,-2.0 c 0.0,0.0 10.0,0.0 10.0,0.0 c 0.0,0.0 0.0,2.0 0.0,2.0 Z M 0.0,-10.0 c -5.52000427246,0.0 -10.0,4.47999572754 -10.0,10.0 c 0.0,5.52000427246 4.47999572754,10.0 10.0,10.0 c 5.52000427246,0.0 10.0,-4.47999572754 10.0,-10.0 c 0.0,-5.52000427246 -4.47999572754,-10.0 -10.0,-10.0 Z"
+ android:fillColor="#FFFFFFFF" />
+ </group>
+ </group>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_dnd_disable_animation.xml b/packages/SystemUI/res/drawable/ic_dnd_disable_animation.xml
new file mode 100644
index 0000000..13ed767
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_dnd_disable_animation.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+<animated-vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:drawable="@drawable/ic_dnd_disable" >
+ <target
+ android:name="mask_1"
+ android:animation="@anim/ic_dnd_disable_mask_1_animation" />
+ <target
+ android:name="bar01_0"
+ android:animation="@anim/ic_dnd_disable_bar01_0_animation" />
+ <target
+ android:name="ic_dnd_disable"
+ android:animation="@anim/ic_dnd_disable_alpha_animation" />
+</animated-vector>
diff --git a/packages/SystemUI/res/drawable/ic_dnd_total_silence_disable.xml b/packages/SystemUI/res/drawable/ic_dnd_total_silence_disable.xml
new file mode 100644
index 0000000..1a33255
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_dnd_total_silence_disable.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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:name="ic_dnd_total_silence_disable"
+ android:width="24dp"
+ android:viewportWidth="24"
+ android:height="24dp"
+ android:viewportHeight="24" >
+ <group
+ android:name="tot_silence"
+ android:translateX="12"
+ android:translateY="12" >
+ <clip-path
+ android:name="mask_1"
+ android:pathData="M -9.67768859863,-9.82725524902 c 0.0,0.0 -7.8091583252,7.18409729004 -7.8091583252,7.18409729004 c 0.0,0.0 20.9320983887,20.9321136475 20.9320983887,20.9321136475 c 0.0,0.0 15.041595459,-15.0416717529 15.041595459,-15.0416717529 c 0.0,0.0 -20.5361938477,-20.536239624 -20.5361938477,-20.536239624 c 0.0,0.0 -6.20835876465,6.05171203613 -6.20835876465,6.05171203613 c 0.0,0.0 0.219390869141,0.219299316406 0.219390869141,0.219299316406 c 0.0,0.0 -1.41998291016,1.40998840332 -1.41998291016,1.40998840332 c 0.0,0.0 -0.219390869141,-0.219299316406 -0.219390869141,-0.219299316406 Z" />
+ <group
+ android:name="icon_shape" >
+ <path
+ android:name="outer_ring_merged"
+ android:pathData="M 0.0,-10.0 c -5.5,0.0 -10.0,4.5 -10.0,10.0 c 0.0,5.5 4.5,10.0 10.0,10.0 c 5.5,0.0 10.0,-4.5 10.0,-10.0 c 0.0,-5.5 -4.5,-10.0 -10.0,-10.0 Z M 0.0,8.5 c -4.69999694824,0.0 -8.5,-3.80000305176 -8.5,-8.5 c 0.0,-4.69999694824 3.80000305176,-8.5 8.5,-8.5 c 4.69999694824,0.0 8.5,3.80000305176 8.5,8.5 c 0.0,4.69999694824 -3.80000305176,8.5 -8.5,8.5 Z M -11.3195953369,-8.46960449219 c 0.0,0.0 -0.0141754150391,0.00492858886719 -0.014175415039,0.00492858886719 c 0.0,0.0 1.41400146484,-1.41400146484 1.41400146484,-1.41400146484 c 0.0,0.0 0.0151672363281,-0.00492858886719 0.0151672363281,-0.00492858886719 c 0.0,0.0 -1.41499328613,1.41400146484 -1.41499328613,1.41400146484 Z M 3.0,1.0 c 0.0,0.0 -6.0,0.0 -6.0,0.0 c 0.0,0.0 0.0,-2.0 0.0,-2.0 c 0.0,0.0 6.0,0.0 6.0,0.0 c 0.0,0.0 0.0,2.0 0.0,2.0 Z M 0.0,-6.0 c -3.30000305176,0.0 -6.0,2.69999694824 -6.0,6.0 c 0.0,3.30000305176 2.69999694824,6.0 6.0,6.0 c 3.30000305176,0.0 6.0,-2.69999694824 6.0,-6.0 c 0.0,-3.30000305176 -2.60000610352,-6.0 -6.0,-6.0 Z"
+ android:fillColor="#FFFFFFFF" />
+ </group>
+ </group>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_dnd_total_silence_disable_animation.xml b/packages/SystemUI/res/drawable/ic_dnd_total_silence_disable_animation.xml
new file mode 100644
index 0000000..c0b2d69
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_dnd_total_silence_disable_animation.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2015 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.
+-->
+<animated-vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:drawable="@drawable/ic_dnd_total_silence_disable" >
+ <target
+ android:name="mask_1"
+ android:animation="@anim/ic_dnd_total_silence_disable_mask_1_animation" />
+ <target
+ android:name="outer_ring_merged"
+ android:animation="@anim/ic_dnd_total_silence_disable_outer_ring_merged_animation" />
+ <target
+ android:name="ic_dnd_total_silence_disable"
+ android:animation="@anim/ic_dnd_total_silence_disable_alpha_animation" />
+</animated-vector>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index a6313ad..3760188 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -164,7 +164,7 @@
<dimen name="pull_span_min">25dp</dimen>
<dimen name="qs_tile_height">88dp</dimen>
- <dimen name="qs_tile_icon_size">28dp</dimen>
+ <dimen name="qs_tile_icon_size">24dp</dimen>
<dimen name="qs_tile_text_size">12sp</dimen>
<dimen name="qs_tile_divider_height">1dp</dimen>
<dimen name="qs_panel_padding">16dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index 1e7ee98..445ecb6 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -16,7 +16,6 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
-import android.os.ServiceManager;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.Log;
@@ -28,12 +27,15 @@ import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
-import com.android.internal.app.IVoiceInteractionManagerService;
+import com.android.internal.app.AssistUtils;
import com.android.internal.app.IVoiceInteractionSessionShowCallback;
import com.android.systemui.R;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.phone.PhoneStatusBar;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
/**
* Class to manage everything related to assist in SystemUI.
*/
@@ -55,7 +57,7 @@ public class AssistManager {
private final WindowManager mWindowManager;
private AssistOrbContainer mView;
private final PhoneStatusBar mBar;
- private final IVoiceInteractionManagerService mVoiceInteractionManagerService;
+ private final AssistUtils mAssistUtils;
private ComponentName mAssistComponent;
@@ -92,8 +94,7 @@ public class AssistManager {
mContext = context;
mBar = bar;
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
- mVoiceInteractionManagerService = IVoiceInteractionManagerService.Stub.asInterface(
- ServiceManager.getService(Context.VOICE_INTERACTION_MANAGER_SERVICE));
+ mAssistUtils = new AssistUtils(context);
mContext.getContentResolver().registerContentObserver(
Settings.Secure.getUriFor(Settings.Secure.ASSISTANT), false,
@@ -140,11 +141,7 @@ public class AssistManager {
}
public void hideAssist() {
- try {
- mVoiceInteractionManagerService.hideCurrentSession();
- } catch (RemoteException e) {
- Log.w(TAG, "Failed to call hideCurrentSession", e);
- }
+ mAssistUtils.hideCurrentSession();
}
private WindowManager.LayoutParams getLayoutParams() {
@@ -216,58 +213,27 @@ public class AssistManager {
}
private void startVoiceInteractor() {
- try {
- mVoiceInteractionManagerService.showSessionForActiveService(mShowCallback);
- } catch (RemoteException e) {
- Log.w(TAG, "Failed to call showSessionForActiveService", e);
- }
+ mAssistUtils.showSessionForActiveService(mShowCallback);
}
public void launchVoiceAssistFromKeyguard() {
- try {
- mVoiceInteractionManagerService.launchVoiceAssistFromKeyguard();
- } catch (RemoteException e) {
- Log.w(TAG, "Failed to call launchVoiceAssistFromKeyguard", e);
- }
+ mAssistUtils.launchVoiceAssistFromKeyguard();
}
private boolean getVoiceInteractorSupportsAssistGesture() {
- try {
- return mVoiceInteractionManagerService != null
- && mVoiceInteractionManagerService.activeServiceSupportsAssist();
- } catch (RemoteException e) {
- Log.w(TAG, "Failed to call activeServiceSupportsAssistGesture", e);
- return false;
- }
+ return mAssistUtils.activeServiceSupportsAssistGesture();
}
public boolean canVoiceAssistBeLaunchedFromKeyguard() {
- try {
- return mVoiceInteractionManagerService != null
- && mVoiceInteractionManagerService.activeServiceSupportsLaunchFromKeyguard();
- } catch (RemoteException e) {
- Log.w(TAG, "Failed to call activeServiceSupportsLaunchFromKeyguard", e);
- return false;
- }
+ return mAssistUtils.activeServiceSupportsLaunchFromKeyguard();
}
public ComponentName getVoiceInteractorComponentName() {
- try {
- return mVoiceInteractionManagerService.getActiveServiceComponentName();
- } catch (RemoteException e) {
- Log.w(TAG, "Failed to call getActiveServiceComponentName", e);
- return null;
- }
+ return mAssistUtils.getActiveServiceComponentName();
}
private boolean isVoiceSessionRunning() {
- try {
- return mVoiceInteractionManagerService != null
- && mVoiceInteractionManagerService.isSessionRunning();
- } catch (RemoteException e) {
- Log.w(TAG, "Failed to call isSessionRunning", e);
- return false;
- }
+ return mAssistUtils.isSessionRunning();
}
public void destroy() {
@@ -324,26 +290,11 @@ public class AssistManager {
}
private void updateAssistInfo() {
- final String setting = Settings.Secure.getStringForUser(mContext.getContentResolver(),
- Settings.Secure.ASSISTANT, UserHandle.USER_CURRENT);
- if (setting != null) {
- mAssistComponent = ComponentName.unflattenFromString(setting);
- return;
- }
-
- // Fallback to keep backward compatible behavior when there is no user setting.
- if (getVoiceInteractorSupportsAssistGesture()) {
- mAssistComponent = getVoiceInteractorComponentName();
- return;
- }
-
- Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
- .getAssistIntent(mContext, false, UserHandle.USER_CURRENT);
- if (intent != null) {
- mAssistComponent = intent.getComponent();
- return;
- }
+ mAssistComponent = mAssistUtils.getAssistComponentForUser(UserHandle.USER_CURRENT);
+ }
- mAssistComponent = null;
+ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ pw.println("AssistManager state:");
+ pw.print(" mAssistComponent="); pw.println(mAssistComponent);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index f00fed5..c06b34f 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -371,7 +371,6 @@ public class KeyguardViewMediator extends SystemUI {
@Override
public void onDeviceProvisioned() {
sendUserPresentBroadcast();
- updateInputRestricted();
}
@Override
@@ -947,7 +946,7 @@ public class KeyguardViewMediator extends SystemUI {
* was suppressed by an app that disabled the keyguard or we haven't been provisioned yet.
*/
public boolean isInputRestricted() {
- return mShowing || mNeedToReshowWhenReenabled || shouldWaitForProvisioning();
+ return mShowing || mNeedToReshowWhenReenabled;
}
private void updateInputRestricted() {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
index f4d6f04..f97f519 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/DndTile.java
@@ -38,6 +38,7 @@ import com.android.systemui.volume.ZenModePanel;
/** Quick settings tile: Do not disturb **/
public class DndTile extends QSTile<QSTile.BooleanState> {
+
private static final Intent ZEN_SETTINGS =
new Intent(Settings.ACTION_ZEN_MODE_SETTINGS);
@@ -47,6 +48,14 @@ public class DndTile extends QSTile<QSTile.BooleanState> {
private static final String ACTION_SET_VISIBLE = "com.android.systemui.dndtile.SET_VISIBLE";
private static final String EXTRA_VISIBLE = "visible";
+ private static final QSTile.Icon TOTAL_SILENCE =
+ ResourceIcon.get(R.drawable.ic_qs_dnd_on_total_silence);
+
+ private final AnimationIcon mDisable =
+ new AnimationIcon(R.drawable.ic_dnd_disable_animation);
+ private final AnimationIcon mDisableTotalSilence =
+ new AnimationIcon(R.drawable.ic_dnd_total_silence_disable_animation);
+
private final ZenModeController mController;
private final DndDetailAdapter mDetailAdapter;
@@ -89,6 +98,8 @@ public class DndTile extends QSTile<QSTile.BooleanState> {
@Override
public void handleClick() {
+ mDisable.setAllowAnimation(true);
+ mDisableTotalSilence.setAllowAnimation(true);
MetricsLogger.action(mContext, getMetricsCategory(), !mState.value);
if (mState.value) {
mController.setZen(Global.ZEN_MODE_OFF, null, TAG);
@@ -114,7 +125,7 @@ public class DndTile extends QSTile<QSTile.BooleanState> {
R.string.accessibility_quick_settings_dnd_priority_on);
break;
case Global.ZEN_MODE_NO_INTERRUPTIONS:
- state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_on_total_silence);
+ state.icon = TOTAL_SILENCE;
state.label = mContext.getString(R.string.quick_settings_dnd_none_label);
state.contentDescription = mContext.getString(
R.string.accessibility_quick_settings_dnd_none_on);
@@ -126,7 +137,7 @@ public class DndTile extends QSTile<QSTile.BooleanState> {
R.string.accessibility_quick_settings_dnd_alarms_on);
break;
default:
- state.icon = ResourceIcon.get(R.drawable.ic_qs_dnd_off);
+ state.icon = TOTAL_SILENCE.equals(state.icon) ? mDisableTotalSilence : mDisable;
state.label = mContext.getString(R.string.quick_settings_dnd_label);
state.contentDescription = mContext.getString(
R.string.accessibility_quick_settings_dnd_off);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
index ff7b37f..9e0b08b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
@@ -114,14 +114,21 @@ public class SignalClusterView
return;
}
ArraySet<String> blockList = StatusBarIconController.getIconBlacklist(newValue);
- mBlockAirplane = blockList.contains(SLOT_AIRPLANE);
- mBlockMobile = blockList.contains(SLOT_MOBILE);
- mBlockWifi = blockList.contains(SLOT_WIFI);
- mBlockEthernet = blockList.contains(SLOT_ETHERNET);
-
- // Re-register to get new callbacks.
- mNC.removeSignalCallback(SignalClusterView.this);
- mNC.addSignalCallback(SignalClusterView.this);
+ boolean blockAirplane = blockList.contains(SLOT_AIRPLANE);
+ boolean blockMobile = blockList.contains(SLOT_MOBILE);
+ boolean blockWifi = blockList.contains(SLOT_WIFI);
+ boolean blockEthernet = blockList.contains(SLOT_ETHERNET);
+
+ if (blockAirplane != mBlockAirplane || blockMobile != mBlockMobile
+ || blockEthernet != mBlockEthernet || blockWifi != mBlockWifi) {
+ mBlockAirplane = blockAirplane;
+ mBlockMobile = blockMobile;
+ mBlockEthernet = blockEthernet;
+ mBlockWifi = blockWifi;
+ // Re-register to get new callbacks.
+ mNC.removeSignalCallback(this);
+ mNC.addSignalCallback(this);
+ }
}
public void setNetworkController(NetworkControllerImpl nc) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 33e8e59..69198ed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -812,12 +812,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
signalClusterQs.setNetworkController(mNetworkController);
final boolean isAPhone = mNetworkController.hasVoiceCallingFeature();
if (isAPhone) {
- mNetworkController.addEmergencyListener(new NetworkControllerImpl.EmergencyListener() {
- @Override
- public void setEmergencyCallsOnly(boolean emergencyOnly) {
- mHeader.setShowEmergencyCallsOnly(emergencyOnly);
- }
- });
+ mNetworkController.addEmergencyListener(mHeader);
}
mFlashlightController = new FlashlightController(mContext);
@@ -2692,6 +2687,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
if (mNextAlarmController != null) {
mNextAlarmController.dump(fd, pw, args);
}
+ if (mAssistManager != null) {
+ mAssistManager.dump(fd, pw, args);
+ }
if (mSecurityController != null) {
mSecurityController.dump(fd, pw, args);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
index dfc6924..a81f06e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
@@ -45,6 +45,7 @@ import com.android.systemui.R;
import com.android.systemui.qs.QSPanel;
import com.android.systemui.qs.QSTile;
import com.android.systemui.statusbar.policy.BatteryController;
+import com.android.systemui.statusbar.policy.NetworkControllerImpl.EmergencyListener;
import com.android.systemui.statusbar.policy.NextAlarmController;
import com.android.systemui.statusbar.policy.UserInfoController;
@@ -54,7 +55,8 @@ import java.text.NumberFormat;
* The view to manage the header area in the expanded status bar.
*/
public class StatusBarHeaderView extends RelativeLayout implements View.OnClickListener,
- BatteryController.BatteryStateChangeCallback, NextAlarmController.NextAlarmChangeCallback {
+ BatteryController.BatteryStateChangeCallback, NextAlarmController.NextAlarmChangeCallback,
+ EmergencyListener {
private boolean mExpanded;
private boolean mListening;
@@ -527,7 +529,8 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
return true;
}
- public void setShowEmergencyCallsOnly(boolean show) {
+ @Override
+ public void setEmergencyCallsOnly(boolean show) {
boolean changed = show != mShowEmergencyCallsOnly;
if (changed) {
mShowEmergencyCallsOnly = show;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
index 686e24c..0aa0b4a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -34,6 +34,7 @@ import com.android.internal.telephony.cdma.EriInfo;
import com.android.systemui.R;
import com.android.systemui.statusbar.policy.NetworkController.IconState;
import com.android.systemui.statusbar.policy.NetworkControllerImpl.Config;
+import com.android.systemui.statusbar.policy.NetworkControllerImpl.SubscriptionDefaults;
import java.io.PrintWriter;
import java.util.BitSet;
@@ -43,6 +44,7 @@ import java.util.Objects;
public class MobileSignalController extends SignalController<
MobileSignalController.MobileState, MobileSignalController.MobileIconGroup> {
private final TelephonyManager mPhone;
+ private final SubscriptionDefaults mDefaults;
private final String mNetworkNameDefault;
private final String mNetworkNameSeparator;
@VisibleForTesting
@@ -67,13 +69,15 @@ public class MobileSignalController extends SignalController<
// need listener lists anymore.
public MobileSignalController(Context context, Config config, boolean hasMobileData,
TelephonyManager phone, CallbackHandler callbackHandler,
- NetworkControllerImpl networkController, SubscriptionInfo info, Looper receiverLooper) {
+ NetworkControllerImpl networkController, SubscriptionInfo info,
+ SubscriptionDefaults defaults, Looper receiverLooper) {
super("MobileSignalController(" + info.getSubscriptionId() + ")", context,
NetworkCapabilities.TRANSPORT_CELLULAR, callbackHandler,
networkController);
mNetworkToIconLookup = new SparseArray<>();
mConfig = config;
mPhone = phone;
+ mDefaults = defaults;
mSubscriptionInfo = info;
mPhoneStateListener = new MobilePhoneStateListener(info.getSubscriptionId(),
receiverLooper);
@@ -290,7 +294,7 @@ public class MobileSignalController extends SignalController<
}
private void updateDataSim() {
- int defaultDataSub = SubscriptionManager.getDefaultDataSubId();
+ int defaultDataSub = mDefaults.getDefaultDataSubId();
if (SubscriptionManager.isValidSubscriptionId(defaultDataSub)) {
mCurrentState.dataSim = defaultDataSub == mSubscriptionInfo.getSubscriptionId();
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index e8957f9..18b5820 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -71,6 +71,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
private final ConnectivityManager mConnectivityManager;
private final SubscriptionManager mSubscriptionManager;
private final boolean mHasMobileDataFeature;
+ private final SubscriptionDefaults mSubDefaults;
private Config mConfig;
// Subcontrollers.
@@ -124,7 +125,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
SubscriptionManager.from(context), Config.readConfig(context), bgLooper,
new CallbackHandler(),
new AccessPointControllerImpl(context, bgLooper),
- new MobileDataControllerImpl(context));
+ new MobileDataControllerImpl(context),
+ new SubscriptionDefaults());
mReceiverHandler.post(mRegisterListeners);
}
@@ -134,13 +136,15 @@ public class NetworkControllerImpl extends BroadcastReceiver
SubscriptionManager subManager, Config config, Looper bgLooper,
CallbackHandler callbackHandler,
AccessPointControllerImpl accessPointController,
- MobileDataControllerImpl mobileDataController) {
+ MobileDataControllerImpl mobileDataController,
+ SubscriptionDefaults defaultsHandler) {
mContext = context;
mConfig = config;
mReceiverHandler = new Handler(bgLooper);
mCallbackHandler = callbackHandler;
mSubscriptionManager = subManager;
+ mSubDefaults = defaultsHandler;
mConnectivityManager = connectivityManager;
mHasMobileDataFeature =
mConnectivityManager.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
@@ -233,7 +237,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
}
private MobileSignalController getDataController() {
- int dataSubId = SubscriptionManager.getDefaultDataSubId();
+ int dataSubId = mSubDefaults.getDefaultDataSubId();
if (!SubscriptionManager.isValidSubscriptionId(dataSubId)) {
if (DEBUG) Log.e(TAG, "No data sim selected");
return mDefaultSignalController;
@@ -251,17 +255,19 @@ public class NetworkControllerImpl extends BroadcastReceiver
}
public boolean isEmergencyOnly() {
- int voiceSubId = SubscriptionManager.getDefaultVoiceSubId();
+ int voiceSubId = mSubDefaults.getDefaultVoiceSubId();
if (!SubscriptionManager.isValidSubscriptionId(voiceSubId)) {
for (MobileSignalController mobileSignalController :
mMobileSignalControllers.values()) {
- if (!mobileSignalController.isEmergencyOnly()) {
+ if (!mobileSignalController.getState().isEmergency) {
+ if (DEBUG) Log.d(TAG, "Found emergency " + mobileSignalController.mTag);
return false;
}
}
}
if (mMobileSignalControllers.containsKey(voiceSubId)) {
- return mMobileSignalControllers.get(voiceSubId).isEmergencyOnly();
+ if (DEBUG) Log.d(TAG, "Getting emergency from " + voiceSubId);
+ return mMobileSignalControllers.get(voiceSubId).getState().isEmergency;
}
if (DEBUG) Log.e(TAG, "Cannot find controller for voice sub: " + voiceSubId);
// Something is wrong, better assume we can't make calls...
@@ -375,6 +381,11 @@ public class NetworkControllerImpl extends BroadcastReceiver
if (!mListening) {
return;
}
+ doUpdateMobileControllers();
+ }
+
+ @VisibleForTesting
+ void doUpdateMobileControllers() {
List<SubscriptionInfo> subscriptions = mSubscriptionManager.getActiveSubscriptionInfoList();
if (subscriptions == null) {
subscriptions = Collections.emptyList();
@@ -389,6 +400,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
}
setCurrentSubscriptions(subscriptions);
updateNoSims();
+ recalculateEmergency();
}
@VisibleForTesting
@@ -425,7 +437,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
} else {
MobileSignalController controller = new MobileSignalController(mContext, mConfig,
mHasMobileDataFeature, mPhone, mCallbackHandler,
- this, subscriptions.get(i), mReceiverHandler.getLooper());
+ this, subscriptions.get(i), mSubDefaults, mReceiverHandler.getLooper());
mMobileSignalControllers.put(subId, controller);
if (subscriptions.get(i).getSimSlotIndex() == 0) {
mDefaultSignalController = controller;
@@ -708,7 +720,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
null, 0, 0, "");
mMobileSignalControllers.put(id, new MobileSignalController(mContext,
mConfig, mHasMobileDataFeature, mPhone, mCallbackHandler, this, info,
- mReceiverHandler.getLooper()));
+ mSubDefaults, mReceiverHandler.getLooper()));
return info;
}
@@ -735,6 +747,16 @@ public class NetworkControllerImpl extends BroadcastReceiver
void setEmergencyCallsOnly(boolean emergencyOnly);
}
+ public static class SubscriptionDefaults {
+ public int getDefaultVoiceSubId() {
+ return SubscriptionManager.getDefaultVoiceSubId();
+ }
+
+ public int getDefaultDataSubId() {
+ return SubscriptionManager.getDefaultDataSubId();
+ }
+ }
+
@VisibleForTesting
static class Config {
boolean showAtLeast3G = false;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
index 441bb16..30c08cd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
@@ -36,6 +36,7 @@ import com.android.internal.telephony.cdma.EriInfo;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.statusbar.policy.NetworkController.IconState;
import com.android.systemui.statusbar.policy.NetworkControllerImpl.Config;
+import com.android.systemui.statusbar.policy.NetworkControllerImpl.SubscriptionDefaults;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
@@ -66,6 +67,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
protected TelephonyManager mMockTm;
protected Config mConfig;
protected CallbackHandler mCallbackHandler;
+ protected SubscriptionDefaults mMockSubDefaults;
protected int mSubId;
@@ -79,6 +81,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
mMockTm = mock(TelephonyManager.class);
mMockSm = mock(SubscriptionManager.class);
mMockCm = mock(ConnectivityManager.class);
+ mMockSubDefaults = mock(SubscriptionDefaults.class);
mNetCapabilities = new NetworkCapabilities();
when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(true);
when(mMockCm.getDefaultNetworkCapabilitiesForUser(0)).thenReturn(
@@ -92,25 +95,39 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
mCallbackHandler = mock(CallbackHandler.class);
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm, mMockSm,
mConfig, Looper.getMainLooper(), mCallbackHandler,
- mock(AccessPointControllerImpl.class), mock(MobileDataControllerImpl.class));
+ mock(AccessPointControllerImpl.class), mock(MobileDataControllerImpl.class),
+ mMockSubDefaults);
setupNetworkController();
+
+ // Trigger blank callbacks to always get the current state (some tests don't trigger
+ // changes from default state).
+ mNetworkController.addSignalCallback(null);
+ mNetworkController.addEmergencyListener(null);
}
protected void setupNetworkController() {
// For now just pretend to be the data sim, so we can test that too.
mSubId = SubscriptionManager.DEFAULT_SUBSCRIPTION_ID;
- SubscriptionInfo subscription = mock(SubscriptionInfo.class);
- List<SubscriptionInfo> subs = new ArrayList<SubscriptionInfo>();
- when(subscription.getSubscriptionId()).thenReturn(mSubId);
- subs.add(subscription);
- mNetworkController.setCurrentSubscriptions(subs);
+ setDefaultSubId(mSubId);
+ setSubscriptions(mSubId);
mMobileSignalController = mNetworkController.mMobileSignalControllers.get(mSubId);
- mMobileSignalController.getState().dataSim = true;
mPhoneStateListener = mMobileSignalController.mPhoneStateListener;
+ }
- // Trigger blank callbacks to always get the current state (some tests don't trigger
- // changes from default state).
- mNetworkController.addSignalCallback(null);
+ protected void setDefaultSubId(int subId) {
+ when(mMockSubDefaults.getDefaultDataSubId()).thenReturn(subId);
+ when(mMockSubDefaults.getDefaultVoiceSubId()).thenReturn(subId);
+ }
+
+ protected void setSubscriptions(int... subIds) {
+ List<SubscriptionInfo> subs = new ArrayList<SubscriptionInfo>();
+ for (int subId : subIds) {
+ SubscriptionInfo subscription = mock(SubscriptionInfo.class);
+ when(subscription.getSubscriptionId()).thenReturn(subId);
+ subs.add(subscription);
+ }
+ when(mMockSm.getActiveSubscriptionInfoList()).thenReturn(subs);
+ mNetworkController.doUpdateMobileControllers();
}
protected NetworkControllerImpl setUpNoMobileData() {
@@ -119,7 +136,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
= new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm, mMockSm,
mConfig, Looper.getMainLooper(), mCallbackHandler,
mock(AccessPointControllerImpl.class),
- mock(MobileDataControllerImpl.class));
+ mock(MobileDataControllerImpl.class), mMockSubDefaults);
setupNetworkController();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
index 15752e1..e60e0a6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
@@ -77,7 +77,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm, mMockSm,
mConfig, Looper.getMainLooper(), mCallbackHandler,
Mockito.mock(AccessPointControllerImpl.class),
- Mockito.mock(MobileDataControllerImpl.class));
+ Mockito.mock(MobileDataControllerImpl.class), mMockSubDefaults);
setupNetworkController();
setupDefaultSignal();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
index 2df1980..168aebe 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
@@ -21,7 +21,6 @@ import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkCapabilities;
import android.os.Looper;
-import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
import android.telephony.TelephonyManager;
@@ -30,6 +29,7 @@ import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.systemui.R;
+import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import java.util.ArrayList;
@@ -43,7 +43,8 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
// Create a new NetworkController as this is currently handled in constructor.
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm, mMockSm,
mConfig, Looper.getMainLooper(), mCallbackHandler,
- mock(AccessPointControllerImpl.class), mock(MobileDataControllerImpl.class));
+ mock(AccessPointControllerImpl.class), mock(MobileDataControllerImpl.class),
+ mMockSubDefaults);
setupNetworkController();
verifyLastMobileDataIndicators(false, 0, 0);
@@ -57,13 +58,33 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
verifyHasNoSims(true);
}
+ public void testEmergencyOnly() {
+ setupDefaultSignal();
+ mNetworkController.recalculateEmergency();
+ verifyEmergencyOnly(false);
+
+ mMobileSignalController.getState().isEmergency = true;
+ mNetworkController.recalculateEmergency();
+ verifyEmergencyOnly(true);
+ }
+
+ public void testEmergencyOnlyNoSubscriptions() {
+ setupDefaultSignal();
+ mNetworkController.recalculateEmergency();
+ verifyEmergencyOnly(false);
+
+ setSubscriptions();
+ verifyEmergencyOnly(true);
+ }
+
public void testNoSimlessIconWithoutMobile() {
// Turn off mobile network support.
Mockito.when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
// Create a new NetworkController as this is currently handled in constructor.
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm, mMockSm,
mConfig, Looper.getMainLooper(), mCallbackHandler,
- mock(AccessPointControllerImpl.class), mock(MobileDataControllerImpl.class));
+ mock(AccessPointControllerImpl.class), mock(MobileDataControllerImpl.class),
+ mMockSubDefaults);
setupNetworkController();
// No Subscriptions.
@@ -418,4 +439,11 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[1][strength] /* strengthIcon */,
DEFAULT_ICON /* typeIcon */);
}
+
+ private void verifyEmergencyOnly(boolean isEmergencyOnly) {
+ ArgumentCaptor<Boolean> emergencyOnly = ArgumentCaptor.forClass(Boolean.class);
+ Mockito.verify(mCallbackHandler, Mockito.atLeastOnce()).setEmergencyCallsOnly(
+ emergencyOnly.capture());
+ assertEquals(isEmergencyOnly, (boolean) emergencyOnly.getValue());
+ }
}