Loading media/libaudioclient/AudioSystem.cpp +16 −8 Original line number Diff line number Diff line Loading @@ -155,8 +155,8 @@ public: return; } if (!mService || mService->getDelegate() != service) { ALOGW("%s: %s unmatched service death pointers, ignoring", __func__, getServiceName()); ALOGW("%s: %s unmatched service death pointers, previous %p, ignoring", __func__, getServiceName(), mService.get()); return; } mValid = false; Loading Loading @@ -1002,6 +1002,10 @@ public: sp<AudioSystem::AudioPolicyServiceClient> client; { std::lock_guard l(mMutex); if (aps == mService) { ALOGW_IF("%s: %s same service, ignoring", __func__, getServiceName()); return; } ALOGW_IF(mValid, "%s: %s service already valid, continuing with initialization", __func__, getServiceName()); if (mClient == nullptr) { Loading @@ -1025,12 +1029,13 @@ public: { std::lock_guard l(mMutex); if (!mValid) { ALOGW("%s: %s service already invalidated, ignoring", __func__, getServiceName()); ALOGW("%s: %s service already invalidated, previous %p, ignoring", __func__, getServiceName(), mService.get()); return; } if (mService != service) { ALOGW("%s: %s unmatched service death pointers, ignoring", __func__, getServiceName()); ALOGW("%s: %s unmatched service death pointers, previous %p, ignoring", __func__, getServiceName(), mService.get()); return; } mValid = false; Loading Loading @@ -1108,9 +1113,12 @@ public: return OK; } } mService = aps; if (aps) { ul.unlock(); if (aps) onNewService(aps); onNewService(aps); } else { mService = nullptr; } return OK; } Loading media/utils/include/mediautils/ServiceSingleton.h +11 −0 Original line number Diff line number Diff line Loading @@ -331,6 +331,9 @@ private: traits->onNewService(service); ul.lock(); setDeathNotifier_l<Service>(service); } else { ALOGW("%s: ignoring duplicated service: %p", __func__, originalService.get()); } ul.unlock(); mCv.notify_all(); Loading Loading @@ -358,6 +361,14 @@ private: // we do not need to generation count. { std::lock_guard l(mMutex); const auto currentService = std::get<BaseInterfaceType<Service>>(mService); if (currentService != service) { ALOGW("%s: ignoring death as current service " "%p != registered death service %p", __func__, currentService.get(), service.get()); return; } invalidateService_l<Service>(); } traits->onServiceDied(service); Loading Loading
media/libaudioclient/AudioSystem.cpp +16 −8 Original line number Diff line number Diff line Loading @@ -155,8 +155,8 @@ public: return; } if (!mService || mService->getDelegate() != service) { ALOGW("%s: %s unmatched service death pointers, ignoring", __func__, getServiceName()); ALOGW("%s: %s unmatched service death pointers, previous %p, ignoring", __func__, getServiceName(), mService.get()); return; } mValid = false; Loading Loading @@ -1002,6 +1002,10 @@ public: sp<AudioSystem::AudioPolicyServiceClient> client; { std::lock_guard l(mMutex); if (aps == mService) { ALOGW_IF("%s: %s same service, ignoring", __func__, getServiceName()); return; } ALOGW_IF(mValid, "%s: %s service already valid, continuing with initialization", __func__, getServiceName()); if (mClient == nullptr) { Loading @@ -1025,12 +1029,13 @@ public: { std::lock_guard l(mMutex); if (!mValid) { ALOGW("%s: %s service already invalidated, ignoring", __func__, getServiceName()); ALOGW("%s: %s service already invalidated, previous %p, ignoring", __func__, getServiceName(), mService.get()); return; } if (mService != service) { ALOGW("%s: %s unmatched service death pointers, ignoring", __func__, getServiceName()); ALOGW("%s: %s unmatched service death pointers, previous %p, ignoring", __func__, getServiceName(), mService.get()); return; } mValid = false; Loading Loading @@ -1108,9 +1113,12 @@ public: return OK; } } mService = aps; if (aps) { ul.unlock(); if (aps) onNewService(aps); onNewService(aps); } else { mService = nullptr; } return OK; } Loading
media/utils/include/mediautils/ServiceSingleton.h +11 −0 Original line number Diff line number Diff line Loading @@ -331,6 +331,9 @@ private: traits->onNewService(service); ul.lock(); setDeathNotifier_l<Service>(service); } else { ALOGW("%s: ignoring duplicated service: %p", __func__, originalService.get()); } ul.unlock(); mCv.notify_all(); Loading Loading @@ -358,6 +361,14 @@ private: // we do not need to generation count. { std::lock_guard l(mMutex); const auto currentService = std::get<BaseInterfaceType<Service>>(mService); if (currentService != service) { ALOGW("%s: ignoring death as current service " "%p != registered death service %p", __func__, currentService.get(), service.get()); return; } invalidateService_l<Service>(); } traits->onServiceDied(service); Loading