When data switches during voice call, make sure signal bar updates it.

isDataEnabled only reflects user setting of mobile data is on or off.
isDataCapable reflects better of whether the data could be setup or not,
considering user settings and other restrictions and exceptions.

We should use isDataCapable when deciding what to show in signal bar.

When non default data SIM is in voice call, there could be an exception
that we also setup data on that SIM.

Bug: 134981077
Test: manual
Change-Id: I54fc4ca104cb451af847d7973fbffc7f0ed97c10
This commit is contained in:
Malcolm Chen
2019-06-11 19:48:38 -07:00
committed by Xiangyu/Malcolm Chen
parent 0a6355e4dc
commit 04be9d1972
3 changed files with 9 additions and 8 deletions

View File

@@ -545,7 +545,7 @@ public class MobileSignalController extends SignalController<
}
private boolean isDataDisabled() {
return !mPhone.getDataEnabled(mSubscriptionInfo.getSubscriptionId());
return !mPhone.isDataCapable();
}
@VisibleForTesting
@@ -566,6 +566,7 @@ public class MobileSignalController extends SignalController<
pw.println(" mDataState=" + mDataState + ",");
pw.println(" mDataNetType=" + mDataNetType + ",");
pw.println(" mInflateSignalStrengths=" + mInflateSignalStrengths + ",");
pw.println(" isDataDisabled=" + isDataDisabled() + ",");
}
class MobilePhoneStateListener extends PhoneStateListener {

View File

@@ -164,7 +164,7 @@ public class NetworkControllerBaseTest extends SysuiTestCase {
protected void setupNetworkController() {
// For now just pretend to be the data sim, so we can test that too.
mSubId = SubscriptionManager.DEFAULT_SUBSCRIPTION_ID;
when(mMockTm.getDataEnabled(mSubId)).thenReturn(true);
when(mMockTm.isDataCapable()).thenReturn(true);
setDefaultSubId(mSubId);
setSubscriptions(mSubId);
mMobileSignalController = mNetworkController.mMobileSignalControllers.get(mSubId);

View File

@@ -119,7 +119,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
@Test
public void testNoInternetIcon_withDefaultSub() {
setupNetworkController();
when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
when(mMockTm.isDataCapable()).thenReturn(false);
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_CONNECTED, 0);
setConnectivityViaBroadcast(NetworkCapabilities.TRANSPORT_CELLULAR, false, false);
@@ -133,7 +133,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
@Test
public void testDataDisabledIcon_withDefaultSub() {
setupNetworkController();
when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
when(mMockTm.isDataCapable()).thenReturn(false);
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_DISCONNECTED, 0);
setConnectivityViaBroadcast(NetworkCapabilities.TRANSPORT_CELLULAR, false, false);
@@ -147,7 +147,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
@Test
public void testNoInternetIcon_withoutDefaultSub() {
setupNetworkController();
when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
when(mMockTm.isDataCapable()).thenReturn(false);
setupDefaultSignal();
setDefaultSubId(mSubId + 1);
updateDataConnectionState(TelephonyManager.DATA_CONNECTED, 0);
@@ -162,7 +162,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
@Test
public void testDataDisabledIcon_withoutDefaultSub() {
setupNetworkController();
when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
when(mMockTm.isDataCapable()).thenReturn(false);
setupDefaultSignal();
setDefaultSubId(mSubId + 1);
updateDataConnectionState(TelephonyManager.DATA_DISCONNECTED, 0);
@@ -218,7 +218,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
@Test
public void testDataDisabledIcon_UserNotSetup() {
setupNetworkController();
when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
when(mMockTm.isDataCapable()).thenReturn(false);
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_DISCONNECTED, 0);
setConnectivityViaBroadcast(NetworkCapabilities.TRANSPORT_CELLULAR, false, false);
@@ -233,7 +233,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
@Test
public void testAlwaysShowDataRatIcon() {
setupDefaultSignal();
when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
when(mMockTm.isDataCapable()).thenReturn(false);
updateDataConnectionState(TelephonyManager.DATA_DISCONNECTED,
TelephonyManager.NETWORK_TYPE_GSM);