Merge "Convert signal icon to be custom drawable" into oc-dev

This commit is contained in:
TreeHugger Robot
2017-04-14 20:44:14 +00:00
committed by Android (Google) Code Review
35 changed files with 504 additions and 1034 deletions

View File

@@ -1,32 +0,0 @@
<!--
Copyright (C) 2016 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:autoMirrored="true"
android:width="32.0dp"
android:height="32.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M10.0,14.6l-8.0,8.0l8.0,0.0l0,-8z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M14.1,14.1l7.9,0.0 0.0,-11.5 -20.0,20.0 12.1,0.0z"
android:fillAlpha="0.3"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M21.9,17.0l-1.1,-1.1 -1.9,1.9 -1.9,-1.9 -1.1,1.1 1.9,1.9 -1.9,1.9 1.1,1.1 1.9,-1.9 1.9,1.9 1.1,-1.1 -1.9,-1.9z"
android:fillColor="#FFFFFF"/>
</vector>

View File

@@ -1,32 +0,0 @@
<!--
Copyright (C) 2016 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:autoMirrored="true"
android:width="32.0dp"
android:height="32.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M14.0,10.6l-12.0,12.0l12.0,0.0L14.0,10.6z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M14.1,14.1l7.9,0.0 0.0,-11.5 -20.0,20.0 12.1,0.0z"
android:fillAlpha="0.3"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M21.9,17.0l-1.1,-1.1 -1.9,1.9 -1.9,-1.9 -1.1,1.1 1.9,1.9 -1.9,1.9 1.1,1.1 1.9,-1.9 1.9,1.9 1.1,-1.1 -1.9,-1.9z"
android:fillColor="#FFFFFF"/>
</vector>

View File

@@ -1,32 +0,0 @@
<!--
Copyright (C) 2016 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:autoMirrored="true"
android:width="32.0dp"
android:height="32.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M14.1,14.1l7.9,0.0 0.0,-11.5 -20.0,20.0 12.1,0.0z"
android:fillAlpha="0.3"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M21.9,17.0l-1.1,-1.1 -1.9,1.9 -1.9,-1.9 -1.1,1.1 1.9,1.9 -1.9,1.9 1.1,1.1 1.9,-1.9 1.9,1.9 1.1,-1.1 -1.9,-1.9z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M14.1,14.1l2.9,0.0 0.0,-6.5 -15.0,15.0 12.1,0.0z"
android:fillColor="#FFFFFF"/>
</vector>

View File

@@ -1,28 +0,0 @@
<!--
Copyright (C) 2016 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:autoMirrored="true"
android:width="32.0dp"
android:height="32.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M14.1,14.1l7.9,0.0 0.0,-11.5 -20.0,20.0 12.1,0.0z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M21.9,17.0l-1.1,-1.1 -1.9,1.9 -1.9,-1.9 -1.1,1.1 1.9,1.9 -1.9,1.9 1.1,1.1 1.9,-1.9 1.9,1.9 1.1,-1.1 -1.9,-1.9z"
android:fillColor="#FFFFFF"/>
</vector>

View File

@@ -1,36 +0,0 @@
<!--
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:width="32dp"
android:height="32dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:name="dot1"
android:fillColor="#FFFFFFFF"
android:pathData="M9.0,19.0l3.0,0.0l0.0,3.0l-3.0,0.0z"/>
<path
android:name="dot2"
android:fillColor="#4DFFFFFF"
android:pathData="M14.0,19.0l3.0,0.0l0.0,3.0l-3.0,0.0z"/>
<path
android:name="dot3"
android:fillColor="#4DFFFFFF"
android:pathData="M19.0,19.0l3.0,0.0l0.0,3.0l-3.0,0.0z"/>
<path
android:fillColor="#4DFFFFFF"
android:pathData="M2.0,22.0l6.0,0.0 0.0,-4.0 14.0,0.0 0.0,-16.0z"/>
</vector>

View File

@@ -1,27 +0,0 @@
<!--
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_qs_signal_carrier_network_change" >
<target
android:name="dot1"
android:animation="@anim/ic_qs_signal_blink_1"/>
<target
android:name="dot2"
android:animation="@anim/ic_qs_signal_blink_2"/>
<target
android:name="dot3"
android:animation="@anim/ic_qs_signal_blink_3"/>
</animated-vector>

View File

@@ -1,25 +0,0 @@
<!--
Copyright (C) 2014 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:autoMirrored="true"
android:width="32dp"
android:height="32dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#4DFFFFFF"
android:pathData="M2.000000,22.000000l20.000000,0.000000 0.000000,-20.000000z"/>
</vector>

View File

@@ -1,28 +0,0 @@
<!--
Copyright (C) 2014 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:autoMirrored="true"
android:width="32dp"
android:height="32dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#4DFFFFFF"
android:pathData="M2.0,22.0l20.0,0.0 0.0,-20.0z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M10.1,13.9l-8.1,8.1 8.1,0.0z"/>
</vector>

View File

@@ -1,28 +0,0 @@
<!--
Copyright (C) 2014 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:autoMirrored="true"
android:width="32dp"
android:height="32dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#4DFFFFFF"
android:pathData="M2.000000,22.000000l20.000000,0.000000 0.000000,-20.000000z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M14.000000,10.000000l-12.000000,12.000000 12.000000,0.000000z"/>
</vector>

View File

@@ -1,28 +0,0 @@
<!--
Copyright (C) 2014 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:autoMirrored="true"
android:width="32dp"
android:height="32dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#4DFFFFFF"
android:pathData="M2.000000,22.000000l20.000000,0.000000 0.000000,-20.000000z"/>
<path
android:fillColor="#FFFFFFFF"
android:pathData="M16.700001,7.300000l-14.700001,14.700000 14.700001,0.000000z"/>
</vector>

View File

@@ -1,25 +0,0 @@
<!--
Copyright (C) 2014 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:autoMirrored="true"
android:width="32dp"
android:height="32dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M2.000000,22.000000l20.000000,0.000000 0.000000,-20.000000z"/>
</vector>

View File

@@ -1,28 +0,0 @@
<!--
Copyright (C) 2016 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:autoMirrored="true"
android:width="17.0dp"
android:height="17.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M14.1,14.1l7.9,0.0 0.0,-11.5 -20.0,20.0 12.1,0.0z"
android:fillColor="?attr/backgroundColor"/>
<path
android:pathData="M21.9,17.0l-1.1,-1.1 -1.9,1.9 -1.9,-1.9 -1.1,1.1 1.9,1.9 -1.9,1.9 1.1,1.1 1.9,-1.9 1.9,1.9 1.1,-1.1 -1.9,-1.9z"
android:fillColor="?attr/fillColor"/>
</vector>

View File

@@ -1,25 +0,0 @@
<!--
Copyright (C) 2014 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:autoMirrored="true"
android:width="17dp"
android:height="17dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="?attr/backgroundColor"
android:pathData="M2.000000,22.000000l20.000000,0.000000 0.000000,-20.000000z"/>
</vector>

View File

@@ -1,31 +0,0 @@
<!--
Copyright (C) 2016 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:autoMirrored="true"
android:width="17.0dp"
android:height="17.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M10.0,14.6l-8.0,8.0l8.0,0.0l0,-8z"
android:fillColor="?attr/fillColor"/>
<path
android:pathData="M14.1,14.1l7.9,0.0 0.0,-11.5 -20.0,20.0 12.1,0.0z"
android:fillColor="?attr/backgroundColor"/>
<path
android:pathData="M21.9,17.0l-1.1,-1.1 -1.9,1.9 -1.9,-1.9 -1.1,1.1 1.9,1.9 -1.9,1.9 1.1,1.1 1.9,-1.9 1.9,1.9 1.1,-1.1 -1.9,-1.9z"
android:fillColor="?attr/fillColor"/>
</vector>

View File

