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

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

Merge "Telephony: Ignore events on a destroyed phone" into klp-dev

parents 150b65fc 5e2000b8
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -341,6 +341,11 @@ public abstract class PhoneBase extends Handler implements Phone {
    public void handleMessage(Message msg) {
        AsyncResult ar;

        if (!mIsTheCurrentActivePhone) {
            Rlog.e(LOG_TAG, "Received message " + msg +
                    "[" + msg.what + "] while being destroyed. Ignoring.");
            return;
        }
        switch(msg.what) {
            case EVENT_CALL_RING:
                Rlog.d(LOG_TAG, "Event EVENT_CALL_RING Received state=" + getState());
+5 −0
Original line number Diff line number Diff line
@@ -1080,6 +1080,11 @@ public class CDMAPhone extends PhoneBase {
        AsyncResult ar;
        Message     onComplete;

        if (!mIsTheCurrentActivePhone) {
            Rlog.e(LOG_TAG, "Received message " + msg +
                    "[" + msg.what + "] while being destroyed. Ignoring.");
            return;
        }
        switch(msg.what) {
            case EVENT_RADIO_AVAILABLE: {
                mCi.getBasebandVersion(obtainMessage(EVENT_GET_BASEBAND_VERSION_DONE));
+18 −4
Original line number Diff line number Diff line
@@ -110,16 +110,26 @@ public final class CdmaCallTracker extends CallTracker {
        mCi.unregisterForCallWaitingInfo(this);
        for(CdmaConnection c : mConnections) {
            try {
                if(c != null) hangup(c);
                if(c != null) {
                    hangup(c);
                    // Since by now we are unregistered, we won't notify
                    // PhoneApp that the call is gone. Do that here
                    Rlog.d(LOG_TAG, "dispose: call connnection onDisconnect, cause LOST_SIGNAL");
                    c.onDisconnect(Connection.DisconnectCause.LOST_SIGNAL);
                }
            } catch (CallStateException ex) {
                Rlog.e(LOG_TAG, "unexpected error on hangup during dispose");
                Rlog.e(LOG_TAG, "dispose: unexpected error on hangup", ex);
            }
        }

        try {
            if(mPendingMO != null) hangup(mPendingMO);
            if(mPendingMO != null) {
                hangup(mPendingMO);
                Rlog.d(LOG_TAG, "dispose: call mPendingMO.onDsiconnect, cause LOST_SIGNAL");
                mPendingMO.onDisconnect(Connection.DisconnectCause.LOST_SIGNAL);
            }
        } catch (CallStateException ex) {
            Rlog.e(LOG_TAG, "unexpected error on hangup during dispose");
            Rlog.e(LOG_TAG, "dispose: unexpected error on hangup", ex);
        }

        clearDisconnected();
@@ -922,6 +932,10 @@ public final class CdmaCallTracker extends CallTracker {
    handleMessage (Message msg) {
        AsyncResult ar;

        if (!mPhone.mIsTheCurrentActivePhone) {
            Rlog.w(LOG_TAG, "Ignoring events received on inactive CdmaPhone");
            return;
        }
        switch (msg.what) {
            case EVENT_POLL_CALLS_RESULT:{
                Rlog.d(LOG_TAG, "Event EVENT_POLL_CALLS_RESULT Received");
+7 −0
Original line number Diff line number Diff line
@@ -66,6 +66,13 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
        AsyncResult ar;
        int[] ints;
        String[] strings;

        if (!mPhone.mIsTheCurrentActivePhone) {
            loge("Received message " + msg + "[" + msg.what + "]" +
                    " while being destroyed. Ignoring.");
            return;
        }

        switch (msg.what) {
        case EVENT_POLL_STATE_GPRS:
            if (DBG) log("handleMessage EVENT_POLL_STATE_GPRS");
+2 −0
Original line number Diff line number Diff line
@@ -203,6 +203,8 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
    @Override
    public void dispose() {
        checkCorrectThread();
        log("ServiceStateTracker dispose");

        // Unregister for all events.
        mCi.unregisterForRadioStateChanged(this);
        mCi.unregisterForVoiceNetworkStateChanged(this);
Loading