Muting ring volume slider disables notification
With volume_separate_notification flag enbaled, muting ring volume slice will cause notification volume slice to gray out. There used to be a bug in which notification slice would not get updated in response to a change in ring volume mute/unmute broadcast. The resulting erroneous behavior was notification slider would get to zero but not get grayed out. To fix that bug, VolumeSliceHelper listens to ring stream mute/unmute broadcasts and forwards them to notification slice. Bug: b/266072907 Test: make DEBUG_ROBOLECTRIC=1 ROBOTEST_FILTER="NotificationVolumePreferenceControllerTest|VolumeSliceHelperTest" RunSettingsRoboTests -j40 Change-Id: I2ab51f1272bf99a0c3d9ca285354052d00910c90
This commit is contained in:
@@ -198,6 +198,7 @@ public class NotificationVolumePreferenceControllerTest {
|
||||
com.android.settings.R.bool.config_show_notification_volume)).thenReturn(true);
|
||||
// block the alternative condition to enable controller
|
||||
when(mTelephonyManager.isVoiceCapable()).thenReturn(true);
|
||||
when(mAudioManager.getRingerModeInternal()).thenReturn(AudioManager.RINGER_MODE_NORMAL);
|
||||
|
||||
DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
|
||||
SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "false", false);
|
||||
@@ -217,8 +218,8 @@ public class NotificationVolumePreferenceControllerTest {
|
||||
SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, Boolean.toString(true),
|
||||
false);
|
||||
|
||||
assertThat(controller.getAvailabilityStatus()
|
||||
== BasePreferenceController.AVAILABLE).isTrue();
|
||||
assertThat(controller.getAvailabilityStatus()).isEqualTo(
|
||||
BasePreferenceController.AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -233,9 +234,10 @@ public class NotificationVolumePreferenceControllerTest {
|
||||
// block the alternative condition to enable controller
|
||||
when(mTelephonyManager.isVoiceCapable()).thenReturn(true);
|
||||
|
||||
when(mAudioManager.getRingerModeInternal()).thenReturn(AudioManager.RINGER_MODE_NORMAL);
|
||||
|
||||
DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
|
||||
SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "true", false);
|
||||
|
||||
NotificationVolumePreferenceController controller =
|
||||
new NotificationVolumePreferenceController(mContext);
|
||||
|
||||
@@ -254,4 +256,19 @@ public class NotificationVolumePreferenceControllerTest {
|
||||
== BasePreferenceController.UNSUPPORTED_ON_DEVICE).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ringerModeSilent_unaliased_getAvailability_returnsDisabled() {
|
||||
when(mResources.getBoolean(
|
||||
com.android.settings.R.bool.config_show_notification_volume)).thenReturn(true);
|
||||
when(mHelper.isSingleVolume()).thenReturn(false);
|
||||
|
||||
when(mAudioManager.getRingerModeInternal()).thenReturn(AudioManager.RINGER_MODE_SILENT);
|
||||
|
||||
DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
|
||||
SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "true", false);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus())
|
||||
.isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user