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

Commit bfaa3398 authored by Ze Li's avatar Ze Li Committed by Android (Google) Code Review
Browse files

Merge "[Hide DCK devices] Hide DCK devices from settings app (available...

Merge "[Hide DCK devices] Hide DCK devices from settings app (available devices section)." into main
parents a6525e9f ad3fc8c2
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -34,8 +34,10 @@ import androidx.preference.PreferenceCategory
import androidx.preference.PreferenceGroup
import com.android.settings.R
import com.android.settings.dashboard.RestrictedDashboardFragment
import com.android.settings.flags.Flags
import com.android.settingslib.bluetooth.BluetoothCallback
import com.android.settingslib.bluetooth.BluetoothDeviceFilter
import com.android.settingslib.bluetooth.BluetoothUtils
import com.android.settingslib.bluetooth.CachedBluetoothDevice
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager
import com.android.settingslib.bluetooth.LocalBluetoothManager
@@ -217,6 +219,14 @@ abstract class DeviceListPreferenceFragment(restrictedKey: String?) :
            )
            return
        }
        if (Flags.enableHideExclusivelyManagedBluetoothDevice()) {
            if (cachedDevice.device.bondState == BluetoothDevice.BOND_BONDED
                && BluetoothUtils.isExclusivelyManagedBluetoothDevice(
                    prefContext, cachedDevice.device)) {
                Log.d(TAG, "Trying to create preference for a exclusively managed device")
                return
            }
        }
        // Only add device preference when it's not found in the map and there's no other state
        // message showing in the list
        val preference = devicePreferenceMap.computeIfAbsent(cachedDevice) {