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

Commit 12a62a81 authored by Kiran Kelageri's avatar Kiran Kelageri Committed by Bruno Martins
Browse files

Bluetooth-TWS: UI updates based on profile connection.

Changes are made as per aosp implementation for TWS,
UI update is moved to profile connection states instead
of depending connection states.

CRs-fixed: 2300825
Change-Id: I7074698b3c421822756c30a808da6cd02968bced
parent 5adbabc6
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ package com.android.settings.bluetooth;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.content.Context;

import com.android.settings.connecteddevice.DevicePreferenceCallback;
@@ -74,11 +75,12 @@ public class SavedBluetoothTwsDeviceUpdater extends BluetoothDeviceUpdater {
    }

    @Override
    public void onConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) {
    public void onProfileConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state,
            int bluetoothProfile) {
        final BluetoothDevice device = cachedDevice.getDevice();
        if (state == BluetoothAdapter.STATE_CONNECTED) {
        if (state == BluetoothProfile.STATE_CONNECTED) {
            removePreference(cachedDevice);
        } else if (state == BluetoothAdapter.STATE_DISCONNECTED &&  device.isTwsPlusDevice()) {
        } else if (state == BluetoothProfile.STATE_DISCONNECTED && device.isTwsPlusDevice()) {
            addPreference(cachedDevice);
        }
    }