diff options
Diffstat (limited to 'test/hidl_test/hidl_test_client.cpp')
-rw-r--r-- | test/hidl_test/hidl_test_client.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/test/hidl_test/hidl_test_client.cpp b/test/hidl_test/hidl_test_client.cpp index 55490d28..614ffdbc 100644 --- a/test/hidl_test/hidl_test_client.cpp +++ b/test/hidl_test/hidl_test_client.cpp @@ -367,15 +367,20 @@ public: ASSERT_NE(manager, nullptr); ASSERT_TRUE(manager->isRemote()); // manager is always remote - // Token manager only exists on devices before Android V - tokenManager = ITokenManager::getService(); - if (tokenManager) { + if (IServiceManager::Transport::EMPTY != + manager->getTransport(ITokenManager::descriptor, "default")) { + // Token manager only exists on devices before Android V + tokenManager = ITokenManager::getService(); + ASSERT_TRUE(tokenManager); ASSERT_TRUE(tokenManager->isRemote()); // tokenManager is always remote } - ashmemAllocator = IAllocator::getService("ashmem"); - ASSERT_NE(ashmemAllocator, nullptr); - ASSERT_TRUE(ashmemAllocator->isRemote()); // allocator is always remote + if (IServiceManager::Transport::EMPTY != + manager->getTransport(IAllocator::descriptor, "ashmem")) { + ashmemAllocator = IAllocator::getService("ashmem"); + ASSERT_NE(ashmemAllocator, nullptr); + ASSERT_TRUE(ashmemAllocator->isRemote()); // allocator is always remote + } // getStub is true if we are in passthrough mode to skip checking // binderized server, false for binderized mode. @@ -897,6 +902,7 @@ TEST_F(HidlTest, TestToken) { } TEST_F(HidlTest, TestSharedMemory) { + if (!ashmemAllocator) GTEST_SKIP() << "ashmem allocator is not on the device"; const uint8_t kValue = 0xCA; hidl_memory mem_copy; EXPECT_OK(ashmemAllocator->allocate(1024, [&](bool success, const hidl_memory& mem) { @@ -960,6 +966,7 @@ TEST_F(HidlTest, TestSharedMemory) { } TEST_F(HidlTest, BatchSharedMemory) { + if (!ashmemAllocator) GTEST_SKIP() << "ashmem allocator is not on the device"; const uint8_t kValue = 0xCA; const uint64_t kBatchSize = 2; hidl_vec<hidl_memory> batchCopy; @@ -1009,6 +1016,7 @@ TEST_F(HidlTest, BatchSharedMemory) { } TEST_F(HidlTest, MemoryBlock) { + if (!ashmemAllocator) GTEST_SKIP() << "ashmem allocator is not on the device"; const uint8_t kValue = 0xCA; using ::android::hardware::IBinder; using ::android::hardware::interfacesEqual; |