summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinu Jella <sjella@codeaurora.org>2015-11-12 17:31:41 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2015-11-17 04:14:16 -0800
commita8dc3a310b9f4547d1ddf759038c4054b6763d5b (patch)
tree8e2e8e781fa03dbcb76a9055af030e77e29c1429
parent7f1f1722750a2ae24a6d7da834bf0cc2f56e1f03 (diff)
downloadandroid_system_bt-a8dc3a310b9f4547d1ddf759038c4054b6763d5b.tar.gz
android_system_bt-a8dc3a310b9f4547d1ddf759038c4054b6763d5b.tar.bz2
android_system_bt-a8dc3a310b9f4547d1ddf759038c4054b6763d5b.zip
Bluetooth: Offload config save functionality to btif thread
- Offload config save functionality to btif thread from timer thread as timer callback thread is critical in a2dp playback case. - If the timer callback thread is busy in config save due to IO operations, it may lead to a2dp audio choppy. CRs-Fixed: 937048 Change-Id: I5f185f3d610a581a734a2a7ae7f20b8a8a806e72
-rw-r--r--btif/src/btif_config.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/btif/src/btif_config.c b/btif/src/btif_config.c
index 241c7710d..c94e449f8 100644
--- a/btif/src/btif_config.c
+++ b/btif/src/btif_config.c
@@ -30,6 +30,7 @@
#include "btif_config.h"
#include "btif_config_transcode.h"
#include "btif_util.h"
+#include "btif_common.h"
#include "osi/include/compat.h"
#include "osi/include/config.h"
#include "btcore/include/module.h"
@@ -42,7 +43,8 @@ static const char *CONFIG_FILE_PATH = "/data/misc/bluedroid/bt_config.conf";
static const char *LEGACY_CONFIG_FILE_PATH = "/data/misc/bluedroid/bt_config.xml";
static const period_ms_t CONFIG_SETTLE_PERIOD_MS = 3000;
-static void timer_config_save(void *data);
+static void timer_config_saving(void* data);
+static void timer_config_save(UINT16 event, char* p_param);
// TODO(zachoverflow): Move these two functions out, because they are too specific for this file
// {grumpy-cat/no, monty-python/you-make-me-sad}
@@ -346,7 +348,7 @@ void btif_config_save(void) {
assert(alarm_timer != NULL);
assert(config != NULL);
- alarm_set(alarm_timer, CONFIG_SETTLE_PERIOD_MS, timer_config_save, NULL);
+ alarm_set(alarm_timer, CONFIG_SETTLE_PERIOD_MS, timer_config_saving, NULL);
}
void btif_config_flush(void) {
@@ -381,7 +383,14 @@ int btif_config_clear(void){
return ret;
}
-static void timer_config_save(UNUSED_ATTR void *data) {
+static void timer_config_saving(UNUSED_ATTR void* data) {
+ // calling file IO onto btif context instead of timer callback because
+ // it usually takes lots of time to be completed timer callback has big
+ // delayed during a2dp playback causing blip or choppiness.
+ btif_transfer_context(timer_config_save, 0, NULL, 0, NULL);
+}
+
+static void timer_config_save(UNUSED_ATTR UINT16 event, UNUSED_ATTR char* p_param) {
assert(config != NULL);
assert(alarm_timer != NULL);