From 8622810347b2be55570c49a44dacb4ab0de78ec7 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Tue, 14 Jan 2014 12:51:47 +0100 Subject: [PATCH] android: Remove support for old Android versions This removes compatibility with Android 4.3 and older. Android 4.4 is current target. Due to bug in Audio HAL in 4.2 build was failing on that version anyway. --- android/Android.mk | 9 +-------- android/Makefile.am | 4 +--- android/README | 2 ++ android/client/haltest.c | 4 ---- android/client/if-bt.c | 16 ---------------- android/client/if-gatt.c | 7 ------- android/client/if-main.h | 6 ------ android/hal-bluetooth.c | 14 -------------- android/hal-utils.c | 2 -- android/main.c | 7 +------ 10 files changed, 5 insertions(+), 66 deletions(-) diff --git a/android/Android.mk b/android/Android.mk index 5a55a7692..ae52ab425 100644 --- a/android/Android.mk +++ b/android/Android.mk @@ -8,7 +8,6 @@ pathmap_INCL += glib:external/bluetooth/glib # Specify common compiler flags BLUEZ_COMMON_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\" \ - -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \ -DANDROID_STORAGEDIR=\"/data/misc/bluetooth\" \ # Disable warnings enabled by Android but not enabled in autotools build @@ -133,15 +132,9 @@ LOCAL_SRC_FILES := \ client/if-hh.c \ client/if-pan.c \ client/if-sock.c \ + client/if-gatt.c \ hal-utils.c \ -ANDROID_4_3_OR_ABOVE := $(shell echo 0 | awk -v v=$(PLATFORM_SDK_VERSION) 'END {print (v > 17) ? 1 : 0}') - -ifeq ($(ANDROID_4_3_OR_ABOVE), 1) -LOCAL_SRC_FILES += \ - client/if-gatt.c -endif - LOCAL_C_INCLUDES += \ $(call include-path-for, system-core) \ $(call include-path-for, libhardware) \ diff --git a/android/Makefile.am b/android/Makefile.am index 356f932e9..7806f7921 100644 --- a/android/Makefile.am +++ b/android/Makefile.am @@ -66,8 +66,7 @@ android_bluetooth_default_la_SOURCES = android/hal.h android/hal-bluetooth.c \ android/hal-ipc.h android/hal-ipc.c \ android/hal-utils.h android/hal-utils.c -android_bluetooth_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \ - -DPLATFORM_SDK_VERSION=19 +android_bluetooth_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android android_bluetooth_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \ -no-undefined @@ -94,7 +93,6 @@ android_haltest_SOURCES = android/client/haltest.c \ android/hal-utils.h android/hal-utils.c android_haltest_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \ - -DPLATFORM_SDK_VERSION=19 \ -DPLUGINDIR=\""$(android_plugindir)"\" android_haltest_LDFLAGS = -pthread -ldl diff --git a/android/README b/android/README index 39ca9d2f6..717ffa224 100644 --- a/android/README +++ b/android/README @@ -9,6 +9,8 @@ replacement to Android provided Bluetooth stack. More details about BlueZ for Android architecture and components can be found in android/hal-apc-api.txt file. +Supported Android version: 4.4 + =============================== Building and running on Android =============================== diff --git a/android/client/haltest.c b/android/client/haltest.c index 7c314c0df..f4d1ade7f 100644 --- a/android/client/haltest.c +++ b/android/client/haltest.c @@ -34,11 +34,9 @@ const struct interface *interfaces[] = { &audio_if, &bluetooth_if, &av_if, -#if PLATFORM_SDK_VERSION > 17 &gatt_if, &gatt_client_if, &gatt_server_if, -#endif &hf_if, &hh_if, &pan_if, @@ -387,9 +385,7 @@ static void init(void) BT_PROFILE_HEALTH_ID, BT_PROFILE_HIDHOST_ID, BT_PROFILE_PAN_ID, -#if PLATFORM_SDK_VERSION > 17 BT_PROFILE_GATT_ID, -#endif BT_PROFILE_SOCKETS_ID }; const struct method *m; diff --git a/android/client/if-bt.c b/android/client/if-bt.c index 6771df426..6bfb439cf 100644 --- a/android/client/if-bt.c +++ b/android/client/if-bt.c @@ -307,13 +307,11 @@ static void dut_mode_recv_cb(uint16_t opcode, uint8_t *buf, uint8_t len) haltest_info("%s\n", __func__); } -#if PLATFORM_SDK_VERSION > 17 static void le_test_mode_cb(bt_status_t status, uint16_t num_packets) { haltest_info("%s %s %d\n", __func__, bt_status_t2str(status), num_packets); } -#endif static bt_callbacks_t bt_callbacks = { .size = sizeof(bt_callbacks), @@ -328,9 +326,7 @@ static bt_callbacks_t bt_callbacks = { .acl_state_changed_cb = acl_state_changed_cb, .thread_evt_cb = thread_evt_cb, .dut_mode_recv_cb = dut_mode_recv_cb, -#if PLATFORM_SDK_VERSION > 17 .le_test_mode_cb = le_test_mode_cb -#endif }; static void init_p(int argc, const char **argv) @@ -726,10 +722,8 @@ static void get_profile_interface_c(int argc, const char **argv, BT_PROFILE_SOCKETS_ID, BT_PROFILE_HIDHOST_ID, BT_PROFILE_PAN_ID, -#if PLATFORM_SDK_VERSION > 17 BT_PROFILE_GATT_ID, BT_PROFILE_AV_RC_ID, -#endif NULL }; @@ -765,12 +759,10 @@ static void get_profile_interface_p(int argc, const char **argv) pif = (const void **) &if_hh; else if (strcmp(BT_PROFILE_PAN_ID, id) == 0) pif = (const void **) &if_pan; -#if PLATFORM_SDK_VERSION > 17 else if (strcmp(BT_PROFILE_AV_RC_ID, id) == 0) pif = &dummy; /* TODO: change when if_rc is there */ else if (strcmp(BT_PROFILE_GATT_ID, id) == 0) pif = (const void **) &if_gatt; -#endif else haltest_error("%s is not correct for get_profile_interface\n", id); @@ -802,14 +794,11 @@ static void dut_mode_send_p(int argc, const char **argv) haltest_error("not implemented\n"); } -#if PLATFORM_SDK_VERSION > 17 static void le_test_mode_p(int argc, const char **argv) { haltest_error("not implemented\n"); } -#endif -#if PLATFORM_SDK_VERSION > 18 static void config_hci_snoop_log_p(int argc, const char **argv) { uint8_t mode; @@ -825,7 +814,6 @@ static void config_hci_snoop_log_p(int argc, const char **argv) EXEC(if_bluetooth->config_hci_snoop_log, mode); } -#endif static struct method methods[] = { STD_METHOD(init), @@ -851,12 +839,8 @@ static struct method methods[] = { STD_METHODCH(get_profile_interface, ""), STD_METHODH(dut_mode_configure, ""), STD_METHOD(dut_mode_send), -#if PLATFORM_SDK_VERSION > 17 STD_METHOD(le_test_mode), -#endif -#if PLATFORM_SDK_VERSION > 18 STD_METHODH(config_hci_snoop_log, ""), -#endif END_METHOD }; diff --git a/android/client/if-gatt.c b/android/client/if-gatt.c index bb539527a..e8837ffd6 100644 --- a/android/client/if-gatt.c +++ b/android/client/if-gatt.c @@ -26,16 +26,9 @@ const btgatt_interface_t *if_gatt = NULL; * btgatt_char_id_t -> btgatt_gatt_id_t * bt_uuid_t -> btgatt_gatt_id_t */ -#if PLATFORM_SDK_VERSION > 18 #define str2btgatt_descr_id_t str2btgatt_gatt_id_t #define btgatt_descr_id_t2str btgatt_gatt_id_t2str #define btgatt_descr_id_t btgatt_gatt_id_t -#else -#define btgatt_descr_id_t2str gatt_uuid_t2str -#define str2btgatt_descr_id_t(a, b) gatt_str2bt_uuid_t(a, -1, b) -#define btgatt_gatt_id_t btgatt_char_id_t -#define btgatt_descr_id_t bt_uuid_t -#endif #define MAX_CHAR_ID_STR_LEN (MAX_UUID_STR_LEN + 3 + 11) #define MAX_SRVC_ID_STR_LEN (MAX_UUID_STR_LEN + 3 + 11 + 1 + 11) diff --git a/android/client/if-main.h b/android/client/if-main.h index 0371c3e7b..2b22fc44e 100644 --- a/android/client/if-main.h +++ b/android/client/if-main.h @@ -37,13 +37,11 @@ #include #include -#if PLATFORM_SDK_VERSION > 17 #include #include #include #include #include -#endif extern audio_hw_device_t *if_audio; @@ -54,11 +52,9 @@ extern const bthf_interface_t *if_hf; extern const bthh_interface_t *if_hh; extern const btpan_interface_t *if_pan; extern const btsock_interface_t *if_sock; -#if PLATFORM_SDK_VERSION > 17 extern const btgatt_interface_t *if_gatt; extern const btgatt_server_interface_t *if_gatt_server; extern const btgatt_client_interface_t *if_gatt_client; -#endif /* * Structure defines top level interfaces that can be used in test tool @@ -72,11 +68,9 @@ struct interface { extern const struct interface audio_if; extern const struct interface bluetooth_if; extern const struct interface av_if; -#if PLATFORM_SDK_VERSION > 17 extern const struct interface gatt_if; extern const struct interface gatt_client_if; extern const struct interface gatt_server_if; -#endif extern const struct interface pan_if; extern const struct interface sock_if; extern const struct interface hf_if; diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c index 7accdccb5..be45836cd 100644 --- a/android/hal-bluetooth.c +++ b/android/hal-bluetooth.c @@ -145,7 +145,6 @@ static void device_props_to_hal(bt_property_t *send_props, enum_prop_to_hal(send_props[i], prop, bt_device_type_t); break; -#if PLATFORM_SDK_VERSION > 17 case HAL_PROP_DEVICE_VERSION_INFO: { static bt_remote_version_t e; @@ -161,7 +160,6 @@ static void device_props_to_hal(bt_property_t *send_props, e.version = p->version; } break; -#endif case HAL_PROP_DEVICE_SERVICE_REC: { static bt_service_record_t e; @@ -342,7 +340,6 @@ static void handle_dut_mode_receive(void *buf, uint16_t len) bt_hal_cbacks->dut_mode_recv_cb(ev->opcode, ev->data, ev->len); } -#if PLATFORM_SDK_VERSION > 17 static void handle_le_test_mode(void *buf, uint16_t len) { struct hal_ev_le_test_mode *ev = buf; @@ -352,7 +349,6 @@ static void handle_le_test_mode(void *buf, uint16_t len) if (bt_hal_cbacks->le_test_mode_cb) bt_hal_cbacks->le_test_mode_cb(ev->status, ev->num_packets); } -#endif /* handlers will be called from notification thread context, * index in table equals to 'opcode - HAL_MINIMUM_EVENT' */ @@ -410,13 +406,11 @@ static const struct hal_ipc_handler ev_handlers[] = { .var_len = true, .data_len = sizeof(struct hal_ev_dut_mode_receive), }, -#if PLATFORM_SDK_VERSION > 17 { /* HAL_EV_LE_TEST_MODE */ .handler = handle_le_test_mode, .var_len = false, .data_len = sizeof(struct hal_ev_le_test_mode), } -#endif }; static int init(bt_callbacks_t *callbacks) @@ -806,7 +800,6 @@ static int dut_mode_send(uint16_t opcode, uint8_t *buf, uint8_t len) sizeof(cmd_buf), cmd, 0, NULL, NULL); } -#if PLATFORM_SDK_VERSION > 17 static int le_test_mode(uint16_t opcode, uint8_t *buf, uint8_t len) { uint8_t cmd_buf[sizeof(struct hal_cmd_le_test_mode) + len]; @@ -824,9 +817,7 @@ static int le_test_mode(uint16_t opcode, uint8_t *buf, uint8_t len) return hal_ipc_cmd(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_LE_TEST_MODE, sizeof(cmd_buf), cmd, 0, NULL, NULL); } -#endif -#if PLATFORM_SDK_VERSION > 18 static int config_hci_snoop_log(uint8_t enable) { DBG("enable %u", enable); @@ -843,7 +834,6 @@ static int config_hci_snoop_log(uint8_t enable) return BT_STATUS_SUCCESS; } -#endif static const bt_interface_t bluetooth_if = { .size = sizeof(bt_interface_t), @@ -869,12 +859,8 @@ static const bt_interface_t bluetooth_if = { .get_profile_interface = get_profile_interface, .dut_mode_configure = dut_mode_configure, .dut_mode_send = dut_mode_send, -#if PLATFORM_SDK_VERSION > 17 .le_test_mode = le_test_mode, -#endif -#if PLATFORM_SDK_VERSION > 18 .config_hci_snoop_log = config_hci_snoop_log, -#endif }; static const bt_interface_t *get_bluetooth_interface(void) diff --git a/android/hal-utils.c b/android/hal-utils.c index e3c0c6070..ceefefc66 100644 --- a/android/hal-utils.c +++ b/android/hal-utils.c @@ -125,9 +125,7 @@ INTMAP(bt_property_type_t, -1, "(unknown)") DELEMENT(BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT), DELEMENT(BT_PROPERTY_REMOTE_FRIENDLY_NAME), DELEMENT(BT_PROPERTY_REMOTE_RSSI), -#if PLATFORM_SDK_VERSION > 17 DELEMENT(BT_PROPERTY_REMOTE_VERSION_INFO), -#endif DELEMENT(BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP), ENDMAP diff --git a/android/main.c b/android/main.c index 5210b4bcd..bd1bed759 100644 --- a/android/main.c +++ b/android/main.c @@ -36,6 +36,7 @@ #include #include +#include #include @@ -52,12 +53,6 @@ #include "a2dp.h" #include "pan.h" -/* TODO: Consider to remove PLATFORM_SDKVERSION check if requirement -* for minimal Android platform version increases. */ -#if defined(ANDROID) && PLATFORM_SDK_VERSION >= 18 -#include -#endif - #define STARTUP_GRACE_SECONDS 5 #define SHUTDOWN_GRACE_SECONDS 10 -- 2.47.3