Compare commits

..

2 commits

Author SHA1 Message Date
Peter Cai 5e8d51db9f ConnectionService: miscellaneous fixes
* Fix a few potential errors due to the use of newer APIs (minSDK is
  still only 24)
* Fix one remaining case of raw usage of generic types.
2022-03-11 22:44:21 -05:00
Peter Cai faab2d5799 ConnectionService: Dialer UI integration for incoming calls
For incoming calls, we fall back to the built-in call UI if the
microphone permission is not granted. The reason is that if the Dialer
UI is displayed over keyguard, then the user may not even be able to see
the notification that we show in order for them to grant the permission.
Having a small annoyance for the first incoming call is better than
having the in-call UI hang.
2022-03-11 22:44:17 -05:00
2 changed files with 9 additions and 7 deletions

View file

@ -166,8 +166,8 @@ public class ConnectionService extends android.telecom.ConnectionService {
CheogramConnection connection = new CheogramConnection(account, with, null);
connection.setSessionId(sessionId);
connection.setAddress(
Uri.fromParts("tel", with.getLocal(), null),
TelecomManager.PRESENTATION_ALLOWED
Uri.fromParts("tel", with.getLocal(), null),
TelecomManager.PRESENTATION_ALLOWED
);
connection.setRinging();
@ -269,9 +269,7 @@ public class ConnectionService extends android.telecom.ConnectionService {
public void onAnswer() {
// For incoming calls, a connection update may not have been triggered before answering
// so we have to acquire the rtp connection object here
this.rtpConnection =
xmppConnectionService.getJingleConnectionManager()
.findJingleRtpConnection(account, with, sessionId);
this.rtpConnection = xmppConnectionService.getJingleConnectionManager().findJingleRtpConnection(account, with, sessionId);
rtpConnection.get().acceptCall();
}

View file

@ -444,10 +444,14 @@ public class NotificationService {
PhoneAccountHandle handle = null;
for (Contact contact : id.account.getRoster().getContacts()) {
if (!contact.getJid().getDomain().equals(id.with.getDomain()))
if (!contact.getJid().getDomain().equals(id.with.getDomain())) {
continue;
if (!contact.getPresences().anyIdentity("gateway", "pstn"))
}
if (!contact.getPresences().anyIdentity("gateway", "pstn")) {
continue;
}
handle = contact.phoneAccountHandle();
break;
}