summaryrefslogtreecommitdiff
path: root/libs/binder/ProcessInfoService.cpp
diff options
context:
space:
mode:
author Emilian Peev <epeev@google.com> 2017-02-02 09:57:18 +0000
committer Emilian Peev <epeev@google.com> 2017-02-06 17:19:21 +0000
commitb4f33df8911e1b2804714fc4e78e8172d2eadd46 (patch)
treea8365056eda2dc776ee7f266759942b4716824b8 /libs/binder/ProcessInfoService.cpp
parent2c2759221d8ec64fb8cd0178d4e00b8effe4b0e9 (diff)
ProcessInfoService: Add support for oom score query
An additional query for the process oom score also needs to be supported. BUG: 34701266 Test: Manual testing + run cts -m Camera --abi armeabi-v7a --disable-reboot Change-Id: I3e7de82c4d14d4b3b7faa86f4c7208deb376b6c4
Diffstat (limited to 'libs/binder/ProcessInfoService.cpp')
-rw-r--r--libs/binder/ProcessInfoService.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/libs/binder/ProcessInfoService.cpp b/libs/binder/ProcessInfoService.cpp
index fb2864355d..8939d9c9b2 100644
--- a/libs/binder/ProcessInfoService.cpp
+++ b/libs/binder/ProcessInfoService.cpp
@@ -57,6 +57,40 @@ status_t ProcessInfoService::getProcessStatesImpl(size_t length, /*in*/ int32_t*
return TIMED_OUT;
}
+status_t ProcessInfoService::getProcessStatesScoresImpl(size_t length,
+ /*in*/ int32_t* pids, /*out*/ int32_t* states,
+ /*out*/ int32_t *scores) {
+ status_t err = NO_ERROR;
+ sp<IProcessInfoService> pis;
+ mProcessInfoLock.lock();
+ pis = mProcessInfoService;
+ mProcessInfoLock.unlock();
+
+ for (int i = 0; i < BINDER_ATTEMPT_LIMIT; i++) {
+
+ if (pis != NULL) {
+ err = pis->getProcessStatesAndOomScoresFromPids(length,
+ /*in*/ pids, /*out*/ states, /*out*/ scores);
+ if (err == NO_ERROR) return NO_ERROR; // success
+ if (IInterface::asBinder(pis)->isBinderAlive()) return err;
+ }
+ sleep(1);
+
+ mProcessInfoLock.lock();
+ if (pis == mProcessInfoService) {
+ updateBinderLocked();
+ }
+ pis = mProcessInfoService;
+ mProcessInfoLock.unlock();
+ }
+
+ ALOGW("%s: Could not retrieve process states and scores "
+ "from ProcessInfoService after %d retries.", __FUNCTION__,
+ BINDER_ATTEMPT_LIMIT);
+
+ return TIMED_OUT;
+}
+
void ProcessInfoService::updateBinderLocked() {
const sp<IServiceManager> sm(defaultServiceManager());
if (sm != NULL) {