disable proximity sensor after switching from audio to video

This commit is contained in:
Daniel Gultsch 2022-12-29 12:53:59 +01:00
parent b4b2939b9c
commit ce0992036a
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
2 changed files with 20 additions and 13 deletions

View file

@ -1409,8 +1409,8 @@ public class RtpSessionActivity extends XmppActivity
@Override @Override
public void onAudioDeviceChanged( public void onAudioDeviceChanged(
AppRTCAudioManager.AudioDevice selectedAudioDevice, final AppRTCAudioManager.AudioDevice selectedAudioDevice,
Set<AppRTCAudioManager.AudioDevice> availableAudioDevices) { final Set<AppRTCAudioManager.AudioDevice> availableAudioDevices) {
Log.d( Log.d(
Config.LOGTAG, Config.LOGTAG,
"onAudioDeviceChanged in activity: selected:" "onAudioDeviceChanged in activity: selected:"
@ -1418,24 +1418,26 @@ public class RtpSessionActivity extends XmppActivity
+ ", available:" + ", available:"
+ availableAudioDevices); + availableAudioDevices);
try { try {
if (getMedia().contains(Media.VIDEO)) {
Log.d(Config.LOGTAG, "nothing to do; in video mode");
return;
}
final RtpEndUserState endUserState = requireRtpConnection().getEndUserState(); final RtpEndUserState endUserState = requireRtpConnection().getEndUserState();
if (endUserState == RtpEndUserState.CONNECTED) { final Set<Media> media = getMedia();
final AppRTCAudioManager audioManager = requireRtpConnection().getAudioManager(); if (END_CARD.contains(endUserState)) {
updateInCallButtonConfigurationSpeaker(
audioManager.getSelectedAudioDevice(),
audioManager.getAudioDevices().size());
} else if (END_CARD.contains(endUserState)) {
Log.d( Log.d(
Config.LOGTAG, Config.LOGTAG,
"onAudioDeviceChanged() nothing to do because end card has been reached"); "onAudioDeviceChanged() nothing to do because end card has been reached");
} else { } else {
if (Media.audioOnly(media) && endUserState == RtpEndUserState.CONNECTED) {
final AppRTCAudioManager audioManager =
requireRtpConnection().getAudioManager();
updateInCallButtonConfigurationSpeaker(
audioManager.getSelectedAudioDevice(),
audioManager.getAudioDevices().size());
}
Log.d(
Config.LOGTAG,
"put proximity wake lock into proper state after device update");
putProximityWakeLockInProperState(selectedAudioDevice); putProximityWakeLockInProperState(selectedAudioDevice);
} }
} catch (IllegalStateException e) { } catch (final IllegalStateException e) {
Log.d(Config.LOGTAG, "RTP connection was not available when audio device changed"); Log.d(Config.LOGTAG, "RTP connection was not available when audio device changed");
} }
} }

View file

@ -433,9 +433,14 @@ public class WebRTCWrapper {
public void setIsReadyToReceiveIceCandidates(final boolean ready) { public void setIsReadyToReceiveIceCandidates(final boolean ready) {
readyToReceivedIceCandidates.set(ready); readyToReceivedIceCandidates.set(ready);
final int was = iceCandidates.size();
while (ready && iceCandidates.peek() != null) { while (ready && iceCandidates.peek() != null) {
eventCallback.onIceCandidate(iceCandidates.poll()); eventCallback.onIceCandidate(iceCandidates.poll());
} }
final int is = iceCandidates.size();
Log.d(
EXTENDED_LOGGING_TAG,
"setIsReadyToReceiveCandidates(" + ready + ") was=" + was + " is=" + is);
} }
synchronized void close() { synchronized void close() {