From b47a832f6faa44313c9c82658ab0db9038cb5fc5 Mon Sep 17 00:00:00 2001 From: Chih-Wei Huang Date: Fri, 8 Jul 2016 22:26:23 +0800 Subject: [PATCH] android: fix building errors on android-6.0.1_r52 Fix all Android Bluetooth APIs mismatching. Treat all warnings as errors to avoid overlooking such issues in the future. --- android/Android.mk | 2 ++ android/client/if-bt.c | 8 ++++++++ android/hal-audio.c | 2 +- android/hal-bluetooth.c | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/android/Android.mk b/android/Android.mk index 89f729456..65d7aded6 100644 --- a/android/Android.mk +++ b/android/Android.mk @@ -27,10 +27,12 @@ BLUEZ_COMMON_CFLAGS += -Wall -Wextra \ -Wmissing-declarations \ -Wredundant-decls \ -Wcast-align \ + -Werror \ # Disable warnings enabled by Android but not enabled in autotools build BLUEZ_COMMON_CFLAGS += -Wno-pointer-arith \ -Wno-missing-field-initializers \ + -Wno-maybe-uninitialized \ -Wno-unused-parameter \ # diff --git a/android/client/if-bt.c b/android/client/if-bt.c index c9acf6c83..25635bac6 100644 --- a/android/client/if-bt.c +++ b/android/client/if-bt.c @@ -250,7 +250,11 @@ static void pin_request_answer(char *reply) } static void pin_request_cb(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *bd_name, +#if ANDROID_VERSION >= PLATFORM_VER(6, 0, 1) + uint32_t cod, bool u) +#else uint32_t cod) +#endif { /* Store for command completion */ bt_bdaddr_t2str(remote_bd_addr, last_remote_addr); @@ -464,7 +468,11 @@ static void enable_p(int argc, const char **argv) { RETURN_IF_NULL(if_bluetooth); +#if ANDROID_VERSION >= PLATFORM_VER(6, 0, 1) + EXEC(if_bluetooth->enable, false); +#else EXEC(if_bluetooth->enable); +#endif } #if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0) static void read_energy_info_p(int argc, const char **argv) diff --git a/android/hal-audio.c b/android/hal-audio.c index 207101fa8..f017c3bc6 100644 --- a/android/hal-audio.c +++ b/android/hal-audio.c @@ -87,7 +87,7 @@ static uint64_t timespec_diff_us(struct timespec *a, struct timespec *b) return res.tv_sec * 1000000ll + res.tv_nsec / 1000ll; } -#if defined(ANDROID) +#if ANDROID_VERSION < PLATFORM_VER(6, 0, 0) /* * Bionic does not have clock_nanosleep() prototype in time.h even though * it provides its implementation. diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c index 40b0df6e1..719834d69 100644 --- a/android/hal-bluetooth.c +++ b/android/hal-bluetooth.c @@ -585,7 +585,7 @@ fail: return status; } -static int enable(void) +static int enable(bool restricted) { DBG(""); -- 2.11.0