Loading libs/binder/tests/binderLibTest.cpp +37 −49 Original line number Diff line number Diff line Loading @@ -1173,22 +1173,14 @@ TEST_F(BinderLibTest, GotSid) { EXPECT_THAT(server->transact(BINDER_LIB_TEST_CAN_GET_SID, data, nullptr), StatusEq(OK)); } class BinderLibTestService : public BBinder { class BinderLibTestService : public BBinder { public: explicit BinderLibTestService(int32_t id) : m_id(id) , m_nextServerId(id + 1) , m_serverStartRequested(false) , m_callback(nullptr) { : m_id(id), m_nextServerId(id + 1), m_serverStartRequested(false), m_callback(nullptr) { pthread_mutex_init(&m_serverWaitMutex, nullptr); pthread_cond_init(&m_serverWaitCond, nullptr); } ~BinderLibTestService() { exit(EXIT_SUCCESS); } ~BinderLibTestService() { exit(EXIT_SUCCESS); } void processPendingCall() { if (m_callback != nullptr) { Loading @@ -1199,8 +1191,7 @@ class BinderLibTestService : public BBinder } } virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, virtual status_t onTransact(uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags = 0) { if (getuid() != (uid_t)IPCThreadState::self()->getCallingUid()) { return PERMISSION_DENIED; Loading @@ -1215,8 +1206,7 @@ class BinderLibTestService : public BBinder return BAD_VALUE; } if (m_id != 0) return INVALID_OPERATION; if (m_id != 0) return INVALID_OPERATION; pthread_mutex_lock(&m_serverWaitMutex); if (m_serverStartRequested) { Loading Loading @@ -1401,8 +1391,7 @@ class BinderLibTestService : public BBinder return BAD_VALUE; } ret = target->linkToDeath(testDeathRecipient); if (ret == NO_ERROR) ret = testDeathRecipient->waitEvent(5); if (ret == NO_ERROR) ret = testDeathRecipient->waitEvent(5); data2.writeInt32(ret); callback->transact(BINDER_LIB_TEST_CALL_BACK, data2, &reply2); return NO_ERROR; Loading @@ -1426,8 +1415,7 @@ class BinderLibTestService : public BBinder return BAD_VALUE; } ret = write(fd, buf, size); if (ret != size) return UNKNOWN_ERROR; if (ret != size) return UNKNOWN_ERROR; return NO_ERROR; } case BINDER_LIB_TEST_WRITE_PARCEL_FILE_DESCRIPTOR_TRANSACTION: { Loading Loading @@ -1482,8 +1470,7 @@ class BinderLibTestService : public BBinder case BINDER_LIB_TEST_ECHO_VECTOR: { std::vector<uint64_t> vector; auto err = data.readUint64Vector(&vector); if (err != NO_ERROR) return err; if (err != NO_ERROR) return err; reply->writeUint64Vector(vector); return NO_ERROR; } Loading @@ -1497,6 +1484,7 @@ class BinderLibTestService : public BBinder return UNKNOWN_TRANSACTION; }; } private: int32_t m_id; int32_t m_nextServerId; Loading Loading
libs/binder/tests/binderLibTest.cpp +37 −49 Original line number Diff line number Diff line Loading @@ -1173,22 +1173,14 @@ TEST_F(BinderLibTest, GotSid) { EXPECT_THAT(server->transact(BINDER_LIB_TEST_CAN_GET_SID, data, nullptr), StatusEq(OK)); } class BinderLibTestService : public BBinder { class BinderLibTestService : public BBinder { public: explicit BinderLibTestService(int32_t id) : m_id(id) , m_nextServerId(id + 1) , m_serverStartRequested(false) , m_callback(nullptr) { : m_id(id), m_nextServerId(id + 1), m_serverStartRequested(false), m_callback(nullptr) { pthread_mutex_init(&m_serverWaitMutex, nullptr); pthread_cond_init(&m_serverWaitCond, nullptr); } ~BinderLibTestService() { exit(EXIT_SUCCESS); } ~BinderLibTestService() { exit(EXIT_SUCCESS); } void processPendingCall() { if (m_callback != nullptr) { Loading @@ -1199,8 +1191,7 @@ class BinderLibTestService : public BBinder } } virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, virtual status_t onTransact(uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags = 0) { if (getuid() != (uid_t)IPCThreadState::self()->getCallingUid()) { return PERMISSION_DENIED; Loading @@ -1215,8 +1206,7 @@ class BinderLibTestService : public BBinder return BAD_VALUE; } if (m_id != 0) return INVALID_OPERATION; if (m_id != 0) return INVALID_OPERATION; pthread_mutex_lock(&m_serverWaitMutex); if (m_serverStartRequested) { Loading Loading @@ -1401,8 +1391,7 @@ class BinderLibTestService : public BBinder return BAD_VALUE; } ret = target->linkToDeath(testDeathRecipient); if (ret == NO_ERROR) ret = testDeathRecipient->waitEvent(5); if (ret == NO_ERROR) ret = testDeathRecipient->waitEvent(5); data2.writeInt32(ret); callback->transact(BINDER_LIB_TEST_CALL_BACK, data2, &reply2); return NO_ERROR; Loading @@ -1426,8 +1415,7 @@ class BinderLibTestService : public BBinder return BAD_VALUE; } ret = write(fd, buf, size); if (ret != size) return UNKNOWN_ERROR; if (ret != size) return UNKNOWN_ERROR; return NO_ERROR; } case BINDER_LIB_TEST_WRITE_PARCEL_FILE_DESCRIPTOR_TRANSACTION: { Loading Loading @@ -1482,8 +1470,7 @@ class BinderLibTestService : public BBinder case BINDER_LIB_TEST_ECHO_VECTOR: { std::vector<uint64_t> vector; auto err = data.readUint64Vector(&vector); if (err != NO_ERROR) return err; if (err != NO_ERROR) return err; reply->writeUint64Vector(vector); return NO_ERROR; } Loading @@ -1497,6 +1484,7 @@ class BinderLibTestService : public BBinder return UNKNOWN_TRANSACTION; }; } private: int32_t m_id; int32_t m_nextServerId; Loading