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

Commit f3bf7315 authored by Mengjun Leng's avatar Mengjun Leng Committed by android-build-merger
Browse files

Fix logging two call records for emergency call

am: ccb7b30c

Change-Id: Ib236d8ba470a1a16952d999df768dcfb1dcafd98
parents afe4c7c2 ccb7b30c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -875,15 +875,17 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
     * (see {@link CallState}), in practice those expectations break down when cellular systems
     * misbehave and they do this very often. The result is that we do not enforce state transitions
     * and instead keep the code resilient to unexpected state changes.
     * @return true indicates if setState succeeded in setting the state to newState,
     * else it is failed, and the call is still in its original state.
     */
    public void setState(int newState, String tag) {
    public boolean setState(int newState, String tag) {
        if (mState != newState) {
            Log.v(this, "setState %s -> %s", mState, newState);

            if (newState == CallState.DISCONNECTED && shouldContinueProcessingAfterDisconnect()) {
                Log.w(this, "continuing processing disconnected call with another service");
                mCreateConnectionProcessor.continueProcessingIfPossible(this, mDisconnectCause);
                return;
                return false;
            }

            updateVideoHistoryViaState(mState, newState);
@@ -962,6 +964,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
            StatsLog.write(StatsLog.CALL_STATE_CHANGED, newState, statsdDisconnectCause,
                    isSelfManaged(), isExternalCall());
        }
        return true;
    }

    void setRingbackRequested(boolean ringbackRequested) {
+22 −18
Original line number Diff line number Diff line
@@ -2516,7 +2516,7 @@ public class CallsManager extends Call.ListenerBase
            // into a well-defined state machine.
            // TODO: Define expected state transitions here, and log when an
            // unexpected transition occurs.
            call.setState(newState, tag);
            if (call.setState(newState, tag)) {
                maybeShowErrorDialogOnDisconnect(call);

                Trace.beginSection("onCallStateChanged");
@@ -2528,7 +2528,8 @@ public class CallsManager extends Call.ListenerBase
                    updateCanAddCall();
                    for (CallsManagerListener listener : mListeners) {
                        if (LogUtils.SYSTRACE_DEBUG) {
                        Trace.beginSection(listener.getClass().toString() + " onCallStateChanged");
                            Trace.beginSection(listener.getClass().toString() +
                                    " onCallStateChanged");
                        }
                        listener.onCallStateChanged(call, oldState, newState);
                        if (LogUtils.SYSTRACE_DEBUG) {
@@ -2537,6 +2538,9 @@ public class CallsManager extends Call.ListenerBase
                    }
                }
                Trace.endSection();
            } else {
                Log.i(this, "failed in setting the state to new state");
            }
        }
    }