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

Commit 834ca26d authored by Roshan Pius's avatar Roshan Pius
Browse files

Update CallsManager state before invoking callback

We should update CallsManager internal state before informing the Calls
Manager event listeners for any call addition/removal/state-change. This
will ensure that we have the correct state when one of the listeners
query CallsManager after being informed about an event.
This will ensure for example that the background call is brought to
foreground when a call is disconnected and so call audio manager will
not relinquish the audio focus when an IMS conference is created
(b/23759265).

BUG: 23786790
Change-Id: Iccb74ac61166f1218f36b7b98df5d35a015e0c43
parent 5d28bc0e
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -1252,7 +1252,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx
        call.addListener(this);
        mCalls.add(call);

        // TODO: Update mForegroundCall prior to invoking
        updateCallsManagerState();
        // onCallAdded for calls which immediately take the foreground (like the first call).
        for (CallsManagerListener listener : mListeners) {
            if (Log.SYSTRACE_DEBUG) {
@@ -1263,7 +1263,6 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx
                Trace.endSection();
            }
        }
        updateCallsManagerState();
        Trace.endSection();
    }

@@ -1285,6 +1284,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx

        // Only broadcast changes for calls that are being tracked.
        if (shouldNotify) {
            updateCallsManagerState();
            for (CallsManagerListener listener : mListeners) {
                if (Log.SYSTRACE_DEBUG) {
                    Trace.beginSection(listener.getClass().toString() + " onCallRemoved");
@@ -1294,7 +1294,6 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx
                    Trace.endSection();
                }
            }
            updateCallsManagerState();
        }
        Trace.endSection();
    }
@@ -1325,6 +1324,7 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx
            Trace.beginSection("onCallStateChanged");
            // Only broadcast state change for calls that are being tracked.
            if (mCalls.contains(call)) {
                updateCallsManagerState();
                for (CallsManagerListener listener : mListeners) {
                    if (Log.SYSTRACE_DEBUG) {
                        Trace.beginSection(listener.getClass().toString() + " onCallStateChanged");
@@ -1334,7 +1334,6 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx
                        Trace.endSection();
                    }
                }
                updateCallsManagerState();
            }
            Trace.endSection();
        }