Fix proximity sensor video stop

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-06-28 01:23:54 +02:00
parent 8b922caea4
commit 942c0581d3
2 changed files with 11 additions and 8 deletions

View File

@ -1453,12 +1453,15 @@ public class CallController extends BaseController {
.PeerConnectionEventType.SENSOR_FAR) ||
peerConnectionEvent.getPeerConnectionEventType().equals(PeerConnectionEvent
.PeerConnectionEventType.SENSOR_NEAR)) {
boolean enableVideo = peerConnectionEvent.getPeerConnectionEventType().equals(PeerConnectionEvent
.PeerConnectionEventType.SENSOR_FAR) && videoOn;
if (getActivity() != null && EffortlessPermissions.hasPermissions(getActivity(), PERMISSIONS_CAMERA) &&
inCall && videoOn
&& enableVideo != localVideoTrack.enabled()) {
toggleMedia(enableVideo, true);
if (!isVoiceOnlyCall) {
boolean enableVideo = peerConnectionEvent.getPeerConnectionEventType().equals(PeerConnectionEvent
.PeerConnectionEventType.SENSOR_FAR) && videoOn;
if (getActivity() != null && EffortlessPermissions.hasPermissions(getActivity(), PERMISSIONS_CAMERA) &&
inCall && videoOn
&& enableVideo != localVideoTrack.enabled()) {
toggleMedia(enableVideo, true);
}
}
} else if (peerConnectionEvent.getPeerConnectionEventType().equals(PeerConnectionEvent
.PeerConnectionEventType.NICK_CHANGE)) {

View File

@ -176,7 +176,7 @@ public class MagicAudioManager {
setAudioDeviceInternal(MagicAudioManager.AudioDevice.EARPIECE);
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType
.SENSOR_FAR, null, null, null));
.SENSOR_NEAR, null, null, null));
} else {
// Sensor reports that a "handset is removed from a person's ear", or
@ -184,7 +184,7 @@ public class MagicAudioManager {
setAudioDeviceInternal(MagicAudioManager.AudioDevice.SPEAKER_PHONE);
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType
.SENSOR_NEAR, null, null, null));
.SENSOR_FAR, null, null, null));
}
}
}