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

Commit a0d82996 authored by Brad Ebinger's avatar Brad Ebinger Committed by Android (Google) Code Review
Browse files

Merge "Schedule IMS -> CS redial notification to happen on main thread" into sc-dev

parents c46a1044 3b0cc100
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -1582,7 +1582,31 @@ public class ImsPhone extends ImsPhoneBase {
                                         new SilentRedialParam(mLastDialString, cause, dialArgs),
                                         null);
        if (ar != null) {
            // There is a race condition that can happen in some cases:
            // (Main thread) dial start
            // (Binder Thread) onCallSessionFailed
            // (Binder Thread) schedule a redial for CS on the main thread
            // (Main Thread) dial finish
            // (Main Thread) schedule to associate ImsPhoneConnection with
            //               GsmConnection on the main thread
            // If scheduling the CS redial occurs before the command to schedule the
            // ImsPhoneConnection to be  associated with the GsmConnection, the CS redial will occur
            // before GsmConnection has had callbacks to ImsPhone correctly updated. This will cause
            // Callbacks back to GsmCdmaPhone to never be set up correctly and we will lose track of
            // the instance.
            // Instead, schedule this redial to happen on the main thread, so that we know dial has
            // finished before scheduling a redial:
            // (Main thread) dial start
            // (Binder Thread) onCallSessionFailed -> move notify registrants to main thread
            // (Main Thread) dial finish
            // (Main Thread) schedule on main thread to associate ImsPhoneConnection with
            //               GsmConnection
            // (Main Thread) schedule a redial for CS
            mContext.getMainExecutor().execute(() -> {
                logd("initiateSilentRedial: notifying registrants, isEmergency=" + isEmergency
                        + ", eccCategory=" + eccCategory);
                mSilentRedialRegistrants.notifyRegistrants(ar);
            });
        }
    }