Add reason field to DEACTIVATE_DATA_CALL request.
Commit 323f059d65 introduced a side effect that
PPP and MIP cannot be disconnected gracefully in case of 1X data calls.
The new disconnect reason field in DEACTIVATE_DATA_CALL will help RIL and Modem
to know whether the disconnect was done for modem shutdown or not. And
the followings can be achieved at the same time.
- Graceful PPP termination
- MIP de-registration
- RF Release Order with "Power Down De-registration" if modem is powered off.
(Also cleaned up the deprecated functions for setup/deactivate default PDP)
Change-Id: If79842ad05827326b6994e1148a6ae68b4467c45
This commit is contained in:
committed by
Wink Saville
parent
ded695bb30
commit
6ef74b1b07
@@ -951,22 +951,6 @@ public interface CommandsInterface {
|
||||
|
||||
void writeSmsToRuim(int status, String pdu, Message response);
|
||||
|
||||
/**
|
||||
* @param apn
|
||||
* @param user
|
||||
* @param password
|
||||
* @param response
|
||||
*/
|
||||
@Deprecated
|
||||
void setupDefaultPDP(String apn, String user, String password, Message response);
|
||||
|
||||
/**
|
||||
* @param cid
|
||||
* @param response
|
||||
*/
|
||||
@Deprecated
|
||||
void deactivateDefaultPDP(int cid, Message response);
|
||||
|
||||
void setRadioPower(boolean on, Message response);
|
||||
|
||||
void acknowledgeLastIncomingGsmSms(boolean success, int cause, Message response);
|
||||
@@ -1354,10 +1338,12 @@ public interface CommandsInterface {
|
||||
*
|
||||
* @param cid
|
||||
* The connection ID
|
||||
* @param reason
|
||||
* Data disconnect reason.
|
||||
* @param result
|
||||
* Callback message is empty on completion
|
||||
*/
|
||||
public void deactivateDataCall(int cid, Message result);
|
||||
public void deactivateDataCall(int cid, int reason, Message result);
|
||||
|
||||
/**
|
||||
* Activate or deactivate cell broadcast SMS for CDMA.
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.net.LinkProperties;
|
||||
import android.os.AsyncResult;
|
||||
import android.os.Message;
|
||||
import android.os.SystemProperties;
|
||||
import android.text.TextUtils;
|
||||
import android.util.EventLog;
|
||||
|
||||
import java.net.InetAddress;
|
||||
@@ -312,9 +313,19 @@ public abstract class DataConnection extends HierarchicalStateMachine {
|
||||
* and is either a DisconnectParams or ConnectionParams.
|
||||
*/
|
||||
private void tearDownData(Object o) {
|
||||
int discReason = RILConstants.DEACTIVATE_REASON_NONE;
|
||||
if ((o != null) && (o instanceof DisconnectParams)) {
|
||||
DisconnectParams dp = (DisconnectParams)o;
|
||||
Message m = dp.onCompletedMsg;
|
||||
if ((m != null) && (m.obj != null) && (m.obj instanceof String)) {
|
||||
String reason = (String)m.obj;
|
||||
if (TextUtils.equals(reason, Phone.REASON_RADIO_TURNED_OFF))
|
||||
discReason = RILConstants.DEACTIVATE_REASON_RADIO_OFF;
|
||||
}
|
||||
}
|
||||
if (phone.mCM.getRadioState().isOn()) {
|
||||
if (DBG) log("tearDownData radio is on, call deactivateDataCall");
|
||||
phone.mCM.deactivateDataCall(cid, obtainMessage(EVENT_DEACTIVATE_DONE, o));
|
||||
phone.mCM.deactivateDataCall(cid, discReason, obtainMessage(EVENT_DEACTIVATE_DONE, o));
|
||||
} else {
|
||||
if (DBG) log("tearDownData radio is off sendMessage EVENT_DEACTIVATE_DONE immediately");
|
||||
AsyncResult ar = new AsyncResult(o, null, null);
|
||||
|
||||
@@ -1264,33 +1264,6 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public void
|
||||
setupDefaultPDP(String apn, String user, String password, Message result) {
|
||||
int radioTechnology;
|
||||
int authType;
|
||||
String profile = ""; //profile number, NULL for GSM/UMTS
|
||||
|
||||
radioTechnology = RILConstants.SETUP_DATA_TECH_GSM;
|
||||
//TODO(): Add to the APN database, AuthType is set to CHAP/PAP
|
||||
authType = (user != null) ? RILConstants.SETUP_DATA_AUTH_PAP_CHAP
|
||||
: RILConstants.SETUP_DATA_AUTH_NONE;
|
||||
|
||||
setupDataCall(Integer.toString(radioTechnology), profile, apn, user,
|
||||
password, Integer.toString(authType), result);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public void
|
||||
deactivateDefaultPDP(int cid, Message result) {
|
||||
deactivateDataCall(cid, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* The preferred new alternative to setupDefaultPDP that is
|
||||
* CDMA-compatible.
|
||||
@@ -1329,15 +1302,16 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
||||
}
|
||||
|
||||
public void
|
||||
deactivateDataCall(int cid, Message result) {
|
||||
deactivateDataCall(int cid, int reason, Message result) {
|
||||
RILRequest rr
|
||||
= RILRequest.obtain(RIL_REQUEST_DEACTIVATE_DATA_CALL, result);
|
||||
|
||||
rr.mp.writeInt(1);
|
||||
rr.mp.writeInt(2);
|
||||
rr.mp.writeString(Integer.toString(cid));
|
||||
rr.mp.writeString(Integer.toString(reason));
|
||||
|
||||
if (RILJ_LOGD) riljLog(rr.serialString() + "> " +
|
||||
requestToString(rr.mRequest) + " " + cid);
|
||||
requestToString(rr.mRequest) + " " + cid + " " + reason);
|
||||
|
||||
send(rr);
|
||||
}
|
||||
|
||||
@@ -96,6 +96,10 @@ public interface RILConstants {
|
||||
int SETUP_DATA_AUTH_CHAP = 2;
|
||||
int SETUP_DATA_AUTH_PAP_CHAP = 3;
|
||||
|
||||
/* Deactivate data call reasons */
|
||||
int DEACTIVATE_REASON_NONE = 0;
|
||||
int DEACTIVATE_REASON_RADIO_OFF = 1;
|
||||
|
||||
/*
|
||||
cat include/telephony/ril.h | \
|
||||
egrep '^#define' | \
|
||||
|
||||
@@ -569,45 +569,24 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
|
||||
msg.obj = CDMAPhone.REASON_RADIO_TURNED_OFF;
|
||||
|
||||
synchronized (this) {
|
||||
if (networkType == ServiceState.RADIO_TECHNOLOGY_1xRTT) {
|
||||
/*
|
||||
* In 1x CDMA , during radio power off modem will disconnect the
|
||||
* data call and sends the power down registration message along
|
||||
* with the data call release message to the network
|
||||
*/
|
||||
|
||||
msg.arg1 = 0; // tearDown is false since modem does it anyway for 1X
|
||||
dcTracker.sendMessage(msg);
|
||||
|
||||
Log.w(LOG_TAG, "Turn off the radio right away");
|
||||
hangupAndPowerOff();
|
||||
} else {
|
||||
if (!mPendingRadioPowerOffAfterDataOff) {
|
||||
DataConnectionTracker.State currentState = dcTracker.getState();
|
||||
if (currentState != DataConnectionTracker.State.CONNECTED
|
||||
&& currentState != DataConnectionTracker.State.DISCONNECTING
|
||||
&& currentState != DataConnectionTracker.State.INITING) {
|
||||
|
||||
msg.arg1 = 0; // tearDown is false as it is not needed.
|
||||
dcTracker.sendMessage(msg);
|
||||
|
||||
if (DBG)
|
||||
log("Data disconnected, turn off radio right away.");
|
||||
hangupAndPowerOff();
|
||||
if (!mPendingRadioPowerOffAfterDataOff) {
|
||||
DataConnectionTracker.State currentState = dcTracker.getState();
|
||||
if (currentState != DataConnectionTracker.State.CONNECTED
|
||||
&& currentState != DataConnectionTracker.State.DISCONNECTING
|
||||
&& currentState != DataConnectionTracker.State.INITING) {
|
||||
msg.arg1 = 0; // tearDown is false as it is not needed.
|
||||
dcTracker.sendMessage(msg);
|
||||
if (DBG) log("Data disconnected, turn off radio right away.");
|
||||
hangupAndPowerOff();
|
||||
} else {
|
||||
msg.arg1 = 1; // tearDown is true
|
||||
dcTracker.sendMessage(msg);
|
||||
if (sendEmptyMessageDelayed(EVENT_SET_RADIO_POWER_OFF, 30000)) {
|
||||
if (DBG) log("Wait upto 30s for data to disconnect, then turn off radio.");
|
||||
mPendingRadioPowerOffAfterDataOff = true;
|
||||
} else {
|
||||
// clean data connection
|
||||
msg.arg1 = 1; // tearDown is true
|
||||
dcTracker.sendMessage(msg);
|
||||
|
||||
if (sendEmptyMessageDelayed(EVENT_SET_RADIO_POWER_OFF, 30000)) {
|
||||
if (DBG) {
|
||||
log("Wait upto 30s for data to disconnect, then turn off radio.");
|
||||
}
|
||||
mPendingRadioPowerOffAfterDataOff = true;
|
||||
} else {
|
||||
Log.w(LOG_TAG, "Cannot send delayed Msg, turn off radio right away.");
|
||||
hangupAndPowerOff();
|
||||
}
|
||||
Log.w(LOG_TAG, "Cannot send delayed Msg, turn off radio right away.");
|
||||
hangupAndPowerOff();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,19 +184,12 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface {
|
||||
public void writeSmsToRuim(int status, String pdu, Message response) {
|
||||
}
|
||||
|
||||
public void setupDefaultPDP(String apn, String user, String password,
|
||||
Message result) {
|
||||
}
|
||||
|
||||
public void deactivateDefaultPDP(int cid, Message result) {
|
||||
}
|
||||
|
||||
public void setupDataCall(String radioTechnology, String profile,
|
||||
String apn, String user, String password, String authType,
|
||||
Message result) {
|
||||
}
|
||||
|
||||
public void deactivateDataCall(int cid, Message result) {
|
||||
public void deactivateDataCall(int cid, int reason, Message result) {
|
||||
}
|
||||
|
||||
public void setRadioPower(boolean on, Message result) {
|
||||
|
||||
@@ -954,20 +954,12 @@ public final class SimulatedCommands extends BaseCommands
|
||||
unimplemented(response);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setupDefaultPDP(String apn, String user, String password, Message result) {
|
||||
unimplemented(result);
|
||||
}
|
||||
|
||||
public void setupDataCall(String radioTechnology, String profile, String apn, String user,
|
||||
String password, String authType, Message result) {
|
||||
unimplemented(result);
|
||||
}
|
||||
|
||||
public void deactivateDataCall(int cid, Message result) {unimplemented(result);}
|
||||
|
||||
@Deprecated
|
||||
public void deactivateDefaultPDP(int cid, Message result) {unimplemented(result);}
|
||||
public void deactivateDataCall(int cid, int reason, Message result) {unimplemented(result);}
|
||||
|
||||
public void setPreferredNetworkType(int networkType , Message result) {
|
||||
mNetworkType = networkType;
|
||||
|
||||
Reference in New Issue
Block a user