Merge "[Provider Model] Add cutout for signal icon if the mobile data is disabled" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
da8ab6a51d
@@ -140,7 +140,7 @@ public class ProviderModelSliceHelper {
|
||||
numLevels += 1;
|
||||
}
|
||||
return MobileNetworkUtils.getSignalStrengthIcon(mContext, level, numLevels,
|
||||
NO_CELL_DATA_TYPE_ICON, false);
|
||||
NO_CELL_DATA_TYPE_ICON, !mTelephonyManager.isDataEnabled());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -311,7 +311,8 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
||||
numLevels += 1;
|
||||
}
|
||||
|
||||
Drawable icon = mSubsPrefCtrlInjector.getIcon(mContext, level, numLevels, false);
|
||||
Drawable icon = mSubsPrefCtrlInjector.getIcon(mContext, level, numLevels,
|
||||
!mTelephonyManager.isDataEnabled());
|
||||
final boolean isActiveCellularNetwork =
|
||||
mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext);
|
||||
if (isActiveCellularNetwork || (mWifiPickerTrackerHelper != null)
|
||||
|
@@ -224,8 +224,9 @@ public class ProviderModelSliceHelperTest {
|
||||
public void getMobileDrawable_noCarrierData_getMobileDrawable() throws Throwable {
|
||||
mockConnections(false, ServiceState.STATE_OUT_OF_SERVICE, "",
|
||||
false, true);
|
||||
when(mConnectivityManager.getActiveNetwork()).thenReturn(null);
|
||||
Drawable expectDrawable = mock(Drawable.class);
|
||||
when(mConnectivityManager.getActiveNetwork()).thenReturn(null);
|
||||
when(mTelephonyManager.isDataEnabled()).thenReturn(false);
|
||||
|
||||
assertThat(mProviderModelSliceHelper.getMobileDrawable(expectDrawable)).isEqualTo(
|
||||
expectDrawable);
|
||||
@@ -236,8 +237,9 @@ public class ProviderModelSliceHelperTest {
|
||||
throws Throwable {
|
||||
mockConnections(true, ServiceState.STATE_IN_SERVICE, "", true,
|
||||
true);
|
||||
addNetworkTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);
|
||||
Drawable drawable = mock(Drawable.class);
|
||||
addNetworkTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);
|
||||
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
||||
|
||||
assertThat(mProviderModelSliceHelper.getMobileDrawable(drawable)).isEqualTo(
|
||||
mDrawableWithSignalStrength);
|
||||
@@ -252,6 +254,7 @@ public class ProviderModelSliceHelperTest {
|
||||
true);
|
||||
Drawable drawable = mock(Drawable.class);
|
||||
addNetworkTransportType(NetworkCapabilities.TRANSPORT_WIFI);
|
||||
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
||||
|
||||
assertThat(mProviderModelSliceHelper.getMobileDrawable(drawable)).isEqualTo(
|
||||
mDrawableWithSignalStrength);
|
||||
|
@@ -665,6 +665,7 @@ public class SubscriptionsPreferenceControllerTest {
|
||||
doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
|
||||
doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
|
||||
Drawable icon = mock(Drawable.class);
|
||||
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
||||
doReturn(icon).when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(false));
|
||||
setupGetIconConditions(sub.get(0).getSubscriptionId(), true, true,
|
||||
true, ServiceState.STATE_IN_SERVICE);
|
||||
@@ -683,6 +684,7 @@ public class SubscriptionsPreferenceControllerTest {
|
||||
doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
|
||||
doReturn(subs.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
|
||||
Drawable icon = mock(Drawable.class);
|
||||
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
||||
doReturn(icon).when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(false));
|
||||
setupGetIconConditions(subId, false, true,
|
||||
true, ServiceState.STATE_IN_SERVICE);
|
||||
@@ -701,7 +703,8 @@ public class SubscriptionsPreferenceControllerTest {
|
||||
doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
|
||||
doReturn(subs.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
|
||||
Drawable icon = mock(Drawable.class);
|
||||
doReturn(icon).when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(false));
|
||||
when(mTelephonyManager.isDataEnabled()).thenReturn(false);
|
||||
doReturn(icon).when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(true));
|
||||
|
||||
setupGetIconConditions(subId, false, false,
|
||||
false, ServiceState.STATE_IN_SERVICE);
|
||||
|
Reference in New Issue
Block a user