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

Commit ad3fc8c2 authored by Ze Li's avatar Ze Li
Browse files

[Hide DCK devices] Hide DCK devices from settings app (available devices section).

Hide preferences of devices that are both bonded and exclusively managed in available devices section.

Test: manual test
Bug: 322285078
Change-Id: Id9df1cd20e36c5d50176d64551754364cc1c795f
parent e9917e2f
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) {