summaryrefslogtreecommitdiffstats
path: root/src/java/com/android/internal
diff options
context:
space:
mode:
authorNaveen Kalla <nkalla@codeaurora.org>2012-07-18 23:25:13 -0700
committerNaveen Kalla <nkalla@codeaurora.org>2012-08-03 13:59:07 -0700
commitb3a03455be44a2a0ffbeb757b193d860c1878599 (patch)
tree92185fc162c15e108d72eed6167c85fb1d0f0470 /src/java/com/android/internal
parentc38bb60d867c5d61d90b7179a9ed2b2d1848124f (diff)
downloadframeworks_opt_telephony-b3a03455be44a2a0ffbeb757b193d860c1878599.zip
frameworks_opt_telephony-b3a03455be44a2a0ffbeb757b193d860c1878599.tar.gz
frameworks_opt_telephony-b3a03455be44a2a0ffbeb757b193d860c1878599.tar.bz2
Add DORMANT state to GSM data link activity
GsmDataConnectionTracker sets its activity flag to DORMANT and notifies LinkActivity when RIL indicates that all its data calls are in dormant state (i.e. active is set to 1 in UNSOL_DATA_CALL_LIST_CHANGED message for all data calls) This indication is needed so that the Android public API getDataActivity() can return DATA_ACTIVITY_DORMANT when Android applications invoke this API while the phone is on a WCDMA data call. Change-Id: I81b9db36375fea4f9fb946ddd5ddf0e1d16cbbab
Diffstat (limited to 'src/java/com/android/internal')
-rw-r--r--src/java/com/android/internal/telephony/DataConnectionTracker.java7
-rw-r--r--src/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java8
-rw-r--r--src/java/com/android/internal/telephony/gsm/GSMPhone.java4
-rw-r--r--src/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java31
4 files changed, 41 insertions, 9 deletions
diff --git a/src/java/com/android/internal/telephony/DataConnectionTracker.java b/src/java/com/android/internal/telephony/DataConnectionTracker.java
index 89a02d3..ef50b91 100644
--- a/src/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/src/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -65,6 +65,13 @@ public abstract class DataConnectionTracker extends Handler {
protected static final boolean DBG = true;
protected static final boolean VDBG = false;
+ /**
+ * Constants for the data connection activity:
+ * physical link down/up
+ */
+ protected static final int DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE = 0;
+ protected static final int DATA_CONNECTION_ACTIVE_PH_LINK_DOWN = 1;
+ protected static final int DATA_CONNECTION_ACTIVE_PH_LINK_UP = 2;
/** Delay between APN attempts.
Note the property override mechanism is there just for testing purpose only. */
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
index 1088131..20f1d08 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -80,14 +80,6 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
"com.android.internal.telephony.cdma-data-stall";
- /**
- * Constants for the data connection activity:
- * physical link down/up
- */
- private static final int DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE = 0;
- private static final int DATA_CONNECTION_ACTIVE_PH_LINK_DOWN = 1;
- private static final int DATA_CONNECTION_ACTIVE_PH_LINK_UP = 2;
-
private static final String[] mSupportedApnTypes = {
PhoneConstants.APN_TYPE_DEFAULT,
PhoneConstants.APN_TYPE_MMS,
diff --git a/src/java/com/android/internal/telephony/gsm/GSMPhone.java b/src/java/com/android/internal/telephony/gsm/GSMPhone.java
index 8c5368e..34ee647 100644
--- a/src/java/com/android/internal/telephony/gsm/GSMPhone.java
+++ b/src/java/com/android/internal/telephony/gsm/GSMPhone.java
@@ -343,6 +343,10 @@ public class GSMPhone extends PhoneBase {
case DATAINANDOUT:
ret = DataActivityState.DATAINANDOUT;
break;
+
+ case DORMANT:
+ ret = DataActivityState.DORMANT;
+ break;
}
}
diff --git a/src/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/src/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index 016513c..0969ec8 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -1219,6 +1219,9 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
}
if (DBG) log("onDataStateChanged(ar): DataCallState size=" + dataCallStates.size());
+ boolean isAnyDataCallDormant = false;
+ boolean isAnyDataCallActive = false;
+
// Create a hash map to store the dataCallState of each DataConnectionAc
HashMap<DataCallState, DataConnectionAc> dataCallStateToDcac;
dataCallStateToDcac = new HashMap<DataCallState, DataConnectionAc>();
@@ -1240,6 +1243,9 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
continue;
}
+ if (newState.active == DATA_CONNECTION_ACTIVE_PH_LINK_UP) isAnyDataCallActive = true;
+ if (newState.active == DATA_CONNECTION_ACTIVE_PH_LINK_DOWN) isAnyDataCallDormant = true;
+
// The list of apn's associated with this DataConnection
Collection<ApnContext> apns = dcac.getApnListSync();
@@ -1325,6 +1331,28 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
}
}
+ if (isAnyDataCallDormant && !isAnyDataCallActive) {
+ // There is no way to indicate link activity per APN right now. So
+ // Link Activity will be considered dormant only when all data calls
+ // are dormant.
+ // If a single data call is in dormant state and none of the data
+ // calls are active broadcast overall link state as dormant.
+ mActivity = DctConstants.Activity.DORMANT;
+ if (DBG) {
+ log("onDataStateChanged: Data Activity updated to DORMANT. stopNetStatePoll");
+ }
+ stopNetStatPoll();
+ } else {
+ mActivity = DctConstants.Activity.NONE;
+ if (DBG) {
+ log("onDataStateChanged: Data Activity updated to NONE. " +
+ "isAnyDataCallActive = " + isAnyDataCallActive +
+ " isAnyDataCallDormant = " + isAnyDataCallDormant);
+ }
+ if (isAnyDataCallActive) startNetStatPoll();
+ }
+ mPhone.notifyDataActivity();
+
if (apnsToCleanup.size() != 0) {
// Add an event log when the network drops PDP
int cid = getCellLocationId();
@@ -1560,7 +1588,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
} else if (sent == 0 && received > 0) {
newActivity = DctConstants.Activity.DATAIN;
} else {
- newActivity = DctConstants.Activity.NONE;
+ newActivity = (mActivity == DctConstants.Activity.DORMANT) ?
+ mActivity : DctConstants.Activity.NONE;
}
if (mActivity != newActivity && mIsScreenOn) {