Loading packages/SettingsLib/src/com/android/settingslib/volume/data/repository/AudioRepository.kt +5 −5 Original line number Diff line number Diff line Loading @@ -161,11 +161,11 @@ class AudioRepositoryImpl( override suspend fun setMuted(audioStream: AudioStream, isMuted: Boolean) = withContext(backgroundCoroutineContext) { if (isMuted) { audioManager.adjustStreamVolume(audioStream.value, 0, AudioManager.ADJUST_MUTE) } else { audioManager.adjustStreamVolume(audioStream.value, 0, AudioManager.ADJUST_UNMUTE) } audioManager.adjustStreamVolume( audioStream.value, if (isMuted) AudioManager.ADJUST_MUTE else AudioManager.ADJUST_UNMUTE, 0, ) } private fun getMinVolume(stream: AudioStream): Int = Loading packages/SettingsLib/src/com/android/settingslib/volume/domain/interactor/AudioVolumeInteractor.kt +2 −2 Original line number Diff line number Diff line Loading @@ -84,10 +84,10 @@ class AudioVolumeInteractor( (audioStreamModel.audioStream.value == AudioManager.STREAM_NOTIFICATION && audioStreamModel.isMuted) ) { return 0 return audioStreamModel.minVolume } } else if (audioStreamModel.isMuted) { return 0 return audioStreamModel.minVolume } return audioStreamModel.volume } Loading packages/SettingsLib/tests/integ/src/com/android/settingslib/volume/data/repository/AudioRepositoryTest.kt +3 −3 Original line number Diff line number Diff line Loading @@ -77,13 +77,13 @@ class AudioRepositoryTest { `when`(audioManager.getStreamMaxVolume(anyInt())).thenReturn(MAX_VOLUME) `when`(audioManager.ringerModeInternal).thenReturn(AudioManager.RINGER_MODE_NORMAL) `when`(audioManager.setStreamVolume(anyInt(), anyInt(), anyInt())).then { val streamType = it.arguments[1] as Int volumeByStream[it.arguments[0] as Int] = streamType val streamType = it.arguments[0] as Int volumeByStream[it.arguments[0] as Int] = it.arguments[1] as Int triggerEvent(AudioManagerEvent.StreamVolumeChanged(AudioStream(streamType))) } `when`(audioManager.adjustStreamVolume(anyInt(), anyInt(), anyInt())).then { val streamType = it.arguments[0] as Int isMuteByStream[streamType] = it.arguments[2] == AudioManager.ADJUST_MUTE isMuteByStream[streamType] = it.arguments[1] == AudioManager.ADJUST_MUTE triggerEvent(AudioManagerEvent.StreamMuteChanged(AudioStream(streamType))) } `when`(audioManager.getStreamVolume(anyInt())).thenAnswer { Loading packages/SystemUI/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -911,7 +911,7 @@ <activity android:name=".volume.panel.ui.activity.VolumePanelActivity" android:label="@string/sound_settings" android:label="@string/accessibility_volume_settings" android:excludeFromRecents="true" android:exported="false" android:launchMode="singleInstance" Loading packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/button/ui/composable/ButtonComponent.kt +13 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,11 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.semantics.Role import androidx.compose.ui.semantics.clearAndSetSemantics import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.role import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import com.android.compose.animation.Expandable Loading @@ -52,6 +57,7 @@ class ButtonComponent( override fun VolumePanelComposeScope.Content(modifier: Modifier) { val viewModelByState by viewModelFlow.collectAsState() val viewModel = viewModelByState ?: return val label = viewModel.label.toString() Column( modifier = modifier, Loading @@ -59,7 +65,11 @@ class ButtonComponent( horizontalAlignment = Alignment.CenterHorizontally, ) { Expandable( modifier = Modifier.height(64.dp).fillMaxWidth(), modifier = Modifier.height(64.dp).fillMaxWidth().semantics { role = Role.Button contentDescription = label }, color = MaterialTheme.colorScheme.primaryContainer, shape = RoundedCornerShape(28.dp), contentColor = MaterialTheme.colorScheme.onPrimaryContainer, Loading @@ -71,7 +81,8 @@ class ButtonComponent( } } Text( text = viewModel.label.toString(), modifier = Modifier.clearAndSetSemantics {}, text = label, style = MaterialTheme.typography.labelMedium, maxLines = 1, overflow = TextOverflow.Ellipsis, Loading Loading
packages/SettingsLib/src/com/android/settingslib/volume/data/repository/AudioRepository.kt +5 −5 Original line number Diff line number Diff line Loading @@ -161,11 +161,11 @@ class AudioRepositoryImpl( override suspend fun setMuted(audioStream: AudioStream, isMuted: Boolean) = withContext(backgroundCoroutineContext) { if (isMuted) { audioManager.adjustStreamVolume(audioStream.value, 0, AudioManager.ADJUST_MUTE) } else { audioManager.adjustStreamVolume(audioStream.value, 0, AudioManager.ADJUST_UNMUTE) } audioManager.adjustStreamVolume( audioStream.value, if (isMuted) AudioManager.ADJUST_MUTE else AudioManager.ADJUST_UNMUTE, 0, ) } private fun getMinVolume(stream: AudioStream): Int = Loading
packages/SettingsLib/src/com/android/settingslib/volume/domain/interactor/AudioVolumeInteractor.kt +2 −2 Original line number Diff line number Diff line Loading @@ -84,10 +84,10 @@ class AudioVolumeInteractor( (audioStreamModel.audioStream.value == AudioManager.STREAM_NOTIFICATION && audioStreamModel.isMuted) ) { return 0 return audioStreamModel.minVolume } } else if (audioStreamModel.isMuted) { return 0 return audioStreamModel.minVolume } return audioStreamModel.volume } Loading
packages/SettingsLib/tests/integ/src/com/android/settingslib/volume/data/repository/AudioRepositoryTest.kt +3 −3 Original line number Diff line number Diff line Loading @@ -77,13 +77,13 @@ class AudioRepositoryTest { `when`(audioManager.getStreamMaxVolume(anyInt())).thenReturn(MAX_VOLUME) `when`(audioManager.ringerModeInternal).thenReturn(AudioManager.RINGER_MODE_NORMAL) `when`(audioManager.setStreamVolume(anyInt(), anyInt(), anyInt())).then { val streamType = it.arguments[1] as Int volumeByStream[it.arguments[0] as Int] = streamType val streamType = it.arguments[0] as Int volumeByStream[it.arguments[0] as Int] = it.arguments[1] as Int triggerEvent(AudioManagerEvent.StreamVolumeChanged(AudioStream(streamType))) } `when`(audioManager.adjustStreamVolume(anyInt(), anyInt(), anyInt())).then { val streamType = it.arguments[0] as Int isMuteByStream[streamType] = it.arguments[2] == AudioManager.ADJUST_MUTE isMuteByStream[streamType] = it.arguments[1] == AudioManager.ADJUST_MUTE triggerEvent(AudioManagerEvent.StreamMuteChanged(AudioStream(streamType))) } `when`(audioManager.getStreamVolume(anyInt())).thenAnswer { Loading
packages/SystemUI/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -911,7 +911,7 @@ <activity android:name=".volume.panel.ui.activity.VolumePanelActivity" android:label="@string/sound_settings" android:label="@string/accessibility_volume_settings" android:excludeFromRecents="true" android:exported="false" android:launchMode="singleInstance" Loading
packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/button/ui/composable/ButtonComponent.kt +13 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,11 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.semantics.Role import androidx.compose.ui.semantics.clearAndSetSemantics import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.role import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import com.android.compose.animation.Expandable Loading @@ -52,6 +57,7 @@ class ButtonComponent( override fun VolumePanelComposeScope.Content(modifier: Modifier) { val viewModelByState by viewModelFlow.collectAsState() val viewModel = viewModelByState ?: return val label = viewModel.label.toString() Column( modifier = modifier, Loading @@ -59,7 +65,11 @@ class ButtonComponent( horizontalAlignment = Alignment.CenterHorizontally, ) { Expandable( modifier = Modifier.height(64.dp).fillMaxWidth(), modifier = Modifier.height(64.dp).fillMaxWidth().semantics { role = Role.Button contentDescription = label }, color = MaterialTheme.colorScheme.primaryContainer, shape = RoundedCornerShape(28.dp), contentColor = MaterialTheme.colorScheme.onPrimaryContainer, Loading @@ -71,7 +81,8 @@ class ButtonComponent( } } Text( text = viewModel.label.toString(), modifier = Modifier.clearAndSetSemantics {}, text = label, style = MaterialTheme.typography.labelMedium, maxLines = 1, overflow = TextOverflow.Ellipsis, Loading