Loading libs/binder/ProcessState.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -93,9 +93,7 @@ sp<ProcessState> ProcessState::selfOrNull() [[clang::no_destroy]] static std::mutex gProcessMutex; static void verifyNotForked(bool forked) { if (forked) { ALOGE("libbinder does not support being forked"); } LOG_ALWAYS_FATAL_IF(forked, "libbinder ProcessState can not be used after fork"); } sp<ProcessState> ProcessState::init(const char *driver, bool requireDefault) Loading libs/binder/tests/binderLibTest.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -436,6 +436,11 @@ class TestDeathRecipient : public IBinder::DeathRecipient, public BinderLibTestE }; }; TEST_F(BinderLibTest, CannotUseBinderAfterFork) { // EXPECT_DEATH works by forking the process EXPECT_DEATH({ ProcessState::self(); }, "libbinder ProcessState can not be used after fork"); } TEST_F(BinderLibTest, WasParceled) { auto binder = sp<BBinder>::make(); EXPECT_FALSE(binder->wasParceled()); Loading Loading
libs/binder/ProcessState.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -93,9 +93,7 @@ sp<ProcessState> ProcessState::selfOrNull() [[clang::no_destroy]] static std::mutex gProcessMutex; static void verifyNotForked(bool forked) { if (forked) { ALOGE("libbinder does not support being forked"); } LOG_ALWAYS_FATAL_IF(forked, "libbinder ProcessState can not be used after fork"); } sp<ProcessState> ProcessState::init(const char *driver, bool requireDefault) Loading
libs/binder/tests/binderLibTest.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -436,6 +436,11 @@ class TestDeathRecipient : public IBinder::DeathRecipient, public BinderLibTestE }; }; TEST_F(BinderLibTest, CannotUseBinderAfterFork) { // EXPECT_DEATH works by forking the process EXPECT_DEATH({ ProcessState::self(); }, "libbinder ProcessState can not be used after fork"); } TEST_F(BinderLibTest, WasParceled) { auto binder = sp<BBinder>::make(); EXPECT_FALSE(binder->wasParceled()); Loading