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

Commit 0ae5729a authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Merge "Properly notify of precise call state change after connection hangup." into cm-10.1

parents 23bd6079 332fb18b
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ public final class CdmaCall extends Call {
    /**
     * Called by CdmaConnection when it has disconnected
     */
    void
    boolean
    connectionDisconnected(CdmaConnection conn) {
        if (state != State.DISCONNECTED) {
            /* If only disconnected connections remain, we are disconnected*/
@@ -133,8 +133,11 @@ public final class CdmaCall extends Call {

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

        return false;
    }


+7 −9
Original line number Diff line number Diff line
@@ -497,6 +497,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;

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

@@ -713,7 +711,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();
        }

@@ -723,7 +721,7 @@ public final class CdmaCallTracker extends CallTracker {
            phone.notifyUnknownConnection();
        }

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

+4 −2
Original line number Diff line number Diff line
@@ -446,8 +446,9 @@ 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;
        this.cause = cause;

        if (!disconnected) {
@@ -458,10 +459,11 @@ public class CdmaConnection extends Connection {
            owner.phone.notifyDisconnect(this);

            if (parent != null) {
                parent.connectionDisconnected(this);
                changed = parent.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
@@ -111,7 +111,7 @@ class GsmCall extends Call {
    /**
     * Called by GsmConnection when it has disconnected
     */
    void
    boolean
    connectionDisconnected(GsmConnection conn) {
        if (state != State.DISCONNECTED) {
            /* If only disconnected connections remain, we are disconnected*/
@@ -129,10 +129,12 @@ class GsmCall extends Call {

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

        return false;
    }

    /*package*/ void
    detach(GsmConnection conn) {
+7 −10
Original line number Diff line number Diff line
@@ -432,6 +432,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;

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

@@ -622,7 +619,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();
        }

@@ -632,7 +629,7 @@ public final class GsmCallTracker extends CallTracker {
            phone.notifyUnknownConnection();
        }

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

Loading