Commit ea8acc97 authored by Zhihai Xu's avatar Zhihai Xu Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE fix a potential native crash during bluetooth sutdown" into klp-dev

parents 1e0849e9 5a79e080
......@@ -155,7 +155,6 @@ static void cleanup( void )
return;
btif_shutdown_bluetooth();
bt_utils_cleanup();
/* hal callbacks reset upon shutdown complete callback */
......
......@@ -37,6 +37,7 @@
#define LOG_TAG "BTIF_CORE"
#include "btif_api.h"
#include "bt_utils.h"
#include "bta_api.h"
#include "gki.h"
#include "btu.h"
......@@ -737,6 +738,14 @@ bt_status_t btif_shutdown_bluetooth(void)
{
BTIF_TRACE_DEBUG1("%s", __FUNCTION__);
if (btif_core_state == BTIF_CORE_STATE_DISABLING)
{
BTIF_TRACE_WARNING0("shutdown during disabling");
/* shutdown called before disabling is done */
btif_shutdown_pending = 1;
return BT_STATUS_NOT_READY;
}
if (btif_is_enabled())
{
BTIF_TRACE_WARNING0("shutdown while still enabled, initiate disable");
......@@ -765,6 +774,8 @@ bt_status_t btif_shutdown_bluetooth(void)
btif_dut_mode = 0;
bt_utils_cleanup();
BTIF_TRACE_DEBUG1("%s done", __FUNCTION__);
return BT_STATUS_SUCCESS;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment