Merge "Ring & notif vol missing on a largescreen device" into tm-qpr-dev am: cf022d4537

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

Change-Id: Id45cee329be0245b513ad3ddd4a405fef2efb223
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Behnam Heydarshahi
2023-01-12 16:37:26 +00:00
committed by Automerger Merge Worker
5 changed files with 24 additions and 11 deletions

View File

@@ -96,12 +96,16 @@ public class RingVolumePreferenceControllerTest {
assertThat(mController.isAvailable()).isFalse();
}
/**
* Devices that are not voice capable should still show Ring volume, because it is used by apps
* that make calls outside the cell network.
*/
@Test
public void isAvailable_notVoiceCapable_shouldReturnFalse() {
public void isAvailable_notSingleVolume_notVoiceCapable_shouldReturnTrue() {
when(mHelper.isSingleVolume()).thenReturn(false);
when(mTelephonyManager.isVoiceCapable()).thenReturn(false);
assertThat(mController.isAvailable()).isFalse();
assertThat(mController.isAvailable()).isTrue();
}
@Test

View File

@@ -27,8 +27,10 @@ import android.content.Context;
import android.content.res.Resources;
import android.media.AudioManager;
import android.os.Vibrator;
import android.provider.DeviceConfig;
import android.telephony.TelephonyManager;
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
import com.android.settings.testutils.shadow.ShadowDeviceConfig;
import org.junit.Before;
@@ -87,6 +89,19 @@ public class SeparateRingVolumePreferenceControllerTest {
assertThat(mController.isAvailable()).isFalse();
}
/**
* Maintain that the device does not need to be voice capable to display this slider
*/
@Test
public void isAvailable_ringNotificationSeparated_isNotVoiceCapable_shouldReturnTrue() {
DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "true", false);
when(mHelper.isSingleVolume()).thenReturn(false);
when(mTelephonyManager.isVoiceCapable()).thenReturn(false);
assertThat(mController.isAvailable()).isTrue();
}
@Test
public void getAudioStream_shouldReturnRing() {
assertThat(mController.getAudioStream()).isEqualTo(AudioManager.STREAM_RING);