From f786aac482757c1892cac416a5b903d1c5a61839 Mon Sep 17 00:00:00 2001 From: Ajay Panicker Date: Thu, 30 Mar 2017 10:33:19 -0700 Subject: [PATCH] Delete bt_snoop.log when snoop logging is disabled This patch will immediatly delete the snoop log if Bluetooth is on. If Bluetooth is off it will delete the log as soon as Bluetooth starts again. Test: Turn off logging while Bluetooth is on and off Bug: 36718948 Change-Id: Ib660cd442c93f1a34c948d51c5cffc38695558d5 --- hci/src/btsnoop.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hci/src/btsnoop.cc b/hci/src/btsnoop.cc index 38de5c336..9e181e34e 100644 --- a/hci/src/btsnoop.cc +++ b/hci/src/btsnoop.cc @@ -142,6 +142,11 @@ static void update_logging() { bool should_log = module_started && (logging_enabled_via_api || stack_config->get_btsnoop_turned_on()); + if (module_started && !should_log) { + LOG_INFO(LOG_TAG, "Deleting snoop log if it exists"); + remove(stack_config->get_btsnoop_log_path()); + } + if (should_log == is_logging) return; is_logging = should_log; -- 2.11.0