Loading telephony/java/com/android/internal/telephony/PhoneBase.java +3 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ public abstract class PhoneBase extends Handler implements Phone { boolean mDoesRilSendMultipleCallRing; int mCallRingContinueToken = 0; int mCallRingDelay; public boolean mIsTheCurrentActivePhone = true; /** * Set a system property, unless we're in unit test mode Loading Loading @@ -226,6 +227,8 @@ public abstract class PhoneBase extends Handler implements Phone { public void dispose() { synchronized(PhoneProxy.lockForRadioTechnologyChange) { mCM.unSetOnCallRing(this); mDataConnection.onCleanUpConnection(false, REASON_RADIO_TURNED_OFF); mIsTheCurrentActivePhone = false; } } Loading telephony/java/com/android/internal/telephony/PhoneProxy.java +18 −11 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.Handler; import android.os.Message; import android.os.SystemProperties; import android.preference.PreferenceManager; import android.telephony.CellLocation; import android.telephony.PhoneStateListener; Loading @@ -40,8 +41,6 @@ import java.util.List; public class PhoneProxy extends Handler implements Phone { public final static Object lockForRadioTechnologyChange = new Object(); // private static boolean radioTechnologyChangeGsmToCdma = false; // private static boolean radioTechnologyChangeCdmaToGsm = false; private Phone mActivePhone; private String mOutgoingPhone; Loading @@ -50,12 +49,16 @@ public class PhoneProxy extends Handler implements Phone { private IccPhoneBookInterfaceManagerProxy mIccPhoneBookInterfaceManagerProxy; private PhoneSubInfoProxy mPhoneSubInfoProxy; private boolean mResetModemOnRadioTechnologyChange = false; private static final int EVENT_RADIO_TECHNOLOGY_CHANGED = 1; private static final String LOG_TAG = "PHONE"; //***** Class Methods public PhoneProxy(Phone phone) { mActivePhone = phone; mResetModemOnRadioTechnologyChange = SystemProperties.getBoolean( TelephonyProperties.PROPERTY_RESET_ON_RADIO_TECH_CHANGE, false); mIccSmsInterfaceManagerProxy = new IccSmsInterfaceManagerProxy( phone.getIccSmsInterfaceManager()); mIccPhoneBookInterfaceManagerProxy = new IccPhoneBookInterfaceManagerProxy( Loading @@ -75,11 +78,14 @@ public class PhoneProxy extends Handler implements Phone { logd("Switching phone from " + mOutgoingPhone + "Phone to " + (mOutgoingPhone.equals("GSM") ? "CDMAPhone" : "GSMPhone") ); boolean oldPowerState = false; // old power state to off if (mResetModemOnRadioTechnologyChange) { if (mCommandsInterface.getRadioState().isOn()) { oldPowerState = true; logd("Setting Radio Power to Off"); mCommandsInterface.setRadioPower(false, null); } } if(mOutgoingPhone.equals("GSM")) { logd("Make a new CDMAPhone and destroy the old GSMPhone."); Loading @@ -93,8 +99,6 @@ public class PhoneProxy extends Handler implements Phone { //System.gc(); mActivePhone = PhoneFactory.getCdmaPhone(); logd("Resetting Radio"); mCommandsInterface.setRadioPower(oldPowerState, null); ((GSMPhone)oldPhone).removeReferences(); oldPhone = null; } else { Loading @@ -111,12 +115,15 @@ public class PhoneProxy extends Handler implements Phone { //System.gc(); mActivePhone = PhoneFactory.getGsmPhone(); logd("Resetting Radio:"); mCommandsInterface.setRadioPower(oldPowerState, null); ((CDMAPhone)oldPhone).removeReferences(); oldPhone = null; } if (mResetModemOnRadioTechnologyChange) { logd("Resetting Radio"); mCommandsInterface.setRadioPower(oldPowerState, null); } //Set the new interfaces in the proxy's mIccSmsInterfaceManagerProxy.setmIccSmsInterfaceManager( mActivePhone.getIccSmsInterfaceManager()); Loading telephony/java/com/android/internal/telephony/TelephonyProperties.java +6 −0 Original line number Diff line number Diff line Loading @@ -141,4 +141,10 @@ public interface TelephonyProperties * Property to override DEFAULT_WAKE_LOCK_TIMEOUT */ static final String PROPERTY_WAKE_LOCK_TIMEOUT = "ro.ril.wake_lock_timeout"; /** * Set to true to indicate that the modem needs to be reset * when there is a radio technology change. */ static final String PROPERTY_RESET_ON_RADIO_TECH_CHANGE = "persist.radio.reset_on_switch"; } telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +34 −15 Original line number Diff line number Diff line Loading @@ -882,32 +882,46 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { } if (state == State.CONNECTED) { if (dataCallStates.size() >= 1) { switch (dataCallStates.get(0).active) { boolean isActiveOrDormantConnectionPresent = false; int connectionState = DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE; // Check for an active or dormant connection element in // the DATA_CALL_LIST array for (int index = 0; index < dataCallStates.size(); index++) { connectionState = dataCallStates.get(index).active; if (connectionState != DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE) { isActiveOrDormantConnectionPresent = true; break; } } if (!isActiveOrDormantConnectionPresent) { // No active or dormant connection Log.i(LOG_TAG, "onDataStateChanged: No active connection" + "state is CONNECTED, disconnecting/cleanup"); writeEventLogCdmaDataDrop(); cleanUpConnection(true, null); return; } switch (connectionState) { case DATA_CONNECTION_ACTIVE_PH_LINK_UP: Log.v(LOG_TAG, "onDataStateChanged: active=LINK_ACTIVE && CONNECTED, ignore"); activity = Activity.NONE; phone.notifyDataActivity(); startNetStatPoll(); break; case DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE: Log.v(LOG_TAG, "onDataStateChanged active=LINK_INACTIVE && CONNECTED, disconnecting/cleanup"); writeEventLogCdmaDataDrop(); cleanUpConnection(true, null); break; case DATA_CONNECTION_ACTIVE_PH_LINK_DOWN: Log.v(LOG_TAG, "onDataStateChanged active=LINK_DOWN && CONNECTED, dormant"); activity = Activity.DORMANT; phone.notifyDataActivity(); stopNetStatPoll(); break; default: Log.v(LOG_TAG, "onDataStateChanged: IGNORE unexpected DataCallState.active=" + dataCallStates.get(0).active); } } else { Log.v(LOG_TAG, "onDataStateChanged: network disconnected, clean up"); writeEventLogCdmaDataDrop(); cleanUpConnection(true, null); + connectionState); } } else { // TODO: Do we need to do anything? Loading Loading @@ -954,6 +968,11 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { public void handleMessage (Message msg) { if (!phone.mIsTheCurrentActivePhone) { Log.d(LOG_TAG, "Ignore CDMA msgs since CDMA phone is inactive"); return; } switch (msg.what) { case EVENT_RECORDS_LOADED: onRecordsLoaded(); Loading telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +6 −0 Original line number Diff line number Diff line Loading @@ -1454,6 +1454,12 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { public void handleMessage (Message msg) { if (DBG) Log.d(LOG_TAG,"GSMDataConnTrack handleMessage "+msg); if (!mGsmPhone.mIsTheCurrentActivePhone) { Log.d(LOG_TAG, "Ignore GSM msgs since GSM phone is inactive"); return; } switch (msg.what) { case EVENT_RECORDS_LOADED: onRecordsLoaded(); Loading Loading
telephony/java/com/android/internal/telephony/PhoneBase.java +3 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ public abstract class PhoneBase extends Handler implements Phone { boolean mDoesRilSendMultipleCallRing; int mCallRingContinueToken = 0; int mCallRingDelay; public boolean mIsTheCurrentActivePhone = true; /** * Set a system property, unless we're in unit test mode Loading Loading @@ -226,6 +227,8 @@ public abstract class PhoneBase extends Handler implements Phone { public void dispose() { synchronized(PhoneProxy.lockForRadioTechnologyChange) { mCM.unSetOnCallRing(this); mDataConnection.onCleanUpConnection(false, REASON_RADIO_TURNED_OFF); mIsTheCurrentActivePhone = false; } } Loading
telephony/java/com/android/internal/telephony/PhoneProxy.java +18 −11 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.Handler; import android.os.Message; import android.os.SystemProperties; import android.preference.PreferenceManager; import android.telephony.CellLocation; import android.telephony.PhoneStateListener; Loading @@ -40,8 +41,6 @@ import java.util.List; public class PhoneProxy extends Handler implements Phone { public final static Object lockForRadioTechnologyChange = new Object(); // private static boolean radioTechnologyChangeGsmToCdma = false; // private static boolean radioTechnologyChangeCdmaToGsm = false; private Phone mActivePhone; private String mOutgoingPhone; Loading @@ -50,12 +49,16 @@ public class PhoneProxy extends Handler implements Phone { private IccPhoneBookInterfaceManagerProxy mIccPhoneBookInterfaceManagerProxy; private PhoneSubInfoProxy mPhoneSubInfoProxy; private boolean mResetModemOnRadioTechnologyChange = false; private static final int EVENT_RADIO_TECHNOLOGY_CHANGED = 1; private static final String LOG_TAG = "PHONE"; //***** Class Methods public PhoneProxy(Phone phone) { mActivePhone = phone; mResetModemOnRadioTechnologyChange = SystemProperties.getBoolean( TelephonyProperties.PROPERTY_RESET_ON_RADIO_TECH_CHANGE, false); mIccSmsInterfaceManagerProxy = new IccSmsInterfaceManagerProxy( phone.getIccSmsInterfaceManager()); mIccPhoneBookInterfaceManagerProxy = new IccPhoneBookInterfaceManagerProxy( Loading @@ -75,11 +78,14 @@ public class PhoneProxy extends Handler implements Phone { logd("Switching phone from " + mOutgoingPhone + "Phone to " + (mOutgoingPhone.equals("GSM") ? "CDMAPhone" : "GSMPhone") ); boolean oldPowerState = false; // old power state to off if (mResetModemOnRadioTechnologyChange) { if (mCommandsInterface.getRadioState().isOn()) { oldPowerState = true; logd("Setting Radio Power to Off"); mCommandsInterface.setRadioPower(false, null); } } if(mOutgoingPhone.equals("GSM")) { logd("Make a new CDMAPhone and destroy the old GSMPhone."); Loading @@ -93,8 +99,6 @@ public class PhoneProxy extends Handler implements Phone { //System.gc(); mActivePhone = PhoneFactory.getCdmaPhone(); logd("Resetting Radio"); mCommandsInterface.setRadioPower(oldPowerState, null); ((GSMPhone)oldPhone).removeReferences(); oldPhone = null; } else { Loading @@ -111,12 +115,15 @@ public class PhoneProxy extends Handler implements Phone { //System.gc(); mActivePhone = PhoneFactory.getGsmPhone(); logd("Resetting Radio:"); mCommandsInterface.setRadioPower(oldPowerState, null); ((CDMAPhone)oldPhone).removeReferences(); oldPhone = null; } if (mResetModemOnRadioTechnologyChange) { logd("Resetting Radio"); mCommandsInterface.setRadioPower(oldPowerState, null); } //Set the new interfaces in the proxy's mIccSmsInterfaceManagerProxy.setmIccSmsInterfaceManager( mActivePhone.getIccSmsInterfaceManager()); Loading
telephony/java/com/android/internal/telephony/TelephonyProperties.java +6 −0 Original line number Diff line number Diff line Loading @@ -141,4 +141,10 @@ public interface TelephonyProperties * Property to override DEFAULT_WAKE_LOCK_TIMEOUT */ static final String PROPERTY_WAKE_LOCK_TIMEOUT = "ro.ril.wake_lock_timeout"; /** * Set to true to indicate that the modem needs to be reset * when there is a radio technology change. */ static final String PROPERTY_RESET_ON_RADIO_TECH_CHANGE = "persist.radio.reset_on_switch"; }
telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +34 −15 Original line number Diff line number Diff line Loading @@ -882,32 +882,46 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { } if (state == State.CONNECTED) { if (dataCallStates.size() >= 1) { switch (dataCallStates.get(0).active) { boolean isActiveOrDormantConnectionPresent = false; int connectionState = DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE; // Check for an active or dormant connection element in // the DATA_CALL_LIST array for (int index = 0; index < dataCallStates.size(); index++) { connectionState = dataCallStates.get(index).active; if (connectionState != DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE) { isActiveOrDormantConnectionPresent = true; break; } } if (!isActiveOrDormantConnectionPresent) { // No active or dormant connection Log.i(LOG_TAG, "onDataStateChanged: No active connection" + "state is CONNECTED, disconnecting/cleanup"); writeEventLogCdmaDataDrop(); cleanUpConnection(true, null); return; } switch (connectionState) { case DATA_CONNECTION_ACTIVE_PH_LINK_UP: Log.v(LOG_TAG, "onDataStateChanged: active=LINK_ACTIVE && CONNECTED, ignore"); activity = Activity.NONE; phone.notifyDataActivity(); startNetStatPoll(); break; case DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE: Log.v(LOG_TAG, "onDataStateChanged active=LINK_INACTIVE && CONNECTED, disconnecting/cleanup"); writeEventLogCdmaDataDrop(); cleanUpConnection(true, null); break; case DATA_CONNECTION_ACTIVE_PH_LINK_DOWN: Log.v(LOG_TAG, "onDataStateChanged active=LINK_DOWN && CONNECTED, dormant"); activity = Activity.DORMANT; phone.notifyDataActivity(); stopNetStatPoll(); break; default: Log.v(LOG_TAG, "onDataStateChanged: IGNORE unexpected DataCallState.active=" + dataCallStates.get(0).active); } } else { Log.v(LOG_TAG, "onDataStateChanged: network disconnected, clean up"); writeEventLogCdmaDataDrop(); cleanUpConnection(true, null); + connectionState); } } else { // TODO: Do we need to do anything? Loading Loading @@ -954,6 +968,11 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { public void handleMessage (Message msg) { if (!phone.mIsTheCurrentActivePhone) { Log.d(LOG_TAG, "Ignore CDMA msgs since CDMA phone is inactive"); return; } switch (msg.what) { case EVENT_RECORDS_LOADED: onRecordsLoaded(); Loading
telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +6 −0 Original line number Diff line number Diff line Loading @@ -1454,6 +1454,12 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { public void handleMessage (Message msg) { if (DBG) Log.d(LOG_TAG,"GSMDataConnTrack handleMessage "+msg); if (!mGsmPhone.mIsTheCurrentActivePhone) { Log.d(LOG_TAG, "Ignore GSM msgs since GSM phone is inactive"); return; } switch (msg.what) { case EVENT_RECORDS_LOADED: onRecordsLoaded(); Loading