From ab0846e0350d7fa2363b3b9bd1d51d966b16d411 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Fri, 15 Jan 2021 15:59:16 +0900 Subject: [PATCH] Remove __ANDROID_API__ guards __ANDROID_API__ guards are removed in favor of __INTRODUCED_IN macros. Currently, __INTRODUCED_IN macro does nothing for these headers (it's meaningful only to the headers processed by versioner which are limited to binic headers). The plan is to make the macros to tag the declaration with the availability attribute. Then, when the min_sdk_version of a caller is set to an API level that is older than the API level of the APIs, the compiler will provide them as weak symbols and enforce that calling the APIs are guarded with a runtime check. For now, these guards are preventing from making a build system change to let __ANDROID_API__ track the min_sdk_version property instead of the sdk_version property. With the build system change, __ANDROID_API__ will suddenly drop for the native modules where min_sdk_version < sdk_version, which is the case when the modules are included in APEXes. As a result, some new APIs will be unavailable at build-time. Dropping the hand-written guards fixes the problem. Bug: 163288375 Test: m Change-Id: I8cafdba77fe358b2dcc9ad33f43c5410c9c27934 --- native/android/include_platform/android/activity_manager.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/native/android/include_platform/android/activity_manager.h b/native/android/include_platform/android/activity_manager.h index 0ecd56d512a27..aa86c74e16c9a 100644 --- a/native/android/include_platform/android/activity_manager.h +++ b/native/android/include_platform/android/activity_manager.h @@ -115,8 +115,6 @@ enum { AACTIVITYMANAGER_IMPORTANCE_GONE = 1000, }; -#if __ANDROID_API__ >= 31 - /** * Adds a UidImportanceListener to the ActivityManager. * @@ -169,8 +167,6 @@ bool AActivityManager_isUidActive(uid_t uid) __INTRODUCED_IN(31); */ int32_t AActivityManager_getUidImportance(uid_t uid) __INTRODUCED_IN(31); -#endif // __ANDROID_API__ >= 31 - __END_DECLS #endif // __AACTIVITYMANAGER_H__