Convert signal icon to be custom drawable
This will make it really easy to change the number of bars it
displays.
Test: runtest systemui
Change-Id: If0b8a606f56430ea08fa0887af85aa0e90de1d40
Fixes: 35902355
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
index 19b4b17..505e1d8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
@@ -31,6 +31,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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());