Loading libs/binder/IPCThreadState.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -1320,6 +1320,22 @@ void IPCThreadState::threadDestructor(void *st) } } status_t IPCThreadState::getProcessFreezeInfo(pid_t pid, bool *sync_received, bool *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; } status_t IPCThreadState::freeze(pid_t pid, bool enable, uint32_t timeout_ms) { struct binder_freeze_info info; int ret = 0; Loading libs/binder/include/binder/IPCThreadState.h +3 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,9 @@ public: // returns: 0 in case of success, a value < 0 in case of error static status_t freeze(pid_t pid, bool enabled, uint32_t timeout_ms); // Provide information about the state of a frozen process static status_t getProcessFreezeInfo(pid_t pid, bool *sync_received, bool *async_received); sp<ProcessState> process(); status_t clearLastError(); Loading libs/binder/include/private/binder/binder_module.h +23 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,29 @@ struct binder_freeze_info { }; #endif //BINDER_FREEZE #ifndef BINDER_GET_FROZEN_INFO #define BINDER_GET_FROZEN_INFO _IOWR('b', 15, struct binder_frozen_status_info) struct binder_frozen_status_info { // // Group-leader PID of process to be queried // __u32 pid; // // Indicates whether the process has received any sync calls since last // freeze (cleared at freeze/unfreeze) // __u32 sync_recv; // // Indicates whether the process has received any async calls since last // freeze (cleared at freeze/unfreeze) // __u32 async_recv; }; #endif //BINDER_GET_FROZEN_INFO #ifdef __cplusplus } // namespace android Loading libs/binder/tests/binderLibTest.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -432,6 +432,15 @@ TEST_F(BinderLibTest, Freeze) { EXPECT_EQ(-EAGAIN, IPCThreadState::self()->freeze(pid, 1, 0)); EXPECT_EQ(NO_ERROR, IPCThreadState::self()->freeze(pid, 1, 1000)); EXPECT_EQ(FAILED_TRANSACTION, m_server->transact(BINDER_LIB_TEST_NOP_TRANSACTION, data, &reply)); bool sync_received, async_received; EXPECT_EQ(NO_ERROR, IPCThreadState::self()->getProcessFreezeInfo(pid, &sync_received, &async_received)); EXPECT_EQ(sync_received, 1); EXPECT_EQ(async_received, 0); EXPECT_EQ(NO_ERROR, IPCThreadState::self()->freeze(pid, 0, 0)); EXPECT_EQ(NO_ERROR, m_server->transact(BINDER_LIB_TEST_NOP_TRANSACTION, data, &reply)); } Loading Loading
libs/binder/IPCThreadState.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -1320,6 +1320,22 @@ void IPCThreadState::threadDestructor(void *st) } } status_t IPCThreadState::getProcessFreezeInfo(pid_t pid, bool *sync_received, bool *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; } status_t IPCThreadState::freeze(pid_t pid, bool enable, uint32_t timeout_ms) { struct binder_freeze_info info; int ret = 0; Loading
libs/binder/include/binder/IPCThreadState.h +3 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,9 @@ public: // returns: 0 in case of success, a value < 0 in case of error static status_t freeze(pid_t pid, bool enabled, uint32_t timeout_ms); // Provide information about the state of a frozen process static status_t getProcessFreezeInfo(pid_t pid, bool *sync_received, bool *async_received); sp<ProcessState> process(); status_t clearLastError(); Loading
libs/binder/include/private/binder/binder_module.h +23 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,29 @@ struct binder_freeze_info { }; #endif //BINDER_FREEZE #ifndef BINDER_GET_FROZEN_INFO #define BINDER_GET_FROZEN_INFO _IOWR('b', 15, struct binder_frozen_status_info) struct binder_frozen_status_info { // // Group-leader PID of process to be queried // __u32 pid; // // Indicates whether the process has received any sync calls since last // freeze (cleared at freeze/unfreeze) // __u32 sync_recv; // // Indicates whether the process has received any async calls since last // freeze (cleared at freeze/unfreeze) // __u32 async_recv; }; #endif //BINDER_GET_FROZEN_INFO #ifdef __cplusplus } // namespace android Loading
libs/binder/tests/binderLibTest.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -432,6 +432,15 @@ TEST_F(BinderLibTest, Freeze) { EXPECT_EQ(-EAGAIN, IPCThreadState::self()->freeze(pid, 1, 0)); EXPECT_EQ(NO_ERROR, IPCThreadState::self()->freeze(pid, 1, 1000)); EXPECT_EQ(FAILED_TRANSACTION, m_server->transact(BINDER_LIB_TEST_NOP_TRANSACTION, data, &reply)); bool sync_received, async_received; EXPECT_EQ(NO_ERROR, IPCThreadState::self()->getProcessFreezeInfo(pid, &sync_received, &async_received)); EXPECT_EQ(sync_received, 1); EXPECT_EQ(async_received, 0); EXPECT_EQ(NO_ERROR, IPCThreadState::self()->freeze(pid, 0, 0)); EXPECT_EQ(NO_ERROR, m_server->transact(BINDER_LIB_TEST_NOP_TRANSACTION, data, &reply)); } Loading