Merge change I36785a9d into eclair-mr2
* changes: Telephony: Make resetting radio on a radio technology change optional
This commit is contained in:
@@ -114,6 +114,7 @@ public abstract class PhoneBase extends Handler implements Phone {
|
|||||||
boolean mDoesRilSendMultipleCallRing;
|
boolean mDoesRilSendMultipleCallRing;
|
||||||
int mCallRingContinueToken = 0;
|
int mCallRingContinueToken = 0;
|
||||||
int mCallRingDelay;
|
int mCallRingDelay;
|
||||||
|
public boolean mIsTheCurrentActivePhone = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a system property, unless we're in unit test mode
|
* Set a system property, unless we're in unit test mode
|
||||||
@@ -226,6 +227,8 @@ public abstract class PhoneBase extends Handler implements Phone {
|
|||||||
public void dispose() {
|
public void dispose() {
|
||||||
synchronized(PhoneProxy.lockForRadioTechnologyChange) {
|
synchronized(PhoneProxy.lockForRadioTechnologyChange) {
|
||||||
mCM.unSetOnCallRing(this);
|
mCM.unSetOnCallRing(this);
|
||||||
|
mDataConnection.onCleanUpConnection(false, REASON_RADIO_TURNED_OFF);
|
||||||
|
mIsTheCurrentActivePhone = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import android.content.Intent;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.os.SystemProperties;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.telephony.CellLocation;
|
import android.telephony.CellLocation;
|
||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
@@ -40,8 +41,6 @@ import java.util.List;
|
|||||||
|
|
||||||
public class PhoneProxy extends Handler implements Phone {
|
public class PhoneProxy extends Handler implements Phone {
|
||||||
public final static Object lockForRadioTechnologyChange = new Object();
|
public final static Object lockForRadioTechnologyChange = new Object();
|
||||||
// private static boolean radioTechnologyChangeGsmToCdma = false;
|
|
||||||
// private static boolean radioTechnologyChangeCdmaToGsm = false;
|
|
||||||
|
|
||||||
private Phone mActivePhone;
|
private Phone mActivePhone;
|
||||||
private String mOutgoingPhone;
|
private String mOutgoingPhone;
|
||||||
@@ -50,12 +49,16 @@ public class PhoneProxy extends Handler implements Phone {
|
|||||||
private IccPhoneBookInterfaceManagerProxy mIccPhoneBookInterfaceManagerProxy;
|
private IccPhoneBookInterfaceManagerProxy mIccPhoneBookInterfaceManagerProxy;
|
||||||
private PhoneSubInfoProxy mPhoneSubInfoProxy;
|
private PhoneSubInfoProxy mPhoneSubInfoProxy;
|
||||||
|
|
||||||
|
private boolean mResetModemOnRadioTechnologyChange = false;
|
||||||
|
|
||||||
private static final int EVENT_RADIO_TECHNOLOGY_CHANGED = 1;
|
private static final int EVENT_RADIO_TECHNOLOGY_CHANGED = 1;
|
||||||
private static final String LOG_TAG = "PHONE";
|
private static final String LOG_TAG = "PHONE";
|
||||||
|
|
||||||
//***** Class Methods
|
//***** Class Methods
|
||||||
public PhoneProxy(Phone phone) {
|
public PhoneProxy(Phone phone) {
|
||||||
mActivePhone = phone;
|
mActivePhone = phone;
|
||||||
|
mResetModemOnRadioTechnologyChange = SystemProperties.getBoolean(
|
||||||
|
TelephonyProperties.PROPERTY_RESET_ON_RADIO_TECH_CHANGE, false);
|
||||||
mIccSmsInterfaceManagerProxy = new IccSmsInterfaceManagerProxy(
|
mIccSmsInterfaceManagerProxy = new IccSmsInterfaceManagerProxy(
|
||||||
phone.getIccSmsInterfaceManager());
|
phone.getIccSmsInterfaceManager());
|
||||||
mIccPhoneBookInterfaceManagerProxy = new IccPhoneBookInterfaceManagerProxy(
|
mIccPhoneBookInterfaceManagerProxy = new IccPhoneBookInterfaceManagerProxy(
|
||||||
@@ -74,12 +77,15 @@ public class PhoneProxy extends Handler implements Phone {
|
|||||||
mOutgoingPhone = ((PhoneBase)mActivePhone).getPhoneName();
|
mOutgoingPhone = ((PhoneBase)mActivePhone).getPhoneName();
|
||||||
logd("Switching phone from " + mOutgoingPhone + "Phone to " +
|
logd("Switching phone from " + mOutgoingPhone + "Phone to " +
|
||||||
(mOutgoingPhone.equals("GSM") ? "CDMAPhone" : "GSMPhone") );
|
(mOutgoingPhone.equals("GSM") ? "CDMAPhone" : "GSMPhone") );
|
||||||
boolean oldPowerState = false; //old power state to off
|
boolean oldPowerState = false; // old power state to off
|
||||||
if (mCommandsInterface.getRadioState().isOn()) {
|
if (mResetModemOnRadioTechnologyChange) {
|
||||||
oldPowerState = true;
|
if (mCommandsInterface.getRadioState().isOn()) {
|
||||||
logd("Setting Radio Power to Off");
|
oldPowerState = true;
|
||||||
mCommandsInterface.setRadioPower(false, null);
|
logd("Setting Radio Power to Off");
|
||||||
|
mCommandsInterface.setRadioPower(false, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mOutgoingPhone.equals("GSM")) {
|
if(mOutgoingPhone.equals("GSM")) {
|
||||||
logd("Make a new CDMAPhone and destroy the old GSMPhone.");
|
logd("Make a new CDMAPhone and destroy the old GSMPhone.");
|
||||||
|
|
||||||
@@ -93,8 +99,6 @@ public class PhoneProxy extends Handler implements Phone {
|
|||||||
//System.gc();
|
//System.gc();
|
||||||
|
|
||||||
mActivePhone = PhoneFactory.getCdmaPhone();
|
mActivePhone = PhoneFactory.getCdmaPhone();
|
||||||
logd("Resetting Radio");
|
|
||||||
mCommandsInterface.setRadioPower(oldPowerState, null);
|
|
||||||
((GSMPhone)oldPhone).removeReferences();
|
((GSMPhone)oldPhone).removeReferences();
|
||||||
oldPhone = null;
|
oldPhone = null;
|
||||||
} else {
|
} else {
|
||||||
@@ -111,12 +115,15 @@ public class PhoneProxy extends Handler implements Phone {
|
|||||||
//System.gc();
|
//System.gc();
|
||||||
|
|
||||||
mActivePhone = PhoneFactory.getGsmPhone();
|
mActivePhone = PhoneFactory.getGsmPhone();
|
||||||
logd("Resetting Radio:");
|
|
||||||
mCommandsInterface.setRadioPower(oldPowerState, null);
|
|
||||||
((CDMAPhone)oldPhone).removeReferences();
|
((CDMAPhone)oldPhone).removeReferences();
|
||||||
oldPhone = null;
|
oldPhone = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mResetModemOnRadioTechnologyChange) {
|
||||||
|
logd("Resetting Radio");
|
||||||
|
mCommandsInterface.setRadioPower(oldPowerState, null);
|
||||||
|
}
|
||||||
|
|
||||||
//Set the new interfaces in the proxy's
|
//Set the new interfaces in the proxy's
|
||||||
mIccSmsInterfaceManagerProxy.setmIccSmsInterfaceManager(
|
mIccSmsInterfaceManagerProxy.setmIccSmsInterfaceManager(
|
||||||
mActivePhone.getIccSmsInterfaceManager());
|
mActivePhone.getIccSmsInterfaceManager());
|
||||||
|
|||||||
@@ -141,4 +141,10 @@ public interface TelephonyProperties
|
|||||||
* Property to override DEFAULT_WAKE_LOCK_TIMEOUT
|
* Property to override DEFAULT_WAKE_LOCK_TIMEOUT
|
||||||
*/
|
*/
|
||||||
static final String PROPERTY_WAKE_LOCK_TIMEOUT = "ro.ril.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";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -871,7 +871,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_CDMA_DATA_DROP, val);
|
EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_CDMA_DATA_DROP, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onDataStateChanged (AsyncResult ar) {
|
protected void onDataStateChanged(AsyncResult ar) {
|
||||||
ArrayList<DataCallState> dataCallStates = (ArrayList<DataCallState>)(ar.result);
|
ArrayList<DataCallState> dataCallStates = (ArrayList<DataCallState>)(ar.result);
|
||||||
|
|
||||||
if (ar.exception != null) {
|
if (ar.exception != null) {
|
||||||
@@ -882,32 +882,46 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (state == State.CONNECTED) {
|
if (state == State.CONNECTED) {
|
||||||
if (dataCallStates.size() >= 1) {
|
boolean isActiveOrDormantConnectionPresent = false;
|
||||||
switch (dataCallStates.get(0).active) {
|
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:
|
case DATA_CONNECTION_ACTIVE_PH_LINK_UP:
|
||||||
Log.v(LOG_TAG, "onDataStateChanged: active=LINK_ACTIVE && CONNECTED, ignore");
|
Log.v(LOG_TAG, "onDataStateChanged: active=LINK_ACTIVE && CONNECTED, ignore");
|
||||||
activity = Activity.NONE;
|
activity = Activity.NONE;
|
||||||
phone.notifyDataActivity();
|
phone.notifyDataActivity();
|
||||||
|
startNetStatPoll();
|
||||||
break;
|
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:
|
case DATA_CONNECTION_ACTIVE_PH_LINK_DOWN:
|
||||||
Log.v(LOG_TAG, "onDataStateChanged active=LINK_DOWN && CONNECTED, dormant");
|
Log.v(LOG_TAG, "onDataStateChanged active=LINK_DOWN && CONNECTED, dormant");
|
||||||
activity = Activity.DORMANT;
|
activity = Activity.DORMANT;
|
||||||
phone.notifyDataActivity();
|
phone.notifyDataActivity();
|
||||||
|
stopNetStatPoll();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Log.v(LOG_TAG, "onDataStateChanged: IGNORE unexpected DataCallState.active="
|
Log.v(LOG_TAG, "onDataStateChanged: IGNORE unexpected DataCallState.active="
|
||||||
+ dataCallStates.get(0).active);
|
+ connectionState);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.v(LOG_TAG, "onDataStateChanged: network disconnected, clean up");
|
|
||||||
writeEventLogCdmaDataDrop();
|
|
||||||
cleanUpConnection(true, null);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: Do we need to do anything?
|
// TODO: Do we need to do anything?
|
||||||
@@ -954,6 +968,11 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
|
|
||||||
public void handleMessage (Message msg) {
|
public void handleMessage (Message msg) {
|
||||||
|
|
||||||
|
if (!phone.mIsTheCurrentActivePhone) {
|
||||||
|
Log.d(LOG_TAG, "Ignore CDMA msgs since CDMA phone is inactive");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
case EVENT_RECORDS_LOADED:
|
case EVENT_RECORDS_LOADED:
|
||||||
onRecordsLoaded();
|
onRecordsLoaded();
|
||||||
|
|||||||
@@ -1454,6 +1454,12 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
|
|
||||||
public void handleMessage (Message msg) {
|
public void handleMessage (Message msg) {
|
||||||
if (DBG) Log.d(LOG_TAG,"GSMDataConnTrack handleMessage "+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) {
|
switch (msg.what) {
|
||||||
case EVENT_RECORDS_LOADED:
|
case EVENT_RECORDS_LOADED:
|
||||||
onRecordsLoaded();
|
onRecordsLoaded();
|
||||||
|
|||||||
Reference in New Issue
Block a user