Loading src/com/android/settings/network/SubscriptionsPreferenceController.java +2 −1 Original line number Diff line number Diff line Loading @@ -257,9 +257,10 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl } private CharSequence getMobilePreferenceSummary(int subId) { TelephonyManager tm = mTelephonyManager.createForSubscriptionId(subId); String result = mSubsPrefCtrlInjector.getNetworkType( mContext, mConfig, mTelephonyDisplayInfo, subId); if (!mTelephonyManager.isDataEnabled()) { if (!tm.isDataEnabled()) { return mContext.getString(R.string.mobile_data_off_summary); } if (!result.isEmpty() && mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext)) { Loading tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java +2 −3 Original line number Diff line number Diff line Loading @@ -97,6 +97,7 @@ public class SubscriptionsPreferenceControllerTest { private LifecycleOwner mLifecycleOwner; @Mock private WifiPickerTrackerHelper mWifiPickerTrackerHelper; private LifecycleRegistry mLifecycleRegistry; private int mOnChildUpdatedCount; private Context mContext; Loading Loading @@ -428,7 +429,6 @@ public class SubscriptionsPreferenceControllerTest { doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext); doReturn(networkType) .when(sInjector).getNetworkType(any(), any(), any(), anyInt()); when(mTelephonyManager.isDataEnabled()).thenReturn(true); mController.onResume(); mController.displayPreference(mPreferenceScreen); Loading @@ -447,7 +447,7 @@ public class SubscriptionsPreferenceControllerTest { final List<SubscriptionInfo> sub = setupMockSubscriptions(2); doReturn(true).when(sInjector).isProviderModelEnabled(mContext); doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo(); setupGetIconConditions(sub.get(0).getSubscriptionId(), false, true, setupGetIconConditions(sub.get(0).getSubscriptionId(), false, false, TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE); doReturn(networkType) .when(sInjector).getNetworkType(any(), any(), any(), anyInt()); Loading Loading @@ -534,7 +534,6 @@ public class SubscriptionsPreferenceControllerTest { doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext); doReturn(networkType) .when(sInjector).getNetworkType(any(), any(), any(), anyInt()); when(mTelephonyManager.isDataEnabled()).thenReturn(true); mController.onResume(); mController.displayPreference(mPreferenceScreen); Loading Loading
src/com/android/settings/network/SubscriptionsPreferenceController.java +2 −1 Original line number Diff line number Diff line Loading @@ -257,9 +257,10 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl } private CharSequence getMobilePreferenceSummary(int subId) { TelephonyManager tm = mTelephonyManager.createForSubscriptionId(subId); String result = mSubsPrefCtrlInjector.getNetworkType( mContext, mConfig, mTelephonyDisplayInfo, subId); if (!mTelephonyManager.isDataEnabled()) { if (!tm.isDataEnabled()) { return mContext.getString(R.string.mobile_data_off_summary); } if (!result.isEmpty() && mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext)) { Loading
tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java +2 −3 Original line number Diff line number Diff line Loading @@ -97,6 +97,7 @@ public class SubscriptionsPreferenceControllerTest { private LifecycleOwner mLifecycleOwner; @Mock private WifiPickerTrackerHelper mWifiPickerTrackerHelper; private LifecycleRegistry mLifecycleRegistry; private int mOnChildUpdatedCount; private Context mContext; Loading Loading @@ -428,7 +429,6 @@ public class SubscriptionsPreferenceControllerTest { doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext); doReturn(networkType) .when(sInjector).getNetworkType(any(), any(), any(), anyInt()); when(mTelephonyManager.isDataEnabled()).thenReturn(true); mController.onResume(); mController.displayPreference(mPreferenceScreen); Loading @@ -447,7 +447,7 @@ public class SubscriptionsPreferenceControllerTest { final List<SubscriptionInfo> sub = setupMockSubscriptions(2); doReturn(true).when(sInjector).isProviderModelEnabled(mContext); doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo(); setupGetIconConditions(sub.get(0).getSubscriptionId(), false, true, setupGetIconConditions(sub.get(0).getSubscriptionId(), false, false, TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE); doReturn(networkType) .when(sInjector).getNetworkType(any(), any(), any(), anyInt()); Loading Loading @@ -534,7 +534,6 @@ public class SubscriptionsPreferenceControllerTest { doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext); doReturn(networkType) .when(sInjector).getNetworkType(any(), any(), any(), anyInt()); when(mTelephonyManager.isDataEnabled()).thenReturn(true); mController.onResume(); mController.displayPreference(mPreferenceScreen); Loading