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
public void onAudioDeviceChanged(
AppRTCAudioManager.AudioDevice selectedAudioDevice,
Set<AppRTCAudioManager.AudioDevice> availableAudioDevices) {
final AppRTCAudioManager.AudioDevice selectedAudioDevice,
final Set<AppRTCAudioManager.AudioDevice> availableAudioDevices) {
Log.d(
Config.LOGTAG,
"onAudioDeviceChanged in activity: selected:"
@ -1418,24 +1418,26 @@ public class RtpSessionActivity extends XmppActivity
+ ", available:"
+ availableAudioDevices);
try {
if (getMedia().contains(Media.VIDEO)) {
Log.d(Config.LOGTAG, "nothing to do; in video mode");
return;
}
final RtpEndUserState endUserState = requireRtpConnection().getEndUserState();
if (endUserState == RtpEndUserState.CONNECTED) {
final AppRTCAudioManager audioManager = requireRtpConnection().getAudioManager();
updateInCallButtonConfigurationSpeaker(
audioManager.getSelectedAudioDevice(),
audioManager.getAudioDevices().size());
} else if (END_CARD.contains(endUserState)) {
final Set<Media> media = getMedia();
if (END_CARD.contains(endUserState)) {
Log.d(
Config.LOGTAG,
"onAudioDeviceChanged() nothing to do because end card has been reached");
} 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);
}
} catch (IllegalStateException e) {
} catch (final IllegalStateException e) {
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) {
readyToReceivedIceCandidates.set(ready);
final int was = iceCandidates.size();
while (ready && iceCandidates.peek() != null) {
eventCallback.onIceCandidate(iceCandidates.poll());
}
final int is = iceCandidates.size();
Log.d(
EXTENDED_LOGGING_TAG,
"setIsReadyToReceiveCandidates(" + ready + ") was=" + was + " is=" + is);
}
synchronized void close() {