Browse Source

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 years ago
parent
commit
a386740103

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

81
         return new ArrayList<>(connections.values());
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
      * Registers a start call promise.
92
      * Registers a start call promise.
86
      *
93
      *
129
         ConnectionImpl connection = connections.get(callUUID);
136
         ConnectionImpl connection = connections.get(callUUID);
130
 
137
 
131
         if (connection != null) {
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
             // Note that the connection is not removed from the list here, but
147
             // Note that the connection is not removed from the list here, but
133
             // in ConnectionImpl's state changed callback. It's a safer
148
             // in ConnectionImpl's state changed callback. It's a safer
134
             // approach, because in case the app would crash on the JavaScript
149
             // approach, because in case the app would crash on the JavaScript

Loading…
Cancel
Save