catch rare race conditions when pressing switch to earpiece

(cherry picked from commit 07600c57ea62ce2fe1a43f4ff391af458fa4b053)
This commit is contained in:
Daniel Gultsch 2024-07-15 10:06:40 +02:00 committed by Arne
parent bacf61fe0f
commit f34fb1b153

View file

@ -1304,13 +1304,21 @@ public class RtpSessionActivity extends XmppActivity
}
private void switchToEarpiece(final View view) {
requireCallIntegration().setAudioDevice(CallIntegration.AudioDevice.EARPIECE);
acquireProximityWakeLock();
try {
requireCallIntegration().setAudioDevice(CallIntegration.AudioDevice.EARPIECE);
acquireProximityWakeLock();
} catch (final IllegalStateException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
private void switchToSpeaker(final View view) {
requireCallIntegration().setAudioDevice(CallIntegration.AudioDevice.SPEAKER_PHONE);
releaseProximityWakeLock();
try {
requireCallIntegration().setAudioDevice(CallIntegration.AudioDevice.SPEAKER_PHONE);
releaseProximityWakeLock();
} catch (final IllegalStateException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
private void retry(final View view) {