Show calling foreground notification on all OS versions.

Fixes #9516
Fixes #9414
This commit is contained in:
Greyson Parrelli
2020-04-29 14:12:57 -04:00
parent f149005026
commit 2b65916344

View File

@@ -583,9 +583,8 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
audioManager.startOutgoingRinger(OutgoingRinger.Type.RINGING); audioManager.startOutgoingRinger(OutgoingRinger.Type.RINGING);
bluetoothStateManager.setWantsConnection(true); bluetoothStateManager.setWantsConnection(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setCallInProgressNotification(TYPE_OUTGOING_RINGING, activePeer); setCallInProgressNotification(TYPE_OUTGOING_RINGING, activePeer);
}
DatabaseFactory.getSmsDatabase(this).insertOutgoingCall(activePeer.getId()); DatabaseFactory.getSmsDatabase(this).insertOutgoingCall(activePeer.getId());
retrieveTurnServers().addListener(new SuccessOnlyListener<List<PeerConnection.IceServer>>(this.activePeer.getState(), this.activePeer.getCallId()) { retrieveTurnServers().addListener(new SuccessOnlyListener<List<PeerConnection.IceServer>>(this.activePeer.getState(), this.activePeer.getCallId()) {
@@ -629,9 +628,8 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
initializeVideo(); initializeVideo();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setCallInProgressNotification(TYPE_INCOMING_CONNECTING, activePeer); setCallInProgressNotification(TYPE_INCOMING_CONNECTING, activePeer);
}
retrieveTurnServers().addListener(new SuccessOnlyListener<List<PeerConnection.IceServer>>(this.activePeer.getState(), this.activePeer.getCallId()) { retrieveTurnServers().addListener(new SuccessOnlyListener<List<PeerConnection.IceServer>>(this.activePeer.getState(), this.activePeer.getCallId()) {
@Override @Override
public void onSuccessContinue(List<PeerConnection.IceServer> iceServers) { public void onSuccessContinue(List<PeerConnection.IceServer> iceServers) {
@@ -857,10 +855,8 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
} }
registerPowerButtonReceiver(); registerPowerButtonReceiver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setCallInProgressNotification(TYPE_INCOMING_RINGING, activePeer); setCallInProgressNotification(TYPE_INCOMING_RINGING, activePeer);
} }
}
private void handleRemoteRinging(Intent intent) { private void handleRemoteRinging(Intent intent) {
RemotePeer remotePeer = getRemotePeer(intent); RemotePeer remotePeer = getRemotePeer(intent);
@@ -902,9 +898,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
unregisterPowerButtonReceiver(); unregisterPowerButtonReceiver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setCallInProgressNotification(TYPE_ESTABLISHED, activePeer); setCallInProgressNotification(TYPE_ESTABLISHED, activePeer);
}
try { try {
callManager.setCommunicationMode(); callManager.setCommunicationMode();
@@ -1012,7 +1006,6 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
RemotePeer remotePeer = getRemotePeer(intent); RemotePeer remotePeer = getRemotePeer(intent);
Log.i(TAG, "handleEndedReceivedOfferWhileActive(): call_id: " + remotePeer.getCallId()); Log.i(TAG, "handleEndedReceivedOfferWhileActive(): call_id: " + remotePeer.getCallId());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
switch (activePeer.getState()) { switch (activePeer.getState()) {
case DIALING: case DIALING:
case REMOTE_RINGING: setCallInProgressNotification(TYPE_OUTGOING_RINGING, activePeer); break; case REMOTE_RINGING: setCallInProgressNotification(TYPE_OUTGOING_RINGING, activePeer); break;
@@ -1022,7 +1015,6 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
case CONNECTED: setCallInProgressNotification(TYPE_ESTABLISHED, activePeer); break; case CONNECTED: setCallInProgressNotification(TYPE_ESTABLISHED, activePeer); break;
default: throw new IllegalStateException(); default: throw new IllegalStateException();
} }
}
if (activePeer.getState() == CallState.IDLE) { if (activePeer.getState() == CallState.IDLE) {
stopForeground(true); stopForeground(true);