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

Commit b90f9c37 authored by Wink Saville's avatar Wink Saville Committed by Android (Google) Code Review
Browse files

Merge "Telephony: Add Powerdown Cause to PDP Deactivate Message." into honeycomb-LTE

parents 11feacb3 26130688
Loading
Loading
Loading
Loading
+9 −8
Original line number Original line Diff line number Diff line
@@ -109,14 +109,17 @@ public abstract class DataConnection extends HierarchicalStateMachine {
     * Used internally for saving disconnecting parameters.
     * Used internally for saving disconnecting parameters.
     */
     */
    protected static class DisconnectParams {
    protected static class DisconnectParams {
        public DisconnectParams(Message onCompletedMsg) {
        public DisconnectParams(String reason, Message onCompletedMsg) {
            this.reason = reason;
            this.onCompletedMsg = onCompletedMsg;
            this.onCompletedMsg = onCompletedMsg;
        }
        }
        public DisconnectParams(ResetSynchronouslyLock lockObj) {
        public DisconnectParams(ResetSynchronouslyLock lockObj) {
            this.reason = null;
            this.lockObj = lockObj;
            this.lockObj = lockObj;
        }
        }


        public int tag;
        public int tag;
        public String reason;
        public Message onCompletedMsg;
        public Message onCompletedMsg;
        public ResetSynchronouslyLock lockObj;
        public ResetSynchronouslyLock lockObj;
    }
    }
@@ -274,9 +277,7 @@ public abstract class DataConnection extends HierarchicalStateMachine {
        if ((o != null) && (o instanceof DisconnectParams)) {
        if ((o != null) && (o instanceof DisconnectParams)) {
            DisconnectParams dp = (DisconnectParams)o;
            DisconnectParams dp = (DisconnectParams)o;
            Message m = dp.onCompletedMsg;
            Message m = dp.onCompletedMsg;
            if ((m != null) && (m.obj != null) && (m.obj instanceof String)) {
            if (TextUtils.equals(dp.reason, Phone.REASON_RADIO_TURNED_OFF)) {
                String reason = (String)m.obj;
                if (TextUtils.equals(reason, Phone.REASON_RADIO_TURNED_OFF))
                discReason = RILConstants.DEACTIVATE_REASON_RADIO_OFF;
                discReason = RILConstants.DEACTIVATE_REASON_RADIO_OFF;
            }
            }
        }
        }
@@ -963,7 +964,7 @@ public abstract class DataConnection extends HierarchicalStateMachine {
     *        With AsyncResult.userObj set to the original msg.obj.
     *        With AsyncResult.userObj set to the original msg.obj.
     */
     */
    public void reset(Message onCompletedMsg) {
    public void reset(Message onCompletedMsg) {
        sendMessage(obtainMessage(EVENT_RESET, new DisconnectParams(onCompletedMsg)));
        sendMessage(obtainMessage(EVENT_RESET, new DisconnectParams(null, onCompletedMsg)));
    }
    }


    /**
    /**
@@ -1014,8 +1015,8 @@ public abstract class DataConnection extends HierarchicalStateMachine {
     * @param onCompletedMsg is sent with its msg.obj as an AsyncResult object.
     * @param onCompletedMsg is sent with its msg.obj as an AsyncResult object.
     *        With AsyncResult.userObj set to the original msg.obj.
     *        With AsyncResult.userObj set to the original msg.obj.
     */
     */
    public void disconnect(Message onCompletedMsg) {
    public void disconnect(String reason, Message onCompletedMsg) {
        sendMessage(obtainMessage(EVENT_DISCONNECT, new DisconnectParams(onCompletedMsg)));
        sendMessage(obtainMessage(EVENT_DISCONNECT, new DisconnectParams(reason, onCompletedMsg)));
    }
    }


    // ****** The following are used for debugging.
    // ****** The following are used for debugging.
+5 −4
Original line number Original line Diff line number Diff line
@@ -461,7 +461,7 @@ public abstract class DataConnectionTracker extends Handler {
    protected abstract void onVoiceCallStarted();
    protected abstract void onVoiceCallStarted();
    protected abstract void onVoiceCallEnded();
    protected abstract void onVoiceCallEnded();
    protected abstract void onCleanUpConnection(boolean tearDown, int apnId, String reason);
    protected abstract void onCleanUpConnection(boolean tearDown, int apnId, String reason);
    protected abstract void onCleanUpAllConnections();
    protected abstract void onCleanUpAllConnections(String cause);


    @Override
    @Override
    public void handleMessage(Message msg) {
    public void handleMessage(Message msg) {
@@ -517,7 +517,7 @@ public abstract class DataConnectionTracker extends Handler {
                break;
                break;


            case EVENT_CLEAN_UP_ALL_CONNECTIONS: {
            case EVENT_CLEAN_UP_ALL_CONNECTIONS: {
                onCleanUpAllConnections();
                onCleanUpAllConnections((String) msg.obj);
                break;
                break;
            }
            }
            case EVENT_CLEAN_UP_CONNECTION: {
            case EVENT_CLEAN_UP_CONNECTION: {
@@ -920,7 +920,7 @@ public abstract class DataConnectionTracker extends Handler {
                    resetAllRetryCounts();
                    resetAllRetryCounts();
                    onTrySetupData(Phone.REASON_DATA_ENABLED);
                    onTrySetupData(Phone.REASON_DATA_ENABLED);
                } else {
                } else {
                    cleanUpAllConnections();
                    cleanUpAllConnections(null);
                }
                }
            }
            }
        }
        }
@@ -930,8 +930,9 @@ public abstract class DataConnectionTracker extends Handler {
        return mDataEnabled;
        return mDataEnabled;
    }
    }


    public void cleanUpAllConnections() {
    public void cleanUpAllConnections(String cause) {
        Message msg = obtainMessage(EVENT_CLEAN_UP_ALL_CONNECTIONS);
        Message msg = obtainMessage(EVENT_CLEAN_UP_ALL_CONNECTIONS);
        msg.obj = cause;
        sendMessage(msg);
        sendMessage(msg);
    }
    }


+1 −1
Original line number Original line Diff line number Diff line
@@ -243,7 +243,7 @@ public abstract class PhoneBase extends Handler implements Phone {
        synchronized(PhoneProxy.lockForRadioTechnologyChange) {
        synchronized(PhoneProxy.lockForRadioTechnologyChange) {
            mCM.unSetOnCallRing(this);
            mCM.unSetOnCallRing(this);
            // Must cleanup all connectionS and needs to use sendMessage!
            // Must cleanup all connectionS and needs to use sendMessage!
            mDataConnection.cleanUpAllConnections();
            mDataConnection.cleanUpAllConnections(null);
            mIsTheCurrentActivePhone = false;
            mIsTheCurrentActivePhone = false;
        }
        }
    }
    }
+9 −9
Original line number Original line Diff line number Diff line
@@ -269,7 +269,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
            if(conn != null) {
            if(conn != null) {
                if (tearDown) {
                if (tearDown) {
                    if (DBG) log("cleanUpConnection: teardown, call conn.disconnect");
                    if (DBG) log("cleanUpConnection: teardown, call conn.disconnect");
                    conn.disconnect(obtainMessage(EVENT_DISCONNECT_DONE,
                    conn.disconnect(reason, obtainMessage(EVENT_DISCONNECT_DONE,
                            conn.getDataConnectionId(), 0, reason));
                            conn.getDataConnectionId(), 0, reason));
                    notificationDeferred = true;
                    notificationDeferred = true;
                } else {
                } else {
@@ -367,7 +367,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
    protected void restartRadio() {
    protected void restartRadio() {
        if (DBG) log("Cleanup connection and wait " +
        if (DBG) log("Cleanup connection and wait " +
                (TIME_DELAYED_TO_RESTART_RADIO / 1000) + "s to restart radio");
                (TIME_DELAYED_TO_RESTART_RADIO / 1000) + "s to restart radio");
        cleanUpAllConnections();
        cleanUpAllConnections(null);
        sendEmptyMessageDelayed(EVENT_RESTART_RADIO, TIME_DELAYED_TO_RESTART_RADIO);
        sendEmptyMessageDelayed(EVENT_RESTART_RADIO, TIME_DELAYED_TO_RESTART_RADIO);
        mPendingRestartRadio = true;
        mPendingRestartRadio = true;
    }
    }
@@ -524,14 +524,14 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {


    protected void onRecordsLoaded() {
    protected void onRecordsLoaded() {
        if (mState == State.FAILED) {
        if (mState == State.FAILED) {
            cleanUpAllConnections();
            cleanUpAllConnections(null);
        }
        }
        sendMessage(obtainMessage(EVENT_TRY_SETUP_DATA, Phone.REASON_SIM_LOADED));
        sendMessage(obtainMessage(EVENT_TRY_SETUP_DATA, Phone.REASON_SIM_LOADED));
    }
    }


    protected void onNVReady() {
    protected void onNVReady() {
        if (mState == State.FAILED) {
        if (mState == State.FAILED) {
            cleanUpAllConnections();
            cleanUpAllConnections(null);
        }
        }
        sendMessage(obtainMessage(EVENT_TRY_SETUP_DATA));
        sendMessage(obtainMessage(EVENT_TRY_SETUP_DATA));
    }
    }
@@ -570,7 +570,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
            trySetupData(Phone.REASON_ROAMING_ON);
            trySetupData(Phone.REASON_ROAMING_ON);
        } else {
        } else {
            if (DBG) log("Tear down data connection on roaming.");
            if (DBG) log("Tear down data connection on roaming.");
            cleanUpAllConnections();
            cleanUpAllConnections(null);
        }
        }
    }
    }


@@ -591,7 +591,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
        notifyDataAvailability(null);
        notifyDataAvailability(null);


        if (mState != State.IDLE) {
        if (mState != State.IDLE) {
            cleanUpAllConnections();
            cleanUpAllConnections(null);
        }
        }
    }
    }


@@ -608,7 +608,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
            log("We're on the simulator; assuming radio off is meaningless");
            log("We're on the simulator; assuming radio off is meaningless");
        } else {
        } else {
            if (DBG) log("Radio is off and clean up all connection");
            if (DBG) log("Radio is off and clean up all connection");
            cleanUpAllConnections();
            cleanUpAllConnections(null);
        }
        }
    }
    }


