summaryrefslogtreecommitdiff
path: root/android/hal-handsfree.c
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2014-03-03 00:50:49 +0100
committerSzymon Janc <szymon.janc@tieto.com>2014-03-04 10:18:27 +0100
commitc088a0f5c60f26441ef8b7418acfc71089e20ff0 (patch)
treec2f8e27c4f443f7811ab71eb22307ee9d4acdf1f /android/hal-handsfree.c
parenta6b131fb47ad84c95e69d73bae60d3c9253a9b0a (diff)
downloadbluez-c088a0f5c60f26441ef8b7418acfc71089e20ff0.tar.gz
android/handsfree: Add support for disabling HSP or HFP AGs
This allows to tune what profiles are supported by handsfree HAL.
Diffstat (limited to 'android/hal-handsfree.c')
-rw-r--r--android/hal-handsfree.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/android/hal-handsfree.c b/android/hal-handsfree.c
index 7a28e0f5c..4117ed0a9 100644
--- a/android/hal-handsfree.c
+++ b/android/hal-handsfree.c
@@ -20,6 +20,8 @@
#include <string.h>
#include <stdlib.h>
+#include <cutils/properties.h>
+
#include "hal-log.h"
#include "hal.h"
#include "hal-msg.h"
@@ -196,6 +198,17 @@ static const struct hal_ipc_handler ev_handlers[] = {
{handle_hsp_key_press, false, 0},
};
+static uint8_t get_mode(void)
+{
+ char value[PROPERTY_VALUE_MAX];
+
+ if (property_get("bluetooth.handsfree_mode", value, "") > 0 &&
+ (!strcasecmp(value, "hsp_only")))
+ return HAL_MODE_HANDSFREE_HSP_ONLY;
+
+ return HAL_MODE_DEFAULT;
+}
+
static bt_status_t init(bthf_callbacks_t *callbacks)
{
struct hal_cmd_register_module cmd;
@@ -212,7 +225,7 @@ static bt_status_t init(bthf_callbacks_t *callbacks)
sizeof(ev_handlers)/sizeof(ev_handlers[0]));
cmd.service_id = HAL_SERVICE_ID_HANDSFREE;
- cmd.mode = HAL_MODE_DEFAULT;
+ cmd.mode = get_mode();
ret = hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
sizeof(cmd), &cmd, 0, NULL, NULL);