Merge "DO NOT MERGE: HA still appears in Media device list even though it has been unpaired." into sc-v2-dev-plus-aosp
This commit is contained in:
@@ -21,7 +21,6 @@ import android.bluetooth.BluetoothClass;
|
|||||||
import android.bluetooth.BluetoothCsipSetCoordinator;
|
import android.bluetooth.BluetoothCsipSetCoordinator;
|
||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
import android.bluetooth.BluetoothHearingAid;
|
import android.bluetooth.BluetoothHearingAid;
|
||||||
import android.bluetooth.BluetoothLeAudio;
|
|
||||||
import android.bluetooth.BluetoothProfile;
|
import android.bluetooth.BluetoothProfile;
|
||||||
import android.bluetooth.BluetoothUuid;
|
import android.bluetooth.BluetoothUuid;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -116,6 +115,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
|
|||||||
private boolean mIsHeadsetProfileConnectedFail = false;
|
private boolean mIsHeadsetProfileConnectedFail = false;
|
||||||
private boolean mIsHearingAidProfileConnectedFail = false;
|
private boolean mIsHearingAidProfileConnectedFail = false;
|
||||||
private boolean mIsLeAudioProfileConnectedFail = false;
|
private boolean mIsLeAudioProfileConnectedFail = false;
|
||||||
|
private boolean mUnpairing = false;
|
||||||
// Group second device for Hearing Aid
|
// Group second device for Hearing Aid
|
||||||
private CachedBluetoothDevice mSubDevice;
|
private CachedBluetoothDevice mSubDevice;
|
||||||
// Group member devices for the coordinated set
|
// Group member devices for the coordinated set
|
||||||
@@ -457,6 +457,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
|
|||||||
if (state != BluetoothDevice.BOND_NONE) {
|
if (state != BluetoothDevice.BOND_NONE) {
|
||||||
final BluetoothDevice dev = mDevice;
|
final BluetoothDevice dev = mDevice;
|
||||||
if (dev != null) {
|
if (dev != null) {
|
||||||
|
mUnpairing = true;
|
||||||
final boolean successful = dev.removeBond();
|
final boolean successful = dev.removeBond();
|
||||||
if (successful) {
|
if (successful) {
|
||||||
releaseLruCache();
|
releaseLruCache();
|
||||||
@@ -1387,4 +1388,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
|
|||||||
void releaseLruCache() {
|
void releaseLruCache() {
|
||||||
mDrawableCache.evictAll();
|
mDrawableCache.evictAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean getUnpairing() {
|
||||||
|
return mUnpairing;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,6 +180,9 @@ public class HearingAidDeviceManager {
|
|||||||
break;
|
break;
|
||||||
case BluetoothProfile.STATE_DISCONNECTED:
|
case BluetoothProfile.STATE_DISCONNECTED:
|
||||||
mainDevice = findMainDevice(cachedDevice);
|
mainDevice = findMainDevice(cachedDevice);
|
||||||
|
if (cachedDevice.getUnpairing()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (mainDevice != null) {
|
if (mainDevice != null) {
|
||||||
// When main device exists, receiving sub device disconnection
|
// When main device exists, receiving sub device disconnection
|
||||||
// To update main device UI
|
// To update main device UI
|
||||||
|
|||||||
Reference in New Issue
Block a user