@@ -714,9 +714,9 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
    }
    }


    @Override
    @Override
    protected void onCleanUpAllConnections() {
    protected void onCleanUpAllConnections(String cause) {
        // Only one CDMA connection is supported
        // Only one CDMA connection is supported
        cleanUpConnection(true, null);
        cleanUpConnection(true, cause);
    }
    }


    private void createAllDataConnectionList() {
    private void createAllDataConnectionList() {
+2 −2
Original line number Original line Diff line number Diff line
@@ -525,7 +525,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
        synchronized (this) {
        synchronized (this) {
            if (!mPendingRadioPowerOffAfterDataOff) {
            if (!mPendingRadioPowerOffAfterDataOff) {
                if (dcTracker.isAnyActiveDataConnections()) {
                if (dcTracker.isAnyActiveDataConnections()) {
                    dcTracker.cleanUpAllConnections();
                    dcTracker.cleanUpAllConnections(Phone.REASON_RADIO_TURNED_OFF);
                    if (sendEmptyMessageDelayed(EVENT_SET_RADIO_POWER_OFF, 30000)) {
                    if (sendEmptyMessageDelayed(EVENT_SET_RADIO_POWER_OFF, 30000)) {
                        if (DBG) log("Wait upto 30s for data to disconnect, then turn off radio.");
                        if (DBG) log("Wait upto 30s for data to disconnect, then turn off radio.");
                        mPendingRadioPowerOffAfterDataOff = true;
                        mPendingRadioPowerOffAfterDataOff = true;
@@ -534,7 +534,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
                        hangupAndPowerOff();
                        hangupAndPowerOff();
                    }
                    }
                } else {
                } else {
                    dcTracker.cleanUpAllConnections();
                    dcTracker.cleanUpAllConnections(Phone.REASON_RADIO_TURNED_OFF);
                    if (DBG) log("Data disconnected, turn off radio right away.");
                    if (DBG) log("Data disconnected, turn off radio right away.");
                    hangupAndPowerOff();
                    hangupAndPowerOff();
                }
                }
Loading