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

Commit 1220a4e2 authored by Danny Baumann's avatar Danny Baumann
Browse files

Properly notify of precise call state change after connection hangup.

When disconnecting connections via Connection.hangup(), previously no
precise call state notification was sent out.

Change-Id: I4439d7d8ed47e72da9d061b885ec9a0e6e1b784d
parent 9505a35e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ public final class CdmaCall extends Call {
    /**
     * Called by CdmaConnection when it has disconnected
     */
    void
    boolean
    connectionDisconnected(CdmaConnection conn) {
        if (mState != State.DISCONNECTED) {
            /* If only disconnected connections remain, we are disconnected*/
@@ -129,8 +129,11 @@ public final class CdmaCall extends Call {

            if (hasOnlyDisconnectedConnections) {
                mState = State.DISCONNECTED;
                return true;
            }
        }

        return false;
    }


+7 −9
Original line number Diff line number Diff line
@@ -483,6 +483,7 @@ public final class CdmaCallTracker extends CallTracker {
        Connection newRinging = null; //or waiting
        boolean hasNonHangupStateChanged = false;   // Any change besides
                                                    // a dropped connection
        boolean hasAnyCallDisconnected = false;
        boolean needsPollDelay = false;
        boolean unknownConnectionAppeared = false;

@@ -666,14 +667,11 @@ public final class CdmaCallTracker extends CallTracker {
                    log("setting cause to " + cause);
                }
                mDroppedDuringPoll.remove(i);
                conn.onDisconnect(cause);
            } else if (conn.mCause == Connection.DisconnectCause.LOCAL) {
                // Local hangup
                hasAnyCallDisconnected |= conn.onDisconnect(cause);
            } else if (conn.mCause == Connection.DisconnectCause.LOCAL
                    || conn.mCause == Connection.DisconnectCause.INVALID_NUMBER) {
                mDroppedDuringPoll.remove(i);
                conn.onDisconnect(Connection.DisconnectCause.LOCAL);
            } else if (conn.mCause == Connection.DisconnectCause.INVALID_NUMBER) {
                mDroppedDuringPoll.remove(i);
                conn.onDisconnect(Connection.DisconnectCause.INVALID_NUMBER);
                hasAnyCallDisconnected |= conn.onDisconnect(conn.mCause);
            }
        }

@@ -692,7 +690,7 @@ public final class CdmaCallTracker extends CallTracker {
        // 1) the phone has started to ring
        // 2) A Call/Connection object has changed state...
        //    we may have switched or held or answered (but not hung up)
        if (newRinging != null || hasNonHangupStateChanged) {
        if (newRinging != null || hasNonHangupStateChanged || hasAnyCallDisconnected) {
            internalClearDisconnected();
        }

@@ -702,7 +700,7 @@ public final class CdmaCallTracker extends CallTracker {
            mPhone.notifyUnknownConnection();
        }

        if (hasNonHangupStateChanged || newRinging != null) {
        if (hasNonHangupStateChanged || newRinging != null || hasAnyCallDisconnected) {
            mPhone.notifyPreciseCallStateChanged();
        }

+5 −2
Original line number Diff line number Diff line
@@ -439,8 +439,10 @@ public class CdmaConnection extends Connection {
    }

    /** Called when the radio indicates the connection has been disconnected */
    /*package*/ void
    /*package*/ boolean
    onDisconnect(DisconnectCause cause) {
        boolean changed = false;

        mCause = cause;

        if (!mDisconnected) {
@@ -450,10 +452,11 @@ public class CdmaConnection extends Connection {
            mOwner.mPhone.notifyDisconnect(this);

            if (mParent != null) {
                mParent.connectionDisconnected(this);
                changed = mParent.connectionDisconnected(this);
            }
        }
        releaseWakeLock();
        return changed;
    }

    /** Called when the call waiting connection has been hung up */
+4 −2
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ class GsmCall extends Call {
    /**
     * Called by GsmConnection when it has disconnected
     */
    void
    boolean
    connectionDisconnected(GsmConnection conn) {
        if (mState != State.DISCONNECTED) {
            /* If only disconnected connections remain, we are disconnected*/
@@ -132,10 +132,12 @@ class GsmCall extends Call {

            if (hasOnlyDisconnectedConnections) {
                mState = State.DISCONNECTED;
            }
                return true;
            }
        }

        return false;
    }

    /*package*/ void
    detach(GsmConnection conn) {
+7 −10
Original line number Diff line number Diff line
@@ -435,6 +435,7 @@ public final class GsmCallTracker extends CallTracker {
        Connection newRinging = null; //or waiting
        boolean hasNonHangupStateChanged = false;   // Any change besides
                                                    // a dropped connection
        boolean hasAnyCallDisconnected = false;
        boolean needsPollDelay = false;
        boolean unknownConnectionAppeared = false;

@@ -594,15 +595,11 @@ public final class GsmCallTracker extends CallTracker {
                    log("setting cause to " + cause);
                }
                mDroppedDuringPoll.remove(i);
                conn.onDisconnect(cause);
            } else if (conn.mCause == Connection.DisconnectCause.LOCAL) {
                // Local hangup
                hasAnyCallDisconnected |= conn.onDisconnect(cause);
            } else if (conn.mCause == Connection.DisconnectCause.LOCAL
                    || conn.mCause == Connection.DisconnectCause.INVALID_NUMBER) {
                mDroppedDuringPoll.remove(i);
                conn.onDisconnect(Connection.DisconnectCause.LOCAL);
            } else if (conn.mCause ==
                Connection.DisconnectCause.INVALID_NUMBER) {
                mDroppedDuringPoll.remove(i);
                conn.onDisconnect(Connection.DisconnectCause.INVALID_NUMBER);
                hasAnyCallDisconnected |= conn.onDisconnect(conn.mCause);
            }
        }

@@ -621,7 +618,7 @@ public final class GsmCallTracker extends CallTracker {
        // 1) the phone has started to ring
        // 2) A Call/Connection object has changed state...
        //    we may have switched or held or answered (but not hung up)
        if (newRinging != null || hasNonHangupStateChanged) {
        if (newRinging != null || hasNonHangupStateChanged || hasAnyCallDisconnected) {
            internalClearDisconnected();
        }

@@ -631,7 +628,7 @@ public final class GsmCallTracker extends CallTracker {
            mPhone.notifyUnknownConnection();
        }

        if (hasNonHangupStateChanged || newRinging != null) {
        if (hasNonHangupStateChanged || newRinging != null || hasAnyCallDisconnected) {
            mPhone.notifyPreciseCallStateChanged();
        }

Loading