Fix the build with NDK r20.

NDK r20 provides a declaration of android_get_device_api_level() at API level
29, and an inline definition at older API levels. The latter conflicts with
crashpad's definition, so stop defining it if the NDK is new enough.

Bug: chromium:891999
Change-Id: If58542c9d6b5315f823f2509f168f2cb79141e3f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1739512
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Peter Collingbourne 2019-08-13 17:55:25 -07:00 committed by Joshua Peraza
parent 70d10eb629
commit 08f070325e
2 changed files with 6 additions and 5 deletions

View File

@ -21,7 +21,7 @@
#include "dlfcn_internal.h"
#if __ANDROID_API__ < 29
#if __NDK_MAJOR__ < 20
extern "C" {
@ -47,4 +47,4 @@ int android_get_device_api_level() {
} // extern "C"
#endif // __ANDROID_API__ < 29
#endif // __NDK_MAJOR__ < 20

View File

@ -16,23 +16,24 @@
#define CRASHPAD_COMPAT_ANDROID_ANDROID_API_LEVEL_H_
#include_next <android/api-level.h>
#include <android/ndk-version.h>
#include <sys/cdefs.h>
#if __ANDROID_API__ < 29
#if __NDK_MAJOR__ < 20
#ifdef __cplusplus
extern "C" {
#endif
// Returns the API level of the device or -1 if it can't be determined. This
// function is provided by Bionic at API 29.
// function is provided by NDK r20.
int android_get_device_api_level();
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __ANDROID_API__ < 29
#endif // __NDK_MAJOR__ < 20
#endif // CRASHPAD_COMPAT_ANDROID_ANDROID_API_LEVEL_H_