diff options
-rw-r--r-- | libs/binder/ndk/tests/iface.cpp | 3 | ||||
-rw-r--r-- | libs/binder/ndk/tests/libbinder_ndk_unit_test.cpp | 39 | ||||
-rw-r--r-- | libs/binder/rust/tests/serialization.hpp | 3 | ||||
-rw-r--r-- | libs/binder/servicedispatcher.cpp | 3 | ||||
-rw-r--r-- | libs/binder/tests/binderClearBufTest.cpp | 3 | ||||
-rw-r--r-- | libs/binder/tests/binderHostDeviceTest.cpp | 3 | ||||
-rw-r--r-- | libs/binder/tests/binderLibTest.cpp | 10 | ||||
-rw-r--r-- | libs/binder/tests/binderRecordReplayTest.cpp | 3 | ||||
-rw-r--r-- | libs/binder/tests/binderSafeInterfaceTest.cpp | 3 | ||||
-rw-r--r-- | libs/binder/tests/binderStabilityTest.cpp | 9 | ||||
-rw-r--r-- | libs/binder/tests/binderThroughputTest.cpp | 3 | ||||
-rw-r--r-- | libs/binder/tests/schd-dbg.cpp | 3 |
12 files changed, 83 insertions, 2 deletions
diff --git a/libs/binder/ndk/tests/iface.cpp b/libs/binder/ndk/tests/iface.cpp index 76acff50bf..3ee36cd8c3 100644 --- a/libs/binder/ndk/tests/iface.cpp +++ b/libs/binder/ndk/tests/iface.cpp @@ -156,7 +156,10 @@ binder_status_t IFoo::addService(const char* instance) { } sp<IFoo> IFoo::getService(const char* instance, AIBinder** outBinder) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" AIBinder* binder = AServiceManager_getService(instance); // maybe nullptr +#pragma clang diagnostic pop if (binder == nullptr) { return nullptr; } diff --git a/libs/binder/ndk/tests/libbinder_ndk_unit_test.cpp b/libs/binder/ndk/tests/libbinder_ndk_unit_test.cpp index 15708ca738..cab1a60370 100644 --- a/libs/binder/ndk/tests/libbinder_ndk_unit_test.cpp +++ b/libs/binder/ndk/tests/libbinder_ndk_unit_test.cpp @@ -341,7 +341,10 @@ TEST(NdkBinder, UnimplementedShell) { // libbinder across processes to the NDK service which doesn't implement // shell static const sp<android::IServiceManager> sm(android::defaultServiceManager()); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" sp<IBinder> testService = sm->getService(String16(IFoo::kSomeInstanceName)); +#pragma clang diagnostic pop Vector<String16> argsVec; EXPECT_EQ(OK, IBinder::shellCommand(testService, STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO, @@ -384,7 +387,10 @@ TEST(NdkBinder, GetTestServiceStressTest) { // checkService on it, since the other process serving it might not be started yet. { // getService, not waitForService, to take advantage of timeout +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" auto binder = ndk::SpAIBinder(AServiceManager_getService(IFoo::kSomeInstanceName)); +#pragma clang diagnostic pop ASSERT_NE(nullptr, binder.get()); } @@ -574,7 +580,10 @@ TEST(NdkBinder, DeathRecipient) { } TEST(NdkBinder, RetrieveNonNdkService) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" AIBinder* binder = AServiceManager_getService(kExistingNonNdkService); +#pragma clang diagnostic pop ASSERT_NE(nullptr, binder); EXPECT_TRUE(AIBinder_isRemote(binder)); EXPECT_TRUE(AIBinder_isAlive(binder)); @@ -588,7 +597,10 @@ void OnBinderDeath(void* cookie) { } TEST(NdkBinder, LinkToDeath) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" AIBinder* binder = AServiceManager_getService(kExistingNonNdkService); +#pragma clang diagnostic pop ASSERT_NE(nullptr, binder); AIBinder_DeathRecipient* recipient = AIBinder_DeathRecipient_new(OnBinderDeath); @@ -618,7 +630,10 @@ TEST(NdkBinder, SetInheritRt) { } TEST(NdkBinder, SetInheritRtNonLocal) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" AIBinder* binder = AServiceManager_getService(kExistingNonNdkService); +#pragma clang diagnostic pop ASSERT_NE(binder, nullptr); ASSERT_TRUE(AIBinder_isRemote(binder)); @@ -654,11 +669,14 @@ TEST(NdkBinder, GetServiceInProcess) { } TEST(NdkBinder, EqualityOfRemoteBinderPointer) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" AIBinder* binderA = AServiceManager_getService(kExistingNonNdkService); ASSERT_NE(nullptr, binderA); AIBinder* binderB = AServiceManager_getService(kExistingNonNdkService); ASSERT_NE(nullptr, binderB); +#pragma clang diagnostic pop EXPECT_EQ(binderA, binderB); @@ -672,7 +690,10 @@ TEST(NdkBinder, ToFromJavaNullptr) { } TEST(NdkBinder, ABpBinderRefCount) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" AIBinder* binder = AServiceManager_getService(kExistingNonNdkService); +#pragma clang diagnostic pop AIBinder_Weak* wBinder = AIBinder_Weak_new(binder); ASSERT_NE(nullptr, binder); @@ -695,7 +716,10 @@ TEST(NdkBinder, AddServiceMultipleTimes) { } TEST(NdkBinder, RequestedSidWorks) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" ndk::SpAIBinder binder(AServiceManager_getService(kBinderNdkUnitTestService)); +#pragma clang diagnostic pop std::shared_ptr<aidl::IBinderNdkUnitTest> service = aidl::IBinderNdkUnitTest::fromBinder(binder); @@ -718,7 +742,10 @@ TEST(NdkBinder, SentAidlBinderCanBeDestroyed) { std::shared_ptr<MyEmpty> empty = ndk::SharedRefBase::make<MyEmpty>(); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" ndk::SpAIBinder binder(AServiceManager_getService(kBinderNdkUnitTestService)); +#pragma clang diagnostic pop std::shared_ptr<aidl::IBinderNdkUnitTest> service = aidl::IBinderNdkUnitTest::fromBinder(binder); @@ -741,7 +768,10 @@ TEST(NdkBinder, SentAidlBinderCanBeDestroyed) { TEST(NdkBinder, ConvertToPlatformBinder) { for (const ndk::SpAIBinder& binder : {// remote +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" ndk::SpAIBinder(AServiceManager_getService(kBinderNdkUnitTestService)), +#pragma clang diagnostic pop // local ndk::SharedRefBase::make<MyBinderNdkUnitTest>()->asBinder()}) { // convert to platform binder @@ -774,7 +804,10 @@ TEST(NdkBinder, ConvertToPlatformParcel) { TEST(NdkBinder, GetAndVerifyScopedAIBinder_Weak) { for (const ndk::SpAIBinder& binder : {// remote +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" ndk::SpAIBinder(AServiceManager_getService(kBinderNdkUnitTestService)), +#pragma clang diagnostic pop // local ndk::SharedRefBase::make<MyBinderNdkUnitTest>()->asBinder()}) { // get a const ScopedAIBinder_Weak and verify promote @@ -869,7 +902,10 @@ std::string shellCmdToString(sp<IBinder> unitTestService, const std::vector<cons TEST(NdkBinder, UseHandleShellCommand) { static const sp<android::IServiceManager> sm(android::defaultServiceManager()); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" sp<IBinder> testService = sm->getService(String16(kBinderNdkUnitTestService)); +#pragma clang diagnostic pop EXPECT_EQ("", shellCmdToString(testService, {})); EXPECT_EQ("", shellCmdToString(testService, {"", ""})); @@ -879,7 +915,10 @@ TEST(NdkBinder, UseHandleShellCommand) { TEST(NdkBinder, FlaggedServiceAccessible) { static const sp<android::IServiceManager> sm(android::defaultServiceManager()); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" sp<IBinder> testService = sm->getService(String16(kBinderNdkUnitTestServiceFlagged)); +#pragma clang diagnostic pop ASSERT_NE(nullptr, testService); } diff --git a/libs/binder/rust/tests/serialization.hpp b/libs/binder/rust/tests/serialization.hpp index 0041608ae0..9edcd6d9b6 100644 --- a/libs/binder/rust/tests/serialization.hpp +++ b/libs/binder/rust/tests/serialization.hpp @@ -14,7 +14,10 @@ * limitations under the License. */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpragma-once-outside-header" #pragma once +#pragma clang diagnostic pop #include <binder/IBinder.h> diff --git a/libs/binder/servicedispatcher.cpp b/libs/binder/servicedispatcher.cpp index 692cc95e3b..738ff4c8f5 100644 --- a/libs/binder/servicedispatcher.cpp +++ b/libs/binder/servicedispatcher.cpp @@ -275,7 +275,10 @@ int main(int argc, char* argv[]) { while (-1 != (opt = getopt(argc, argv, "g"))) { switch (opt) { case 'g': { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" serviceRetriever = &android::IServiceManager::getService; +#pragma clang diagnostic pop } break; default: { return Usage(argv[0]); diff --git a/libs/binder/tests/binderClearBufTest.cpp b/libs/binder/tests/binderClearBufTest.cpp index 307151c7de..3ea5b553bc 100644 --- a/libs/binder/tests/binderClearBufTest.cpp +++ b/libs/binder/tests/binderClearBufTest.cpp @@ -74,7 +74,10 @@ class FooBar : public BBinder { }; TEST(BinderClearBuf, ClearKernelBuffer) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" sp<IBinder> binder = defaultServiceManager()->getService(kServerName); +#pragma clang diagnostic pop ASSERT_NE(nullptr, binder); std::string replyBuffer; diff --git a/libs/binder/tests/binderHostDeviceTest.cpp b/libs/binder/tests/binderHostDeviceTest.cpp index 77a5fa8d65..0075688ed3 100644 --- a/libs/binder/tests/binderHostDeviceTest.cpp +++ b/libs/binder/tests/binderHostDeviceTest.cpp @@ -135,7 +135,10 @@ TEST_F(HostDeviceTest, CheckService) { TEST_F(HostDeviceTest, GetService) { auto sm = defaultServiceManager(); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" auto rpcBinder = sm->getService(String16(kServiceName)); +#pragma clang diagnostic pop ASSERT_NE(nullptr, rpcBinder); EXPECT_THAT(rpcBinder->pingBinder(), StatusEq(OK)); diff --git a/libs/binder/tests/binderLibTest.cpp b/libs/binder/tests/binderLibTest.cpp index e021af0264..853be01a2a 100644 --- a/libs/binder/tests/binderLibTest.cpp +++ b/libs/binder/tests/binderLibTest.cpp @@ -213,7 +213,10 @@ class BinderLibTestEnv : public ::testing::Environment { sp<IServiceManager> sm = defaultServiceManager(); //printf("%s: pid %d, get service\n", __func__, m_pid); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" m_server = sm->getService(binderLibTestServiceName); +#pragma clang diagnostic pop ASSERT_TRUE(m_server != nullptr); //printf("%s: pid %d, get service done\n", __func__, m_pid); } @@ -1107,6 +1110,7 @@ TEST_F(BinderLibTest, WorkSourcePropagatedForAllFollowingBinderCalls) status_t ret; data.writeInterfaceToken(binderLibTestServiceName); ret = m_server->transact(BINDER_LIB_TEST_GET_WORK_SOURCE_TRANSACTION, data, &reply); + EXPECT_EQ(NO_ERROR, ret); Parcel data2, reply2; status_t ret2; @@ -1565,9 +1569,8 @@ public: } switch (code) { case BINDER_LIB_TEST_REGISTER_SERVER: { - int32_t id; sp<IBinder> binder; - id = data.readInt32(); + /*id =*/data.readInt32(); binder = data.readStrongBinder(); if (binder == nullptr) { return BAD_VALUE; @@ -1963,7 +1966,10 @@ int run_server(int index, int readypipefd, bool usePoll) if (index == 0) { ret = sm->addService(binderLibTestServiceName, testService); } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" sp<IBinder> server = sm->getService(binderLibTestServiceName); +#pragma clang diagnostic pop Parcel data, reply; data.writeInt32(index); data.writeStrongBinder(testService); diff --git a/libs/binder/tests/binderRecordReplayTest.cpp b/libs/binder/tests/binderRecordReplayTest.cpp index 6773c95ed6..d08a9bb430 100644 --- a/libs/binder/tests/binderRecordReplayTest.cpp +++ b/libs/binder/tests/binderRecordReplayTest.cpp @@ -133,7 +133,10 @@ class BinderRecordReplayTest : public ::testing::Test { public: void SetUp() override { // get the remote service +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" auto binder = defaultServiceManager()->getService(kServerName); +#pragma clang diagnostic pop ASSERT_NE(nullptr, binder); mInterface = interface_cast<IBinderRecordReplayTest>(binder); mBpBinder = binder->remoteBinder(); diff --git a/libs/binder/tests/binderSafeInterfaceTest.cpp b/libs/binder/tests/binderSafeInterfaceTest.cpp index 5e8a32a61b..1c13866626 100644 --- a/libs/binder/tests/binderSafeInterfaceTest.cpp +++ b/libs/binder/tests/binderSafeInterfaceTest.cpp @@ -605,7 +605,10 @@ private: static constexpr const char* getLogTag() { return "SafeInterfaceTest"; } sp<ISafeInterfaceTest> getRemoteService() { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" sp<IBinder> binder = defaultServiceManager()->getService(kServiceName); +#pragma clang diagnostic pop sp<ISafeInterfaceTest> iface = interface_cast<ISafeInterfaceTest>(binder); EXPECT_TRUE(iface != nullptr); diff --git a/libs/binder/tests/binderStabilityTest.cpp b/libs/binder/tests/binderStabilityTest.cpp index 2398e1e1ef..3d993588a4 100644 --- a/libs/binder/tests/binderStabilityTest.cpp +++ b/libs/binder/tests/binderStabilityTest.cpp @@ -155,7 +155,10 @@ TEST(BinderStability, NdkForceDowngradeToLocalStability) { } TEST(BinderStability, ForceDowngradeToVendorStability) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" sp<IBinder> serverBinder = android::defaultServiceManager()->getService(kSystemStabilityServer); +#pragma clang diagnostic pop auto server = interface_cast<IBinderStabilityTest>(serverBinder); ASSERT_NE(nullptr, server.get()); @@ -206,7 +209,10 @@ TEST(BinderStability, ConnectionInfoRequiresManifestEntries) { EXPECT_EQ(connectionInfo, std::nullopt); } TEST(BinderStability, CantCallVendorBinderInSystemContext) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" sp<IBinder> serverBinder = android::defaultServiceManager()->getService(kSystemStabilityServer); +#pragma clang diagnostic pop auto server = interface_cast<IBinderStabilityTest>(serverBinder); ASSERT_NE(nullptr, server.get()); @@ -310,8 +316,11 @@ static AIBinder_Class* kNdkBadStableBinder = extern "C" void AIBinder_markVendorStability(AIBinder* binder); // <- BAD DO NOT COPY TEST(BinderStability, NdkCantCallVendorBinderInSystemContext) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" SpAIBinder binder = SpAIBinder(AServiceManager_getService( String8(kSystemStabilityServer).c_str())); +#pragma clang diagnostic pop std::shared_ptr<aidl::IBinderStabilityTest> remoteServer = aidl::IBinderStabilityTest::fromBinder(binder); diff --git a/libs/binder/tests/binderThroughputTest.cpp b/libs/binder/tests/binderThroughputTest.cpp index cfaf2a987f..0ea4a3faaa 100644 --- a/libs/binder/tests/binderThroughputTest.cpp +++ b/libs/binder/tests/binderThroughputTest.cpp @@ -204,7 +204,10 @@ void worker_fx(int num, for (int i = 0; i < server_count; i++) { if (num == i) continue; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" workers.push_back(serviceMgr->getService(generateServiceName(i))); +#pragma clang diagnostic pop } // Run the benchmark if client diff --git a/libs/binder/tests/schd-dbg.cpp b/libs/binder/tests/schd-dbg.cpp index 0035e4ee5a..d3cd528e26 100644 --- a/libs/binder/tests/schd-dbg.cpp +++ b/libs/binder/tests/schd-dbg.cpp @@ -340,7 +340,10 @@ void worker_fx(int num, int no_process, int iterations, int payload_size, for (int i = 0; i < server_count; i++) { // self service is in-process so just skip if (num == i) continue; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" workers.push_back(serviceMgr->getService(generateServiceName(i))); +#pragma clang diagnostic pop } // Client for each pair iterates here |