Merge "Muting ring volume slider disables notification" into tm-qpr-dev am: 40a293fbdf am: d65e087b0d

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/21164988

Change-Id: I560670cee8bd07312766d494c4a66ef770e121cb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Behnam Heydarshahi
2023-02-16 15:47:36 +00:00
committed by Automerger Merge Worker
7 changed files with 121 additions and 24 deletions

View File

@@ -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);
}
}