From 2e994586ed0aa09f93951dbc4de35d56a93abe95 Mon Sep 17 00:00:00 2001 From: Kazuhiro Ondo Date: Fri, 3 Jun 2011 19:13:35 -0500 Subject: [PATCH] Report data status from ApnContext even if data is detached While in HO, data connection type may temporary become "unknown". This triggers TelephonyRegistry picks up the wrong data connection state, ending up notifying bogus state to ConnectivityService. The patch is just to pick up the status from ApnContext which should be maintaining the right state. Also cleaned up unnecessary lines which was added earlier phase. Change-Id: I07e74ce55f09ad31f2d8d09e2a144dc0b600eb0c --- .../internal/telephony/cdma/CDMALTEPhone.java | 24 ++----------------- .../internal/telephony/gsm/GSMPhone.java | 3 +++ 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java index fe2fcb22db245..518a34ab78e00 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java +++ b/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java @@ -65,32 +65,12 @@ public class CDMALTEPhone extends CDMAPhone { @Override public DataState getDataConnectionState(String apnType) { - // TODO: Remove instanceof if possible. - boolean isCdmaDataConnectionTracker = false; - if (mDataConnectionTracker instanceof CdmaDataConnectionTracker) { - log("getDataConnectionState isCdmaDataConnectionTracker"); - isCdmaDataConnectionTracker = true; - } else { - log("getDataConnectionState NOT CdmaDataConnectionTracker"); - } DataState ret = DataState.DISCONNECTED; - if (!isCdmaDataConnectionTracker && (SystemProperties.get("adb.connected", "").length() - > 0)) { - // We're connected to an ADB host and we have USB networking - // turned on. No matter what the radio state is, - // we report data connected - - ret = DataState.CONNECTED; - } else if (mSST == null) { + if (mSST == null) { // Radio Technology Change is ongoning, dispose() and - // removeReferences() have - // already been called + // removeReferences() have already been called - ret = DataState.DISCONNECTED; - } else if (mSST.getCurrentDataConnectionState() != ServiceState.STATE_IN_SERVICE) { - // If we're out of service, open TCP sockets may still work - // but no data will flow ret = DataState.DISCONNECTED; } else if (mDataConnectionTracker.isApnTypeEnabled(apnType) == false) { ret = DataState.DISCONNECTED; diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java index 3ccc03d680b8a..275c8fe437f12 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java +++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java @@ -301,6 +301,9 @@ public class GSMPhone extends PhoneBase { ret = DataState.DISCONNECTED; } else if (mDataConnectionTracker.isApnTypeEnabled(apnType) == false || mDataConnectionTracker.isApnTypeActive(apnType) == false) { + //TODO: isApnTypeActive() is just checking whether ApnContext holds + // Dataconnection or not. Checking each ApnState below should + // provide the same state. Calling isApnTypeActive() can be removed. ret = DataState.DISCONNECTED; } else { /* mSST.gprsState == ServiceState.STATE_IN_SERVICE */ switch (mDataConnectionTracker.getState(apnType)) {