Loading telephony/java/com/android/internal/telephony/Call.java +17 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.internal.telephony; import java.util.List; import android.util.Log; /** * {@hide} */ Loading Loading @@ -54,6 +56,8 @@ public abstract class Call { // merged, etc. protected boolean isGeneric = false; protected final String LOG_TAG = "Call"; /* Instance Methods */ /** Do not modify the List result!!! This list is not yours to keep Loading Loading @@ -235,4 +239,17 @@ public abstract class Call { public void setGeneric(boolean generic) { isGeneric = generic; } /** * Hangup call if it is alive */ public void hangupIfAlive() { if (getState().isAlive()) { try { hangup(); } catch (CallStateException ex) { Log.w(LOG_TAG, " hangupIfActive: caught " + ex); } } } } telephony/java/com/android/internal/telephony/ServiceStateTracker.java +7 −0 Original line number Diff line number Diff line Loading @@ -271,6 +271,13 @@ public abstract class ServiceStateTracker extends Handler { protected abstract void updateSpnDisplay(); protected abstract void setPowerStateToDesired(); /** * Clean up existing voice and data connection then turn off radio power. * * Hang up the existing voice calls to decrease call drop rate. */ protected abstract void powerOffRadioSafely(); /** Cancel a pending (if any) pollState() operation */ protected void cancelPollState() { // This will effectively cancel the rest of the poll requests. Loading telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +42 −24 Original line number Diff line number Diff line Loading @@ -514,7 +514,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { synchronized(this) { if (mPendingRadioPowerOffAfterDataOff) { if (DBG) log("EVENT_SET_RADIO_OFF, turn radio off now."); cm.setRadioPower(false, null); hangupAndPowerOff(); mPendingRadioPowerOffAfterDataOff = false; } } Loading @@ -541,6 +541,17 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { dcTracker.getStateInString(), dcTracker.getAnyDataEnabled() ? 1 : 0); } // If it's on and available and we want it off gracefully powerOffRadioSafely(); } // Otherwise, we're in the desired state } @Override protected void powerOffRadioSafely(){ // clean data connection DataConnectionTracker dcTracker = phone.mDataConnection; Message msg = dcTracker.obtainMessage(DataConnectionTracker.EVENT_CLEAN_UP_CONNECTION); msg.arg1 = 1; // tearDown is true msg.obj = CDMAPhone.REASON_RADIO_TURNED_OFF; Loading @@ -553,7 +564,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { && currentState != DataConnectionTracker.State.DISCONNECTING && currentState != DataConnectionTracker.State.INITING) { if (DBG) log("Data disconnected, turn off radio right away."); cm.setRadioPower(false, null); hangupAndPowerOff(); } else if (sendEmptyMessageDelayed(EVENT_SET_RADIO_POWER_OFF, 30000)) { if (DBG) { Loading @@ -562,11 +573,10 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { mPendingRadioPowerOffAfterDataOff = true; } else { Log.w(LOG_TAG, "Cannot send delayed Msg, turn off radio right away."); cm.setRadioPower(false, null); hangupAndPowerOff(); } } } } // Otherwise, we're in the desired state } @Override Loading Loading @@ -1644,11 +1654,19 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { if (mPendingRadioPowerOffAfterDataOff) { if (DBG) log("Process pending request to turn radio off."); removeMessages(EVENT_SET_RADIO_POWER_OFF); cm.setRadioPower(false, null); hangupAndPowerOff(); mPendingRadioPowerOffAfterDataOff = false; return true; } return false; } } private void hangupAndPowerOff() { // hang up all active voice calls phone.mCT.ringingCall.hangupIfAlive(); phone.mCT.backgroundCall.hangupIfAlive(); phone.mCT.foregroundCall.hangupIfAlive(); cm.setRadioPower(false, null); } } telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +1 −1 Original line number Diff line number Diff line Loading @@ -808,7 +808,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { protected void restartRadio() { Log.d(LOG_TAG, "************TURN OFF RADIO**************"); cleanUpConnection(true, Phone.REASON_RADIO_TURNED_OFF); phone.mCM.setRadioPower(false, null); mGsmPhone.mSST.powerOffRadioSafely(); /* Note: no need to call setRadioPower(true). Assuming the desired * radio power state is still ON (as tracked by ServiceStateTracker), * ServiceStateTracker will call setRadioPower when it receives the Loading telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +32 −17 Original line number Diff line number Diff line Loading @@ -518,6 +518,15 @@ final class GsmServiceStateTracker extends ServiceStateTracker { EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_DATA_STATE_RADIO_OFF, dcTracker.getStateInString(), dcTracker.getAnyDataEnabled() ? 1 : 0); } // If it's on and available and we want it off gracefully powerOffRadioSafely(); } // Otherwise, we're in the desired state } @Override protected void powerOffRadioSafely() { // clean data connection DataConnectionTracker dcTracker = phone.mDataConnection; Message msg = dcTracker.obtainMessage(DataConnectionTracker.EVENT_CLEAN_UP_CONNECTION); msg.arg1 = 1; // tearDown is true msg.obj = GSMPhone.REASON_RADIO_TURNED_OFF; Loading @@ -533,9 +542,15 @@ final class GsmServiceStateTracker extends ServiceStateTracker { } SystemClock.sleep(DATA_STATE_POLL_SLEEP_MS); } // If it's on and available and we want it off.. // hang up all active voice calls if (phone.isInCall()) { phone.mCT.ringingCall.hangupIfAlive(); phone.mCT.backgroundCall.hangupIfAlive(); phone.mCT.foregroundCall.hangupIfAlive(); } cm.setRadioPower(false, null); } // Otherwise, we're in the desired state } protected void updateSpnDisplay() { Loading Loading
telephony/java/com/android/internal/telephony/Call.java +17 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.internal.telephony; import java.util.List; import android.util.Log; /** * {@hide} */ Loading Loading @@ -54,6 +56,8 @@ public abstract class Call { // merged, etc. protected boolean isGeneric = false; protected final String LOG_TAG = "Call"; /* Instance Methods */ /** Do not modify the List result!!! This list is not yours to keep Loading Loading @@ -235,4 +239,17 @@ public abstract class Call { public void setGeneric(boolean generic) { isGeneric = generic; } /** * Hangup call if it is alive */ public void hangupIfAlive() { if (getState().isAlive()) { try { hangup(); } catch (CallStateException ex) { Log.w(LOG_TAG, " hangupIfActive: caught " + ex); } } } }
telephony/java/com/android/internal/telephony/ServiceStateTracker.java +7 −0 Original line number Diff line number Diff line Loading @@ -271,6 +271,13 @@ public abstract class ServiceStateTracker extends Handler { protected abstract void updateSpnDisplay(); protected abstract void setPowerStateToDesired(); /** * Clean up existing voice and data connection then turn off radio power. * * Hang up the existing voice calls to decrease call drop rate. */ protected abstract void powerOffRadioSafely(); /** Cancel a pending (if any) pollState() operation */ protected void cancelPollState() { // This will effectively cancel the rest of the poll requests. Loading
telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +42 −24 Original line number Diff line number Diff line Loading @@ -514,7 +514,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { synchronized(this) { if (mPendingRadioPowerOffAfterDataOff) { if (DBG) log("EVENT_SET_RADIO_OFF, turn radio off now."); cm.setRadioPower(false, null); hangupAndPowerOff(); mPendingRadioPowerOffAfterDataOff = false; } } Loading @@ -541,6 +541,17 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { dcTracker.getStateInString(), dcTracker.getAnyDataEnabled() ? 1 : 0); } // If it's on and available and we want it off gracefully powerOffRadioSafely(); } // Otherwise, we're in the desired state } @Override protected void powerOffRadioSafely(){ // clean data connection DataConnectionTracker dcTracker = phone.mDataConnection; Message msg = dcTracker.obtainMessage(DataConnectionTracker.EVENT_CLEAN_UP_CONNECTION); msg.arg1 = 1; // tearDown is true msg.obj = CDMAPhone.REASON_RADIO_TURNED_OFF; Loading @@ -553,7 +564,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { && currentState != DataConnectionTracker.State.DISCONNECTING && currentState != DataConnectionTracker.State.INITING) { if (DBG) log("Data disconnected, turn off radio right away."); cm.setRadioPower(false, null); hangupAndPowerOff(); } else if (sendEmptyMessageDelayed(EVENT_SET_RADIO_POWER_OFF, 30000)) { if (DBG) { Loading @@ -562,11 +573,10 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { mPendingRadioPowerOffAfterDataOff = true; } else { Log.w(LOG_TAG, "Cannot send delayed Msg, turn off radio right away."); cm.setRadioPower(false, null); hangupAndPowerOff(); } } } } // Otherwise, we're in the desired state } @Override Loading Loading @@ -1644,11 +1654,19 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { if (mPendingRadioPowerOffAfterDataOff) { if (DBG) log("Process pending request to turn radio off."); removeMessages(EVENT_SET_RADIO_POWER_OFF); cm.setRadioPower(false, null); hangupAndPowerOff(); mPendingRadioPowerOffAfterDataOff = false; return true; } return false; } } private void hangupAndPowerOff() { // hang up all active voice calls phone.mCT.ringingCall.hangupIfAlive(); phone.mCT.backgroundCall.hangupIfAlive(); phone.mCT.foregroundCall.hangupIfAlive(); cm.setRadioPower(false, null); } }
telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +1 −1 Original line number Diff line number Diff line Loading @@ -808,7 +808,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { protected void restartRadio() { Log.d(LOG_TAG, "************TURN OFF RADIO**************"); cleanUpConnection(true, Phone.REASON_RADIO_TURNED_OFF); phone.mCM.setRadioPower(false, null); mGsmPhone.mSST.powerOffRadioSafely(); /* Note: no need to call setRadioPower(true). Assuming the desired * radio power state is still ON (as tracked by ServiceStateTracker), * ServiceStateTracker will call setRadioPower when it receives the Loading
telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +32 −17 Original line number Diff line number Diff line Loading @@ -518,6 +518,15 @@ final class GsmServiceStateTracker extends ServiceStateTracker { EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_DATA_STATE_RADIO_OFF, dcTracker.getStateInString(), dcTracker.getAnyDataEnabled() ? 1 : 0); } // If it's on and available and we want it off gracefully powerOffRadioSafely(); } // Otherwise, we're in the desired state } @Override protected void powerOffRadioSafely() { // clean data connection DataConnectionTracker dcTracker = phone.mDataConnection; Message msg = dcTracker.obtainMessage(DataConnectionTracker.EVENT_CLEAN_UP_CONNECTION); msg.arg1 = 1; // tearDown is true msg.obj = GSMPhone.REASON_RADIO_TURNED_OFF; Loading @@ -533,9 +542,15 @@ final class GsmServiceStateTracker extends ServiceStateTracker { } SystemClock.sleep(DATA_STATE_POLL_SLEEP_MS); } // If it's on and available and we want it off.. // hang up all active voice calls if (phone.isInCall()) { phone.mCT.ringingCall.hangupIfAlive(); phone.mCT.backgroundCall.hangupIfAlive(); phone.mCT.foregroundCall.hangupIfAlive(); } cm.setRadioPower(false, null); } // Otherwise, we're in the desired state } protected void updateSpnDisplay() { Loading