summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorKazuhiro Ondo <kazuhiro.ondo@motorola.com>2010-12-02 01:34:27 -0600
committerWink Saville <wink@google.com>2010-12-02 16:15:22 -0800
commit6ef74b1b073f04f55ef43095a336bd10d599dedf (patch)
tree83cfd066fc4709557d455e7501fd1af353463952 /telephony
parentded695bb30e9c88c48c37e6fa5736771c6011b3d (diff)
downloadframeworks_base-6ef74b1b073f04f55ef43095a336bd10d599dedf.zip
frameworks_base-6ef74b1b073f04f55ef43095a336bd10d599dedf.tar.gz
frameworks_base-6ef74b1b073f04f55ef43095a336bd10d599dedf.tar.bz2
Add reason field to DEACTIVATE_DATA_CALL request.
Commit 323f059d65db8413ee2ca8ce04533bc00e4f84e4 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
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/com/android/internal/telephony/CommandsInterface.java20
-rw-r--r--telephony/java/com/android/internal/telephony/DataConnection.java13
-rw-r--r--telephony/java/com/android/internal/telephony/RIL.java34
-rw-r--r--telephony/java/com/android/internal/telephony/RILConstants.java4
-rwxr-xr-xtelephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java55
-rw-r--r--telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java9
-rw-r--r--telephony/java/com/android/internal/telephony/test/SimulatedCommands.java10
7 files changed, 42 insertions, 103 deletions
diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java
index 27a4dca..c7da3d4 100644
--- a/telephony/java/com/android/internal/telephony/CommandsInterface.java
+++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java
@@ -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.
diff --git a/telephony/java/com/android/internal/telephony/DataConnection.java b/telephony/java/com/android/internal/telephony/DataConnection.java
index 2536745..58fb13b 100644
--- a/telephony/java/com/android/internal/telephony/DataConnection.java
+++ b/telephony/java/com/android/internal/telephony/DataConnection.java
@@ -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);
diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java
index a77e73e..916602f 100644
--- a/telephony/java/com/android/internal/telephony/RIL.java
+++ b/telephony/java/com/android/internal/telephony/RIL.java
@@ -1265,33 +1265,6 @@ public final class RIL extends BaseCommands implements CommandsInterface {
}
/**
- * @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);
}
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index 888f721..305e15f 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -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' | \
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index b60be6e..de15408 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -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();
}
}
}
diff --git a/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java b/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java
index ed578c8..2e729fe 100644
--- a/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java
+++ b/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java
@@ -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) {
diff --git a/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java b/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java
index fdcf78d..c2f88e5 100644
--- a/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java
+++ b/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java
@@ -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;