From 7a3baf7d2e511935e4318376886eea85fec83182 Mon Sep 17 00:00:00 2001 From: Haijie Hong Date: Tue, 15 Oct 2024 14:49:25 +0800 Subject: [PATCH] Fix multi-toggle flicker bug BUG: 343317785 Test: local tested Flag: com.android.settings.flags.enable_bluetooth_device_details_polish Change-Id: Ib5e700412c112ff6fa19b54f341fbd598c6b345c --- .../bluetooth/ui/viewmodel/BluetoothDeviceDetailsViewModel.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/bluetooth/ui/viewmodel/BluetoothDeviceDetailsViewModel.kt b/src/com/android/settings/bluetooth/ui/viewmodel/BluetoothDeviceDetailsViewModel.kt index dd0012e90fb..3b7a5829bcc 100644 --- a/src/com/android/settings/bluetooth/ui/viewmodel/BluetoothDeviceDetailsViewModel.kt +++ b/src/com/android/settings/bluetooth/ui/viewmodel/BluetoothDeviceDetailsViewModel.kt @@ -58,6 +58,8 @@ class BluetoothDeviceDetailsViewModel( deviceSettingRepository.getDeviceSettingsConfig(cachedDevice) } + private val spatialAudioModel by lazy { spatialAudioInteractor.getDeviceSetting(cachedDevice) } + suspend fun getItems(fragment: FragmentTypeModel): List? = when (fragment) { is FragmentTypeModel.DeviceDetailsMainFragment -> items.await()?.mainItems @@ -81,7 +83,7 @@ class BluetoothDeviceDetailsViewModel( } return when (settingId) { DeviceSettingId.DEVICE_SETTING_ID_SPATIAL_AUDIO_MULTI_TOGGLE -> - spatialAudioInteractor.getDeviceSetting(cachedDevice) + spatialAudioModel else -> deviceSettingRepository.getDeviceSetting(cachedDevice, settingId) }.map { it?.toPreferenceModel() } }