Merge "Revert "Status bar updates" DO NOT MERGE" into oc-dev
This commit is contained in:
@@ -14,10 +14,10 @@ Copyright (C) 2014 The Android Open Source Project
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="17dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="12.0"
|
||||
android:viewportHeight="12.0">
|
||||
android:width="8.5dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="12.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M3.500000,11.000000L1.800000,11.000000L1.800000,4.400000L0.200000,5.100000L0.200000,3.700000l3.100000,-1.300000l0.200000,0.000000L3.500000,11.000000z"/>
|
||||
|
||||
@@ -14,10 +14,10 @@ Copyright (C) 2014 The Android Open Source Project
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="17dp"
|
||||
android:width="9.208dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="13.0"
|
||||
android:viewportHeight="13.0">
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M2.000000,6.000000l0.800000,0.000000c0.300000,0.000000 0.500000,-0.100000 0.700000,-0.300000s0.200000,-0.500000 0.200000,-0.900000c0.000000,-0.300000 -0.100000,-0.600000 -0.200000,-0.800000S3.200000,3.700000 2.900000,3.700000C2.700000,3.700000 2.500000,3.800000 2.300000,4.000000S2.100000,4.400000 2.100000,4.700000L0.500000,4.700000C0.500000,4.000000 0.700000,3.400000 1.100000,3.000000s1.000000,-0.600000 1.700000,-0.600000c0.800000,0.000000 1.400000,0.200000 1.900000,0.600000s0.700000,1.000000 0.700000,1.800000c0.000000,0.400000 -0.100000,0.700000 -0.300000,1.100000S4.600000,6.500000 4.300000,6.600000C4.700000,6.800000 5.000000,7.100000 5.200000,7.400000s0.300000,0.700000 0.300000,1.200000c0.000000,0.800000 -0.200000,1.400000 -0.700000,1.800000s-1.100000,0.700000 -1.900000,0.700000c-0.700000,0.000000 -1.300000,-0.200000 -1.800000,-0.600000s-0.700000,-1.000000 -0.700000,-1.800000L2.000000,8.700000C2.000000,9.000000 2.100000,9.300000 2.300000,9.500000s0.400000,0.300000 0.600000,0.300000c0.300000,0.000000 0.500000,-0.100000 0.700000,-0.300000S3.900000,9.000000 3.900000,8.600000c0.000000,-0.500000 -0.100000,-0.800000 -0.300000,-1.000000S3.200000,7.300000 2.800000,7.300000L2.000000,7.300000L2.000000,6.000000z"/>
|
||||
|
||||
@@ -14,10 +14,10 @@ Copyright (C) 2014 The Android Open Source Project
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="17dp"
|
||||
android:width="8.5dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="12.0"
|
||||
android:viewportHeight="12.0">
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M4.600000,7.800000l0.700000,0.000000l0.000000,1.300000L4.600000,9.100000L4.600000,11.000000L3.000000,11.000000L3.000000,9.200000L0.100000,9.200000L0.000000,8.100000L3.000000,2.500000l1.700000,0.000000L4.700000,7.800000zM1.600000,7.800000L3.000000,7.800000l0.000000,-3.000000L2.900000,5.000000L1.600000,7.800000z"/>
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="25.5dp"
|
||||
android:width="17.0dp"
|
||||
android:height="17.0dp"
|
||||
android:viewportWidth="18.0"
|
||||
android:viewportHeight="12.0">
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M4.6,7.8l0.7,0.0l0.0,1.3L4.6,9.1L4.6,11.0L3.0,11.0L3.0,9.2L0.1,9.2L0.0,8.2l3.0,-5.7l1.7,0.0L4.6,7.8L4.6,7.8zM1.7,7.8L3.0,7.8l0.0,-3.0L2.9,5.0L1.7,7.8z"/>
|
||||
|
||||
@@ -14,10 +14,10 @@ Copyright (C) 2014 The Android Open Source Project
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="7.083dp"
|
||||
android:width="3.541dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="5.0"
|
||||
android:viewportHeight="12.0">
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M4.400000,7.300000L1.700000,7.300000l0.000000,2.400000l3.300000,0.000000L5.000000,11.000000L0.000000,11.000000L0.000000,2.500000l4.900000,0.000000l0.000000,1.300000L1.700000,3.800000l0.000000,2.100000l2.800000,0.000000L4.500000,7.300000z"/>
|
||||
|
||||
@@ -14,10 +14,10 @@ Copyright (C) 2014 The Android Open Source Project
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="9.154dp"
|
||||
android:width="4.958dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="7.0"
|
||||
android:viewportHeight="13">
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M6.500000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S0.700000,9.000000 0.700000,7.900000L0.700000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000s1.200000,-0.800000 2.100000,-0.800000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000L4.700000,5.200000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000S4.000000,3.700000 3.600000,3.700000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S2.300000,5.000000 2.300000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L4.700000,7.800000L3.500000,7.800000L3.500000,6.600000l2.900000,0.000000L6.400000,9.900000z"/>
|
||||
|
||||
@@ -14,10 +14,10 @@ Copyright (C) 2014 The Android Open Source Project
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="9.5dp"
|
||||
android:width="4.25dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="6.0"
|
||||
android:viewportHeight="12.0">
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M6.000000,11.000000L4.400000,11.000000L4.400000,7.500000L1.700000,7.500000L1.700000,11.000000L0.000000,11.000000L0.000000,2.500000l1.700000,0.000000l0.000000,3.700000l2.700000,0.000000L4.400000,2.500000L6.000000,2.500000L6.000000,11.000000z"/>
|
||||
|
||||
@@ -14,10 +14,10 @@ Copyright (C) 2014 The Android Open Source Project
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="18.417dp"
|
||||
android:width="9.208dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="13"
|
||||
android:viewportHeight="12.0">
|
||||
android:viewportWidth="13.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M2.000000,9.700000l2.000000,0.000000L4.000000,11.000000L0.300000,11.000000L0.300000,2.500000L2.000000,2.500000L2.000000,9.700000z"/>
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="25.0dp"
|
||||
android:width="17.0dp"
|
||||
android:height="17.0dp"
|
||||
android:viewportWidth="18.0"
|
||||
android:viewportHeight="12.0">
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M2.0,9.7l2.0,0.0L4.0,11.0L0.4,11.0L0.4,2.5L2.0,2.5L2.0,9.7z"/>
|
||||
|
||||
@@ -14,10 +14,10 @@ Copyright (C) 2014 The Android Open Source Project
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="4.25dp"
|
||||
android:width="8.5dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="6.0"
|
||||
android:viewportHeight="24.0">
|
||||
android:viewportHeight="12.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M2.800000,7.900000l-1.000000,0.000000L1.800000,11.000000L0.200000,11.000000L0.200000,2.500000l2.700000,0.000000c0.900000,0.000000 1.500000,0.200000 2.000000,0.700000s0.700000,1.100000 0.700000,1.900000c0.000000,0.600000 -0.100000,1.100000 -0.300000,1.500000S4.800000,7.200000 4.400000,7.400000l1.500000,3.500000L5.900000,11.000000L4.100000,11.000000L2.800000,7.900000zM1.800000,6.500000l1.100000,0.000000c0.400000,0.000000 0.600000,-0.100000 0.800000,-0.400000S4.000000,5.600000 4.000000,5.200000c0.000000,-0.400000 -0.100000,-0.800000 -0.300000,-1.000000S3.300000,3.800000 2.900000,3.800000L1.800000,3.800000L1.800000,6.500000z"/>
|
||||
|
||||
@@ -1,41 +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:width="18.41dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="26.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="?attr/backgroundColor"
|
||||
android:pathData="M21.0,8.5
|
||||
c0.85,0.0 1.6,0.23 2.3,0.62l2.24,-2.79
|
||||
C25.1,5.96 20.26,2.0 13.0,2.0
|
||||
S0.9,5.9 0.42,6.32
|
||||
l12.57,15.6 4.21,-5.17
|
||||
c-0.76,-0.87 -1.22,-2.0 -1.22,-3.25
|
||||
c0.0,-2.76 2.24,-5.0 5.0,-5.0z"/>
|
||||
<path
|
||||
android:fillColor="?attr/backgroundColor"
|
||||
android:pathData="M21.0,10.0
|
||||
c-1.93,0.0 -3.5,1.57 -3.5,3.5l1.75,0.0
|
||||
c0.0,-0.9 0.78,-1.75 1.75,-1.75s1.7,0.78 1.75,1.75
|
||||
c0.0,0.48 -0.2,0.92 -0.51,1.24l-1.09,1.1
|
||||
c-0.6,0.63 -1.02,1.51 -1.02,2.47l0.0,0.44l1.75,0.0
|
||||
c0.0,-1.3 0.39,-1.84 1.03,-2.47l0.78,-0.8
|
||||
c0.5,-0.5 0.82,-1.2 0.82,-1.97
|
||||
C24.5,11.57 22.93,10.0 21.0,10.0z
|
||||
m-0.95,11.95l1.9,0.0l0.0,-1.9l-1.9,0.0l0.0,1.9z"/>
|
||||
</vector>
|
||||
@@ -20,8 +20,5 @@ Copyright (C) 2014 The Android Open Source Project
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="?attr/backgroundColor"
|
||||
android:pathData="M17.500000,16.500000L5.800000,3.400000c0.000000,0.000000 0.000000,0.000000 0.000000,0.000000l-2.700000,-3.000000L1.600000,1.800000l2.200000,2.500000c-2.000000,1.000000 -3.200000,2.000000 -3.400000,2.200000L13.000000,22.000000l0.000000,0.000000l0.000000,0.000000l0.000000,0.000000l0.000000,0.000000l3.200000,-3.900000l2.400000,2.700000l1.500000,-1.400000L17.500000,16.500000L17.500000,16.500000z"/>
|
||||
<path
|
||||
android:fillColor="?attr/backgroundColor"
|
||||
android:pathData="M25.600000,6.500000C25.100000,6.100000 20.299999,2.100000 13.000000,2.100000c-1.900000,0.000000 -3.600000,0.300000 -5.200000,0.700000L18.700001,15.000000L25.600000,6.500000z"/>
|
||||
android:pathData="M13.000000,2.000000C7.700000,2.000000 3.700000,3.900000 0.400000,6.400000L13.000000,22.000000L25.600000,6.500000C22.299999,4.000000 18.299999,2.000000 13.000000,2.000000zM13.000000,18.600000L3.300000,7.000000l0.000000,0.000000l0.000000,0.000000C6.000000,5.300000 8.700000,4.000000 13.000000,4.000000s7.000000,1.400000 9.700000,3.000000l0.000000,0.000000l0.000000,0.000000L13.000000,18.600000z"/>
|
||||
</vector>
|
||||
|
||||
@@ -63,21 +63,20 @@
|
||||
systemui:hasOverlappingRendering="false"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/mobile_roaming"
|
||||
android:id="@+id/mobile_type"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/stat_sys_roaming"
|
||||
android:contentDescription="@string/accessibility_data_connection_roaming"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/mobile_type"
|
||||
android:id="@+id/mobile_roaming"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="17dp"
|
||||
android:paddingStart="19dp"
|
||||
android:paddingStart="22dp"
|
||||
android:paddingTop="1.5dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/stat_sys_roaming"
|
||||
android:contentDescription="@string/accessibility_data_connection_roaming"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -53,54 +53,9 @@
|
||||
android:alpha="0.0"
|
||||
/>
|
||||
</FrameLayout>
|
||||
<ViewStub
|
||||
android:id="@+id/connected_device_signals_stub"
|
||||
android:layout="@layout/connected_device_signal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:id="@+id/mobile_signal_group"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
>
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:id="@+id/wifi_signal_spacer"
|
||||
android:layout_width="@dimen/status_bar_wifi_signal_spacer_width"
|
||||
android:layout_height="4dp"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<FrameLayout
|
||||
android:id="@+id/no_sims_combo"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:contentDescription="@string/accessibility_no_sims">
|
||||
<com.android.systemui.statusbar.AlphaOptimizedImageView
|
||||
android:theme="@style/DualToneLightTheme"
|
||||
android:id="@+id/no_sims"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/stat_sys_no_sims"
|
||||
/>
|
||||
<com.android.systemui.statusbar.AlphaOptimizedImageView
|
||||
android:theme="@style/DualToneDarkTheme"
|
||||
android:id="@+id/no_sims_dark"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/stat_sys_no_sims"
|
||||
android:alpha="0.0"
|
||||
/>
|
||||
</FrameLayout>
|
||||
<View
|
||||
android:id="@+id/wifi_airplane_spacer"
|
||||
android:layout_width="@dimen/status_bar_airplane_spacer_width"
|
||||
android:layout_height="4dp"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<FrameLayout
|
||||
android:layout_height="17dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:paddingStart="2dp">
|
||||
android:layout_width="wrap_content">
|
||||
<ImageView
|
||||
android:id="@+id/wifi_in"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -142,6 +97,50 @@
|
||||
android:layout_width="wrap_content"
|
||||
/>
|
||||
</FrameLayout>
|
||||
<View
|
||||
android:id="@+id/wifi_signal_spacer"
|
||||
android:layout_width="@dimen/status_bar_wifi_signal_spacer_width"
|
||||
android:layout_height="4dp"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<ViewStub
|
||||
android:id="@+id/connected_device_signals_stub"
|
||||
android:layout="@layout/connected_device_signal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:id="@+id/mobile_signal_group"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
>
|
||||
</LinearLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/no_sims_combo"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:contentDescription="@string/accessibility_no_sims">
|
||||
<com.android.systemui.statusbar.AlphaOptimizedImageView
|
||||
android:theme="@style/DualToneLightTheme"
|
||||
android:id="@+id/no_sims"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/stat_sys_no_sims"
|
||||
/>
|
||||
<com.android.systemui.statusbar.AlphaOptimizedImageView
|
||||
android:theme="@style/DualToneDarkTheme"
|
||||
android:id="@+id/no_sims_dark"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/stat_sys_no_sims"
|
||||
android:alpha="0.0"
|
||||
/>
|
||||
</FrameLayout>
|
||||
<View
|
||||
android:id="@+id/wifi_airplane_spacer"
|
||||
android:layout_width="@dimen/status_bar_airplane_spacer_width"
|
||||
android:layout_height="4dp"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<ImageView
|
||||
android:id="@+id/airplane"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -77,9 +77,6 @@ public class QuickStatusBarHeader extends RelativeLayout {
|
||||
|
||||
BatteryMeterView battery = findViewById(R.id.battery);
|
||||
battery.setForceShowPercent(true);
|
||||
// Don't show the Wi-Fi indicator here, because it is shown just below in the tile.
|
||||
SignalClusterView signalCluster = findViewById(R.id.signal_cluster);
|
||||
signalCluster.setForceBlockWifi();
|
||||
|
||||
mActivityStarter = Dependency.get(ActivityStarter.class);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class CellularTile extends QSTileImpl<SignalState> {
|
||||
state.value = mDataController.isMobileDataSupported()
|
||||
&& mDataController.isMobileDataEnabled();
|
||||
state.icon = ResourceIcon.get(R.drawable.ic_data_unavailable);
|
||||
state.state = cb.airplaneModeEnabled || !cb.enabled || cb.noSim ? Tile.STATE_UNAVAILABLE
|
||||
state.state = cb.airplaneModeEnabled || !cb.enabled ? Tile.STATE_UNAVAILABLE
|
||||
: state.value ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
|
||||
if (state.state == Tile.STATE_ACTIVE) {
|
||||
state.icon = ResourceIcon.get(R.drawable.ic_data_on);
|
||||
@@ -161,27 +161,44 @@ public class CellularTile extends QSTileImpl<SignalState> {
|
||||
|
||||
private static final class CallbackInfo {
|
||||
boolean enabled;
|
||||
boolean wifiEnabled;
|
||||
boolean airplaneModeEnabled;
|
||||
String signalContentDescription;
|
||||
int dataTypeIconId;
|
||||
String dataContentDescription;
|
||||
boolean activityIn;
|
||||
boolean activityOut;
|
||||
String enabledDesc;
|
||||
boolean noSim;
|
||||
boolean isDataTypeIconWide;
|
||||
boolean roaming;
|
||||
}
|
||||
|
||||
private final class CellSignalCallback implements SignalCallback {
|
||||
private final CallbackInfo mInfo = new CallbackInfo();
|
||||
@Override
|
||||
public void setWifiIndicators(boolean enabled, IconState statusIcon, IconState qsIcon,
|
||||
boolean activityIn, boolean activityOut, String description, boolean isTransient) {
|
||||
mInfo.wifiEnabled = enabled;
|
||||
refreshState(mInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMobileDataIndicators(IconState statusIcon, int statusType,
|
||||
boolean activityIn, boolean activityOut, String typeContentDescription,
|
||||
int subId, boolean roaming, boolean isEmergency) {
|
||||
if (statusIcon == null) {
|
||||
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
||||
int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
|
||||
String description, boolean isWide, int subId, boolean roaming) {
|
||||
if (qsIcon == null) {
|
||||
// Not data sim, don't display.
|
||||
return;
|
||||
}
|
||||
mInfo.enabled = statusIcon.visible;
|
||||
mInfo.enabled = qsIcon.visible;
|
||||
mInfo.signalContentDescription = qsIcon.contentDescription;
|
||||
mInfo.dataTypeIconId = qsType;
|
||||
mInfo.dataContentDescription = typeContentDescription;
|
||||
mInfo.activityIn = activityIn;
|
||||
mInfo.activityOut = activityOut;
|
||||
mInfo.enabledDesc = description;
|
||||
mInfo.isDataTypeIconWide = qsType != 0 && isWide;
|
||||
mInfo.roaming = roaming;
|
||||
refreshState(mInfo);
|
||||
}
|
||||
@@ -189,6 +206,15 @@ public class CellularTile extends QSTileImpl<SignalState> {
|
||||
@Override
|
||||
public void setNoSims(boolean show) {
|
||||
mInfo.noSim = show;
|
||||
if (mInfo.noSim) {
|
||||
// Make sure signal gets cleared out when no sims.
|
||||
mInfo.dataTypeIconId = 0;
|
||||
// Show a No SIMs description to avoid emergency calls message.
|
||||
mInfo.enabled = true;
|
||||
mInfo.enabledDesc = mContext.getString(
|
||||
R.string.keyguard_missing_sim_message_short);
|
||||
mInfo.signalContentDescription = mInfo.enabledDesc;
|
||||
}
|
||||
refreshState(mInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Animatable;
|
||||
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
@@ -118,7 +120,6 @@ public class SignalClusterView extends LinearLayout implements NetworkController
|
||||
private boolean mBlockWifi;
|
||||
private boolean mBlockEthernet;
|
||||
private boolean mActivityEnabled;
|
||||
private boolean mForceBlockWifi;
|
||||
|
||||
public SignalClusterView(Context context) {
|
||||
this(context, null);
|
||||
@@ -150,16 +151,6 @@ public class SignalClusterView extends LinearLayout implements NetworkController
|
||||
updateActivityEnabled();
|
||||
}
|
||||
|
||||
public void setForceBlockWifi() {
|
||||
mForceBlockWifi = true;
|
||||
mBlockWifi = true;
|
||||
if (isAttachedToWindow()) {
|
||||
// Re-register to get new callbacks.
|
||||
mNetworkController.removeCallback(this);
|
||||
mNetworkController.addCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTuningChanged(String key, String newValue) {
|
||||
if (!StatusBarIconController.ICON_BLACKLIST.equals(key)) {
|
||||
@@ -176,7 +167,7 @@ public class SignalClusterView extends LinearLayout implements NetworkController
|
||||
mBlockAirplane = blockAirplane;
|
||||
mBlockMobile = blockMobile;
|
||||
mBlockEthernet = blockEthernet;
|
||||
mBlockWifi = blockWifi || mForceBlockWifi;
|
||||
mBlockWifi = blockWifi;
|
||||
// Re-register to get new callbacks.
|
||||
mNetworkController.removeCallback(this);
|
||||
mNetworkController.addCallback(this);
|
||||
@@ -297,9 +288,9 @@ public class SignalClusterView extends LinearLayout implements NetworkController
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMobileDataIndicators(IconState statusIcon, int statusType,
|
||||
boolean activityIn, boolean activityOut, String typeContentDescription,
|
||||
int subId, boolean roaming, boolean isEmergency) {
|
||||
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
||||
int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
|
||||
String description, boolean isWide, int subId, boolean roaming) {
|
||||
PhoneState state = getState(subId);
|
||||
if (state == null) {
|
||||
return;
|
||||
@@ -309,6 +300,7 @@ public class SignalClusterView extends LinearLayout implements NetworkController
|
||||
state.mMobileTypeId = statusType;
|
||||
state.mMobileDescription = statusIcon.contentDescription;
|
||||
state.mMobileTypeDescription = typeContentDescription;
|
||||
state.mIsMobileTypeIconWide = statusType != 0 && isWide;
|
||||
state.mRoaming = roaming;
|
||||
state.mActivityIn = activityIn && mActivityEnabled;
|
||||
state.mActivityOut = activityOut && mActivityEnabled;
|
||||
@@ -533,7 +525,7 @@ public class SignalClusterView extends LinearLayout implements NetworkController
|
||||
mWifiAirplaneSpacer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (((anyMobileVisible && firstMobileTypeId == 0) || mNoSimsVisible) && mWifiVisible) {
|
||||
if (((anyMobileVisible && firstMobileTypeId != 0) || mNoSimsVisible) && mWifiVisible) {
|
||||
mWifiSignalSpacer.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mWifiSignalSpacer.setVisibility(View.GONE);
|
||||
@@ -644,6 +636,7 @@ public class SignalClusterView extends LinearLayout implements NetworkController
|
||||
private int mMobileStrengthId = 0, mMobileTypeId = 0;
|
||||
private int mLastMobileStrengthId = -1;
|
||||
private int mLastMobileTypeId = -1;
|
||||
private boolean mIsMobileTypeIconWide;
|
||||
private String mMobileDescription, mMobileTypeDescription;
|
||||
|
||||
private ViewGroup mMobileGroup;
|
||||
@@ -699,8 +692,12 @@ public class SignalClusterView extends LinearLayout implements NetworkController
|
||||
// When this isn't next to wifi, give it some extra padding between the signals.
|
||||
mMobileGroup.setPaddingRelative(isSecondaryIcon ? mSecondaryTelephonyPadding : 0,
|
||||
0, 0, 0);
|
||||
mMobile.setPaddingRelative(mMobileDataIconStartPadding, 0, 0, 0);
|
||||
mMobileDark.setPaddingRelative(mMobileDataIconStartPadding, 0, 0, 0);
|
||||
mMobile.setPaddingRelative(
|
||||
mIsMobileTypeIconWide ? mWideTypeIconStartPadding : mMobileDataIconStartPadding,
|
||||
0, 0, 0);
|
||||
mMobileDark.setPaddingRelative(
|
||||
mIsMobileTypeIconWide ? mWideTypeIconStartPadding : mMobileDataIconStartPadding,
|
||||
0, 0, 0);
|
||||
|
||||
if (DEBUG) Log.d(TAG, String.format("mobile: %s sig=%d typ=%d",
|
||||
(mMobileVisible ? "VISIBLE" : "GONE"), mMobileStrengthId, mMobileTypeId));
|
||||
|
||||
@@ -57,12 +57,12 @@ public class SignalDrawable extends Drawable {
|
||||
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;
|
||||
public static final int STATE_SHIFT = 16;
|
||||
public static final int STATE_MASK = 0xff << STATE_SHIFT;
|
||||
public static final int STATE_NONE = 0;
|
||||
public static final int STATE_EMPTY = 1;
|
||||
public static final int STATE_CUT = 2;
|
||||
public static final int STATE_CARRIER_CHANGE = 3;
|
||||
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;
|
||||
|
||||
|
||||
@@ -110,24 +110,30 @@ public class CallbackHandler extends Handler implements EmergencyListener, Signa
|
||||
public void setWifiIndicators(final boolean enabled, final IconState statusIcon,
|
||||
final IconState qsIcon, final boolean activityIn, final boolean activityOut,
|
||||
final String description, boolean isTransient) {
|
||||
post(() -> {
|
||||
for (SignalCallback callback : mSignalCallbacks) {
|
||||
callback.setWifiIndicators(enabled, statusIcon, qsIcon, activityIn, activityOut,
|
||||
description, isTransient);
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (SignalCallback callback : mSignalCallbacks) {
|
||||
callback.setWifiIndicators(enabled, statusIcon, qsIcon, activityIn, activityOut,
|
||||
description, isTransient);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMobileDataIndicators(final IconState statusIcon,
|
||||
final int statusType, final boolean activityIn,
|
||||
public void setMobileDataIndicators(final IconState statusIcon, final IconState qsIcon,
|
||||
final int statusType, final int qsType,final boolean activityIn,
|
||||
final boolean activityOut, final String typeContentDescription,
|
||||
final int subId, boolean roaming, boolean isEmergency) {
|
||||
post(() -> {
|
||||
for (SignalCallback signalCluster : mSignalCallbacks) {
|
||||
signalCluster.setMobileDataIndicators(statusIcon, statusType,
|
||||
activityIn, activityOut, typeContentDescription,
|
||||
subId, roaming, isEmergency);
|
||||
final String description, final boolean isWide, final int subId, boolean roaming) {
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (SignalCallback signalCluster : mSignalCallbacks) {
|
||||
signalCluster.setMobileDataIndicators(statusIcon, qsIcon, statusType, qsType,
|
||||
activityIn, activityOut, typeContentDescription, description, isWide,
|
||||
subId, roaming);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -244,8 +244,7 @@ public class MobileSignalController extends SignalController<
|
||||
return SignalDrawable.getCarrierChangeState(getNumLevels());
|
||||
} else if (mCurrentState.connected) {
|
||||
return SignalDrawable.getState(mCurrentState.level, getNumLevels(),
|
||||
mCurrentState.inetCondition == 0 ||
|
||||
(mCurrentState.dataDisabled && mCurrentState.userSetup));
|
||||
mCurrentState.inetCondition == 0);
|
||||
} else if (mCurrentState.enabled) {
|
||||
return SignalDrawable.getEmptyState(getNumLevels());
|
||||
} else {
|
||||
@@ -264,14 +263,24 @@ public class MobileSignalController extends SignalController<
|
||||
|
||||
String contentDescription = getStringIfExists(getContentDescription());
|
||||
String dataContentDescription = getStringIfExists(icons.mDataContentDescription);
|
||||
final boolean dataDisabled = mCurrentState.dataDisabled
|
||||
final boolean dataDisabled = mCurrentState.iconGroup == TelephonyIcons.DATA_DISABLED
|
||||
&& mCurrentState.userSetup;
|
||||
|
||||
// Show icon in QS when we are connected or data is disabled.
|
||||
boolean showDataIcon = mCurrentState.dataConnected;
|
||||
boolean showDataIcon = mCurrentState.dataConnected || dataDisabled;
|
||||
IconState statusIcon = new IconState(mCurrentState.enabled && !mCurrentState.airplaneMode,
|
||||
getCurrentIconId(), contentDescription);
|
||||
|
||||
int qsTypeIcon = 0;
|
||||
IconState qsIcon = null;
|
||||
String description = null;
|
||||
// Only send data sim callbacks to QS.
|
||||
if (mCurrentState.dataSim) {
|
||||
qsTypeIcon = showDataIcon ? icons.mQsDataType : 0;
|
||||
qsIcon = new IconState(mCurrentState.enabled
|
||||
&& !mCurrentState.isEmergency, getQsCurrentIconId(), contentDescription);
|
||||
description = mCurrentState.isEmergency ? null : mCurrentState.networkName;
|
||||
}
|
||||
boolean activityIn = mCurrentState.dataConnected
|
||||
&& !mCurrentState.carrierNetworkChangeMode
|
||||
&& mCurrentState.activityIn;
|
||||
@@ -280,10 +289,9 @@ public class MobileSignalController extends SignalController<
|
||||
&& mCurrentState.activityOut;
|
||||
showDataIcon &= mCurrentState.isDefault || dataDisabled;
|
||||
int typeIcon = showDataIcon ? icons.mDataType : 0;
|
||||
callback.setMobileDataIndicators(statusIcon, typeIcon,
|
||||
activityIn, activityOut, dataContentDescription,
|
||||
mSubscriptionInfo.getSubscriptionId(), mCurrentState.roaming,
|
||||
mCurrentState.isEmergency);
|
||||
callback.setMobileDataIndicators(statusIcon, qsIcon, typeIcon, qsTypeIcon,
|
||||
activityIn, activityOut, dataContentDescription, description, icons.mIsWide,
|
||||
mSubscriptionInfo.getSubscriptionId(), mCurrentState.roaming);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -430,14 +438,14 @@ public class MobileSignalController extends SignalController<
|
||||
} else {
|
||||
mCurrentState.iconGroup = mDefaultIcons;
|
||||
}
|
||||
mCurrentState.dataDisabled = isDataDisabled();
|
||||
mCurrentState.dataConnected = mCurrentState.connected
|
||||
&& mDataState == TelephonyManager.DATA_CONNECTED
|
||||
&& !mCurrentState.dataDisabled;
|
||||
&& mDataState == TelephonyManager.DATA_CONNECTED;
|
||||
|
||||
mCurrentState.roaming = isRoaming();
|
||||
if (isCarrierNetworkChangeActive()) {
|
||||
mCurrentState.iconGroup = TelephonyIcons.CARRIER_NETWORK_CHANGE;
|
||||
} else if (isDataDisabled()) {
|
||||
mCurrentState.iconGroup = TelephonyIcons.DATA_DISABLED;
|
||||
}
|
||||
if (isEmergencyOnly() != mCurrentState.isEmergency) {
|
||||
mCurrentState.isEmergency = isEmergencyOnly();
|
||||
@@ -569,7 +577,6 @@ public class MobileSignalController extends SignalController<
|
||||
boolean isDefault;
|
||||
boolean userSetup;
|
||||
boolean roaming;
|
||||
boolean dataDisabled;
|
||||
|
||||
@Override
|
||||
public void copyFrom(State s) {
|
||||
@@ -585,7 +592,6 @@ public class MobileSignalController extends SignalController<
|
||||
carrierNetworkChangeMode = state.carrierNetworkChangeMode;
|
||||
userSetup = state.userSetup;
|
||||
roaming = state.roaming;
|
||||
dataDisabled = state.dataDisabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -603,7 +609,6 @@ public class MobileSignalController extends SignalController<
|
||||
builder.append("carrierNetworkChangeMode=").append(carrierNetworkChangeMode)
|
||||
.append(',');
|
||||
builder.append("userSetup=").append(userSetup);
|
||||
builder.append("dataDisabled=").append(dataDisabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -618,7 +623,6 @@ public class MobileSignalController extends SignalController<
|
||||
&& ((MobileState) o).carrierNetworkChangeMode == carrierNetworkChangeMode
|
||||
&& ((MobileState) o).userSetup == userSetup
|
||||
&& ((MobileState) o).isDefault == isDefault
|
||||
&& ((MobileState) o).dataDisabled == dataDisabled
|
||||
&& ((MobileState) o).roaming == roaming;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,9 +48,9 @@ public interface NetworkController extends CallbackController<SignalCallback>, D
|
||||
default void setWifiIndicators(boolean enabled, IconState statusIcon, IconState qsIcon,
|
||||
boolean activityIn, boolean activityOut, String description, boolean isTransient) {}
|
||||
|
||||
default void setMobileDataIndicators(IconState statusIcon, int statusType,
|
||||
boolean activityIn, boolean activityOut, String typeContentDescription,
|
||||
int subId, boolean roaming, boolean isEmergency) {}
|
||||
default void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
|
||||
int qsType, boolean activityIn, boolean activityOut, String typeContentDescription,
|
||||
String description, boolean isWide, int subId, boolean roaming) {}
|
||||
default void setSubs(List<SubscriptionInfo> subs) {}
|
||||
default void setNoSims(boolean show) {}
|
||||
|
||||
|
||||
@@ -867,6 +867,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
||||
datatype.equals("h") ? TelephonyIcons.H :
|
||||
datatype.equals("lte") ? TelephonyIcons.LTE :
|
||||
datatype.equals("lte+") ? TelephonyIcons.LTE_PLUS :
|
||||
datatype.equals("dis") ? TelephonyIcons.DATA_DISABLED :
|
||||
TelephonyIcons.UNKNOWN;
|
||||
}
|
||||
if (args.containsKey("roam")) {
|
||||
|
||||
@@ -44,6 +44,10 @@ class TelephonyIcons {
|
||||
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_DATA_DISABLED = R.drawable.stat_sys_data_disabled;
|
||||
|
||||
static final int QS_ICON_DATA_DISABLED = R.drawable.ic_qs_data_disabled;
|
||||
|
||||
static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup(
|
||||
"CARRIER_NETWORK_CHANGE",
|
||||
null,
|
||||
@@ -217,5 +221,20 @@ class TelephonyIcons {
|
||||
true,
|
||||
TelephonyIcons.QS_DATA_LTE_PLUS
|
||||
);
|
||||
|
||||
static final MobileIconGroup DATA_DISABLED = new MobileIconGroup(
|
||||
"DataDisabled",
|
||||
null,
|
||||
null,
|
||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
|
||||
0, 0,
|
||||
0,
|
||||
0,
|
||||
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
|
||||
R.string.accessibility_cell_data_off,
|
||||
TelephonyIcons.ICON_DATA_DISABLED,
|
||||
false,
|
||||
TelephonyIcons.QS_ICON_DATA_DISABLED
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ public class WifiIcons {
|
||||
|
||||
static final int QS_WIFI_NO_NETWORK = R.drawable.ic_qs_wifi_no_network;
|
||||
static final int WIFI_NO_NETWORK = R.drawable.stat_sys_wifi_signal_null;
|
||||
static final int WIFI_DISCONNECTED = R.drawable.stat_sys_wifi_signal_disconnected;
|
||||
|
||||
static final int WIFI_LEVEL_COUNT = WIFI_SIGNAL_STRENGTH[0].length;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class WifiSignalController extends
|
||||
AccessibilityContentDescriptions.WIFI_CONNECTION_STRENGTH,
|
||||
WifiIcons.WIFI_NO_NETWORK,
|
||||
WifiIcons.QS_WIFI_NO_NETWORK,
|
||||
WifiIcons.WIFI_DISCONNECTED,
|
||||
WifiIcons.WIFI_NO_NETWORK,
|
||||
WifiIcons.QS_WIFI_NO_NETWORK,
|
||||
AccessibilityContentDescriptions.WIFI_NO_CONNECTION
|
||||
);
|
||||
@@ -133,7 +133,8 @@ public class WifiSignalController extends
|
||||
@Override
|
||||
public void notifyListeners(SignalCallback callback) {
|
||||
// only show wifi in the cluster if connected or if wifi-only
|
||||
boolean wifiVisible = true;
|
||||
boolean wifiVisible = mCurrentState.enabled
|
||||
&& (mCurrentState.connected || !mHasMobileData);
|
||||
String wifiDesc = wifiVisible ? mCurrentState.ssid : null;
|
||||
boolean ssidPresent = wifiVisible && mCurrentState.ssid != null;
|
||||
String contentDescription = getStringIfExists(getContentDescription());
|
||||
|
||||
@@ -114,26 +114,33 @@ public class CallbackHandlerTest {
|
||||
boolean wide = true;
|
||||
int subId = 5;
|
||||
boolean roaming = true;
|
||||
boolean isEmergency = true;
|
||||
mHandler.setMobileDataIndicators(status, type, in, out, typeDescription,
|
||||
subId, roaming, isEmergency);
|
||||
mHandler.setMobileDataIndicators(status, qs, type, qsType, in, out, typeDescription,
|
||||
description, wide, subId, roaming);
|
||||
waitForCallbacks();
|
||||
|
||||
ArgumentCaptor<IconState> statusArg = ArgumentCaptor.forClass(IconState.class);
|
||||
ArgumentCaptor<IconState> qsArg = ArgumentCaptor.forClass(IconState.class);
|
||||
ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class);
|
||||
ArgumentCaptor<Integer> qsTypeIconArg = ArgumentCaptor.forClass(Integer.class);
|
||||
ArgumentCaptor<Boolean> inArg = ArgumentCaptor.forClass(Boolean.class);
|
||||
ArgumentCaptor<Boolean> outArg = ArgumentCaptor.forClass(Boolean.class);
|
||||
ArgumentCaptor<String> typeContentArg = ArgumentCaptor.forClass(String.class);
|
||||
ArgumentCaptor<String> descArg = ArgumentCaptor.forClass(String.class);
|
||||
ArgumentCaptor<Boolean> wideArg = ArgumentCaptor.forClass(Boolean.class);
|
||||
ArgumentCaptor<Integer> subIdArg = ArgumentCaptor.forClass(Integer.class);
|
||||
Mockito.verify(mSignalCallback).setMobileDataIndicators(statusArg.capture(),
|
||||
typeIconArg.capture(), inArg.capture(),
|
||||
outArg.capture(), typeContentArg.capture(),
|
||||
subIdArg.capture(), eq(roaming), eq(isEmergency));
|
||||
qsArg.capture(), typeIconArg.capture(), qsTypeIconArg.capture(), inArg.capture(),
|
||||
outArg.capture(), typeContentArg.capture(), descArg.capture(), wideArg.capture(),
|
||||
subIdArg.capture(), eq(roaming));
|
||||
assertEquals(status, statusArg.getValue());
|
||||
assertEquals(qs, qsArg.getValue());
|
||||
assertEquals(type, (int) typeIconArg.getValue());
|
||||
assertEquals(qsType, (int) qsTypeIconArg.getValue());
|
||||
assertEquals(in, (boolean) inArg.getValue());
|
||||
assertEquals(out, (boolean) outArg.getValue());
|
||||
assertEquals(typeDescription, typeContentArg.getValue());
|
||||
assertEquals(description, descArg.getValue());
|
||||
assertEquals(wide, (boolean) wideArg.getValue());
|
||||
assertEquals(subId, (int) subIdArg.getValue());
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.SubscriptionManager;
|
||||
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;
|
||||
@@ -46,6 +45,8 @@ import org.junit.rules.TestWatcher;
|
||||
import org.junit.runner.Description;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
@@ -69,7 +70,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
||||
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 = DEFAULT_ICON;
|
||||
protected static final int DEFAULT_QS_ICON = TelephonyIcons.QS_DATA_3G;
|
||||
|
||||
protected NetworkControllerImpl mNetworkController;
|
||||
protected MobileSignalController mMobileSignalController;
|
||||
@@ -116,7 +117,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
||||
|
||||
when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(true);
|
||||
when(mMockCm.getDefaultNetworkCapabilitiesForUser(0)).thenReturn(
|
||||
new NetworkCapabilities[]{mNetCapabilities});
|
||||
new NetworkCapabilities[] { mNetCapabilities });
|
||||
|
||||
mSignalStrength = mock(SignalStrength.class);
|
||||
mServiceState = mock(ServiceState.class);
|
||||
@@ -174,17 +175,17 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
protected NetworkControllerImpl setUpNoMobileData() {
|
||||
when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
|
||||
NetworkControllerImpl networkControllerNoMobile
|
||||
= new NetworkControllerImpl(mContext, mMockCm, mMockNetworkScoreManager, mMockTm,
|
||||
mMockWm, mMockSm, mConfig, mContext.getMainLooper(), mCallbackHandler,
|
||||
mock(AccessPointControllerImpl.class),
|
||||
mock(DataUsageController.class), mMockSubDefaults,
|
||||
mock(DeviceProvisionedController.class));
|
||||
when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
|
||||
NetworkControllerImpl networkControllerNoMobile
|
||||
= new NetworkControllerImpl(mContext, mMockCm, mMockNetworkScoreManager, mMockTm,
|
||||
mMockWm, mMockSm, mConfig, mContext.getMainLooper(), mCallbackHandler,
|
||||
mock(AccessPointControllerImpl.class),
|
||||
mock(DataUsageController.class), mMockSubDefaults,
|
||||
mock(DeviceProvisionedController.class));
|
||||
|
||||
setupNetworkController();
|
||||
setupNetworkController();
|
||||
|
||||
return networkControllerNoMobile;
|
||||
return networkControllerNoMobile;
|
||||
|
||||
}
|
||||
|
||||
@@ -307,10 +308,11 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
||||
ArgumentCaptor<Boolean> dataOutArg = ArgumentCaptor.forClass(Boolean.class);
|
||||
|
||||
Mockito.verify(mCallbackHandler, Mockito.atLeastOnce()).setMobileDataIndicators(
|
||||
iconArg.capture(),
|
||||
typeIconArg.capture(),
|
||||
dataInArg.capture(), dataOutArg.capture(),
|
||||
anyString(), anyInt(), anyBoolean(), anyBoolean());
|
||||
any(),
|
||||
iconArg.capture(),
|
||||
anyInt(),
|
||||
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);
|
||||
@@ -333,16 +335,17 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
protected void verifyLastMobileDataIndicators(boolean visible, int icon, int typeIcon,
|
||||
boolean roaming, boolean inet) {
|
||||
boolean roaming, boolean inet) {
|
||||
ArgumentCaptor<IconState> iconArg = ArgumentCaptor.forClass(IconState.class);
|
||||
ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class);
|
||||
|
||||
// TODO: Verify all fields.
|
||||
Mockito.verify(mCallbackHandler, Mockito.atLeastOnce()).setMobileDataIndicators(
|
||||
iconArg.capture(),
|
||||
any(),
|
||||
typeIconArg.capture(),
|
||||
anyBoolean(), anyBoolean(), anyString(),
|
||||
anyInt(), eq(roaming), anyBoolean());
|
||||
anyInt(), anyBoolean(), anyBoolean(), anyString(), anyString(), anyBoolean(),
|
||||
anyInt(), eq(roaming));
|
||||
IconState iconState = iconArg.getValue();
|
||||
|
||||
int state = icon == -1 ? 0
|
||||
@@ -353,18 +356,22 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
protected void verifyLastMobileDataIndicators(boolean visible, int icon, int typeIcon,
|
||||
boolean qsVisible, boolean dataIn, boolean dataOut) {
|
||||
boolean qsVisible, int qsIcon, int qsTypeIcon, boolean dataIn, boolean dataOut) {
|
||||
ArgumentCaptor<IconState> iconArg = ArgumentCaptor.forClass(IconState.class);
|
||||
ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class);
|
||||
ArgumentCaptor<IconState> qsIconArg = ArgumentCaptor.forClass(IconState.class);
|
||||
ArgumentCaptor<Integer> qsTypeIconArg = ArgumentCaptor.forClass(Integer.class);
|
||||
ArgumentCaptor<Boolean> dataInArg = ArgumentCaptor.forClass(Boolean.class);
|
||||
ArgumentCaptor<Boolean> dataOutArg = ArgumentCaptor.forClass(Boolean.class);
|
||||
|
||||
Mockito.verify(mCallbackHandler, Mockito.atLeastOnce()).setMobileDataIndicators(
|
||||
iconArg.capture(),
|
||||
qsIconArg.capture(),
|
||||
typeIconArg.capture(),
|
||||
qsTypeIconArg.capture(),
|
||||
dataInArg.capture(),
|
||||
dataOutArg.capture(),
|
||||
anyString(), anyInt(), anyBoolean(), anyBoolean());
|
||||
anyString(), anyString(), anyBoolean(), anyInt(), anyBoolean());
|
||||
|
||||
IconState iconState = iconArg.getValue();
|
||||
|
||||
@@ -374,15 +381,17 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
|
||||
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", state, iconState.icon);
|
||||
assertEquals("Data icon in quick settings", qsTypeIcon, (int) qsTypeIconArg.getValue());
|
||||
assertEquals("Data direction in in quick settings", dataIn,
|
||||
(boolean) dataInArg.getValue());
|
||||
assertEquals("Data direction out in quick settings", dataOut,
|
||||
(boolean) dataOutArg.getValue());
|
||||
}
|
||||
|
||||
protected void assertNetworkNameEquals(String expected) {
|
||||
assertEquals("Network name", expected, mMobileSignalController.getState().networkName);
|
||||
}
|
||||
protected void assertNetworkNameEquals(String expected) {
|
||||
assertEquals("Network name", expected, mMobileSignalController.getState().networkName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package com.android.systemui.statusbar.policy;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -15,14 +11,10 @@ import android.telephony.TelephonyManager;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
|
||||
import com.android.settingslib.net.DataUsageController;
|
||||
import com.android.systemui.statusbar.phone.SignalDrawable;
|
||||
import com.android.systemui.statusbar.policy.NetworkController.IconState;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@@ -124,11 +116,8 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
|
||||
updateDataConnectionState(TelephonyManager.DATA_DISCONNECTED, 0);
|
||||
setConnectivity(NetworkCapabilities.TRANSPORT_CELLULAR, false, false);
|
||||
|
||||
ArgumentCaptor<IconState> iconArg = ArgumentCaptor.forClass(IconState.class);
|
||||
Mockito.verify(mCallbackHandler, Mockito.atLeastOnce()).setMobileDataIndicators(
|
||||
iconArg.capture(), anyInt(), anyBoolean(), anyBoolean(), any(), anyInt(),
|
||||
anyBoolean(), anyBoolean());
|
||||
assertEquals(SignalDrawable.STATE_CUT, SignalDrawable.getState(iconArg.getValue().icon));
|
||||
verifyDataIndicators(TelephonyIcons.ICON_DATA_DISABLED,
|
||||
TelephonyIcons.QS_ICON_DATA_DISABLED);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -140,14 +129,9 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
|
||||
setConnectivity(NetworkCapabilities.TRANSPORT_CELLULAR, false, false);
|
||||
when(mMockProvisionController.isUserSetup(anyInt())).thenReturn(false);
|
||||
mUserCallback.onUserSetupChanged();
|
||||
waitForIdleSync();
|
||||
|
||||
// Don't show the X until the device is setup.
|
||||
ArgumentCaptor<IconState> iconArg = ArgumentCaptor.forClass(IconState.class);
|
||||
Mockito.verify(mCallbackHandler, Mockito.atLeastOnce()).setMobileDataIndicators(
|
||||
iconArg.capture(), anyInt(), anyBoolean(), anyBoolean(), any(), anyInt(),
|
||||
anyBoolean(), anyBoolean());
|
||||
assertNotEquals(SignalDrawable.STATE_CUT, SignalDrawable.getState(iconArg.getValue().icon));
|
||||
verifyDataIndicators(0, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -197,12 +181,12 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
|
||||
updateDataActivity(direction);
|
||||
|
||||
verifyLastMobileDataIndicators(true, DEFAULT_SIGNAL_STRENGTH, DEFAULT_ICON, true,
|
||||
in, out);
|
||||
DEFAULT_QS_SIGNAL_STRENGTH, DEFAULT_QS_ICON, in, out);
|
||||
}
|
||||
|
||||
private void verifyDataIndicators(int dataIcon, int qsDataIcon) {
|
||||
verifyLastMobileDataIndicators(true, DEFAULT_SIGNAL_STRENGTH, dataIcon,
|
||||
true, false,
|
||||
true, DEFAULT_QS_SIGNAL_STRENGTH, qsDataIcon, false,
|
||||
false);
|
||||
}
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
|
||||
|
||||
verifyLastQsMobileDataIndicators(true,
|
||||
testStrength,
|
||||
TelephonyIcons.ICON_1X, false, false);
|
||||
TelephonyIcons.QS_DATA_1X, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,7 +434,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
|
||||
|
||||
verifyLastQsMobileDataIndicators(true /* visible */,
|
||||
DEFAULT_LEVEL /* icon */,
|
||||
DEFAULT_ICON /* typeIcon */,
|
||||
DEFAULT_QS_ICON /* typeIcon */,
|
||||
false /* dataIn */,
|
||||
true /* dataOut */);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class NetworkControllerWifiTest extends NetworkControllerBaseTest {
|
||||
public void testWifiIcon() {
|
||||
String testSsid = "Test SSID";
|
||||
setWifiEnabled(true);
|
||||
verifyLastWifiIcon(true, WifiIcons.WIFI_DISCONNECTED);
|
||||
verifyLastWifiIcon(false, WifiIcons.WIFI_NO_NETWORK);
|
||||
|
||||
setWifiState(true, testSsid);
|
||||
verifyLastWifiIcon(true, WifiIcons.WIFI_SIGNAL_STRENGTH[0][0]);
|
||||
|
||||
Reference in New Issue
Block a user