Loading flags/telecom_ringer_flag_declarations.aconfig +0 −9 Original line number Diff line number Diff line Loading @@ -9,15 +9,6 @@ flag { bug: "282113261" } # OWNER=grantmenke TARGET=24Q4 flag { name: "ensure_in_car_ringing" namespace: "telecom" description: "Gates whether to ensure that when a user is in their car, they are able to hear ringing for an incoming call." bug: "348708398" } # OWNER=tjstuart TARGET=25Q1 flag { name: "get_ringer_mode_anom_report" Loading src/com/android/server/telecom/CallAudioManager.java +3 −4 Original line number Diff line number Diff line Loading @@ -444,10 +444,9 @@ public class CallAudioManager extends CallsManagerListenerBase { @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) public void onRingerModeChange() { if (mFeatureFlags.ensureInCarRinging()) { // Stop the current ringtone before attempting to start the new ringtone: stopRinging(); } mCallAudioModeStateMachine.sendMessageWithArgs( CallAudioModeStateMachine.RINGER_MODE_CHANGE, makeArgsForModeStateMachine()); } Loading src/com/android/server/telecom/Ringer.java +5 −8 Original line number Diff line number Diff line Loading @@ -787,14 +787,11 @@ public class Ringer { boolean isVolumeOverZero; if (mFlags.ensureInCarRinging()) { AudioAttributes aa = new AudioAttributes.Builder() .setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE) .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).build(); isVolumeOverZero = mAudioManager.shouldNotificationSoundPlay(aa); } else { isVolumeOverZero = mAudioManager.getStreamVolume(AudioManager.STREAM_RING) > 0; } timer.record("isVolumeOverZero"); boolean shouldRingForContact = shouldRingForContact(call); timer.record("shouldRingForContact"); Loading tests/src/com/android/server/telecom/tests/MissedInformationTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -319,7 +319,7 @@ public class MissedInformationTest extends TelecomSystemTest { mCallsManager.onCallFilteringComplete(mIncomingCall, result, false); // Wait for ringer attributes build completed verify(mAudioManager, timeout(TEST_TIMEOUT_MILLIS)).getStreamVolume(anyInt()); verify(mAudioManager, timeout(TEST_TIMEOUT_MILLIS)).shouldNotificationSoundPlay(any()); mCallsManager.getRinger().waitForAttributesCompletion(); mCallsManager.markCallAsDisconnected(mIncomingCall, Loading @@ -343,7 +343,7 @@ public class MissedInformationTest extends TelecomSystemTest { mCallsManager.onCallFilteringComplete(mIncomingCall, result, false); // Wait for ringer attributes build completed verify(mAudioManager, timeout(TEST_TIMEOUT_MILLIS)).getStreamVolume(anyInt()); verify(mAudioManager, timeout(TEST_TIMEOUT_MILLIS)).shouldNotificationSoundPlay(any()); mCallsManager.getRinger().waitForAttributesCompletion(); mCallsManager.markCallAsDisconnected(mIncomingCall, Loading tests/src/com/android/server/telecom/tests/RingerTest.java +36 −17 Original line number Diff line number Diff line Loading @@ -154,10 +154,10 @@ public class RingerTest extends TelecomTestCase { super.setUp(); mContext = spy(mComponentContextFixture.getTestDouble().getApplicationContext()); when(mFeatureFlags.telecomResolveHiddenDependencies()).thenReturn(true); when(mFeatureFlags.ensureInCarRinging()).thenReturn(false); doReturn(URI_VIBRATION_EFFECT).when(spyVibrationEffectProxy).get(any(), any()); when(mockPlayerFactory.createPlayer(any(Call.class), anyInt())).thenReturn(mockTonePlayer); mockAudioManager = mContext.getSystemService(AudioManager.class); mockAudioManager = mock(AudioManager.class); when(mContext.getSystemService(AudioManager.class)).thenReturn(mockAudioManager); when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); when(mockVibrator.getInfo()).thenReturn(mockVibratorInfo); when(mockSystemSettingsUtil.isHapticPlaybackSupported(any(Context.class))) Loading Loading @@ -457,7 +457,6 @@ public class RingerTest extends TelecomTestCase { @SmallTest @Test public void testAudibleRingWhenNotificationSoundShouldPlay() throws Exception { when(mFeatureFlags.ensureInCarRinging()).thenReturn(true); Ringtone mockRingtone = ensureRingtoneMocked(); mRingerUnderTest.startCallWaiting(mockCall1); Loading @@ -468,9 +467,11 @@ public class RingerTest extends TelecomTestCase { when(mockAudioManager.shouldNotificationSoundPlay(aa)).thenReturn(true); enableVibrationWhenRinging(); // This will set AudioManager#getStreamVolume to 0. This test ensures that whether a // ringtone is audible is controlled by AudioManager#shouldNotificationSoundPlay instead: ensureRingerIsNotAudible(); // This will set AudioManager#getStreamVolume to 0. This test ensures that // whether a ringtone is audible is controlled by AudioManager#shouldNotificationSoundPlay // instead: when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(0); // Ensure an audible ringtone is played: assertTrue(startRingingAndWaitForAsync(mockCall2, false)); Loading @@ -487,7 +488,6 @@ public class RingerTest extends TelecomTestCase { @SmallTest @Test public void testNoAudibleRingWhenNotificationSoundShouldNotPlay() throws Exception { when(mFeatureFlags.ensureInCarRinging()).thenReturn(true); Ringtone mockRingtone = ensureRingtoneMocked(); mRingerUnderTest.startCallWaiting(mockCall1); Loading @@ -498,9 +498,11 @@ public class RingerTest extends TelecomTestCase { when(mockAudioManager.shouldNotificationSoundPlay(aa)).thenReturn(false); enableVibrationWhenRinging(); // This will set AudioManager#getStreamVolume to 100. This test ensures that whether a // ringtone is audible is controlled by AudioManager#shouldNotificationSoundPlay instead: ensureRingerIsAudible(); // This will set AudioManager#getStreamVolume to 100. This test ensures that // whether a ringtone is audible is controlled by AudioManager#shouldNotificationSoundPlay // instead: when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(100); // Ensure no audible ringtone is played: assertFalse(startRingingAndWaitForAsync(mockCall2, false)); Loading @@ -520,6 +522,8 @@ public class RingerTest extends TelecomTestCase { mRingerUnderTest.startCallWaiting(mockCall1); when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); enableVibrationWhenRinging(); // Need audio to be considered playable ensureRingerIsAudible(); // The ringtone isn't known to be null until the async portion after the call completes, // so startRinging still returns true here as there should nominally be a ringtone. // Notably, vibration still happens in this scenario. Loading @@ -545,7 +549,8 @@ public class RingerTest extends TelecomTestCase { when(mockRingtoneFactory.getRingtone(any(Call.class), eq(null), anyBoolean())) .thenReturn(new Pair(FAKE_RINGTONE_URI, mockRingtone)); when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_VIBRATE); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(0); when(mockAudioManager.shouldNotificationSoundPlay(any(AudioAttributes.class))) .thenReturn(false); enableVibrationWhenRinging(); assertFalse(startRingingAndWaitForAsync(mockCall2, false)); verify(mockTonePlayer).stopTone(); Loading @@ -562,7 +567,8 @@ public class RingerTest extends TelecomTestCase { createRingerUnderTest(); // Needed after changing haptic playback support. mRingerUnderTest.startCallWaiting(mockCall1); when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_VIBRATE); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(0); when(mockAudioManager.shouldNotificationSoundPlay(any(AudioAttributes.class))) .thenReturn(false); enableVibrationWhenRinging(); assertFalse(startRingingAndWaitForAsync(mockCall2, false)); verify(mockTonePlayer).stopTone(); Loading @@ -581,6 +587,8 @@ public class RingerTest extends TelecomTestCase { when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); when(mockRingtone.getUri()).thenReturn(FAKE_RINGTONE_URI); enableVibrationWhenRinging(); // Need audio to be considered playable ensureRingerIsAudible(); assertTrue(startRingingAndWaitForAsync(mockCall2, false)); verify(mockTonePlayer).stopTone(); verify(mockRingtoneFactory, atLeastOnce()) Loading Loading @@ -631,7 +639,8 @@ public class RingerTest extends TelecomTestCase { public void testSilentRingWithHfpStillAcquiresFocus() throws Exception { mRingerUnderTest.startCallWaiting(mockCall1); when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(0); when(mockAudioManager.shouldNotificationSoundPlay(any(AudioAttributes.class))) .thenReturn(false); enableVibrationOnlyWhenNotRinging(); assertTrue(startRingingAndWaitForAsync(mockCall2, true)); verify(mockTonePlayer).stopTone(); Loading @@ -650,7 +659,8 @@ public class RingerTest extends TelecomTestCase { when(mockNotificationManager.getCurrentInterruptionFilter()).thenReturn( NotificationManager.INTERRUPTION_FILTER_PRIORITY); when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_SILENT); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(100); when(mockAudioManager.shouldNotificationSoundPlay(any(AudioAttributes.class))) .thenReturn(true); enableVibrationWhenRinging(); assertTrue(startRingingAndWaitForAsync(mockCall2, true)); verify(mockRingtoneFactory, atLeastOnce()) Loading Loading @@ -796,6 +806,9 @@ public class RingerTest extends TelecomTestCase { when(mockCall2.wasDndCheckComputedForCall()).thenReturn(false); when(mockCall2.getHandle()).thenReturn(Uri.parse("")); // Ringer needs to be audible to start flash/ring ensureRingerIsAudible(); assertTrue(mRingerUnderTest.shouldRingForContact(mockCall2)); assertTrue(startRingingAndWaitForAsync(mockCall2, false)); verify(mockAccessibilityManagerAdapter, atLeastOnce()) Loading @@ -822,6 +835,9 @@ public class RingerTest extends TelecomTestCase { when(mockCall2.wasDndCheckComputedForCall()).thenReturn(false); when(mockCall2.getHandle()).thenReturn(Uri.parse("")); // Ringer needs to be audible to start flash/ring ensureRingerIsAudible(); assertTrue(mRingerUnderTest.shouldRingForContact(mockCall2)); assertTrue(mRingerUnderTest.startRinging(mockCall2, false)); mRingerUnderTest.stopRinging(); Loading Loading @@ -872,7 +888,8 @@ public class RingerTest extends TelecomTestCase { mRingerUnderTest.startCallWaiting(mockCall1); when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_VIBRATE); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(0); when(mockAudioManager.shouldNotificationSoundPlay(any(AudioAttributes.class))) .thenReturn(false); enableVibrationWhenRinging(); assertFalse(startRingingAndWaitForAsync(mockCall2, false)); Loading Loading @@ -904,12 +921,14 @@ public class RingerTest extends TelecomTestCase { private void ensureRingerIsAudible() { when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(100); when(mockAudioManager.shouldNotificationSoundPlay(any(AudioAttributes.class))) .thenReturn(true); } private void ensureRingerIsNotAudible() { when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(0); when(mockAudioManager.shouldNotificationSoundPlay(any(AudioAttributes.class))) .thenReturn(false); } private void enableVibrationWhenRinging() { Loading Loading
flags/telecom_ringer_flag_declarations.aconfig +0 −9 Original line number Diff line number Diff line Loading @@ -9,15 +9,6 @@ flag { bug: "282113261" } # OWNER=grantmenke TARGET=24Q4 flag { name: "ensure_in_car_ringing" namespace: "telecom" description: "Gates whether to ensure that when a user is in their car, they are able to hear ringing for an incoming call." bug: "348708398" } # OWNER=tjstuart TARGET=25Q1 flag { name: "get_ringer_mode_anom_report" Loading
src/com/android/server/telecom/CallAudioManager.java +3 −4 Original line number Diff line number Diff line Loading @@ -444,10 +444,9 @@ public class CallAudioManager extends CallsManagerListenerBase { @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) public void onRingerModeChange() { if (mFeatureFlags.ensureInCarRinging()) { // Stop the current ringtone before attempting to start the new ringtone: stopRinging(); } mCallAudioModeStateMachine.sendMessageWithArgs( CallAudioModeStateMachine.RINGER_MODE_CHANGE, makeArgsForModeStateMachine()); } Loading
src/com/android/server/telecom/Ringer.java +5 −8 Original line number Diff line number Diff line Loading @@ -787,14 +787,11 @@ public class Ringer { boolean isVolumeOverZero; if (mFlags.ensureInCarRinging()) { AudioAttributes aa = new AudioAttributes.Builder() .setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE) .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION).build(); isVolumeOverZero = mAudioManager.shouldNotificationSoundPlay(aa); } else { isVolumeOverZero = mAudioManager.getStreamVolume(AudioManager.STREAM_RING) > 0; } timer.record("isVolumeOverZero"); boolean shouldRingForContact = shouldRingForContact(call); timer.record("shouldRingForContact"); Loading
tests/src/com/android/server/telecom/tests/MissedInformationTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -319,7 +319,7 @@ public class MissedInformationTest extends TelecomSystemTest { mCallsManager.onCallFilteringComplete(mIncomingCall, result, false); // Wait for ringer attributes build completed verify(mAudioManager, timeout(TEST_TIMEOUT_MILLIS)).getStreamVolume(anyInt()); verify(mAudioManager, timeout(TEST_TIMEOUT_MILLIS)).shouldNotificationSoundPlay(any()); mCallsManager.getRinger().waitForAttributesCompletion(); mCallsManager.markCallAsDisconnected(mIncomingCall, Loading @@ -343,7 +343,7 @@ public class MissedInformationTest extends TelecomSystemTest { mCallsManager.onCallFilteringComplete(mIncomingCall, result, false); // Wait for ringer attributes build completed verify(mAudioManager, timeout(TEST_TIMEOUT_MILLIS)).getStreamVolume(anyInt()); verify(mAudioManager, timeout(TEST_TIMEOUT_MILLIS)).shouldNotificationSoundPlay(any()); mCallsManager.getRinger().waitForAttributesCompletion(); mCallsManager.markCallAsDisconnected(mIncomingCall, Loading
tests/src/com/android/server/telecom/tests/RingerTest.java +36 −17 Original line number Diff line number Diff line Loading @@ -154,10 +154,10 @@ public class RingerTest extends TelecomTestCase { super.setUp(); mContext = spy(mComponentContextFixture.getTestDouble().getApplicationContext()); when(mFeatureFlags.telecomResolveHiddenDependencies()).thenReturn(true); when(mFeatureFlags.ensureInCarRinging()).thenReturn(false); doReturn(URI_VIBRATION_EFFECT).when(spyVibrationEffectProxy).get(any(), any()); when(mockPlayerFactory.createPlayer(any(Call.class), anyInt())).thenReturn(mockTonePlayer); mockAudioManager = mContext.getSystemService(AudioManager.class); mockAudioManager = mock(AudioManager.class); when(mContext.getSystemService(AudioManager.class)).thenReturn(mockAudioManager); when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); when(mockVibrator.getInfo()).thenReturn(mockVibratorInfo); when(mockSystemSettingsUtil.isHapticPlaybackSupported(any(Context.class))) Loading Loading @@ -457,7 +457,6 @@ public class RingerTest extends TelecomTestCase { @SmallTest @Test public void testAudibleRingWhenNotificationSoundShouldPlay() throws Exception { when(mFeatureFlags.ensureInCarRinging()).thenReturn(true); Ringtone mockRingtone = ensureRingtoneMocked(); mRingerUnderTest.startCallWaiting(mockCall1); Loading @@ -468,9 +467,11 @@ public class RingerTest extends TelecomTestCase { when(mockAudioManager.shouldNotificationSoundPlay(aa)).thenReturn(true); enableVibrationWhenRinging(); // This will set AudioManager#getStreamVolume to 0. This test ensures that whether a // ringtone is audible is controlled by AudioManager#shouldNotificationSoundPlay instead: ensureRingerIsNotAudible(); // This will set AudioManager#getStreamVolume to 0. This test ensures that // whether a ringtone is audible is controlled by AudioManager#shouldNotificationSoundPlay // instead: when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(0); // Ensure an audible ringtone is played: assertTrue(startRingingAndWaitForAsync(mockCall2, false)); Loading @@ -487,7 +488,6 @@ public class RingerTest extends TelecomTestCase { @SmallTest @Test public void testNoAudibleRingWhenNotificationSoundShouldNotPlay() throws Exception { when(mFeatureFlags.ensureInCarRinging()).thenReturn(true); Ringtone mockRingtone = ensureRingtoneMocked(); mRingerUnderTest.startCallWaiting(mockCall1); Loading @@ -498,9 +498,11 @@ public class RingerTest extends TelecomTestCase { when(mockAudioManager.shouldNotificationSoundPlay(aa)).thenReturn(false); enableVibrationWhenRinging(); // This will set AudioManager#getStreamVolume to 100. This test ensures that whether a // ringtone is audible is controlled by AudioManager#shouldNotificationSoundPlay instead: ensureRingerIsAudible(); // This will set AudioManager#getStreamVolume to 100. This test ensures that // whether a ringtone is audible is controlled by AudioManager#shouldNotificationSoundPlay // instead: when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(100); // Ensure no audible ringtone is played: assertFalse(startRingingAndWaitForAsync(mockCall2, false)); Loading @@ -520,6 +522,8 @@ public class RingerTest extends TelecomTestCase { mRingerUnderTest.startCallWaiting(mockCall1); when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); enableVibrationWhenRinging(); // Need audio to be considered playable ensureRingerIsAudible(); // The ringtone isn't known to be null until the async portion after the call completes, // so startRinging still returns true here as there should nominally be a ringtone. // Notably, vibration still happens in this scenario. Loading @@ -545,7 +549,8 @@ public class RingerTest extends TelecomTestCase { when(mockRingtoneFactory.getRingtone(any(Call.class), eq(null), anyBoolean())) .thenReturn(new Pair(FAKE_RINGTONE_URI, mockRingtone)); when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_VIBRATE); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(0); when(mockAudioManager.shouldNotificationSoundPlay(any(AudioAttributes.class))) .thenReturn(false); enableVibrationWhenRinging(); assertFalse(startRingingAndWaitForAsync(mockCall2, false)); verify(mockTonePlayer).stopTone(); Loading @@ -562,7 +567,8 @@ public class RingerTest extends TelecomTestCase { createRingerUnderTest(); // Needed after changing haptic playback support. mRingerUnderTest.startCallWaiting(mockCall1); when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_VIBRATE); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(0); when(mockAudioManager.shouldNotificationSoundPlay(any(AudioAttributes.class))) .thenReturn(false); enableVibrationWhenRinging(); assertFalse(startRingingAndWaitForAsync(mockCall2, false)); verify(mockTonePlayer).stopTone(); Loading @@ -581,6 +587,8 @@ public class RingerTest extends TelecomTestCase { when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); when(mockRingtone.getUri()).thenReturn(FAKE_RINGTONE_URI); enableVibrationWhenRinging(); // Need audio to be considered playable ensureRingerIsAudible(); assertTrue(startRingingAndWaitForAsync(mockCall2, false)); verify(mockTonePlayer).stopTone(); verify(mockRingtoneFactory, atLeastOnce()) Loading Loading @@ -631,7 +639,8 @@ public class RingerTest extends TelecomTestCase { public void testSilentRingWithHfpStillAcquiresFocus() throws Exception { mRingerUnderTest.startCallWaiting(mockCall1); when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(0); when(mockAudioManager.shouldNotificationSoundPlay(any(AudioAttributes.class))) .thenReturn(false); enableVibrationOnlyWhenNotRinging(); assertTrue(startRingingAndWaitForAsync(mockCall2, true)); verify(mockTonePlayer).stopTone(); Loading @@ -650,7 +659,8 @@ public class RingerTest extends TelecomTestCase { when(mockNotificationManager.getCurrentInterruptionFilter()).thenReturn( NotificationManager.INTERRUPTION_FILTER_PRIORITY); when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_SILENT); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(100); when(mockAudioManager.shouldNotificationSoundPlay(any(AudioAttributes.class))) .thenReturn(true); enableVibrationWhenRinging(); assertTrue(startRingingAndWaitForAsync(mockCall2, true)); verify(mockRingtoneFactory, atLeastOnce()) Loading Loading @@ -796,6 +806,9 @@ public class RingerTest extends TelecomTestCase { when(mockCall2.wasDndCheckComputedForCall()).thenReturn(false); when(mockCall2.getHandle()).thenReturn(Uri.parse("")); // Ringer needs to be audible to start flash/ring ensureRingerIsAudible(); assertTrue(mRingerUnderTest.shouldRingForContact(mockCall2)); assertTrue(startRingingAndWaitForAsync(mockCall2, false)); verify(mockAccessibilityManagerAdapter, atLeastOnce()) Loading @@ -822,6 +835,9 @@ public class RingerTest extends TelecomTestCase { when(mockCall2.wasDndCheckComputedForCall()).thenReturn(false); when(mockCall2.getHandle()).thenReturn(Uri.parse("")); // Ringer needs to be audible to start flash/ring ensureRingerIsAudible(); assertTrue(mRingerUnderTest.shouldRingForContact(mockCall2)); assertTrue(mRingerUnderTest.startRinging(mockCall2, false)); mRingerUnderTest.stopRinging(); Loading Loading @@ -872,7 +888,8 @@ public class RingerTest extends TelecomTestCase { mRingerUnderTest.startCallWaiting(mockCall1); when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_VIBRATE); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(0); when(mockAudioManager.shouldNotificationSoundPlay(any(AudioAttributes.class))) .thenReturn(false); enableVibrationWhenRinging(); assertFalse(startRingingAndWaitForAsync(mockCall2, false)); Loading Loading @@ -904,12 +921,14 @@ public class RingerTest extends TelecomTestCase { private void ensureRingerIsAudible() { when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(100); when(mockAudioManager.shouldNotificationSoundPlay(any(AudioAttributes.class))) .thenReturn(true); } private void ensureRingerIsNotAudible() { when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_NORMAL); when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(0); when(mockAudioManager.shouldNotificationSoundPlay(any(AudioAttributes.class))) .thenReturn(false); } private void enableVibrationWhenRinging() { Loading