Merge "Show W+ when connected to Carrier Wi-Fi Network" into sc-dev
This commit is contained in:
@@ -28,6 +28,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.net.wifi.WifiManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.telephony.ServiceState;
|
import android.telephony.ServiceState;
|
||||||
import android.telephony.SignalStrength;
|
import android.telephony.SignalStrength;
|
||||||
@@ -56,9 +57,11 @@ import com.android.settings.network.telephony.SignalStrengthListener;
|
|||||||
import com.android.settings.network.telephony.TelephonyDisplayInfoListener;
|
import com.android.settings.network.telephony.TelephonyDisplayInfoListener;
|
||||||
import com.android.settings.widget.GearPreference;
|
import com.android.settings.widget.GearPreference;
|
||||||
import com.android.settings.wifi.WifiPickerTrackerHelper;
|
import com.android.settings.wifi.WifiPickerTrackerHelper;
|
||||||
|
import com.android.settingslib.SignalIcon.MobileIconGroup;
|
||||||
import com.android.settingslib.core.AbstractPreferenceController;
|
import com.android.settingslib.core.AbstractPreferenceController;
|
||||||
import com.android.settingslib.mobile.MobileMappings;
|
import com.android.settingslib.mobile.MobileMappings;
|
||||||
import com.android.settingslib.mobile.MobileMappings.Config;
|
import com.android.settingslib.mobile.MobileMappings.Config;
|
||||||
|
import com.android.settingslib.mobile.TelephonyIcons;
|
||||||
import com.android.settingslib.net.SignalStrengthUtil;
|
import com.android.settingslib.net.SignalStrengthUtil;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -96,13 +99,15 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
|||||||
private WifiPickerTrackerHelper mWifiPickerTrackerHelper;
|
private WifiPickerTrackerHelper mWifiPickerTrackerHelper;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
final BroadcastReceiver mDataSubscriptionChangedReceiver = new BroadcastReceiver() {
|
final BroadcastReceiver mConnectionChangeReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
final String action = intent.getAction();
|
final String action = intent.getAction();
|
||||||
if (action.equals(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED)) {
|
if (action.equals(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED)) {
|
||||||
mConfig = mSubsPrefCtrlInjector.getConfig(mContext);
|
mConfig = mSubsPrefCtrlInjector.getConfig(mContext);
|
||||||
update();
|
update();
|
||||||
|
} else if (action.equals(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION)) {
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -159,17 +164,17 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
|||||||
mConfig = mSubsPrefCtrlInjector.getConfig(mContext);
|
mConfig = mSubsPrefCtrlInjector.getConfig(mContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerDataSubscriptionChangedReceiver() {
|
private void registerReceiver() {
|
||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED);
|
filter.addAction(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED);
|
||||||
mContext.registerReceiver(mDataSubscriptionChangedReceiver, filter);
|
filter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
|
||||||
|
mContext.registerReceiver(mConnectionChangeReceiver, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unRegisterDataSubscriptionChangedReceiver() {
|
private void unRegisterReceiver() {
|
||||||
if (mDataSubscriptionChangedReceiver != null) {
|
if (mConnectionChangeReceiver != null) {
|
||||||
mContext.unregisterReceiver(mDataSubscriptionChangedReceiver);
|
mContext.unregisterReceiver(mConnectionChangeReceiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnLifecycleEvent(ON_RESUME)
|
@OnLifecycleEvent(ON_RESUME)
|
||||||
@@ -179,7 +184,7 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
|||||||
mConnectivityListener.start();
|
mConnectivityListener.start();
|
||||||
mSignalStrengthListener.resume();
|
mSignalStrengthListener.resume();
|
||||||
mTelephonyDisplayInfoListener.resume();
|
mTelephonyDisplayInfoListener.resume();
|
||||||
registerDataSubscriptionChangedReceiver();
|
registerReceiver();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,7 +195,7 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
|||||||
mConnectivityListener.stop();
|
mConnectivityListener.stop();
|
||||||
mSignalStrengthListener.pause();
|
mSignalStrengthListener.pause();
|
||||||
mTelephonyDisplayInfoListener.pause();
|
mTelephonyDisplayInfoListener.pause();
|
||||||
unRegisterDataSubscriptionChangedReceiver();
|
unRegisterReceiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -264,9 +269,12 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
|||||||
|
|
||||||
final boolean isDataInService = tmForSubId.getDataState()
|
final boolean isDataInService = tmForSubId.getDataState()
|
||||||
== TelephonyManager.DATA_CONNECTED;
|
== TelephonyManager.DATA_CONNECTED;
|
||||||
|
final boolean isActiveCarrierNetwork =
|
||||||
|
(mWifiPickerTrackerHelper != null)
|
||||||
|
&& mWifiPickerTrackerHelper.isActiveCarrierNetwork();
|
||||||
String result = mSubsPrefCtrlInjector.getNetworkType(
|
String result = mSubsPrefCtrlInjector.getNetworkType(
|
||||||
mContext, mConfig, mTelephonyDisplayInfo, subId);
|
mContext, mConfig, mTelephonyDisplayInfo, subId, isActiveCarrierNetwork);
|
||||||
if (mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext)) {
|
if (mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext) || isActiveCarrierNetwork) {
|
||||||
result = mContext.getString(R.string.preference_summary_default_combination,
|
result = mContext.getString(R.string.preference_summary_default_combination,
|
||||||
mContext.getString(R.string.mobile_data_connection_active), result);
|
mContext.getString(R.string.mobile_data_connection_active), result);
|
||||||
} else if (!isDataInService) {
|
} else if (!isDataInService) {
|
||||||
@@ -288,7 +296,8 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
|||||||
Drawable icon = mSubsPrefCtrlInjector.getIcon(mContext, level, numLevels, false);
|
Drawable icon = mSubsPrefCtrlInjector.getIcon(mContext, level, numLevels, false);
|
||||||
final boolean isActiveCellularNetwork =
|
final boolean isActiveCellularNetwork =
|
||||||
mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext);
|
mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext);
|
||||||
if (isActiveCellularNetwork) {
|
if (isActiveCellularNetwork || (mWifiPickerTrackerHelper != null)
|
||||||
|
&& mWifiPickerTrackerHelper.isActiveCarrierNetwork()) {
|
||||||
icon.setTint(Utils.getColorAccentDefaultColor(mContext));
|
icon.setTint(Utils.getColorAccentDefaultColor(mContext));
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
@@ -523,7 +532,7 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public static class SubsPrefCtrlInjector {
|
public static class SubsPrefCtrlInjector {
|
||||||
/**
|
/**
|
||||||
* Use to inject function and value for class and test class.
|
* Uses to inject function and value for class and test class.
|
||||||
*/
|
*/
|
||||||
public boolean canSubscriptionBeDisplayed(Context context, int subId) {
|
public boolean canSubscriptionBeDisplayed(Context context, int subId) {
|
||||||
return (SubscriptionUtil.getAvailableSubscription(context,
|
return (SubscriptionUtil.getAvailableSubscription(context,
|
||||||
@@ -538,42 +547,42 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get default voice subscription ID.
|
* Gets default voice subscription ID.
|
||||||
*/
|
*/
|
||||||
public int getDefaultVoiceSubscriptionId() {
|
public int getDefaultVoiceSubscriptionId() {
|
||||||
return SubscriptionManager.getDefaultVoiceSubscriptionId();
|
return SubscriptionManager.getDefaultVoiceSubscriptionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get default data subscription ID.
|
* Gets default data subscription ID.
|
||||||
*/
|
*/
|
||||||
public int getDefaultDataSubscriptionId() {
|
public int getDefaultDataSubscriptionId() {
|
||||||
return SubscriptionManager.getDefaultDataSubscriptionId();
|
return SubscriptionManager.getDefaultDataSubscriptionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirm the current network is cellular and active.
|
* Confirms the current network is cellular and active.
|
||||||
*/
|
*/
|
||||||
public boolean isActiveCellularNetwork(Context context) {
|
public boolean isActiveCellularNetwork(Context context) {
|
||||||
return MobileNetworkUtils.activeNetworkIsCellular(context);
|
return MobileNetworkUtils.activeNetworkIsCellular(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirm the flag of Provider Model switch is turned on or not.
|
* Confirms the flag of Provider Model switch is turned on or not.
|
||||||
*/
|
*/
|
||||||
public boolean isProviderModelEnabled(Context context) {
|
public boolean isProviderModelEnabled(Context context) {
|
||||||
return Utils.isProviderModelEnabled(context);
|
return Utils.isProviderModelEnabled(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get config for carrier customization.
|
* Gets config for carrier customization.
|
||||||
*/
|
*/
|
||||||
public Config getConfig(Context context) {
|
public Config getConfig(Context context) {
|
||||||
return MobileMappings.Config.readConfig(context);
|
return MobileMappings.Config.readConfig(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current mobile network type.
|
* Gets current mobile network type.
|
||||||
*/
|
*/
|
||||||
public String getNetworkType(Context context, Config config,
|
public String getNetworkType(Context context, Config config,
|
||||||
TelephonyDisplayInfo telephonyDisplayInfo, int subId) {
|
TelephonyDisplayInfo telephonyDisplayInfo, int subId) {
|
||||||
@@ -585,7 +594,24 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get signal icon with different signal level.
|
* Gets current network type of Carrier Wi-Fi Network or Cellular.
|
||||||
|
*/
|
||||||
|
public String getNetworkType(Context context, Config config,
|
||||||
|
TelephonyDisplayInfo telephonyDisplayInfo, int subId,
|
||||||
|
boolean isCarrierWifiNetwork) {
|
||||||
|
if (isCarrierWifiNetwork) {
|
||||||
|
MobileIconGroup carrierMergedWifiIconGroup = TelephonyIcons.CARRIER_MERGED_WIFI;
|
||||||
|
int resId = carrierMergedWifiIconGroup.dataContentDescription;
|
||||||
|
return resId != 0
|
||||||
|
? SubscriptionManager.getResourcesForSubId(context, subId)
|
||||||
|
.getString(resId) : "";
|
||||||
|
} else {
|
||||||
|
return getNetworkType(context, config, telephonyDisplayInfo, subId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets signal icon with different signal level.
|
||||||
*/
|
*/
|
||||||
public Drawable getIcon(Context context, int level, int numLevels, boolean cutOut) {
|
public Drawable getIcon(Context context, int level, int numLevels, boolean cutOut) {
|
||||||
return MobileNetworkUtils.getSignalStrengthIcon(context, level, numLevels,
|
return MobileNetworkUtils.getSignalStrengthIcon(context, level, numLevels,
|
||||||
|
@@ -39,8 +39,10 @@ import com.android.settings.network.MobileDataContentObserver;
|
|||||||
import com.android.settings.network.MobileDataEnabledListener;
|
import com.android.settings.network.MobileDataEnabledListener;
|
||||||
import com.android.settings.network.SubscriptionsChangeListener;
|
import com.android.settings.network.SubscriptionsChangeListener;
|
||||||
import com.android.settings.wifi.slice.WifiScanWorker;
|
import com.android.settings.wifi.slice.WifiScanWorker;
|
||||||
|
import com.android.settingslib.SignalIcon.MobileIconGroup;
|
||||||
import com.android.settingslib.mobile.MobileMappings;
|
import com.android.settingslib.mobile.MobileMappings;
|
||||||
import com.android.settingslib.mobile.MobileMappings.Config;
|
import com.android.settingslib.mobile.MobileMappings.Config;
|
||||||
|
import com.android.settingslib.mobile.TelephonyIcons;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
@@ -247,14 +249,21 @@ public class NetworkProviderWorker extends WifiScanWorker implements
|
|||||||
return SubscriptionManager.getDefaultDataSubscriptionId();
|
return SubscriptionManager.getDefaultDataSubscriptionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String updateNetworkTypeName(Context context, Config config,
|
private String updateNetworkTypeName(Context context, Config config,
|
||||||
TelephonyDisplayInfo telephonyDisplayInfo, int subId) {
|
TelephonyDisplayInfo telephonyDisplayInfo, int subId) {
|
||||||
String iconKey = getIconKey(telephonyDisplayInfo);
|
String iconKey = getIconKey(telephonyDisplayInfo);
|
||||||
int resId = mapIconSets(config).get(iconKey).dataContentDescription;
|
int resId = mapIconSets(config).get(iconKey).dataContentDescription;
|
||||||
|
if (mWifiPickerTrackerHelper != null
|
||||||
|
&& mWifiPickerTrackerHelper.isActiveCarrierNetwork()) {
|
||||||
|
MobileIconGroup carrierMergedWifiIconGroup = TelephonyIcons.CARRIER_MERGED_WIFI;
|
||||||
|
resId = carrierMergedWifiIconGroup.dataContentDescription;
|
||||||
|
return resId != 0
|
||||||
|
? SubscriptionManager.getResourcesForSubId(context, subId)
|
||||||
|
.getString(resId) : "";
|
||||||
|
}
|
||||||
|
|
||||||
return resId != 0
|
return resId != 0
|
||||||
? SubscriptionManager.getResourcesForSubId(context, subId).getString(resId) : "";
|
? SubscriptionManager.getResourcesForSubId(context, subId).getString(resId) : "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@@ -139,6 +139,16 @@ public class WifiPickerTrackerHelper implements LifecycleObserver {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Confirms connection of the carrier network */
|
||||||
|
public boolean isActiveCarrierNetwork() {
|
||||||
|
final MergedCarrierEntry mergedCarrierEntry = mWifiPickerTracker.getMergedCarrierEntry();
|
||||||
|
if (mergedCarrierEntry != null) {
|
||||||
|
return mergedCarrierEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTED
|
||||||
|
&& mergedCarrierEntry.hasInternetAccess();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/** Return the carrier network ssid */
|
/** Return the carrier network ssid */
|
||||||
public String getCarrierNetworkSsid() {
|
public String getCarrierNetworkSsid() {
|
||||||
final MergedCarrierEntry mergedCarrierEntry = mWifiPickerTracker.getMergedCarrierEntry();
|
final MergedCarrierEntry mergedCarrierEntry = mWifiPickerTracker.getMergedCarrierEntry();
|
||||||
|
@@ -428,7 +428,30 @@ public class SubscriptionsPreferenceControllerTest {
|
|||||||
TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE);
|
TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE);
|
||||||
doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext);
|
doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext);
|
||||||
doReturn(networkType)
|
doReturn(networkType)
|
||||||
.when(sInjector).getNetworkType(any(), any(), any(), anyInt());
|
.when(sInjector).getNetworkType(any(), any(), any(), anyInt(), eq(false));
|
||||||
|
|
||||||
|
mController.onResume();
|
||||||
|
mController.displayPreference(mPreferenceScreen);
|
||||||
|
|
||||||
|
assertThat(mPreferenceCategory.getPreference(0).getSummary()).isEqualTo(expectedSummary);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@UiThreadTest
|
||||||
|
public void displayPreference_providerAndHasMultiSimAndActiveCarrierWifi_connectedAndWPlus() {
|
||||||
|
final CharSequence expectedSummary =
|
||||||
|
Html.fromHtml("Connected / W+", Html.FROM_HTML_MODE_LEGACY);
|
||||||
|
final String networkType = "W+";
|
||||||
|
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,
|
||||||
|
TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE);
|
||||||
|
doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext);
|
||||||
|
doReturn(networkType)
|
||||||
|
.when(sInjector).getNetworkType(any(), any(), any(), anyInt(), eq(true));
|
||||||
|
doReturn(true).when(mWifiPickerTrackerHelper).isActiveCarrierNetwork();
|
||||||
|
mController.setWifiPickerTrackerHelper(mWifiPickerTrackerHelper);
|
||||||
|
|
||||||
mController.onResume();
|
mController.onResume();
|
||||||
mController.displayPreference(mPreferenceScreen);
|
mController.displayPreference(mPreferenceScreen);
|
||||||
@@ -450,7 +473,7 @@ public class SubscriptionsPreferenceControllerTest {
|
|||||||
setupGetIconConditions(sub.get(0).getSubscriptionId(), false, false,
|
setupGetIconConditions(sub.get(0).getSubscriptionId(), false, false,
|
||||||
TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE);
|
TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE);
|
||||||
doReturn(networkType)
|
doReturn(networkType)
|
||||||
.when(sInjector).getNetworkType(any(), any(), any(), anyInt());
|
.when(sInjector).getNetworkType(any(), any(), any(), anyInt(), eq(false));
|
||||||
|
|
||||||
mController.onResume();
|
mController.onResume();
|
||||||
mController.displayPreference(mPreferenceScreen);
|
mController.displayPreference(mPreferenceScreen);
|
||||||
@@ -470,7 +493,7 @@ public class SubscriptionsPreferenceControllerTest {
|
|||||||
setupGetIconConditions(sub.get(0).getSubscriptionId(), false, true,
|
setupGetIconConditions(sub.get(0).getSubscriptionId(), false, true,
|
||||||
TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE);
|
TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE);
|
||||||
doReturn(networkType)
|
doReturn(networkType)
|
||||||
.when(sInjector).getNetworkType(any(), any(), any(), anyInt());
|
.when(sInjector).getNetworkType(any(), any(), any(), anyInt(), eq(false));
|
||||||
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
||||||
|
|
||||||
mController.onResume();
|
mController.onResume();
|
||||||
@@ -507,7 +530,7 @@ public class SubscriptionsPreferenceControllerTest {
|
|||||||
TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE);
|
TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE);
|
||||||
doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext);
|
doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext);
|
||||||
doReturn(networkType)
|
doReturn(networkType)
|
||||||
.when(sInjector).getNetworkType(any(), any(), any(), anyInt());
|
.when(sInjector).getNetworkType(any(), any(), any(), anyInt(), eq(false));
|
||||||
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
when(mTelephonyManager.isDataEnabled()).thenReturn(true);
|
||||||
|
|
||||||
mController.onResume();
|
mController.onResume();
|
||||||
@@ -533,7 +556,7 @@ public class SubscriptionsPreferenceControllerTest {
|
|||||||
TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE);
|
TelephonyManager.DATA_CONNECTED, ServiceState.STATE_IN_SERVICE);
|
||||||
doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext);
|
doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext);
|
||||||
doReturn(networkType)
|
doReturn(networkType)
|
||||||
.when(sInjector).getNetworkType(any(), any(), any(), anyInt());
|
.when(sInjector).getNetworkType(any(), any(), any(), anyInt(), eq(false));
|
||||||
|
|
||||||
mController.onResume();
|
mController.onResume();
|
||||||
mController.displayPreference(mPreferenceScreen);
|
mController.displayPreference(mPreferenceScreen);
|
||||||
@@ -560,7 +583,7 @@ public class SubscriptionsPreferenceControllerTest {
|
|||||||
TelephonyManager.DATA_DISCONNECTED, ServiceState.STATE_OUT_OF_SERVICE);
|
TelephonyManager.DATA_DISCONNECTED, ServiceState.STATE_OUT_OF_SERVICE);
|
||||||
doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext);
|
doReturn(mock(MobileMappings.Config.class)).when(sInjector).getConfig(mContext);
|
||||||
doReturn(networkType)
|
doReturn(networkType)
|
||||||
.when(sInjector).getNetworkType(any(), any(), any(), anyInt());
|
.when(sInjector).getNetworkType(any(), any(), any(), anyInt(), eq(false));
|
||||||
|
|
||||||
mController.onResume();
|
mController.onResume();
|
||||||
mController.displayPreference(mPreferenceScreen);
|
mController.displayPreference(mPreferenceScreen);
|
||||||
@@ -595,7 +618,7 @@ public class SubscriptionsPreferenceControllerTest {
|
|||||||
|
|
||||||
mController.onResume();
|
mController.onResume();
|
||||||
mController.displayPreference(mPreferenceScreen);
|
mController.displayPreference(mPreferenceScreen);
|
||||||
mController.mDataSubscriptionChangedReceiver.onReceive(mContext, intent);
|
mController.mConnectionChangeReceiver.onReceive(mContext, intent);
|
||||||
|
|
||||||
assertThat(mController.isAvailable()).isTrue();
|
assertThat(mController.isAvailable()).isTrue();
|
||||||
assertThat(mPreferenceCategory.getPreferenceCount()).isEqualTo(1);
|
assertThat(mPreferenceCategory.getPreferenceCount()).isEqualTo(1);
|
||||||
@@ -621,7 +644,7 @@ public class SubscriptionsPreferenceControllerTest {
|
|||||||
|
|
||||||
doReturn(sub.get(1)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
|
doReturn(sub.get(1)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
|
||||||
|
|
||||||
mController.mDataSubscriptionChangedReceiver.onReceive(mContext, intent);
|
mController.mConnectionChangeReceiver.onReceive(mContext, intent);
|
||||||
|
|
||||||
assertThat(mController.isAvailable()).isTrue();
|
assertThat(mController.isAvailable()).isTrue();
|
||||||
assertThat(mPreferenceCategory.getPreferenceCount()).isEqualTo(1);
|
assertThat(mPreferenceCategory.getPreferenceCount()).isEqualTo(1);
|
||||||
|
Reference in New Issue
Block a user