fix(ConnectionService): history and audio focus on Samsung devices

On some Samsung devices the call done with the ConnectionService end up
in the native call history which we don't want. That's fixable by
marking the Connection as "external" just before the call is
disconnected.

Another issue specific to Samsung devices about the audio focus not
always being release when that call ends. That's fixable by marking
the call as holding just before disconnecting it.
pull/4039/head jitsi-meet_3625
paweldomas 6 years ago committed by Paweł Domas
parent 451949f49d
commit a386740103
  1. 15
      android/sdk/src/main/java/org/jitsi/meet/sdk/ConnectionService.java

@ -81,6 +81,13 @@ public class ConnectionService extends android.telecom.ConnectionService {
return new ArrayList<>(connections.values()); return new ArrayList<>(connections.values());
} }
/**
* @return {@code true} if running a Samsung device.
*/
static boolean isSamsungDevice() {
return android.os.Build.MANUFACTURER.toLowerCase().contains("samsung");
}
/** /**
* Registers a start call promise. * Registers a start call promise.
* *
@ -129,6 +136,14 @@ public class ConnectionService extends android.telecom.ConnectionService {
ConnectionImpl connection = connections.get(callUUID); ConnectionImpl connection = connections.get(callUUID);
if (connection != null) { if (connection != null) {
if (isSamsungDevice()) {
// Required to release the audio focus correctly.
connection.setOnHold();
// Prevents from including in the native phone calls history
connection.setConnectionProperties(
Connection.PROPERTY_SELF_MANAGED
| Connection.PROPERTY_IS_EXTERNAL_CALL);
}
// Note that the connection is not removed from the list here, but // Note that the connection is not removed from the list here, but
// in ConnectionImpl's state changed callback. It's a safer // in ConnectionImpl's state changed callback. It's a safer
// approach, because in case the app would crash on the JavaScript // approach, because in case the app would crash on the JavaScript

Loading…
Cancel
Save