From 7d342ac09ec8e2b81a88ff6a01c4da4cc9df1fb1 Mon Sep 17 00:00:00 2001 From: himalia416 Date: Mon, 13 Oct 2025 09:23:11 +0200 Subject: [PATCH] Added CS feature not enabled. --- .../channelSounding/ChannelSoundingScreen.kt | 41 +++++++++++++++++-- .../res/values/channelSoundingStrings.xml | 1 + 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/profile/src/main/java/no/nordicsemi/android/toolbox/profile/view/channelSounding/ChannelSoundingScreen.kt b/profile/src/main/java/no/nordicsemi/android/toolbox/profile/view/channelSounding/ChannelSoundingScreen.kt index 85af1186..d5b2ac23 100644 --- a/profile/src/main/java/no/nordicsemi/android/toolbox/profile/view/channelSounding/ChannelSoundingScreen.kt +++ b/profile/src/main/java/no/nordicsemi/android/toolbox/profile/view/channelSounding/ChannelSoundingScreen.kt @@ -68,11 +68,40 @@ internal fun ChannelSoundingScreen(isNotificationPermissionGranted: Boolean?) { { channelSoundingViewModel.onEvent(it) } ChannelSoundingView(channelSoundingState, onClickEvent) } + } else if (Build.VERSION.SDK_INT_FULL == Build.VERSION_CODES_FULL.BAKLAVA && isNotificationPermissionGranted != null) { + // It supports the Channel Sounding but we are intentionally not enabling it because of the accuracy and performance issues. + ChannelSoundingNotEnabledView() } else { ChannelSoundingNotSupportedView() } } +@Preview(showBackground = true) +@Composable +private fun ChannelSoundingNotEnabledView() { + Column( + verticalArrangement = Arrangement.spacedBy(16.dp), + modifier = Modifier.fillMaxWidth() + ) { + ScreenSection(modifier = Modifier.padding(0.dp) /* No padding */) { + Column(modifier = Modifier.padding(top = 16.dp, start = 16.dp, end = 16.dp)) { + SectionTitle( + icon = Icons.Default.SocialDistance, + title = stringResource(R.string.channel_sounding), + ) + } + Box( + modifier = Modifier + .padding(16.dp) + .fillMaxWidth(), + contentAlignment = Alignment.Center + ) { + Text(stringResource(R.string.channel_sounding_not_enabled)) + } + } + } +} + @Preview(showBackground = true) @Composable private fun ChannelSoundingNotSupportedView() { @@ -81,14 +110,18 @@ private fun ChannelSoundingNotSupportedView() { modifier = Modifier.fillMaxWidth() ) { ScreenSection(modifier = Modifier.padding(0.dp) /* No padding */) { - Column( - verticalArrangement = Arrangement.spacedBy(16.dp), - modifier = Modifier.padding(16.dp), - ) { + Column(modifier = Modifier.padding(top = 16.dp, start = 16.dp, end = 16.dp)) { SectionTitle( icon = Icons.Default.SocialDistance, title = stringResource(R.string.channel_sounding), ) + } + Box( + modifier = Modifier + .padding(16.dp) + .fillMaxWidth(), + contentAlignment = Alignment.Center + ) { Text(stringResource(R.string.channel_sounding_not_supported)) } } diff --git a/profile/src/main/res/values/channelSoundingStrings.xml b/profile/src/main/res/values/channelSoundingStrings.xml index 36341407..42fa5971 100644 --- a/profile/src/main/res/values/channelSoundingStrings.xml +++ b/profile/src/main/res/values/channelSoundingStrings.xml @@ -3,6 +3,7 @@ Channel Sounding Channel Sounding is not supported on this Android version. + Channel Sounding is supported on this device, but it is currently disabled due to potential accuracy and performance issues. For the best experience, we recommend using a device running Android 16 (API 36, minor version 1) or later. Initiating ranging Reconnecting session Ranging session stopped