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

Commit fd745f28 authored by Andy Hung's avatar Andy Hung
Browse files

AudioSystem: Improve consistency checking for AudioFlinger service

Flag: EXEMPT bugfix
Test: for run in {1..100}; do (sleep 8; echo $run; adb shell pkill audioserver); done
Bug: 386871946
Change-Id: I0f4b764e3343fa8f235a48eeda8b31d3fb21d42a
parent 96ff53af
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -238,9 +238,12 @@ public:
            ALOGW_IF(old != mService,
                    "%s: service changed during callback, continuing.", __func__);
        }
        mService = af;
        if (af) {
            ul.unlock();
        if (af) onNewServiceWithAdapter(af);
            onNewServiceWithAdapter(af);
        } else {
            mService = nullptr;
        }
        return OK;
    }

@@ -270,6 +273,11 @@ private:
        bool reportNoError = false;
        {
            std::lock_guard l(mMutex);
            if (mService == service ||
                    (mService && service && mService->getDelegate() == service->getDelegate())) {
                ALOGW("%s: %s  same service, ignoring", __func__, getServiceName());
                return;
            }
            ALOGW_IF(mValid, "%s: %s service already valid, continuing with initialization",
                    __func__, getServiceName());
            if (mClient == nullptr) {