Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

Merge "fix a potential native crash during bluetooth sutdown"

parents 044c9a16 a5aa8d52
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -155,7 +155,6 @@ static void cleanup( void )
        return;

    btif_shutdown_bluetooth();
    bt_utils_cleanup();

    /* hal callbacks reset upon shutdown complete callback */

+11 −0
Original line number Diff line number Diff line
@@ -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;