summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalcolm Chen <refuhoo@google.com>2019-06-12 02:48:38 (GMT)
committerLuca Stefani <luca.stefani.ge1@gmail.com>2019-07-27 20:57:26 (GMT)
commit90a791ed53910b624b8f09086218c402e9b1174f (patch)
tree6f095db355a6830bd1975be58197e7344eb9ef29
parentaf4eb1c0d9b9a2eb746c39fffc6ec6d94c57414a (diff)
downloadframeworks_base-90a791ed53910b624b8f09086218c402e9b1174f.zip
frameworks_base-90a791ed53910b624b8f09086218c402e9b1174f.tar.gz
frameworks_base-90a791ed53910b624b8f09086218c402e9b1174f.tar.bz2
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 Merged-In: I54fc4ca104cb451af847d7973fbffc7f0ed97c10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java3
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java8
3 files changed, 7 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
index a046675..2671692 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -485,7 +485,7 @@ public class MobileSignalController extends SignalController<
}
private boolean isDataDisabled() {
- return !mPhone.getDataEnabled(mSubscriptionInfo.getSubscriptionId());
+ return !mPhone.isDataCapable();
}
@VisibleForTesting
@@ -505,6 +505,7 @@ public class MobileSignalController extends SignalController<
pw.println(" mSignalStrength=" + mSignalStrength + ",");
pw.println(" mDataState=" + mDataState + ",");
pw.println(" mDataNetType=" + mDataNetType + ",");
+ pw.println(" isDataDisabled=" + isDataDisabled() + ",");
}
class MobilePhoneStateListener extends PhoneStateListener {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
index 35f0dba..75fc75e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
@@ -155,7 +155,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);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
index d42940a..6b0d2cb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
@@ -115,7 +115,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
@Test
public void testNoInternetIcon() {
setupNetworkController();
- when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
+ when(mMockTm.isDataCapable()).thenReturn(false);
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_CONNECTED, 0);
setConnectivityViaBroadcast(NetworkCapabilities.TRANSPORT_CELLULAR, false, false);
@@ -129,7 +129,7 @@ public class NetworkControllerDataTest extends NetworkControllerBaseTest {
@Test
public void testDataDisabledIcon() {
setupNetworkController();
- when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
+ when(mMockTm.isDataCapable()).thenReturn(false);
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_DISCONNECTED, 0);
setConnectivityViaBroadcast(NetworkCapabilities.TRANSPORT_CELLULAR, false, false);
@@ -143,7 +143,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);
@@ -158,7 +158,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);