summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Haijie Hong <hahong@google.com> 2024-10-22 17:38:07 +0800
committer Haijie Hong <hahong@google.com> 2024-10-22 17:40:58 +0800
commit6cf9cd82efa0b5ff3a93bb96249188d58a6707f1 (patch)
treef270ff4a2ac35e462759a3fd5f19b2fa3d018aaa
parent8731e6024299a595edb9d3f35e5348a1a1f93af1 (diff)
Use stopTimeoutMillis to avoid unnecessary bind/unbind
BUG: 343317785 Test: local tested Flag: com.android.settings.flags.enable_bluetooth_device_details_polish Change-Id: I1f0adb97fc3d4669ad6a730b73c3fd64d102c98e
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/bluetooth/devicesettings/data/repository/DeviceSettingServiceConnection.kt3
1 files changed, 2 insertions, 1 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/devicesettings/data/repository/DeviceSettingServiceConnection.kt b/packages/SettingsLib/src/com/android/settingslib/bluetooth/devicesettings/data/repository/DeviceSettingServiceConnection.kt
index a33fcc6747b4..c16366e14560 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/devicesettings/data/repository/DeviceSettingServiceConnection.kt
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/devicesettings/data/repository/DeviceSettingServiceConnection.kt
@@ -279,7 +279,7 @@ class DeviceSettingServiceConnection(
getService(intent, IDeviceSettingsProviderService.Stub::asInterface)
.stateIn(
coroutineScope.plus(backgroundCoroutineContext),
- SharingStarted.WhileSubscribed(),
+ SharingStarted.WhileSubscribed(stopTimeoutMillis = SERVICE_CONNECTION_STOP_MILLIS),
ServiceConnectionStatus.Connecting,
)
},
@@ -370,5 +370,6 @@ class DeviceSettingServiceConnection(
const val CONFIG_SERVICE_PACKAGE_NAME = "DEVICE_SETTINGS_CONFIG_PACKAGE_NAME"
const val CONFIG_SERVICE_CLASS_NAME = "DEVICE_SETTINGS_CONFIG_CLASS"
const val CONFIG_SERVICE_INTENT_ACTION = "DEVICE_SETTINGS_CONFIG_ACTION"
+ const val SERVICE_CONNECTION_STOP_MILLIS = 1000L
}
}