From 44038aa032ffd876f3c9b20a84db9d189f77e18e Mon Sep 17 00:00:00 2001 From: Wink Saville Date: Mon, 13 Apr 2009 21:15:23 -0700 Subject: Fix crash when mSST is null and change default to GSM. --- .../java/com/android/internal/telephony/Phone.java | 2 +- .../android/internal/telephony/PhoneFactory.java | 21 ++++++++------------- .../java/com/android/internal/telephony/RIL.java | 14 +++++--------- .../android/internal/telephony/RILConstants.java | 2 +- .../android/internal/telephony/cdma/CDMAPhone.java | 5 +++++ .../android/internal/telephony/gsm/GSMPhone.java | 5 +++++ 6 files changed, 25 insertions(+), 24 deletions(-) mode change 100644 => 100755 telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java mode change 100644 => 100755 telephony/java/com/android/internal/telephony/gsm/GSMPhone.java (limited to 'telephony/java/com') diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java index ed90d32..62949b0 100644 --- a/telephony/java/com/android/internal/telephony/Phone.java +++ b/telephony/java/com/android/internal/telephony/Phone.java @@ -170,7 +170,7 @@ public interface Phone { int NT_MODE_EVDO_NO_CDMA = 6; /* EvDo only */ int NT_MODE_GLOBAL = 7; /* GSM/WCDMA, CDMA, and EvDo (auto mode, according to PRL) AVAILABLE Application Settings menu*/ - int PREFERRED_NT_MODE = NT_MODE_GLOBAL; + int PREFERRED_NT_MODE = NT_MODE_GSM_ONLY; // Used for CDMA roaming mode diff --git a/telephony/java/com/android/internal/telephony/PhoneFactory.java b/telephony/java/com/android/internal/telephony/PhoneFactory.java index 3db0499..86e2f04 100644 --- a/telephony/java/com/android/internal/telephony/PhoneFactory.java +++ b/telephony/java/com/android/internal/telephony/PhoneFactory.java @@ -108,26 +108,23 @@ public class PhoneFactory { sCommandsInterface = new RIL(context, networkMode, cdmaSubscription); switch(networkMode) { - case RILConstants.NETWORK_MODE_WCDMA_PREF: - case RILConstants.NETWORK_MODE_GSM_ONLY: - case RILConstants.NETWORK_MODE_WCDMA_ONLY: - case RILConstants.NETWORK_MODE_GSM_UMTS: - sProxyPhone = new PhoneProxy(new GSMPhone(context, - sCommandsInterface, sPhoneNotifier)); - Log.i(LOG_TAG, "Creating GSMPhone"); - break; case RILConstants.NETWORK_MODE_CDMA: case RILConstants.NETWORK_MODE_CDMA_NO_EVDO: case RILConstants.NETWORK_MODE_EVDO_NO_CDMA: + case RILConstants.NETWORK_MODE_GLOBAL: sProxyPhone = new PhoneProxy(new CDMAPhone(context, sCommandsInterface, sPhoneNotifier)); Log.i(LOG_TAG, "Creating CDMAPhone"); break; - case RILConstants.NETWORK_MODE_GLOBAL: + case RILConstants.NETWORK_MODE_WCDMA_PREF: + case RILConstants.NETWORK_MODE_GSM_ONLY: + case RILConstants.NETWORK_MODE_WCDMA_ONLY: + case RILConstants.NETWORK_MODE_GSM_UMTS: default: - sProxyPhone = new PhoneProxy(new CDMAPhone(context, + sProxyPhone = new PhoneProxy(new GSMPhone(context, sCommandsInterface, sPhoneNotifier)); - Log.i(LOG_TAG, "Creating CDMAPhone"); + Log.i(LOG_TAG, "Creating GSMPhone"); + break; } sMadeDefaults = true; } @@ -160,5 +157,3 @@ public class PhoneFactory { } } } - - diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index f5d3b32..636a223 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -565,22 +565,18 @@ public final class RIL extends BaseCommands implements CommandsInterface { mNetworkMode = networkMode; //At startup mPhoneType is first set from networkMode switch(networkMode) { - case RILConstants.NETWORK_MODE_WCDMA_PREF: - case RILConstants.NETWORK_MODE_GSM_ONLY: - case RILConstants.NETWORK_MODE_WCDMA_ONLY: - case RILConstants.NETWORK_MODE_GSM_UMTS: - mPhoneType = RILConstants.GSM_PHONE; - break; case RILConstants.NETWORK_MODE_CDMA: case RILConstants.NETWORK_MODE_CDMA_NO_EVDO: case RILConstants.NETWORK_MODE_EVDO_NO_CDMA: - mPhoneType = RILConstants.CDMA_PHONE; - break; case RILConstants.NETWORK_MODE_GLOBAL: mPhoneType = RILConstants.CDMA_PHONE; break; + case RILConstants.NETWORK_MODE_WCDMA_PREF: + case RILConstants.NETWORK_MODE_GSM_ONLY: + case RILConstants.NETWORK_MODE_WCDMA_ONLY: + case RILConstants.NETWORK_MODE_GSM_UMTS: default: - mPhoneType = RILConstants.CDMA_PHONE; + mPhoneType = RILConstants.GSM_PHONE; } PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE); diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index 028aad7..9c63627 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -51,7 +51,7 @@ public interface RILConstants { int NETWORK_MODE_EVDO_NO_CDMA = 6; /* EvDo only */ int NETWORK_MODE_GLOBAL = 7; /* GSM/WCDMA, CDMA, and EvDo (auto mode, according to PRL) AVAILABLE Application Settings menu*/ - int PREFERRED_NETWORK_MODE = NETWORK_MODE_GLOBAL; + int PREFERRED_NETWORK_MODE = NETWORK_MODE_GSM_ONLY; /* CDMA subscription source. See ril.h RIL_REQUEST_CDMA_SET_SUBSCRIPTION */ int SUBSCRIPTION_FROM_RUIM = 0; /* CDMA subscription from RUIM when available */ diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java old mode 100644 new mode 100755 index c139619..8ffb7ec --- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java +++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java @@ -475,6 +475,11 @@ public class CDMAPhone extends PhoneBase { // we report data connected ret = DataState.CONNECTED; + } else if (mSST == null) { + // Radio Technology Change is ongoning, dispose() and removeReferences() have + // already been called + + ret = DataState.DISCONNECTED; } else if (mSST.getCurrentCdmaDataConnectionState() == ServiceState.RADIO_TECHNOLOGY_UNKNOWN) { // If we're out of service, open TCP sockets may still work diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java old mode 100644 new mode 100755 index d1ae997..a2d3c5e --- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java +++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java @@ -316,6 +316,11 @@ public class GSMPhone extends PhoneBase { // we report data connected ret = DataState.CONNECTED; + } else if (mSST == null) { + // Radio Technology Change is ongoning, dispose() and removeReferences() have + // already been called + + ret = DataState.DISCONNECTED; } else if (mSST.getCurrentGprsState() != ServiceState.STATE_IN_SERVICE) { // If we're out of service, open TCP sockets may still work -- cgit v1.1