Loading libs/binder/ProcessState.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -298,12 +298,17 @@ ProcessState::handle_entry* ProcessState::lookupHandleLocked(int32_t handle) return &mHandleToObject.editItemAt(handle); return &mHandleToObject.editItemAt(handle); } } // see b/166779391: cannot change the VNDK interface, so access like this extern sp<BBinder> the_context_object; sp<IBinder> ProcessState::getStrongProxyForHandle(int32_t handle) sp<IBinder> ProcessState::getStrongProxyForHandle(int32_t handle) { { sp<IBinder> result; sp<IBinder> result; AutoMutex _l(mLock); AutoMutex _l(mLock); if (handle == 0 && the_context_object != nullptr) return the_context_object; handle_entry* e = lookupHandleLocked(handle); handle_entry* e = lookupHandleLocked(handle); if (e != nullptr) { if (e != nullptr) { Loading libs/binder/tests/binderLibTest.cpp +6 −0 Original line number Original line Diff line number Diff line Loading @@ -447,6 +447,12 @@ TEST_F(BinderLibTest, CannotUseBinderAfterFork) { EXPECT_DEATH({ ProcessState::self(); }, "libbinder ProcessState can not be used after fork"); EXPECT_DEATH({ ProcessState::self(); }, "libbinder ProcessState can not be used after fork"); } } TEST_F(BinderLibTest, AddManagerToManager) { sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder = IInterface::asBinder(sm); EXPECT_EQ(NO_ERROR, sm->addService(String16("binderLibTest-manager"), binder)); } TEST_F(BinderLibTest, WasParceled) { TEST_F(BinderLibTest, WasParceled) { auto binder = sp<BBinder>::make(); auto binder = sp<BBinder>::make(); EXPECT_FALSE(binder->wasParceled()); EXPECT_FALSE(binder->wasParceled()); Loading Loading
libs/binder/ProcessState.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -298,12 +298,17 @@ ProcessState::handle_entry* ProcessState::lookupHandleLocked(int32_t handle) return &mHandleToObject.editItemAt(handle); return &mHandleToObject.editItemAt(handle); } } // see b/166779391: cannot change the VNDK interface, so access like this extern sp<BBinder> the_context_object; sp<IBinder> ProcessState::getStrongProxyForHandle(int32_t handle) sp<IBinder> ProcessState::getStrongProxyForHandle(int32_t handle) { { sp<IBinder> result; sp<IBinder> result; AutoMutex _l(mLock); AutoMutex _l(mLock); if (handle == 0 && the_context_object != nullptr) return the_context_object; handle_entry* e = lookupHandleLocked(handle); handle_entry* e = lookupHandleLocked(handle); if (e != nullptr) { if (e != nullptr) { Loading
libs/binder/tests/binderLibTest.cpp +6 −0 Original line number Original line Diff line number Diff line Loading @@ -447,6 +447,12 @@ TEST_F(BinderLibTest, CannotUseBinderAfterFork) { EXPECT_DEATH({ ProcessState::self(); }, "libbinder ProcessState can not be used after fork"); EXPECT_DEATH({ ProcessState::self(); }, "libbinder ProcessState can not be used after fork"); } } TEST_F(BinderLibTest, AddManagerToManager) { sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder = IInterface::asBinder(sm); EXPECT_EQ(NO_ERROR, sm->addService(String16("binderLibTest-manager"), binder)); } TEST_F(BinderLibTest, WasParceled) { TEST_F(BinderLibTest, WasParceled) { auto binder = sp<BBinder>::make(); auto binder = sp<BBinder>::make(); EXPECT_FALSE(binder->wasParceled()); EXPECT_FALSE(binder->wasParceled()); Loading