Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b3a03455 authored by Naveen Kalla's avatar Naveen Kalla
Browse files

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
parent c38bb60d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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. */
+0 −8
Original line number Diff line number Diff line
@@ -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,
+4 −0
Original line number Diff line number Diff line
@@ -343,6 +343,10 @@ public class GSMPhone extends PhoneBase {
                case DATAINANDOUT:
                    ret = DataActivityState.DATAINANDOUT;
                break;

                case DORMANT:
                    ret = DataActivityState.DORMANT;
                break;
            }
        }

+30 −1
Original line number Diff line number Diff line
@@ -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) {