[Wi-Fi] Show Pie+x Wi-Fi icon when a connected Wi-Fi is not default route

This change shows Pie+x Wi-Fi icon in Wi-Fi Details for a connected Wi-Fi
network which is not the default network when

  1. It's connection speed quality is bad.
  or
  2. It has certain internet connection problem.

Bug: 163627176
Test: make RunSettingsRoboTests ROBOTEST_FILTER=WifiDetailPreferenceController2Test
      manual visual
Change-Id: I1f102471426a55c7dabd9110afba20f802abedbe
This commit is contained in:
Arc Wang
2020-08-25 17:53:58 +08:00
parent b75d2f6009
commit 20680c254c
2 changed files with 34 additions and 10 deletions

View File

@@ -299,7 +299,7 @@ public class WifiDetailPreferenceController2Test {
.thenReturn(mMockHeaderController);
when(mMockHeaderController.setSecondSummary(nullable(String.class)))
.thenReturn(mMockHeaderController);
when(mMockIconInjector.getIcon(anyInt())).thenReturn(new ColorDrawable());
when(mMockIconInjector.getIcon(anyBoolean(), anyInt())).thenReturn(new ColorDrawable());
setupMockedPreferenceScreen();
}
@@ -500,7 +500,7 @@ public class WifiDetailPreferenceController2Test {
public void entityHeader_shouldHaveIconSetForConnectedNetwork() {
setUpForConnectedNetwork();
setUpSpyController();
Drawable expectedIcon = mMockIconInjector.getIcon(LEVEL);
Drawable expectedIcon = mMockIconInjector.getIcon(false /* showX */, LEVEL);
displayAndResume();
@@ -510,7 +510,7 @@ public class WifiDetailPreferenceController2Test {
@Test
public void entityHeader_shouldHaveIconSetForDisconnectedNetwork() {
setUpForDisconnectedNetwork();
Drawable expectedIcon = mMockIconInjector.getIcon(LEVEL);
Drawable expectedIcon = mMockIconInjector.getIcon(false /* showX */, LEVEL);
displayAndResume();
@@ -615,6 +615,7 @@ public class WifiDetailPreferenceController2Test {
displayAndResume();
assertThat(mController.mShowX).isFalse();
verify(mMockSignalStrengthPref).setIcon(any(Drawable.class));
}
@@ -624,6 +625,7 @@ public class WifiDetailPreferenceController2Test {
displayAndResume();
assertThat(mController.mShowX).isFalse();
verify(mMockSignalStrengthPref).setIcon(any(Drawable.class));
}
@@ -633,6 +635,7 @@ public class WifiDetailPreferenceController2Test {
displayAndResume();
assertThat(mController.mShowX).isFalse();
verify(mMockSignalStrengthPref, never()).setIcon(any(Drawable.class));
}
@@ -645,6 +648,7 @@ public class WifiDetailPreferenceController2Test {
displayAndResume();
assertThat(mController.mShowX).isFalse();
verify(mMockSignalStrengthPref).setSummary(expectedStrength);
}
@@ -656,6 +660,7 @@ public class WifiDetailPreferenceController2Test {
displayAndResume();
assertThat(mController.mShowX).isFalse();
verify(mMockSignalStrengthPref).setSummary(expectedStrength);
}
@@ -665,9 +670,24 @@ public class WifiDetailPreferenceController2Test {
displayAndResume();
assertThat(mController.mShowX).isFalse();
verify(mMockSignalStrengthPref, never()).setSummary(any(String.class));
}
@Test
public void signalStrengthPref_shouldShowXLevelIcon_showXTrue() {
setUpForConnectedNetwork();
setUpSpyController();
final String expectedStrength =
mContext.getResources().getStringArray(R.array.wifi_signal)[LEVEL];
when(mMockWifiEntry.shouldShowXLevelIcon()).thenReturn(true);
displayAndResume();
assertThat(mController.mShowX).isTrue();
verify(mMockSignalStrengthPref).setSummary(expectedStrength);
}
@Test
public void linkSpeedPref_shouldNotShowIfNotSet() {
setUpForConnectedNetwork();
@@ -1529,7 +1549,7 @@ public class WifiDetailPreferenceController2Test {
ArgumentCaptor<BitmapDrawable> drawableCaptor =
ArgumentCaptor.forClass(BitmapDrawable.class);
Drawable original = mContext.getDrawable(Utils.getWifiIconResource(LEVEL)).mutate();
when(mMockIconInjector.getIcon(anyInt())).thenReturn(original);
when(mMockIconInjector.getIcon(anyBoolean(), anyInt())).thenReturn(original);
displayAndResume();
@@ -1548,7 +1568,7 @@ public class WifiDetailPreferenceController2Test {
ArgumentCaptor<BitmapDrawable> drawableCaptor =
ArgumentCaptor.forClass(BitmapDrawable.class);
Drawable original = mContext.getDrawable(Utils.getWifiIconResource(LEVEL)).mutate();
when(mMockIconInjector.getIcon(anyInt())).thenReturn(original);
when(mMockIconInjector.getIcon(anyBoolean(), anyInt())).thenReturn(original);
displayAndResume();