diff options
author | Eric Laurent <elaurent@google.com> | 2013-07-02 11:15:41 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2013-07-02 12:15:10 -0700 |
commit | f59a4b393f4844c5bbc8d6212364bdddea33d232 (patch) | |
tree | 50a7dc8e5ac254ca4f6a40d84980713a8ac30599 /services/audioflinger/SchedulingPolicyService.cpp | |
parent | a691ff3c03e38e148bbefed35ebb15e552a12613 (diff) | |
download | frameworks_av-f59a4b393f4844c5bbc8d6212364bdddea33d232.zip frameworks_av-f59a4b393f4844c5bbc8d6212364bdddea33d232.tar.gz frameworks_av-f59a4b393f4844c5bbc8d6212364bdddea33d232.tar.bz2 |
fix scheduling policy service death detection
Check status of transactions to scheduling policy service
and re-acquire a binder interface in case of DEAD_OBJECT.
Bug: 8875559.
Change-Id: I1e00bd44e2d4723b3ec95d5c31d9652ba08e238a
Diffstat (limited to 'services/audioflinger/SchedulingPolicyService.cpp')
-rw-r--r-- | services/audioflinger/SchedulingPolicyService.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/services/audioflinger/SchedulingPolicyService.cpp b/services/audioflinger/SchedulingPolicyService.cpp index 36e62e9..70a3f1a 100644 --- a/services/audioflinger/SchedulingPolicyService.cpp +++ b/services/audioflinger/SchedulingPolicyService.cpp @@ -14,6 +14,9 @@ * limitations under the License. */ +#define LOG_TAG "SchedulingPolicyService" +//#define LOG_NDEBUG 0 + #include <binder/IServiceManager.h> #include <utils/Mutex.h> #include "ISchedulingPolicyService.h" @@ -28,25 +31,32 @@ static Mutex sMutex; int requestPriority(pid_t pid, pid_t tid, int32_t prio, bool asynchronous) { // FIXME merge duplicated code related to service lookup, caching, and error recovery - sp<ISchedulingPolicyService> sps; + int ret; for (;;) { sMutex.lock(); - sps = sSchedulingPolicyService; + sp<ISchedulingPolicyService> sps = sSchedulingPolicyService; sMutex.unlock(); - if (sps != 0) { - break; - } - sp<IBinder> binder = defaultServiceManager()->checkService(_scheduling_policy); - if (binder != 0) { + if (sps == 0) { + sp<IBinder> binder = defaultServiceManager()->checkService(_scheduling_policy); + if (binder == 0) { + sleep(1); + continue; + } sps = interface_cast<ISchedulingPolicyService>(binder); sMutex.lock(); sSchedulingPolicyService = sps; sMutex.unlock(); + } + ret = sps->requestPriority(pid, tid, prio, asynchronous); + if (ret != DEAD_OBJECT) { break; } - sleep(1); + ALOGW("SchedulingPolicyService died"); + sMutex.lock(); + sSchedulingPolicyService.clear(); + sMutex.unlock(); } - return sps->requestPriority(pid, tid, prio, asynchronous); + return ret; } } // namespace android |