From 9833109a3e8cb5d4935e7288af435fbef1ca6c75 Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Thu, 24 Aug 2017 09:13:02 -0700 Subject: [PATCH] Bluetooth: Return false when not shut down Do not crash in the vendor layer. The stack will crash when it fails to initialize. Bug: 64535243 Test: Bluetooth starts/stops Change-Id: I69fdd2879c80fa2f006c50f0a42a85e9289b14fe --- bluetooth/1.0/default/vendor_interface.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bluetooth/1.0/default/vendor_interface.cc b/bluetooth/1.0/default/vendor_interface.cc index 15b6c74532..6ce2f11fb4 100644 --- a/bluetooth/1.0/default/vendor_interface.cc +++ b/bluetooth/1.0/default/vendor_interface.cc @@ -162,8 +162,10 @@ bool VendorInterface::Initialize( InitializeCompleteCallback initialize_complete_cb, PacketReadCallback event_cb, PacketReadCallback acl_cb, PacketReadCallback sco_cb) { - LOG_ALWAYS_FATAL_IF(g_vendor_interface, "%s: No previous Shutdown()?", - __func__); + if (g_vendor_interface) { + ALOGE("%s: No previous Shutdown()?", __func__); + return false; + } g_vendor_interface = new VendorInterface(); return g_vendor_interface->Open(initialize_complete_cb, event_cb, acl_cb, sco_cb);