Bluetooth: deal with framework going away.

Bug: 35624326
Test: Bluetooth HAL stays alive and works after com.android.bluetooth
is killed.

Change-Id: Id5b5a5b88cd35202e5737a0c99d28db9bebb4250
diff --git a/bluetooth/1.0/default/bluetooth_hci.cc b/bluetooth/1.0/default/bluetooth_hci.cc
index 6cea623..1d6e600 100644
--- a/bluetooth/1.0/default/bluetooth_hci.cc
+++ b/bluetooth/1.0/default/bluetooth_hci.cc
@@ -30,9 +30,13 @@
 static const uint8_t HCI_DATA_TYPE_ACL = 2;
 static const uint8_t HCI_DATA_TYPE_SCO = 3;
 
+BluetoothHci::BluetoothHci()
+    : deathRecipient(new BluetoothDeathRecipient(this)) {}
+
 Return<void> BluetoothHci::initialize(
     const ::android::sp<IBluetoothHciCallbacks>& cb) {
   ALOGW("BluetoothHci::initialize()");
+  cb->linkToDeath(deathRecipient, 0);
   event_cb_ = cb;
 
   bool rc = VendorInterface::Initialize(
@@ -62,6 +66,7 @@
 
 Return<void> BluetoothHci::close() {
   ALOGW("BluetoothHci::close()");
+  event_cb_->unlinkToDeath(deathRecipient);
   VendorInterface::Shutdown();
   return Void();
 }