@@ -1,28 +0,0 @@
<!--
Copyright (C) 2014 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:autoMirrored="true"
android:width="17dp"
android:height="17dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="?attr/backgroundColor"
android:pathData="M2.0,22.0l20.0,0.0 0.0,-20.0z"/>
<path
android:fillColor="?attr/fillColor"
android:pathData="M10.1,13.9l-8.1,8.1 8.1,0.0z"/>
</vector>

View File

@@ -1,31 +0,0 @@
<!--
Copyright (C) 2016 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:autoMirrored="true"
android:width="17.0dp"
android:height="17.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M14.0,10.6l-12.0,12.0l12.0,0.0L14.0,10.6z"
android:fillColor="?attr/fillColor"/>
<path
android:pathData="M14.1,14.1l7.9,0.0 0.0,-11.5 -20.0,20.0 12.1,0.0z"
android:fillColor="?attr/backgroundColor"/>
<path
android:pathData="M21.9,17.0l-1.1,-1.1 -1.9,1.9 -1.9,-1.9 -1.1,1.1 1.9,1.9 -1.9,1.9 1.1,1.1 1.9,-1.9 1.9,1.9 1.1,-1.1 -1.9,-1.9z"
android:fillColor="?attr/fillColor"/>
</vector>

View File

@@ -1,28 +0,0 @@
<!--
Copyright (C) 2014 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:autoMirrored="true"
android:width="17dp"
android:height="17dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="?attr/backgroundColor"
android:pathData="M2.000000,22.000000l20.000000,0.000000 0.000000,-20.000000z"/>
<path
android:fillColor="?attr/fillColor"
android:pathData="M14.000000,10.000000l-12.000000,12.000000 12.000000,0.000000z"/>
</vector>

View File

@@ -1,31 +0,0 @@
<!--
Copyright (C) 2016 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:autoMirrored="true"
android:width="17.0dp"
android:height="17.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M14.1,14.1l7.9,0.0 0.0,-11.5 -20.0,20.0 12.1,0.0z"
android:fillColor="?attr/backgroundColor"/>
<path
android:pathData="M21.9,17.0l-1.1,-1.1 -1.9,1.9 -1.9,-1.9 -1.1,1.1 1.9,1.9 -1.9,1.9 1.1,1.1 1.9,-1.9 1.9,1.9 1.1,-1.1 -1.9,-1.9z"
android:fillColor="?attr/fillColor"/>
<path
android:pathData="M14.1,14.1l2.9,0.0 0.0,-6.5 -15.0,15.0 12.1,0.0z"
android:fillColor="?attr/fillColor"/>
</vector>

View File

@@ -1,28 +0,0 @@
<!--
Copyright (C) 2014 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:autoMirrored="true"
android:width="17dp"
android:height="17dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="?attr/backgroundColor"
android:pathData="M2.000000,22.000000l20.000000,0.000000 0.000000,-20.000000z"/>
<path
android:fillColor="?attr/fillColor"
android:pathData="M16.700001,7.300000l-14.700001,14.700000 14.700001,0.000000z"/>
</vector>

View File

@@ -1,28 +0,0 @@
<!--
Copyright (C) 2016 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:autoMirrored="true"
android:width="17.0dp"
android:height="17.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M14.1,14.1l7.9,0.0 0.0,-11.5 -20.0,20.0 12.1,0.0z"
android:fillColor="?attr/fillColor"/>
<path
android:pathData="M21.9,17.0l-1.1,-1.1 -1.9,1.9 -1.9,-1.9 -1.1,1.1 1.9,1.9 -1.9,1.9 1.1,1.1 1.9,-1.9 1.9,1.9 1.1,-1.1 -1.9,-1.9z"
android:fillColor="?attr/fillColor"/>
</vector>

View File

@@ -1,25 +0,0 @@
<!--
Copyright (C) 2014 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:autoMirrored="true"
android:width="17dp"
android:height="17dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="?attr/singleToneColor"
android:pathData="M2.000000,22.000000l20.000000,0.000000 0.000000,-20.000000z"/>
</vector>

View File

@@ -1,36 +0,0 @@
<!--
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:width="17dp"
android:height="17dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:name="dot1"
android:fillColor="?attr/fillColor"
android:pathData="M9.0,19.0l3.0,0.0l0.0,3.0l-3.0,0.0z"/>
<path
android:name="dot2"
android:fillColor="?attr/backgroundColor"
android:pathData="M14.0,19.0l3.0,0.0l0.0,3.0l-3.0,0.0z"/>
<path
android:name="dot3"
android:fillColor="?attr/backgroundColor"
android:pathData="M19.0,19.0l3.0,0.0l0.0,3.0l-3.0,0.0z"/>
<path
android:fillColor="?attr/backgroundColor"
android:pathData="M2.0,22.0l6.0,0.0 0.0,-4.0 14.0,0.0 0.0,-16.0z"/>
</vector>

View File

@@ -1,27 +0,0 @@
<!--
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/stat_sys_signal_carrier_network_change" >
<target
android:name="dot1"
android:animation="@anim/ic_signal_blink_1"/>
<target
android:name="dot2"
android:animation="@anim/ic_signal_blink_2"/>
<target
android:name="dot3"
android:animation="@anim/ic_signal_blink_3"/>
</animated-vector>

View File

@@ -760,4 +760,6 @@
<dimen name="default_gear_space">18dp</dimen>
<dimen name="cell_overlay_padding">18dp</dimen>
<dimen name="signal_icon_size">17dp</dimen>
</resources>

View File

