OSDN Git Service

android: fix building errors on android-6.0.1_r52
authorChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 8 Jul 2016 14:26:23 +0000 (22:26 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 1 Jun 2017 03:28:29 +0000 (11:28 +0800)
Fix all Android Bluetooth APIs mismatching.

Treat all warnings as errors to avoid overlooking such issues
in the future.

android/Android.mk
android/client/if-bt.c
android/hal-audio.c
android/hal-bluetooth.c

index 89f7294..65d7ade 100644 (file)
@@ -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 \
 
 #
index c9acf6c..25635ba 100644 (file)
@@ -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)
index 207101f..f017c3b 100644 (file)
@@ -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.
index 40b0df6..719834d 100644 (file)
@@ -585,7 +585,7 @@ fail:
        return status;
 }
 
-static int enable(void)
+static int enable(bool restricted)
 {
        DBG("");