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

Commit 1d0eec50 authored by tim peng's avatar tim peng Committed by Android (Google) Code Review
Browse files

Merge "HA still appears in Media device list even though it has been unpaired."

parents 54d0193e 5597cbd7
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
    private boolean mIsA2dpProfileConnectedFail = false;
    private boolean mIsHeadsetProfileConnectedFail = false;
    private boolean mIsHearingAidProfileConnectedFail = false;
    private boolean mUnpairing;
    // Group second device for Hearing Aid
    private CachedBluetoothDevice mSubDevice;
    @VisibleForTesting
@@ -142,6 +143,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
        fillData();
        mHiSyncId = BluetoothHearingAid.HI_SYNC_ID_INVALID;
        initDrawableCache();
        mUnpairing = false;
    }

    private void initDrawableCache() {
@@ -402,6 +404,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
        if (state != BluetoothDevice.BOND_NONE) {
            final BluetoothDevice dev = mDevice;
            if (dev != null) {
                mUnpairing = true;
                final boolean successful = dev.removeBond();
                if (successful) {
                    releaseLruCache();
@@ -1243,4 +1246,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
    void releaseLruCache() {
        mDrawableCache.evictAll();
    }

    boolean getUnpairing() {
        return mUnpairing;
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -180,6 +180,9 @@ public class HearingAidDeviceManager {
                break;
            case BluetoothProfile.STATE_DISCONNECTED:
                mainDevice = findMainDevice(cachedDevice);
                if (cachedDevice.getUnpairing()) {
                    return true;
                }
                if (mainDevice != null) {
                    // When main device exists, receiving sub device disconnection
                    // To update main device UI