diff options
author | 2021-09-10 09:59:30 -0700 | |
---|---|---|
committer | 2021-09-10 16:56:28 -0700 | |
commit | 6f059293526c8ccd8e875190aeffd900c6d9b3a3 (patch) | |
tree | e77b1d698d8f3b7ad8d18c03d0b591ad8a87fc5b /libs/binder/IPCThreadState.cpp | |
parent | cf2e66bf19e65be7bd8bd9f73a3d4bcb229ebdde (diff) |
getProcessFreezeInfo reads more info from kernel
Improve primitive binder function to check if a process has any pending
binder transactions so that the freezer policy can choose to wait and
drain those pending transactions.
Bug: 198493121
Test: app launch/foreground/background stress test
Change-Id: Ia7ce6899ddaeb8e8453b0b8f3536d129b6b761d3
Diffstat (limited to 'libs/binder/IPCThreadState.cpp')
-rw-r--r-- | libs/binder/IPCThreadState.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp index fa9f3a9749..9e04ffeb11 100644 --- a/libs/binder/IPCThreadState.cpp +++ b/libs/binder/IPCThreadState.cpp @@ -1426,6 +1426,25 @@ status_t IPCThreadState::getProcessFreezeInfo(pid_t pid, bool *sync_received, bo return ret; } +#ifndef __ANDROID_VNDK__ +status_t IPCThreadState::getProcessFreezeInfo(pid_t pid, uint32_t *sync_received, + uint32_t *async_received) +{ + int ret = 0; + binder_frozen_status_info info; + info.pid = pid; + +#if defined(__ANDROID__) + if (ioctl(self()->mProcess->mDriverFD, BINDER_GET_FROZEN_INFO, &info) < 0) + ret = -errno; +#endif + *sync_received = info.sync_recv; + *async_received = info.async_recv; + + return ret; +} +#endif + status_t IPCThreadState::freeze(pid_t pid, bool enable, uint32_t timeout_ms) { struct binder_freeze_info info; int ret = 0; |