Loading packages/SettingsLib/aconfig/settingslib.aconfig +0 −7 Original line number Diff line number Diff line Loading @@ -36,13 +36,6 @@ flag { bug: "388674074" } flag { name: "enable_hide_exclusively_managed_bluetooth_device" namespace: "dck_framework" description: "Hide exclusively managed Bluetooth devices in BT settings menu." bug: "324475542" } flag { name: "enable_set_preferred_transport_for_le_audio_device" namespace: "bluetooth" Loading packages/SystemUI/src/com/android/systemui/accessibility/hearingaid/HearingDevicesChecker.java +2 −5 Original line number Diff line number Diff line Loading @@ -99,10 +99,7 @@ public class HearingDevicesChecker { private boolean isExclusivelyManagedBluetoothDevice( @NonNull CachedBluetoothDevice cachedDevice) { if (com.android.settingslib.flags.Flags.enableHideExclusivelyManagedBluetoothDevice()) { return BluetoothUtils.isExclusivelyManagedBluetoothDevice(mContext, cachedDevice.getDevice()); } return false; } } packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/DeviceItemFactory.kt +10 −25 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.content.Context import com.android.settingslib.bluetooth.BluetoothUtils import com.android.settingslib.bluetooth.CachedBluetoothDevice import com.android.settingslib.bluetooth.LocalBluetoothManager import com.android.settingslib.flags.Flags import com.android.systemui.res.R private val backgroundOn = R.drawable.settingslib_switch_bar_bg_on Loading Loading @@ -222,12 +221,8 @@ internal class ConnectedDeviceItemFactory : DeviceItemFactory() { isOngoingCall: Boolean, audioSharingAvailable: Boolean, ): Boolean { return if (Flags.enableHideExclusivelyManagedBluetoothDevice()) { !BluetoothUtils.isExclusivelyManagedBluetoothDevice(context, cachedDevice.device) && return !BluetoothUtils.isExclusivelyManagedBluetoothDevice(context, cachedDevice.device) && BluetoothUtils.isConnectedBluetoothDevice(cachedDevice, isOngoingCall) } else { BluetoothUtils.isConnectedBluetoothDevice(cachedDevice, isOngoingCall) } } override fun create(context: Context, cachedDevice: CachedBluetoothDevice): DeviceItem { Loading @@ -250,13 +245,9 @@ internal open class SavedDeviceItemFactory : DeviceItemFactory() { isOngoingCall: Boolean, audioSharingAvailable: Boolean, ): Boolean { return if (Flags.enableHideExclusivelyManagedBluetoothDevice()) { !BluetoothUtils.isExclusivelyManagedBluetoothDevice(context, cachedDevice.device) && return !BluetoothUtils.isExclusivelyManagedBluetoothDevice(context, cachedDevice.device) && cachedDevice.bondState == BluetoothDevice.BOND_BONDED && !cachedDevice.isConnected } else { cachedDevice.bondState == BluetoothDevice.BOND_BONDED && !cachedDevice.isConnected } } override fun create(context: Context, cachedDevice: CachedBluetoothDevice): DeviceItem { Loading @@ -279,18 +270,12 @@ internal class SavedHearingDeviceItemFactory : SavedDeviceItemFactory() { isOngoingCall: Boolean, audioSharingAvailable: Boolean, ): Boolean { return if (Flags.enableHideExclusivelyManagedBluetoothDevice()) { !BluetoothUtils.isExclusivelyManagedBluetoothDevice( return !BluetoothUtils.isExclusivelyManagedBluetoothDevice( context, cachedDevice.getDevice(), ) && cachedDevice.isHearingAidDevice && cachedDevice.bondState == BluetoothDevice.BOND_BONDED && !cachedDevice.isConnected } else { cachedDevice.isHearingAidDevice && cachedDevice.bondState == BluetoothDevice.BOND_BONDED && !cachedDevice.isConnected } } } packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/DeviceItemFactoryTest.kt +0 −72 Original line number Diff line number Diff line Loading @@ -18,8 +18,6 @@ package com.android.systemui.bluetooth.qsdialog import android.bluetooth.BluetoothDevice import android.graphics.drawable.Drawable import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import android.testing.TestableLooper import android.util.Pair import androidx.test.ext.junit.runners.AndroidJUnit4 Loading @@ -29,7 +27,6 @@ import com.android.dx.mockito.inline.extended.StaticMockitoSession import com.android.settingslib.bluetooth.BluetoothUtils import com.android.settingslib.bluetooth.CachedBluetoothDevice import com.android.settingslib.bluetooth.LocalBluetoothManager import com.android.settingslib.flags.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.res.R import com.google.common.truth.Truth.assertThat Loading Loading @@ -208,42 +205,6 @@ class DeviceItemFactoryTest : SysuiTestCase() { } @Test @DisableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testSavedFactory_isFilterMatched_bondedAndNotConnected_returnsTrue() { `when`(cachedDevice.bondState).thenReturn(BluetoothDevice.BOND_BONDED) `when`(cachedDevice.isConnected).thenReturn(false) assertThat( savedDeviceItemFactory.isFilterMatched(context, cachedDevice, isOngoingCall = false) ) .isTrue() } @Test @DisableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testSavedFactory_isFilterMatched_connected_returnsFalse() { `when`(cachedDevice.bondState).thenReturn(BluetoothDevice.BOND_BONDED) `when`(cachedDevice.isConnected).thenReturn(true) assertThat( savedDeviceItemFactory.isFilterMatched(context, cachedDevice, isOngoingCall = false) ) .isFalse() } @Test @DisableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testSavedFactory_isFilterMatched_notBonded_returnsFalse() { `when`(cachedDevice.bondState).thenReturn(BluetoothDevice.BOND_NONE) assertThat( savedDeviceItemFactory.isFilterMatched(context, cachedDevice, isOngoingCall = false) ) .isFalse() } @Test @EnableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testSavedFactory_isFilterMatched_exclusivelyManaged_returnsFalse() { `when`(cachedDevice.device).thenReturn(bluetoothDevice) `when`(BluetoothUtils.isExclusivelyManagedBluetoothDevice(any(), any())).thenReturn(true) Loading @@ -255,7 +216,6 @@ class DeviceItemFactoryTest : SysuiTestCase() { } @Test @EnableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testSavedFactory_isFilterMatched_notExclusiveManaged_returnsTrue() { `when`(cachedDevice.device).thenReturn(bluetoothDevice) `when`(BluetoothUtils.isExclusivelyManagedBluetoothDevice(any(), any())).thenReturn(false) Loading @@ -269,7 +229,6 @@ class DeviceItemFactoryTest : SysuiTestCase() { } @Test @EnableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testSavedFactory_isFilterMatched_notExclusivelyManaged_connected_returnsFalse() { `when`(cachedDevice.device).thenReturn(bluetoothDevice) `when`(BluetoothUtils.isExclusivelyManagedBluetoothDevice(any(), any())).thenReturn(false) Loading @@ -283,35 +242,6 @@ class DeviceItemFactoryTest : SysuiTestCase() { } @Test @DisableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testConnectedFactory_isFilterMatched_bondedAndConnected_returnsTrue() { `when`(BluetoothUtils.isConnectedBluetoothDevice(any(), any())).thenReturn(true) assertThat( connectedDeviceItemFactory.isFilterMatched( context, cachedDevice, isOngoingCall = false, ) ) .isTrue() } @Test @DisableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testConnectedFactory_isFilterMatched_notConnected_returnsFalse() { assertThat( connectedDeviceItemFactory.isFilterMatched( context, cachedDevice, isOngoingCall = false, ) ) .isFalse() } @Test @EnableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testConnectedFactory_isFilterMatched_exclusivelyManaged_returnsFalse() { `when`(cachedDevice.device).thenReturn(bluetoothDevice) `when`(BluetoothUtils.isExclusivelyManagedBluetoothDevice(any(), any())).thenReturn(true) Loading @@ -327,7 +257,6 @@ class DeviceItemFactoryTest : SysuiTestCase() { } @Test @EnableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testConnectedFactory_isFilterMatched_noExclusiveManager_returnsTrue() { `when`(cachedDevice.device).thenReturn(bluetoothDevice) `when`(BluetoothUtils.isExclusivelyManagedBluetoothDevice(any(), any())).thenReturn(false) Loading @@ -344,7 +273,6 @@ class DeviceItemFactoryTest : SysuiTestCase() { } @Test @EnableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testConnectedFactory_isFilterMatched_notExclusivelyManaged_notConnected_returnsFalse() { `when`(cachedDevice.device).thenReturn(bluetoothDevice) `when`(BluetoothUtils.isExclusivelyManagedBluetoothDevice(any(), any())).thenReturn(false) Loading Loading
packages/SettingsLib/aconfig/settingslib.aconfig +0 −7 Original line number Diff line number Diff line Loading @@ -36,13 +36,6 @@ flag { bug: "388674074" } flag { name: "enable_hide_exclusively_managed_bluetooth_device" namespace: "dck_framework" description: "Hide exclusively managed Bluetooth devices in BT settings menu." bug: "324475542" } flag { name: "enable_set_preferred_transport_for_le_audio_device" namespace: "bluetooth" Loading
packages/SystemUI/src/com/android/systemui/accessibility/hearingaid/HearingDevicesChecker.java +2 −5 Original line number Diff line number Diff line Loading @@ -99,10 +99,7 @@ public class HearingDevicesChecker { private boolean isExclusivelyManagedBluetoothDevice( @NonNull CachedBluetoothDevice cachedDevice) { if (com.android.settingslib.flags.Flags.enableHideExclusivelyManagedBluetoothDevice()) { return BluetoothUtils.isExclusivelyManagedBluetoothDevice(mContext, cachedDevice.getDevice()); } return false; } }
packages/SystemUI/src/com/android/systemui/bluetooth/qsdialog/DeviceItemFactory.kt +10 −25 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.content.Context import com.android.settingslib.bluetooth.BluetoothUtils import com.android.settingslib.bluetooth.CachedBluetoothDevice import com.android.settingslib.bluetooth.LocalBluetoothManager import com.android.settingslib.flags.Flags import com.android.systemui.res.R private val backgroundOn = R.drawable.settingslib_switch_bar_bg_on Loading Loading @@ -222,12 +221,8 @@ internal class ConnectedDeviceItemFactory : DeviceItemFactory() { isOngoingCall: Boolean, audioSharingAvailable: Boolean, ): Boolean { return if (Flags.enableHideExclusivelyManagedBluetoothDevice()) { !BluetoothUtils.isExclusivelyManagedBluetoothDevice(context, cachedDevice.device) && return !BluetoothUtils.isExclusivelyManagedBluetoothDevice(context, cachedDevice.device) && BluetoothUtils.isConnectedBluetoothDevice(cachedDevice, isOngoingCall) } else { BluetoothUtils.isConnectedBluetoothDevice(cachedDevice, isOngoingCall) } } override fun create(context: Context, cachedDevice: CachedBluetoothDevice): DeviceItem { Loading @@ -250,13 +245,9 @@ internal open class SavedDeviceItemFactory : DeviceItemFactory() { isOngoingCall: Boolean, audioSharingAvailable: Boolean, ): Boolean { return if (Flags.enableHideExclusivelyManagedBluetoothDevice()) { !BluetoothUtils.isExclusivelyManagedBluetoothDevice(context, cachedDevice.device) && return !BluetoothUtils.isExclusivelyManagedBluetoothDevice(context, cachedDevice.device) && cachedDevice.bondState == BluetoothDevice.BOND_BONDED && !cachedDevice.isConnected } else { cachedDevice.bondState == BluetoothDevice.BOND_BONDED && !cachedDevice.isConnected } } override fun create(context: Context, cachedDevice: CachedBluetoothDevice): DeviceItem { Loading @@ -279,18 +270,12 @@ internal class SavedHearingDeviceItemFactory : SavedDeviceItemFactory() { isOngoingCall: Boolean, audioSharingAvailable: Boolean, ): Boolean { return if (Flags.enableHideExclusivelyManagedBluetoothDevice()) { !BluetoothUtils.isExclusivelyManagedBluetoothDevice( return !BluetoothUtils.isExclusivelyManagedBluetoothDevice( context, cachedDevice.getDevice(), ) && cachedDevice.isHearingAidDevice && cachedDevice.bondState == BluetoothDevice.BOND_BONDED && !cachedDevice.isConnected } else { cachedDevice.isHearingAidDevice && cachedDevice.bondState == BluetoothDevice.BOND_BONDED && !cachedDevice.isConnected } } }
packages/SystemUI/tests/src/com/android/systemui/bluetooth/qsdialog/DeviceItemFactoryTest.kt +0 −72 Original line number Diff line number Diff line Loading @@ -18,8 +18,6 @@ package com.android.systemui.bluetooth.qsdialog import android.bluetooth.BluetoothDevice import android.graphics.drawable.Drawable import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import android.testing.TestableLooper import android.util.Pair import androidx.test.ext.junit.runners.AndroidJUnit4 Loading @@ -29,7 +27,6 @@ import com.android.dx.mockito.inline.extended.StaticMockitoSession import com.android.settingslib.bluetooth.BluetoothUtils import com.android.settingslib.bluetooth.CachedBluetoothDevice import com.android.settingslib.bluetooth.LocalBluetoothManager import com.android.settingslib.flags.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.res.R import com.google.common.truth.Truth.assertThat Loading Loading @@ -208,42 +205,6 @@ class DeviceItemFactoryTest : SysuiTestCase() { } @Test @DisableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testSavedFactory_isFilterMatched_bondedAndNotConnected_returnsTrue() { `when`(cachedDevice.bondState).thenReturn(BluetoothDevice.BOND_BONDED) `when`(cachedDevice.isConnected).thenReturn(false) assertThat( savedDeviceItemFactory.isFilterMatched(context, cachedDevice, isOngoingCall = false) ) .isTrue() } @Test @DisableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testSavedFactory_isFilterMatched_connected_returnsFalse() { `when`(cachedDevice.bondState).thenReturn(BluetoothDevice.BOND_BONDED) `when`(cachedDevice.isConnected).thenReturn(true) assertThat( savedDeviceItemFactory.isFilterMatched(context, cachedDevice, isOngoingCall = false) ) .isFalse() } @Test @DisableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testSavedFactory_isFilterMatched_notBonded_returnsFalse() { `when`(cachedDevice.bondState).thenReturn(BluetoothDevice.BOND_NONE) assertThat( savedDeviceItemFactory.isFilterMatched(context, cachedDevice, isOngoingCall = false) ) .isFalse() } @Test @EnableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testSavedFactory_isFilterMatched_exclusivelyManaged_returnsFalse() { `when`(cachedDevice.device).thenReturn(bluetoothDevice) `when`(BluetoothUtils.isExclusivelyManagedBluetoothDevice(any(), any())).thenReturn(true) Loading @@ -255,7 +216,6 @@ class DeviceItemFactoryTest : SysuiTestCase() { } @Test @EnableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testSavedFactory_isFilterMatched_notExclusiveManaged_returnsTrue() { `when`(cachedDevice.device).thenReturn(bluetoothDevice) `when`(BluetoothUtils.isExclusivelyManagedBluetoothDevice(any(), any())).thenReturn(false) Loading @@ -269,7 +229,6 @@ class DeviceItemFactoryTest : SysuiTestCase() { } @Test @EnableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testSavedFactory_isFilterMatched_notExclusivelyManaged_connected_returnsFalse() { `when`(cachedDevice.device).thenReturn(bluetoothDevice) `when`(BluetoothUtils.isExclusivelyManagedBluetoothDevice(any(), any())).thenReturn(false) Loading @@ -283,35 +242,6 @@ class DeviceItemFactoryTest : SysuiTestCase() { } @Test @DisableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testConnectedFactory_isFilterMatched_bondedAndConnected_returnsTrue() { `when`(BluetoothUtils.isConnectedBluetoothDevice(any(), any())).thenReturn(true) assertThat( connectedDeviceItemFactory.isFilterMatched( context, cachedDevice, isOngoingCall = false, ) ) .isTrue() } @Test @DisableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testConnectedFactory_isFilterMatched_notConnected_returnsFalse() { assertThat( connectedDeviceItemFactory.isFilterMatched( context, cachedDevice, isOngoingCall = false, ) ) .isFalse() } @Test @EnableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testConnectedFactory_isFilterMatched_exclusivelyManaged_returnsFalse() { `when`(cachedDevice.device).thenReturn(bluetoothDevice) `when`(BluetoothUtils.isExclusivelyManagedBluetoothDevice(any(), any())).thenReturn(true) Loading @@ -327,7 +257,6 @@ class DeviceItemFactoryTest : SysuiTestCase() { } @Test @EnableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testConnectedFactory_isFilterMatched_noExclusiveManager_returnsTrue() { `when`(cachedDevice.device).thenReturn(bluetoothDevice) `when`(BluetoothUtils.isExclusivelyManagedBluetoothDevice(any(), any())).thenReturn(false) Loading @@ -344,7 +273,6 @@ class DeviceItemFactoryTest : SysuiTestCase() { } @Test @EnableFlags(Flags.FLAG_ENABLE_HIDE_EXCLUSIVELY_MANAGED_BLUETOOTH_DEVICE) fun testConnectedFactory_isFilterMatched_notExclusivelyManaged_notConnected_returnsFalse() { `when`(cachedDevice.device).thenReturn(bluetoothDevice) `when`(BluetoothUtils.isExclusivelyManagedBluetoothDevice(any(), any())).thenReturn(false) Loading