@@ -163,7 +163,6 @@ public class CellularTile extends QSTileImpl<SignalState> {
boolean enabled;
boolean wifiEnabled;
boolean airplaneModeEnabled;
int mobileSignalIconId;
String signalContentDescription;
int dataTypeIconId;
String dataContentDescription;
@@ -193,7 +192,6 @@ public class CellularTile extends QSTileImpl<SignalState> {
return;
}
mInfo.enabled = qsIcon.visible;
mInfo.mobileSignalIconId = qsIcon.icon;
mInfo.signalContentDescription = qsIcon.contentDescription;
mInfo.dataTypeIconId = qsType;
mInfo.dataContentDescription = typeContentDescription;
@@ -210,7 +208,6 @@ public class CellularTile extends QSTileImpl<SignalState> {
mInfo.noSim = show;
if (mInfo.noSim) {
// Make sure signal gets cleared out when no sims.
mInfo.mobileSignalIconId = 0;
mInfo.dataTypeIconId = 0;
// Show a No SIMs description to avoid emergency calls message.
mInfo.enabled = true;

View File

@@ -42,6 +42,7 @@ import android.widget.LinearLayout;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.statusbar.phone.SignalDrawable;
import com.android.systemui.statusbar.phone.StatusBarIconController;
import com.android.systemui.statusbar.policy.DarkIconDispatcher;
import com.android.systemui.statusbar.policy.DarkIconDispatcher.DarkReceiver;
@@ -192,7 +193,7 @@ public class SignalClusterView extends LinearLayout implements NetworkController
mNoSimsCombo = findViewById(R.id.no_sims_combo);
mWifiAirplaneSpacer = findViewById(R.id.wifi_airplane_spacer);
mWifiSignalSpacer = findViewById(R.id.wifi_signal_spacer);
mMobileSignalGroup = findViewById(R.id.mobile_signal_group);
mMobileSignalGroup = findViewById(R.id.mobile_signal_group);
maybeScaleVpnAndNoSimsIcons();
}
@@ -327,15 +328,6 @@ public class SignalClusterView extends LinearLayout implements NetworkController
if (hasCorrectSubs(subs)) {
return;
}
// Clear out all old subIds.
for (PhoneState state : mPhoneStates) {
if (state.mMobile != null) {
state.maybeStopAnimatableDrawable(state.mMobile);
}
if (state.mMobileDark != null) {
state.maybeStopAnimatableDrawable(state.mMobileDark);
}
}
mPhoneStates.clear();
if (mMobileSignalGroup != null) {
mMobileSignalGroup.removeAllViews();
@@ -428,16 +420,6 @@ public class SignalClusterView extends LinearLayout implements NetworkController
}
for (PhoneState state : mPhoneStates) {
if (state.mMobile != null) {
state.maybeStopAnimatableDrawable(state.mMobile);
state.mMobile.setImageDrawable(null);
state.mLastMobileStrengthId = -1;
}
if (state.mMobileDark != null) {
state.maybeStopAnimatableDrawable(state.mMobileDark);
state.mMobileDark.setImageDrawable(null);
state.mLastMobileStrengthId = -1;
}
if (state.mMobileType != null) {
state.mMobileType.setImageDrawable(null);
state.mLastMobileTypeId = -1;
@@ -654,7 +636,6 @@ public class SignalClusterView extends LinearLayout implements NetworkController
private int mMobileStrengthId = 0, mMobileTypeId = 0;
private int mLastMobileStrengthId = -1;
private int mLastMobileTypeId = -1;
private int mLastMobileActivityId = -1;
private boolean mIsMobileTypeIconWide;
private String mMobileDescription, mMobileTypeDescription;
@@ -681,13 +662,18 @@ public class SignalClusterView extends LinearLayout implements NetworkController
mMobileRoaming = root.findViewById(R.id.mobile_roaming);
mMobileActivityIn = root.findViewById(R.id.mobile_in);
mMobileActivityOut = root.findViewById(R.id.mobile_out);
// TODO: Remove the 2 instances because now the drawable can handle darkness.
mMobile.setImageDrawable(new SignalDrawable(mMobile.getContext()));
SignalDrawable drawable = new SignalDrawable(mMobileDark.getContext());
drawable.setDarkIntensity(1);
mMobileDark.setImageDrawable(drawable);
}
public boolean apply(boolean isSecondaryIcon) {
if (mMobileVisible && !mIsAirplaneMode) {
if (mLastMobileStrengthId != mMobileStrengthId) {
updateAnimatableIcon(mMobile, mMobileStrengthId);
updateAnimatableIcon(mMobileDark, mMobileStrengthId);
mMobile.getDrawable().setLevel(mMobileStrengthId);
mMobileDark.getDrawable().setLevel(mMobileStrengthId);
mLastMobileStrengthId = mMobileStrengthId;
}
@@ -724,49 +710,6 @@ public class SignalClusterView extends LinearLayout implements NetworkController
return mMobileVisible;
}
private void updateAnimatableIcon(ImageView view, int resId) {
maybeStopAnimatableDrawable(view);
setIconForView(view, resId);
maybeStartAnimatableDrawable(view);
}
private void maybeStopAnimatableDrawable(ImageView view) {
Drawable drawable = view.getDrawable();
// Check if the icon has been scaled. If it has retrieve the actual drawable out of the
// wrapper.
if (drawable instanceof ScalingDrawableWrapper) {
drawable = ((ScalingDrawableWrapper) drawable).getDrawable();
}
if (drawable instanceof Animatable) {
Animatable ad = (Animatable) drawable;
if (ad.isRunning()) {
ad.stop();
}
}
}
private void maybeStartAnimatableDrawable(ImageView view) {
Drawable drawable = view.getDrawable();
// Check if the icon has been scaled. If it has retrieve the actual drawable out of the
// wrapper.
if (drawable instanceof ScalingDrawableWrapper) {
drawable = ((ScalingDrawableWrapper) drawable).getDrawable();
}
if (drawable instanceof Animatable) {
Animatable ad = (Animatable) drawable;
if (ad instanceof AnimatedVectorDrawable) {
((AnimatedVectorDrawable) ad).forceAnimationOnUI();
}
if (!ad.isRunning()) {
ad.start();
}
}
}
public void populateAccessibilityEvent(AccessibilityEvent event) {
if (mMobileVisible && mMobileGroup != null
&& mMobileGroup.getContentDescription() != null) {

View File

@@ -11,6 +11,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.telephony.SignalStrength;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
@@ -18,6 +19,7 @@ import android.widget.ImageView;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.statusbar.ScalingDrawableWrapper;
import com.android.systemui.statusbar.phone.SignalDrawable;
import com.android.systemui.statusbar.policy.BluetoothController;
import static com.android.systemui.statusbar.phone.StatusBar.DEBUG;
@@ -47,12 +49,12 @@ public class ConnectedDeviceSignalController extends BroadcastReceiver implement
* Note that the icon is the same for 0 and 1.
*/
private static final int[] SIGNAL_STRENGTH_ICONS = {
R.drawable.stat_sys_signal_0_fully,
R.drawable.stat_sys_signal_0_fully,
R.drawable.stat_sys_signal_1_fully,
R.drawable.stat_sys_signal_2_fully,
R.drawable.stat_sys_signal_3_fully,
R.drawable.stat_sys_signal_4_fully,
0,
0,
1,
2,
3,
4,
};
private static final int INVALID_SIGNAL = -1;
@@ -65,6 +67,7 @@ public class ConnectedDeviceSignalController extends BroadcastReceiver implement
private final ImageView mNetworkSignalView;
private final float mIconScaleFactor;
private final SignalDrawable mSignalDrawable;
private BluetoothHeadsetClient mBluetoothHeadsetClient;
@@ -79,6 +82,9 @@ public class ConnectedDeviceSignalController extends BroadcastReceiver implement
TypedValue typedValue = new TypedValue();
context.getResources().getValue(R.dimen.status_bar_icon_scale_factor, typedValue, true);
mIconScaleFactor = typedValue.getFloat();
mSignalDrawable = new SignalDrawable(mNetworkSignalView.getContext());
mNetworkSignalView.setImageDrawable(
new ScalingDrawableWrapper(mSignalDrawable, mIconScaleFactor));
if (mAdapter == null) {
return;
@@ -187,14 +193,12 @@ public class ConnectedDeviceSignalController extends BroadcastReceiver implement
}
}
private void setNetworkSignalIcon(int iconId) {
private void setNetworkSignalIcon(int level) {
// Setting the icon on a child view of mSignalView, so toggle this container visible.
mSignalsView.setVisibility(View.VISIBLE);
// Using mNetworkSignalView's context to get the Drawable in order to preserve the theme.
Drawable icon = mNetworkSignalView.getContext().getDrawable(iconId);
mNetworkSignalView.setImageDrawable(new ScalingDrawableWrapper(icon, mIconScaleFactor));
mSignalDrawable.setLevel(SignalDrawable.getState(level,
SignalStrength.NUM_SIGNAL_STRENGTH_BINS, false));
mNetworkSignalView.setVisibility(View.VISIBLE);
}

View File

@@ -0,0 +1,342 @@
/*
* Copyright (C) 2017 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.systemui.statusbar.phone;
import android.animation.ArgbEvaluator;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.graphics.Path.FillType;
import android.graphics.Path.Op;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.Log;
import com.android.settingslib.R;
import com.android.settingslib.Utils;
public class SignalDrawable extends Drawable {
private static final String TAG = "SignalDrawable";
private static final int NUM_DOTS = 3;
private static final float VIEWPORT = 24f;
private static final float PAD = 2f / VIEWPORT;
private static final float CUT_OUT = 7.9f / VIEWPORT;
private static final float DOT_SIZE = 3f / VIEWPORT;
private static final float DOT_PADDING = 1f / VIEWPORT;
private static final float DOT_CUT_WIDTH = (DOT_SIZE * 3) + (DOT_PADDING * 5);
private static final float DOT_CUT_HEIGHT = (DOT_SIZE * 1) + (DOT_PADDING * 1);
private static final float[] FIT = {2.26f, -3.02f, 1.76f};
// All of these are masks to push all of the drawable state into one int for easy callbacks
// and flow through sysui.
private static final int LEVEL_MASK = 0xff;
private static final int NUM_LEVEL_SHIFT = 8;
private static final int NUM_LEVEL_MASK = 0xff << NUM_LEVEL_SHIFT;
private static final int STATE_SHIFT = 16;
private static final int STATE_MASK = 0xff << STATE_SHIFT;
private static final int STATE_NONE = 0;
private static final int STATE_EMPTY = 1;
private static final int STATE_CUT = 2;
private static final int STATE_CARRIER_CHANGE = 3;
private static final long DOT_DELAY = 1000;
private static float[][] X_PATH = new float[][]{
{21.9f / VIEWPORT, 17.0f / VIEWPORT},
{-1.1f / VIEWPORT, -1.1f / VIEWPORT},
{-1.9f / VIEWPORT, 1.9f / VIEWPORT},
{-1.9f / VIEWPORT, -1.9f / VIEWPORT},
{-1.1f / VIEWPORT, 1.1f / VIEWPORT},
{1.9f / VIEWPORT, 1.9f / VIEWPORT},
{-1.9f / VIEWPORT, 1.9f / VIEWPORT},
{1.1f / VIEWPORT, 1.1f / VIEWPORT},
{1.9f / VIEWPORT, -1.9f / VIEWPORT},
{1.9f / VIEWPORT, 1.9f / VIEWPORT},
{1.1f / VIEWPORT, -1.1f / VIEWPORT},
{-1.9f / VIEWPORT, -1.9f / VIEWPORT},
};
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Paint mForegroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final int mDarkModeBackgroundColor;
private final int mDarkModeFillColor;
private final int mLightModeBackgroundColor;
private final int mLightModeFillColor;
private final Path mFullPath = new Path();
private final Path mForegroundPath = new Path();
private final Path mXPath = new Path();
private final int mIntrinsicSize;
private final Handler mHandler;
private float mOldDarkIntensity = -1;
private float mNumLevels = 1;
private int mLevel;
private int mState;
private boolean mVisible;
private boolean mAnimating;
private int mCurrentDot;
public SignalDrawable(Context context) {
mDarkModeBackgroundColor =
Utils.getDefaultColor(context, R.color.dark_mode_icon_color_dual_tone_background);
mDarkModeFillColor =
Utils.getDefaultColor(context, R.color.dark_mode_icon_color_dual_tone_fill);
mLightModeBackgroundColor =
Utils.getDefaultColor(context, R.color.light_mode_icon_color_dual_tone_background);
mLightModeFillColor =
Utils.getDefaultColor(context, R.color.light_mode_icon_color_dual_tone_fill);
mIntrinsicSize = context.getResources().getDimensionPixelSize(R.dimen.signal_icon_size);
mHandler = new Handler();
setDarkIntensity(0);
}
@Override
public int getIntrinsicWidth() {
return mIntrinsicSize;
}
@Override
public int getIntrinsicHeight() {
return mIntrinsicSize;
}
public void setNumLevels(int levels) {
if (levels == mNumLevels) return;
mNumLevels = levels;
invalidateSelf();
}
private void setSignalState(int state) {
if (state == mState) return;
mState = state;
updateAnimation();
invalidateSelf();
}
private void updateAnimation() {
boolean shouldAnimate = (mState == STATE_CARRIER_CHANGE) && mVisible;
if (shouldAnimate == mAnimating) return;
mAnimating = shouldAnimate;
if (shouldAnimate) {
mChangeDot.run();
} else {
mHandler.removeCallbacks(mChangeDot);
}
}
@Override
protected boolean onLevelChange(int state) {
setNumLevels(getNumLevels(state));
setSignalState(getState(state));
int level = getLevel(state);
if (level != mLevel) {
mLevel = level;
invalidateSelf();
}
return true;
}
public void setDarkIntensity(float darkIntensity) {
if (darkIntensity == mOldDarkIntensity) {
return;
}
mPaint.setColor(getBackgroundColor(darkIntensity));
mForegroundPaint.setColor(getFillColor(darkIntensity));
mOldDarkIntensity = darkIntensity;
invalidateSelf();
}
private int getFillColor(float darkIntensity) {
return getColorForDarkIntensity(
darkIntensity, mLightModeFillColor, mDarkModeFillColor);
}
private int getBackgroundColor(float darkIntensity) {
return getColorForDarkIntensity(
darkIntensity, mLightModeBackgroundColor, mDarkModeBackgroundColor);
}
private int getColorForDarkIntensity(float darkIntensity, int lightColor, int darkColor) {
return (int) ArgbEvaluator.getInstance().evaluate(darkIntensity, lightColor, darkColor);
}
@Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
invalidateSelf();
}
@Override
public void draw(@NonNull Canvas canvas) {
mFullPath.reset();
mFullPath.setFillType(FillType.WINDING);
float width = getBounds().width();
float height = getBounds().height();
float padding = (PAD * width);
mFullPath.moveTo(width - padding, height - padding);
mFullPath.lineTo(width - padding, padding);
mFullPath.lineTo(padding, height - padding);
mFullPath.lineTo(width - padding, height - padding);
if (mState == STATE_CARRIER_CHANGE) {
float cutWidth = (DOT_CUT_WIDTH * width);
float cutHeight = (DOT_CUT_HEIGHT * width);
float dotSize = (DOT_SIZE * height);
float dotPadding = (DOT_PADDING * height);
mFullPath.moveTo(width - padding, height - padding);
mFullPath.rLineTo(-cutWidth, 0);
mFullPath.rLineTo(0, -cutHeight);
mFullPath.rLineTo(cutWidth, 0);
mFullPath.rLineTo(0, cutHeight);
float dotSpacing = dotPadding * 2 + dotSize;
float x = width - padding - dotSize;
float y = height - padding - dotSize;
mForegroundPath.reset();
drawDot(mFullPath, mForegroundPath, x, y, dotSize, 2);
drawDot(mFullPath, mForegroundPath, x - dotSpacing, y, dotSize, 1);
drawDot(mFullPath, mForegroundPath, x - dotSpacing * 2, y, dotSize, 0);
} else if (mState == STATE_CUT) {
float cut = (CUT_OUT * width);
mFullPath.moveTo(width - padding, height - padding);
mFullPath.rLineTo(-cut, 0);
mFullPath.rLineTo(0, -cut);
mFullPath.rLineTo(cut, 0);
mFullPath.rLineTo(0, cut);
}
mPaint.setStyle(mState == STATE_EMPTY ? Style.STROKE : Style.FILL);
mForegroundPaint.setStyle(mState == STATE_EMPTY ? Style.STROKE : Style.FILL);
if (mState != STATE_CARRIER_CHANGE) {
mForegroundPath.reset();
int sigWidth = Math.round(calcFit(mLevel / (mNumLevels - 1)) * (width - 2 * padding));
mForegroundPath.addRect(padding, padding, padding + sigWidth, height - padding,
Direction.CW);
mForegroundPath.op(mFullPath, Op.INTERSECT);
}
canvas.drawPath(mFullPath, mPaint);
canvas.drawPath(mForegroundPath, mForegroundPaint);
if (mState == STATE_CUT) {
mXPath.reset();
mXPath.moveTo(X_PATH[0][0] * width, X_PATH[0][1] * height);
for (int i = 1; i < X_PATH.length; i++) {
mXPath.rLineTo(X_PATH[i][0] * width, X_PATH[i][1] * height);
}
canvas.drawPath(mXPath, mForegroundPaint);
}
}
private void drawDot(Path fullPath, Path foregroundPath, float x, float y, float dotSize,
int i) {
Path p = (i == mCurrentDot) ? foregroundPath : fullPath;
p.addRect(x, y, x + dotSize, y + dotSize, Direction.CW);
}
// This is a fit line based on previous values of provided in assets, but if
// you look at the a plot of this actual fit, it makes a lot of sense, what it does
// is compress the areas that are very visually easy to see changes (the middle sections)
// and spread out the sections that are hard to see (each end of the icon).
// The current fit is cubic, but pretty easy to change the way the code is written (just add
// terms to the end of FIT).
private float calcFit(float v) {
float ret = 0;
float t = v;
for (int i = 0; i < FIT.length; i++) {
ret += FIT[i] * t;
t *= v;
}
return ret;
}
@Override
public int getAlpha() {
return mPaint.getAlpha();
}
@Override
public void setAlpha(@IntRange(from = 0, to = 255) int alpha) {
mPaint.setAlpha(alpha);
mForegroundPaint.setAlpha(alpha);
}
@Override
public void setColorFilter(@Nullable ColorFilter colorFilter) {
mPaint.setColorFilter(colorFilter);
mForegroundPaint.setColorFilter(colorFilter);
}
@Override
public int getOpacity() {
return 255;
}
@Override
public boolean setVisible(boolean visible, boolean restart) {
mVisible = visible;
updateAnimation();
return super.setVisible(visible, restart);
}
private final Runnable mChangeDot = new Runnable() {
@Override
public void run() {
if (++mCurrentDot == NUM_DOTS) {
mCurrentDot = 0;
}
invalidateSelf();
mHandler.postDelayed(mChangeDot, DOT_DELAY);
}
};
public static int getLevel(int fullState) {
return fullState & LEVEL_MASK;
}
public static int getState(int fullState) {
return (fullState & STATE_MASK) >> STATE_SHIFT;
}
public static int getNumLevels(int fullState) {
return (fullState & NUM_LEVEL_MASK) >> NUM_LEVEL_SHIFT;
}
public static int getState(int level, int numLevels, boolean cutOut) {
return ((cutOut ? STATE_CUT : 0) << STATE_SHIFT)
| (numLevels << NUM_LEVEL_SHIFT)
| level;
}
public static int getCarrierChangeState(int numLevels) {
return (STATE_CARRIER_CHANGE << STATE_SHIFT) | (numLevels << NUM_LEVEL_SHIFT);
}
public static int getEmptyState(int numLevels) {
return (STATE_EMPTY << STATE_SHIFT) | (numLevels << NUM_LEVEL_SHIFT);
}
}

View File

@@ -36,6 +36,7 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.cdma.EriInfo;
import com.android.systemui.R;
import com.android.systemui.statusbar.phone.SignalDrawable;
import com.android.systemui.statusbar.policy.NetworkController.IconState;
import com.android.systemui.statusbar.policy.NetworkController.SignalCallback;
import com.android.systemui.statusbar.policy.NetworkControllerImpl.Config;
@@ -233,6 +234,29 @@ public class MobileSignalController extends SignalController<
mNetworkToIconLookup.put(TelephonyManager.NETWORK_TYPE_IWLAN, TelephonyIcons.WFC);
}
private int getNumLevels() {
return SignalStrength.NUM_SIGNAL_STRENGTH_BINS;
}
@Override
public int getCurrentIconId() {
if (mCurrentState.iconGroup == TelephonyIcons.CARRIER_NETWORK_CHANGE) {
return SignalDrawable.getCarrierChangeState(getNumLevels());
} else if (mCurrentState.connected) {
return SignalDrawable.getState(mCurrentState.level, getNumLevels(),
mCurrentState.inetCondition == 0);
} else if (mCurrentState.enabled) {
return SignalDrawable.getEmptyState(getNumLevels());
} else {
return 0;
}
}
@Override
public int getQsCurrentIconId() {
return getCurrentIconId();
}
@Override
public void notifyListeners(SignalCallback callback) {
MobileIconGroup icons = getIcons();

View File

@@ -32,6 +32,7 @@ import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
@@ -872,11 +873,11 @@ public class NetworkControllerImpl extends BroadcastReceiver
if (args.containsKey("roam")) {
controller.getState().roaming = "show".equals(args.getString("roam"));
}
int[][] icons = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH;
String level = args.getString("level");
if (level != null) {
controller.getState().level = level.equals("null") ? -1
: Math.min(Integer.parseInt(level), icons[0].length - 1);
: Math.min(Integer.parseInt(level),
SignalStrength.NUM_SIGNAL_STRENGTH_BINS);
controller.getState().connected = controller.getState().level >= 0;
}
String activity = args.getString("activity");

View File

@@ -20,196 +20,20 @@ import com.android.systemui.R;
import com.android.systemui.statusbar.policy.MobileSignalController.MobileIconGroup;
class TelephonyIcons {
//***** Signal strength icons
static final int TELEPHONY_NUM_LEVELS = 5;
//GSM/UMTS
static final int TELEPHONY_NO_NETWORK = R.drawable.stat_sys_signal_null;
static final int[][] TELEPHONY_SIGNAL_STRENGTH = {
{ R.drawable.stat_sys_signal_0,
R.drawable.stat_sys_signal_1,
R.drawable.stat_sys_signal_2,
R.drawable.stat_sys_signal_3,
R.drawable.stat_sys_signal_4 },
{ R.drawable.stat_sys_signal_0_fully,
R.drawable.stat_sys_signal_1_fully,
R.drawable.stat_sys_signal_2_fully,
R.drawable.stat_sys_signal_3_fully,
R.drawable.stat_sys_signal_4_fully }
};
static final int QS_TELEPHONY_NO_NETWORK = R.drawable.ic_qs_signal_no_signal;
static final int[][] QS_TELEPHONY_SIGNAL_STRENGTH = {
{ R.drawable.ic_qs_signal_0,
R.drawable.ic_qs_signal_1,
R.drawable.ic_qs_signal_2,
R.drawable.ic_qs_signal_3,
R.drawable.ic_qs_signal_4 },
{ R.drawable.ic_qs_signal_full_0,
R.drawable.ic_qs_signal_full_1,
R.drawable.ic_qs_signal_full_2,
R.drawable.ic_qs_signal_full_3,
R.drawable.ic_qs_signal_full_4 }
};
static final int[][] TELEPHONY_SIGNAL_STRENGTH_ROAMING = {
{ R.drawable.stat_sys_signal_0,
R.drawable.stat_sys_signal_1,
R.drawable.stat_sys_signal_2,
R.drawable.stat_sys_signal_3,
R.drawable.stat_sys_signal_4 },
{ R.drawable.stat_sys_signal_0_fully,
R.drawable.stat_sys_signal_1_fully,
R.drawable.stat_sys_signal_2_fully,
R.drawable.stat_sys_signal_3_fully,
R.drawable.stat_sys_signal_4_fully }
};
//CarrierNetworkChange
static final int[][] TELEPHONY_CARRIER_NETWORK_CHANGE = {
{ R.drawable.stat_sys_signal_carrier_network_change_animation,
R.drawable.stat_sys_signal_carrier_network_change_animation,
R.drawable.stat_sys_signal_carrier_network_change_animation,
R.drawable.stat_sys_signal_carrier_network_change_animation,
R.drawable.stat_sys_signal_carrier_network_change_animation },
{ R.drawable.stat_sys_signal_carrier_network_change_animation,
R.drawable.stat_sys_signal_carrier_network_change_animation,
R.drawable.stat_sys_signal_carrier_network_change_animation,
R.drawable.stat_sys_signal_carrier_network_change_animation,
R.drawable.stat_sys_signal_carrier_network_change_animation }
};
static final int[][] QS_TELEPHONY_CARRIER_NETWORK_CHANGE = {
{ R.drawable.ic_qs_signal_carrier_network_change_animation,
R.drawable.ic_qs_signal_carrier_network_change_animation,
R.drawable.ic_qs_signal_carrier_network_change_animation,
R.drawable.ic_qs_signal_carrier_network_change_animation,
R.drawable.ic_qs_signal_carrier_network_change_animation },
{ R.drawable.ic_qs_signal_carrier_network_change_animation,
R.drawable.ic_qs_signal_carrier_network_change_animation,
R.drawable.ic_qs_signal_carrier_network_change_animation,
R.drawable.ic_qs_signal_carrier_network_change_animation,
R.drawable.ic_qs_signal_carrier_network_change_animation }
};
//***** Data connection icons
//GSM/UMTS
static final int[][] DATA_G = {
{ R.drawable.stat_sys_data_fully_connected_g,
R.drawable.stat_sys_data_fully_connected_g,
R.drawable.stat_sys_data_fully_connected_g,
R.drawable.stat_sys_data_fully_connected_g },
{ R.drawable.stat_sys_data_fully_connected_g,
R.drawable.stat_sys_data_fully_connected_g,
R.drawable.stat_sys_data_fully_connected_g,
R.drawable.stat_sys_data_fully_connected_g }
};
static final int QS_DATA_G = R.drawable.ic_qs_signal_g;
static final int[][] DATA_3G = {
{ R.drawable.stat_sys_data_fully_connected_3g,
R.drawable.stat_sys_data_fully_connected_3g,
R.drawable.stat_sys_data_fully_connected_3g,
R.drawable.stat_sys_data_fully_connected_3g },
{ R.drawable.stat_sys_data_fully_connected_3g,
R.drawable.stat_sys_data_fully_connected_3g,
R.drawable.stat_sys_data_fully_connected_3g,
R.drawable.stat_sys_data_fully_connected_3g }
};
static final int QS_DATA_3G = R.drawable.ic_qs_signal_3g;
static final int[][] DATA_E = {
{ R.drawable.stat_sys_data_fully_connected_e,
R.drawable.stat_sys_data_fully_connected_e,
R.drawable.stat_sys_data_fully_connected_e,
R.drawable.stat_sys_data_fully_connected_e },
{ R.drawable.stat_sys_data_fully_connected_e,
R.drawable.stat_sys_data_fully_connected_e,
R.drawable.stat_sys_data_fully_connected_e,
R.drawable.stat_sys_data_fully_connected_e }
};
static final int QS_DATA_E = R.drawable.ic_qs_signal_e;
//3.5G
static final int[][] DATA_H = {
{ R.drawable.stat_sys_data_fully_connected_h,
R.drawable.stat_sys_data_fully_connected_h,
R.drawable.stat_sys_data_fully_connected_h,
R.drawable.stat_sys_data_fully_connected_h },
{ R.drawable.stat_sys_data_fully_connected_h,
R.drawable.stat_sys_data_fully_connected_h,
R.drawable.stat_sys_data_fully_connected_h,
R.drawable.stat_sys_data_fully_connected_h }
};
static final int QS_DATA_H = R.drawable.ic_qs_signal_h;
//CDMA
// Use 3G icons for EVDO data and 1x icons for 1XRTT data
static final int[][] DATA_1X = {
{ R.drawable.stat_sys_data_fully_connected_1x,
R.drawable.stat_sys_data_fully_connected_1x,
R.drawable.stat_sys_data_fully_connected_1x,
R.drawable.stat_sys_data_fully_connected_1x },
{ R.drawable.stat_sys_data_fully_connected_1x,
R.drawable.stat_sys_data_fully_connected_1x,
R.drawable.stat_sys_data_fully_connected_1x,
R.drawable.stat_sys_data_fully_connected_1x }
};
static final int QS_DATA_1X = R.drawable.ic_qs_signal_1x;
// LTE and eHRPD
static final int[][] DATA_4G = {
{ R.drawable.stat_sys_data_fully_connected_4g,
R.drawable.stat_sys_data_fully_connected_4g,
R.drawable.stat_sys_data_fully_connected_4g,
R.drawable.stat_sys_data_fully_connected_4g },
{ R.drawable.stat_sys_data_fully_connected_4g,
R.drawable.stat_sys_data_fully_connected_4g,
R.drawable.stat_sys_data_fully_connected_4g,
R.drawable.stat_sys_data_fully_connected_4g }
};
static final int QS_DATA_4G = R.drawable.ic_qs_signal_4g;
static final int[][] DATA_4G_PLUS = {
{ R.drawable.stat_sys_data_fully_connected_4g_plus,
R.drawable.stat_sys_data_fully_connected_4g_plus,
R.drawable.stat_sys_data_fully_connected_4g_plus,
R.drawable.stat_sys_data_fully_connected_4g_plus },
{ R.drawable.stat_sys_data_fully_connected_4g_plus,
R.drawable.stat_sys_data_fully_connected_4g_plus,
R.drawable.stat_sys_data_fully_connected_4g_plus,
R.drawable.stat_sys_data_fully_connected_4g_plus }
};
static final int QS_DATA_4G_PLUS = R.drawable.ic_qs_signal_4g_plus;
// LTE branded "LTE"
static final int[][] DATA_LTE = {
{ R.drawable.stat_sys_data_fully_connected_lte,
R.drawable.stat_sys_data_fully_connected_lte,
R.drawable.stat_sys_data_fully_connected_lte,
R.drawable.stat_sys_data_fully_connected_lte },
{ R.drawable.stat_sys_data_fully_connected_lte,
R.drawable.stat_sys_data_fully_connected_lte,
R.drawable.stat_sys_data_fully_connected_lte,
R.drawable.stat_sys_data_fully_connected_lte }
};
static final int QS_DATA_LTE = R.drawable.ic_qs_signal_lte;
static final int QS_DATA_LTE_PLUS = R.drawable.ic_qs_signal_lte_plus;
static final int FLIGHT_MODE_ICON = R.drawable.stat_sys_airplane_mode;
static final int ROAMING_ICON = R.drawable.stat_sys_roaming;
static final int ICON_LTE = R.drawable.stat_sys_data_fully_connected_lte;
static final int ICON_LTE_PLUS = R.drawable.stat_sys_data_fully_connected_lte_plus;
static final int ICON_G = R.drawable.stat_sys_data_fully_connected_g;
@@ -219,29 +43,19 @@ class TelephonyIcons {
static final int ICON_4G = R.drawable.stat_sys_data_fully_connected_4g;
static final int ICON_4G_PLUS = R.drawable.stat_sys_data_fully_connected_4g_plus;
static final int ICON_1X = R.drawable.stat_sys_data_fully_connected_1x;
static final int ICON_CARRIER_NETWORK_CHANGE =
R.drawable.stat_sys_signal_carrier_network_change_animation;
static final int ICON_DATA_DISABLED = R.drawable.stat_sys_data_disabled;
static final int QS_ICON_LTE = R.drawable.ic_qs_signal_lte;
static final int QS_ICON_3G = R.drawable.ic_qs_signal_3g;
static final int QS_ICON_4G = R.drawable.ic_qs_signal_4g;
static final int QS_ICON_4G_PLUS = R.drawable.ic_qs_signal_4g_plus;
static final int QS_ICON_1X = R.drawable.ic_qs_signal_1x;
static final int QS_ICON_CARRIER_NETWORK_CHANGE =
R.drawable.ic_qs_signal_carrier_network_change_animation;
static final int QS_ICON_DATA_DISABLED = R.drawable.ic_qs_data_disabled;
static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup(
"CARRIER_NETWORK_CHANGE",
TelephonyIcons.TELEPHONY_CARRIER_NETWORK_CHANGE,
TelephonyIcons.QS_TELEPHONY_CARRIER_NETWORK_CHANGE,
null,
null,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
0, 0,
TelephonyIcons.ICON_CARRIER_NETWORK_CHANGE,
TelephonyIcons.QS_ICON_CARRIER_NETWORK_CHANGE,
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_carrier_network_change_mode,
0,
@@ -251,12 +65,12 @@ class TelephonyIcons {
static final MobileIconGroup THREE_G = new MobileIconGroup(
"3G",
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
null,
null,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
0, 0,
TelephonyIcons.TELEPHONY_NO_NETWORK,
TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_3g,
TelephonyIcons.ICON_3G,
@@ -266,36 +80,36 @@ class TelephonyIcons {
static final MobileIconGroup WFC = new MobileIconGroup(
"WFC",
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
null,
null,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
0, 0,
TelephonyIcons.TELEPHONY_NO_NETWORK,
TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
0, 0, false, 0
);
static final MobileIconGroup UNKNOWN = new MobileIconGroup(
"Unknown",
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
null,
null,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
0, 0,
TelephonyIcons.TELEPHONY_NO_NETWORK,
TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
0, 0, false, 0
);
static final MobileIconGroup E = new MobileIconGroup(
"E",
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
null,
null,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
0, 0,
TelephonyIcons.TELEPHONY_NO_NETWORK,
TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_edge,
TelephonyIcons.ICON_E,
@@ -305,12 +119,12 @@ class TelephonyIcons {
static final MobileIconGroup ONE_X = new MobileIconGroup(
"1X",
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
null,
null,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
0, 0,
TelephonyIcons.TELEPHONY_NO_NETWORK,
TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_cdma,
TelephonyIcons.ICON_1X,
@@ -320,12 +134,12 @@ class TelephonyIcons {
static final MobileIconGroup G = new MobileIconGroup(
"G",
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
null,
null,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
0, 0,
TelephonyIcons.TELEPHONY_NO_NETWORK,
TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_gprs,
TelephonyIcons.ICON_G,
@@ -335,12 +149,12 @@ class TelephonyIcons {
static final MobileIconGroup H = new MobileIconGroup(
"H",
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
null,
null,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
0, 0,
TelephonyIcons.TELEPHONY_NO_NETWORK,
TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_3_5g,
TelephonyIcons.ICON_H,
@@ -350,12 +164,12 @@ class TelephonyIcons {
static final MobileIconGroup FOUR_G = new MobileIconGroup(
"4G",
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
null,
null,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
0, 0,
TelephonyIcons.TELEPHONY_NO_NETWORK,
TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_4g,
TelephonyIcons.ICON_4G,
@@ -365,12 +179,12 @@ class TelephonyIcons {
static final MobileIconGroup FOUR_G_PLUS = new MobileIconGroup(
"4G+",
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
null,
null,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
0,0,
TelephonyIcons.TELEPHONY_NO_NETWORK,
TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_4g_plus,
TelephonyIcons.ICON_4G_PLUS,
@@ -380,12 +194,12 @@ class TelephonyIcons {
static final MobileIconGroup LTE = new MobileIconGroup(
"LTE",
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
null,
null,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
0, 0,
TelephonyIcons.TELEPHONY_NO_NETWORK,
TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_lte,
TelephonyIcons.ICON_LTE,
@@ -395,12 +209,12 @@ class TelephonyIcons {
static final MobileIconGroup LTE_PLUS = new MobileIconGroup(
"LTE+",
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
null,
null,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
0, 0,
TelephonyIcons.TELEPHONY_NO_NETWORK,
TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_lte_plus,
TelephonyIcons.ICON_LTE_PLUS,
@@ -410,12 +224,12 @@ class TelephonyIcons {
static final MobileIconGroup DATA_DISABLED = new MobileIconGroup(
"DataDisabled",
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
null,
null,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
0, 0,
TelephonyIcons.TELEPHONY_NO_NETWORK,
TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_cell_data_off,
TelephonyIcons.ICON_DATA_DISABLED,

View File

@@ -31,6 +31,7 @@ import android.telephony.TelephonyManager;
import android.util.Log;
import com.android.internal.telephony.cdma.EriInfo;
import com.android.settingslib.net.DataUsageController;
import com.android.systemui.statusbar.phone.SignalDrawable;
import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener;
import com.android.systemui.statusbar.policy.NetworkController.IconState;
import com.android.systemui.statusbar.policy.NetworkController.SignalCallback;
@@ -66,12 +67,10 @@ import static org.mockito.Mockito.when;
public class NetworkControllerBaseTest extends SysuiTestCase {
private static final String TAG = "NetworkControllerBaseTest";
protected static final int DEFAULT_LEVEL = 2;
protected static final int DEFAULT_SIGNAL_STRENGTH =
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[1][DEFAULT_LEVEL];
protected static final int DEFAULT_QS_SIGNAL_STRENGTH =
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][DEFAULT_LEVEL];
protected static final int DEFAULT_SIGNAL_STRENGTH = DEFAULT_LEVEL;
protected static final int DEFAULT_QS_SIGNAL_STRENGTH = DEFAULT_LEVEL;
protected static final int DEFAULT_ICON = TelephonyIcons.ICON_3G;
protected static final int DEFAULT_QS_ICON = TelephonyIcons.QS_ICON_3G;
protected static final int DEFAULT_QS_ICON = TelephonyIcons.QS_DATA_3G;
protected NetworkControllerImpl mNetworkController;
protected MobileSignalController mMobileSignalController;
@@ -315,8 +314,10 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
typeIconArg.capture(), dataInArg.capture(), dataOutArg.capture(),
anyString(), anyString(), anyBoolean(), anyInt(), anyBoolean());
IconState iconState = iconArg.getValue();
int state = SignalDrawable.getState(icon, SignalStrength.NUM_SIGNAL_STRENGTH_BINS,
false);
assertEquals("Visibility in, quick settings", visible, iconState.visible);
assertEquals("Signal icon in, quick settings", icon, iconState.icon);
assertEquals("Signal icon in, quick settings", state, iconState.icon);
assertEquals("Data icon in, quick settings", typeIcon, (int) typeIconArg.getValue());
assertEquals("Data direction in, in quick settings", dataIn,
(boolean) dataInArg.getValue());
@@ -330,6 +331,11 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
protected void verifyLastMobileDataIndicators(boolean visible, int icon, int typeIcon,
boolean roaming) {
verifyLastMobileDataIndicators(visible, icon, typeIcon, roaming, true);
}
protected void verifyLastMobileDataIndicators(boolean visible, int icon, int typeIcon,
boolean roaming, boolean inet) {
ArgumentCaptor<IconState> iconArg = ArgumentCaptor.forClass(IconState.class);
ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class);
@@ -342,7 +348,9 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
anyInt(), eq(roaming));
IconState iconState = iconArg.getValue();
assertEquals("Signal icon in status bar", icon, iconState.icon);
int state = icon == -1 ? 0
: SignalDrawable.getState(icon, SignalStrength.NUM_SIGNAL_STRENGTH_BINS, !inet);
assertEquals("Signal icon in status bar", state, iconState.icon);
assertEquals("Data icon in status bar", typeIcon, (int) typeIconArg.getValue());
assertEquals("Visibility in status bar", visible, iconState.visible);
}
@@ -367,13 +375,15 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
IconState iconState = iconArg.getValue();
int state = SignalDrawable.getState(icon, SignalStrength.NUM_SIGNAL_STRENGTH_BINS,
false);
assertEquals("Data icon in status bar", typeIcon, (int) typeIconArg.getValue());
assertEquals("Signal icon in status bar", icon, iconState.icon);
assertEquals("Signal icon in status bar", state, iconState.icon);
assertEquals("Visibility in status bar", visible, iconState.visible);
iconState = qsIconArg.getValue();
assertEquals("Visibility in quick settings", qsVisible, iconState.visible);
assertEquals("Signal icon in quick settings", qsIcon, iconState.icon);
assertEquals("Signal icon in quick settings", state, iconState.icon);
assertEquals("Data icon in quick settings", qsTypeIcon, (int) qsTypeIconArg.getValue());
assertEquals("Data direction in in quick settings", dataIn,
(boolean) dataInArg.getValue());

View File

@@ -24,7 +24,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
public void test3gDataIcon() {
setupDefaultSignal();
verifyDataIndicators(TelephonyIcons.DATA_3G[1][0 /* No direction */],
verifyDataIndicators(TelephonyIcons.ICON_3G,
TelephonyIcons.QS_DATA_3G);
}
@@ -34,7 +34,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_GSM);
verifyDataIndicators(TelephonyIcons.DATA_G[1][0 /* No direction */],
verifyDataIndicators(TelephonyIcons.ICON_G,
TelephonyIcons.QS_DATA_G);
}
@@ -44,7 +44,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_CDMA);
verifyDataIndicators(TelephonyIcons.DATA_1X[1][0 /* No direction */],
verifyDataIndicators(TelephonyIcons.ICON_1X,
TelephonyIcons.QS_DATA_1X);
}
@@ -54,7 +54,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_EDGE);
verifyDataIndicators(TelephonyIcons.DATA_E[1][0 /* No direction */],
verifyDataIndicators(TelephonyIcons.ICON_E,
TelephonyIcons.QS_DATA_E);
}
@@ -64,7 +64,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_LTE);
verifyDataIndicators(TelephonyIcons.DATA_LTE[1][0 /* No direction */],
verifyDataIndicators(TelephonyIcons.ICON_LTE,
TelephonyIcons.QS_DATA_LTE);
}
@@ -74,7 +74,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_HSPA);
verifyDataIndicators(TelephonyIcons.DATA_H[1][0 /* No direction */],
verifyDataIndicators(TelephonyIcons.ICON_H,
TelephonyIcons.QS_DATA_H);
}
@@ -103,7 +103,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_LTE);
verifyDataIndicators(TelephonyIcons.DATA_4G[1][0 /* No direction */],
verifyDataIndicators(TelephonyIcons.ICON_4G,
TelephonyIcons.QS_DATA_4G);
}
@@ -147,7 +147,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
// the after work.
mNetworkController.handleConfigurationChanged();
verifyDataIndicators(TelephonyIcons.DATA_4G[1][0 /* No direction */],
verifyDataIndicators(TelephonyIcons.ICON_4G,
TelephonyIcons.QS_DATA_4G);
}
@@ -157,13 +157,13 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_LTE);
verifyDataIndicators(TelephonyIcons.DATA_LTE[1][0 /* No direction */],
verifyDataIndicators(TelephonyIcons.ICON_LTE,
TelephonyIcons.QS_DATA_LTE);
when(mServiceState.getDataNetworkType())
.thenReturn(TelephonyManager.NETWORK_TYPE_HSPA);
updateServiceState();
verifyDataIndicators(TelephonyIcons.DATA_H[1][0 /* No direction */],
verifyDataIndicators(TelephonyIcons.ICON_H,
TelephonyIcons.QS_DATA_H);
}

View File

@@ -30,6 +30,7 @@ import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.settingslib.net.DataUsageController;
import com.android.systemui.R;
import com.android.systemui.statusbar.phone.SignalDrawable;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -60,7 +61,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
mMockSubDefaults, mock(DeviceProvisionedController.class));
setupNetworkController();
verifyLastMobileDataIndicators(false, 0, 0);
verifyLastMobileDataIndicators(false, -1, 0);
}
@Test
@@ -132,45 +133,45 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
@Test
public void testSignalStrength() {
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
for (int testStrength = 0;
testStrength < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; testStrength++) {
setupDefaultSignal();
setLevel(testStrength);
verifyLastMobileDataIndicators(true,
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[1][testStrength], DEFAULT_ICON);
testStrength, DEFAULT_ICON);
// Verify low inet number indexing.
setConnectivity(NetworkCapabilities.TRANSPORT_CELLULAR, false, true);
verifyLastMobileDataIndicators(true,
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[0][testStrength], DEFAULT_ICON);
testStrength, DEFAULT_ICON, false, false);
}
}
@Test
public void testCdmaSignalStrength() {
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
for (int testStrength = 0;
testStrength < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; testStrength++) {
setupDefaultSignal();
setCdma();
setLevel(testStrength);
verifyLastMobileDataIndicators(true,
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[1][testStrength],
TelephonyIcons.DATA_1X[1][0 /* No direction */]);
testStrength,
TelephonyIcons.ICON_1X);
}
}
@Test
public void testSignalRoaming() {
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
for (int testStrength = 0;
testStrength < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; testStrength++) {
setupDefaultSignal();
setGsmRoaming(true);
setLevel(testStrength);
verifyLastMobileDataIndicators(true,
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[1][testStrength],
testStrength,
DEFAULT_ICON, true);
}
}
@@ -185,8 +186,8 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
setLevel(testStrength);
verifyLastMobileDataIndicators(true,
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[1][testStrength],
TelephonyIcons.DATA_1X[1][0 /* No direction */], true);
testStrength,
TelephonyIcons.ICON_1X, true);
}
}
@@ -198,7 +199,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
setLevel(testStrength);
verifyLastQsMobileDataIndicators(true,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][testStrength],
testStrength,
DEFAULT_QS_ICON, false, false);
}
}
@@ -212,8 +213,8 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
setLevel(testStrength);
verifyLastQsMobileDataIndicators(true,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][testStrength],
TelephonyIcons.QS_ICON_1X, false, false);
testStrength,
TelephonyIcons.QS_DATA_1X, false, false);
}
}
@@ -223,7 +224,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
setConnectivity(mMobileSignalController.mTransportType, false, false);
setConnectivity(NetworkCapabilities.TRANSPORT_WIFI, true, true);
verifyLastMobileDataIndicators(true, TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[1][2], 0);
verifyLastMobileDataIndicators(true, DEFAULT_LEVEL, 0);
}
// Some tests of actual NetworkController code, just internals not display stuff
@@ -418,7 +419,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
updateDataActivity(TelephonyManager.DATA_ACTIVITY_IN);
verifyLastQsMobileDataIndicators(true /* visible */,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][DEFAULT_LEVEL] /* icon */,
DEFAULT_LEVEL /* icon */,
DEFAULT_QS_ICON /* typeIcon */,
true /* dataIn */,
false /* dataOut */);
@@ -432,11 +433,10 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
updateDataActivity(TelephonyManager.DATA_ACTIVITY_OUT);
verifyLastQsMobileDataIndicators(true /* visible */,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][DEFAULT_LEVEL] /* icon */,
DEFAULT_LEVEL /* icon */,
DEFAULT_QS_ICON /* typeIcon */,
false /* dataIn */,
true /* dataOut */);
}
@Test
@@ -446,7 +446,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
updateDataActivity(TelephonyManager.DATA_ACTIVITY_INOUT);
verifyLastQsMobileDataIndicators(true /* visible */,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][DEFAULT_LEVEL] /* icon */,
DEFAULT_LEVEL /* icon */,
DEFAULT_QS_ICON /* typeIcon */,
true /* dataIn */,
true /* dataOut */);
@@ -460,7 +460,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
updateDataActivity(TelephonyManager.DATA_ACTIVITY_NONE);
verifyLastQsMobileDataIndicators(true /* visible */,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][DEFAULT_LEVEL] /* icon */,
DEFAULT_LEVEL /* icon */,
DEFAULT_QS_ICON /* typeIcon */,
false /* dataIn */,
false /* dataOut */);
@@ -476,7 +476,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
// Verify baseline
verifyLastMobileDataIndicators(true /* visible */,
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[1][strength] /* strengthIcon */,
strength /* strengthIcon */,
DEFAULT_ICON /* typeIcon */);
// API call is made
@@ -484,7 +484,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
// Carrier network change is true, show special indicator
verifyLastMobileDataIndicators(true /* visible */,
TelephonyIcons.TELEPHONY_CARRIER_NETWORK_CHANGE[0][0] /* strengthIcon */,
SignalDrawable.getCarrierChangeState(SignalStrength.NUM_SIGNAL_STRENGTH_BINS),
0 /* typeIcon */);
// Revert back
@@ -492,7 +492,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
// Verify back in previous state
verifyLastMobileDataIndicators(true /* visible */,
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[1][strength] /* strengthIcon */,
strength /* strengthIcon */,
DEFAULT_ICON /* typeIcon */);
}

View File

@@ -218,7 +218,7 @@ public class NetworkControllerWifiTest extends NetworkControllerBaseTest {
setConnectivity(NetworkCapabilities.TRANSPORT_WIFI, true, true);
setConnectivity(NetworkCapabilities.TRANSPORT_CELLULAR, false, false);
verifyLastMobileDataIndicators(true,
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[1][DEFAULT_LEVEL],
DEFAULT_LEVEL,
0, true);
}