Sfoglia il codice sorgente

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.
master
paweldomas 6 anni fa
parent
commit
a386740103

+ 15
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/ConnectionService.java Vedi File

@@ -81,6 +81,13 @@ public class ConnectionService extends android.telecom.ConnectionService {
81 81
         return new ArrayList<>(connections.values());
82 82
     }
83 83
 
84
+    /**
85
+     * @return {@code true} if running a Samsung device.
86
+     */
87
+    static boolean isSamsungDevice() {
88
+        return android.os.Build.MANUFACTURER.toLowerCase().contains("samsung");
89
+    }
90
+
84 91
     /**
85 92
      * Registers a start call promise.
86 93
      *
@@ -129,6 +136,14 @@ public class ConnectionService extends android.telecom.ConnectionService {
129 136
         ConnectionImpl connection = connections.get(callUUID);
130 137
 
131 138
         if (connection != null) {
139
+            if (isSamsungDevice()) {
140
+                // Required to release the audio focus correctly.
141
+                connection.setOnHold();
142
+                // Prevents from including in the native phone calls history
143
+                connection.setConnectionProperties(
144
+                    Connection.PROPERTY_SELF_MANAGED
145
+                        | Connection.PROPERTY_IS_EXTERNAL_CALL);
146
+            }
132 147
             // Note that the connection is not removed from the list here, but
133 148
             // in ConnectionImpl's state changed callback. It's a safer
134 149
             // approach, because in case the app would crash on the JavaScript

Loading…
Annulla
Salva