Loading src/com/android/server/telecom/CallAudioManager.java +5 −3 Original line number Diff line number Diff line Loading @@ -727,12 +727,14 @@ public class CallAudioManager extends CallsManagerListenerBase { Log.d(this, "Found a disconnected call with tone to play %d.", toneToPlay); if (toneToPlay != InCallTonePlayer.TONE_INVALID) { mPlayerFactory.createPlayer(toneToPlay).startTone(); boolean didToneStart = mPlayerFactory.createPlayer(toneToPlay).startTone(); if (didToneStart) { mCallsManager.onDisconnectedTonePlaying(true); mIsDisconnectedTonePlaying = true; } } } } private void playRingbackForCall(Call call) { if (call == mForegroundCall && call.isRingbackRequested()) { Loading src/com/android/server/telecom/InCallTonePlayer.java +3 −2 Original line number Diff line number Diff line Loading @@ -427,11 +427,11 @@ public class InCallTonePlayer extends Thread { } @VisibleForTesting public void startTone() { public boolean startTone() { // Skip playing the end call tone if the volume is silenced. if (mToneId == TONE_CALL_ENDED && !mAudioManagerAdapter.isVolumeOverZero()) { Log.i(this, "startTone: skip end-call tone as device is silenced."); return; return false; } sTonesPlaying++; Loading @@ -447,6 +447,7 @@ public class InCallTonePlayer extends Thread { } super.start(); return true; } @Override Loading tests/src/com/android/server/telecom/tests/CallAudioManagerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ public class CallAudioManagerTest extends TelecomTestCase { InCallTonePlayer mockInCallTonePlayer = mock(InCallTonePlayer.class); doAnswer((invocation2) -> { mCallAudioManager.setIsTonePlaying(true); return null; return true; }).when(mockInCallTonePlayer).startTone(); return mockInCallTonePlayer; }).when(mPlayerFactory).createPlayer(anyInt()); Loading tests/src/com/android/server/telecom/tests/InCallTonePlayerTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.telecom.tests; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; Loading Loading @@ -114,7 +116,7 @@ public class InCallTonePlayerTest extends TelecomTestCase { public void testNoEndCallToneInSilence() { when(mAudioManagerAdapter.isVolumeOverZero()).thenReturn(false); InCallTonePlayer player = mFactory.createPlayer(InCallTonePlayer.TONE_CALL_ENDED); player.startTone(); assertFalse(player.startTone()); // Verify we didn't play a tone. verify(mCallAudioManager, never()).setIsTonePlaying(eq(true)); Loading @@ -126,7 +128,7 @@ public class InCallTonePlayerTest extends TelecomTestCase { public void testEndCallToneWhenNotSilenced() { when(mAudioManagerAdapter.isVolumeOverZero()).thenReturn(true); InCallTonePlayer player = mFactory.createPlayer(InCallTonePlayer.TONE_CALL_ENDED); player.startTone(); assertTrue(player.startTone()); // Verify we did play a tone. verify(mCallAudioManager).setIsTonePlaying(eq(true)); Loading tests/src/com/android/server/telecom/tests/RingerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,7 @@ public class RingerTest extends TelecomTestCase { when(mockAudioManager.getRingerModeInternal()).thenReturn(AudioManager.RINGER_MODE_NORMAL); NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); when(mockTonePlayer.startTone()).thenReturn(true); when(notificationManager.matchesCallFilter(any(Bundle.class))).thenReturn(true); mRingerUnderTest = new Ringer(mockPlayerFactory, mContext, mockSystemSettingsUtil, mockRingtonePlayer, mockRingtoneFactory, mockVibrator, spyVibrationEffectProxy, Loading Loading
src/com/android/server/telecom/CallAudioManager.java +5 −3 Original line number Diff line number Diff line Loading @@ -727,12 +727,14 @@ public class CallAudioManager extends CallsManagerListenerBase { Log.d(this, "Found a disconnected call with tone to play %d.", toneToPlay); if (toneToPlay != InCallTonePlayer.TONE_INVALID) { mPlayerFactory.createPlayer(toneToPlay).startTone(); boolean didToneStart = mPlayerFactory.createPlayer(toneToPlay).startTone(); if (didToneStart) { mCallsManager.onDisconnectedTonePlaying(true); mIsDisconnectedTonePlaying = true; } } } } private void playRingbackForCall(Call call) { if (call == mForegroundCall && call.isRingbackRequested()) { Loading
src/com/android/server/telecom/InCallTonePlayer.java +3 −2 Original line number Diff line number Diff line Loading @@ -427,11 +427,11 @@ public class InCallTonePlayer extends Thread { } @VisibleForTesting public void startTone() { public boolean startTone() { // Skip playing the end call tone if the volume is silenced. if (mToneId == TONE_CALL_ENDED && !mAudioManagerAdapter.isVolumeOverZero()) { Log.i(this, "startTone: skip end-call tone as device is silenced."); return; return false; } sTonesPlaying++; Loading @@ -447,6 +447,7 @@ public class InCallTonePlayer extends Thread { } super.start(); return true; } @Override Loading
tests/src/com/android/server/telecom/tests/CallAudioManagerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ public class CallAudioManagerTest extends TelecomTestCase { InCallTonePlayer mockInCallTonePlayer = mock(InCallTonePlayer.class); doAnswer((invocation2) -> { mCallAudioManager.setIsTonePlaying(true); return null; return true; }).when(mockInCallTonePlayer).startTone(); return mockInCallTonePlayer; }).when(mPlayerFactory).createPlayer(anyInt()); Loading
tests/src/com/android/server/telecom/tests/InCallTonePlayerTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.telecom.tests; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; Loading Loading @@ -114,7 +116,7 @@ public class InCallTonePlayerTest extends TelecomTestCase { public void testNoEndCallToneInSilence() { when(mAudioManagerAdapter.isVolumeOverZero()).thenReturn(false); InCallTonePlayer player = mFactory.createPlayer(InCallTonePlayer.TONE_CALL_ENDED); player.startTone(); assertFalse(player.startTone()); // Verify we didn't play a tone. verify(mCallAudioManager, never()).setIsTonePlaying(eq(true)); Loading @@ -126,7 +128,7 @@ public class InCallTonePlayerTest extends TelecomTestCase { public void testEndCallToneWhenNotSilenced() { when(mAudioManagerAdapter.isVolumeOverZero()).thenReturn(true); InCallTonePlayer player = mFactory.createPlayer(InCallTonePlayer.TONE_CALL_ENDED); player.startTone(); assertTrue(player.startTone()); // Verify we did play a tone. verify(mCallAudioManager).setIsTonePlaying(eq(true)); Loading
tests/src/com/android/server/telecom/tests/RingerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,7 @@ public class RingerTest extends TelecomTestCase { when(mockAudioManager.getRingerModeInternal()).thenReturn(AudioManager.RINGER_MODE_NORMAL); NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); when(mockTonePlayer.startTone()).thenReturn(true); when(notificationManager.matchesCallFilter(any(Bundle.class))).thenReturn(true); mRingerUnderTest = new Ringer(mockPlayerFactory, mContext, mockSystemSettingsUtil, mockRingtonePlayer, mockRingtoneFactory, mockVibrator, spyVibrationEffectProxy, Loading