From 3b24d97130b79b9266a85f0efd1fe0c382eebb64 Mon Sep 17 00:00:00 2001 From: Stanley Tng Date: Tue, 25 Sep 2018 15:43:41 -0700 Subject: Fix missing connection state changes intent for Hearing Aids In some corner cases, the intent receiver for hearing aids CONNECTION_STATE_CHANGED is not registered. This fixes this problem. Test: Manual tests with one Hearing Aid device and in Settings-Device details page. Bug: 116643085 Change-Id: I20bf6b9fe929cd8753a20b8112e66467e560f6df Merged-In: I20bf6b9fe929cd8753a20b8112e66467e560f6df Merged-In: Id2dc364dfa815e72db91b92bcee9745e6c40d34a --- .../bluetooth/LocalBluetoothProfileManager.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java index 88ec1d8dccdd..a993306cc32d 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java @@ -128,6 +128,14 @@ public class LocalBluetoothProfileManager { ParcelUuid[] uuids = adapter.getUuids(); + List supportedList = mLocalAdapter.getSupportedProfiles(); + if (supportedList.contains(BluetoothProfile.HEARING_AID)) { + mHearingAidProfile = new HearingAidProfile(mContext, mLocalAdapter, mDeviceManager, + this); + addProfile(mHearingAidProfile, HearingAidProfile.NAME, + BluetoothHearingAid.ACTION_CONNECTION_STATE_CHANGED); + } + // uuids may be null if Bluetooth is turned off if (uuids != null) { updateLocalProfiles(uuids); @@ -164,13 +172,6 @@ public class LocalBluetoothProfileManager { addProfile(mPbapProfile, PbapServerProfile.NAME, BluetoothPbap.ACTION_CONNECTION_STATE_CHANGED); - List supportedList = mLocalAdapter.getSupportedProfiles(); - if (supportedList.contains(BluetoothProfile.HEARING_AID)) { - mHearingAidProfile = new HearingAidProfile(mContext, mLocalAdapter, mDeviceManager, - this); - addProfile(mHearingAidProfile, HearingAidProfile.NAME, - BluetoothHearingAid.ACTION_CONNECTION_STATE_CHANGED); - } if (DEBUG) Log.d(TAG, "LocalBluetoothProfileManager construction complete"); } -- cgit v1.2.3-59-g8ed1b