Merge "suppress unguarded-availability warning for only AServiceManager_waitForService" into main

This commit is contained in:
Kangping Dong 2023-11-16 08:35:30 +00:00 • committed by Gerrit Code Review
commit eb08e8cdc8
2 changed files with 6 additions and 4 deletions

View file

@ -107,10 +107,6 @@ cc_library_shared {
"-Werror",
"-Wno-unused-parameter",
"-Wthread-safety",
// AServiceManager_waitForService is available on only 31+, but it's still safe for Thread
// service because it's enabled on only 34+
"-Wno-unguarded-availability",
],
srcs: [
":services.connectivity-netstats-jni-sources",

View file

@ -25,7 +25,13 @@ namespace android {
static jobject com_android_server_ServiceManagerWrapper_waitForService(
JNIEnv* env, jobject clazz, jstring serviceName) {
ScopedUtfChars name(env, serviceName);
// AServiceManager_waitForService is available on only 31+, but it's still safe for Thread
// service because it's enabled on only 34+
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability"
return AIBinder_toJavaBinder(env, AServiceManager_waitForService(name.c_str()));
#pragma clang diagnostic pop
}
/*