Compare commits

...

8 Commits

Author SHA1 Message Date
Saúl Ibarra Corretgé
3fd2f4052f android: workaround for building
Somehow the bundle doesn't get included in the APK when I build this branch on
one laptop, but works on another, go figure. All of this has changed with the RN
0.59 update, so this is just a band-aid for 19.0 builds.
2019-03-25 11:31:37 +01:00
Saúl Ibarra Corretgé
bf6c41adb1 android: update version 2019-03-25 11:12:46 +01:00
paweldomas
59f3dce01c fix(Android/ConnectionService): do not display the address
Turns out that on Samsung phones the calls placed with
the ConnectionService appear in the calls log as weird long numbers.
The system mangles the address we give it ("sip:meet.jit.si/something")
into this weird long number and the call to request.getAddress() returns
that. Turn off the presentation as neither this number nor our address
makes sense. This way the call appears as from "Unknown" caller in call
history which is still not perfect, but better than the random number.

Note that other phones will preserve the originally passed address value
(tested on One Plus 5).
2019-03-25 10:59:04 +01:00
paweldomas
6d1b891c4c fix(Android/ConnectionService): mic not working
Turns out the microphone will not work on some devices when starting in
"audio only", because the audio mode is not set to the MODE_IN_COMMUNICATION,
but to the MODE_IN_CALL. Calling setAudioModeIsVoip(true) makes
the system adjust to MODE_IN_COMMUNICATION and the mic works fine.
2019-03-25 10:58:56 +01:00
paweldomas
0062f8ae8e ref(AudioModeModule): check 1 method to enable ConnectionService 2019-03-25 10:58:46 +01:00
Saúl Ibarra Corretgé
eb63e19d63 android: updated version 2019-03-08 13:09:15 +01:00
Saúl Ibarra Corretgé
cd48f5cb20 android: updated version 2019-03-08 11:51:52 +01:00
Saúl Ibarra Corretgé
42e495e359 android: fix running on Android < M
The android.telecom.CallAudioState class was only added in API level 23 (Android
M), so make sure we don't import it in lower versioned devices.
2019-03-08 11:38:32 +01:00
5 changed files with 37 additions and 34 deletions

View File

@@ -17,6 +17,6 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
buildNumber=1
appVersion=19.0.0
buildNumber=120
appVersion=19.0.3
sdkVersion=1.21.0

View File

@@ -139,8 +139,8 @@ android.libraryVariants.all { def variant ->
//
if (currentBundleTask.enabled) {
copy {
from(jsBundleDir)
into(assetsDir)
from(jsBundleFile)
into("${assetsDir}/")
}
}
}

View File

@@ -26,7 +26,6 @@ import android.media.AudioDeviceInfo;
import android.media.AudioManager;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.telecom.CallAudioState;
import android.util.Log;
import com.facebook.react.bridge.Arguments;
@@ -59,8 +58,7 @@ import java.util.concurrent.Executors;
* Before a call has started and after it has ended the
* {@code AudioModeModule.DEFAULT} mode should be used.
*/
class AudioModeModule
extends ReactContextBaseJavaModule
class AudioModeModule extends ReactContextBaseJavaModule
implements AudioManager.OnAudioFocusChangeListener {
/**
@@ -104,29 +102,29 @@ class AudioModeModule
/**
* Converts any of the "DEVICE_" constants into the corresponding
* {@link CallAudioState} "ROUTE_" number.
* {@link android.telecom.CallAudioState} "ROUTE_" number.
*
* @param audioDevice one of the "DEVICE_" constants.
* @return a route number {@link CallAudioState#ROUTE_EARPIECE} if no match
* is found.
* @return a route number {@link android.telecom.CallAudioState#ROUTE_EARPIECE} if
* no match is found.
*/
@RequiresApi(api = Build.VERSION_CODES.M)
private static int audioDeviceToRouteInt(String audioDevice) {
if (audioDevice == null) {
return CallAudioState.ROUTE_EARPIECE;
return android.telecom.CallAudioState.ROUTE_EARPIECE;
}
switch (audioDevice) {
case DEVICE_BLUETOOTH:
return CallAudioState.ROUTE_BLUETOOTH;
return android.telecom.CallAudioState.ROUTE_BLUETOOTH;
case DEVICE_EARPIECE:
return CallAudioState.ROUTE_EARPIECE;
return android.telecom.CallAudioState.ROUTE_EARPIECE;
case DEVICE_HEADPHONES:
return CallAudioState.ROUTE_WIRED_HEADSET;
return android.telecom.CallAudioState.ROUTE_WIRED_HEADSET;
case DEVICE_SPEAKER:
return CallAudioState.ROUTE_SPEAKER;
return android.telecom.CallAudioState.ROUTE_SPEAKER;
default:
Log.e(TAG, "Unsupported device name: " + audioDevice);
return CallAudioState.ROUTE_EARPIECE;
return android.telecom.CallAudioState.ROUTE_EARPIECE;
}
}
@@ -134,25 +132,26 @@ class AudioModeModule
* Populates given route mask into the "DEVICE_" list.
*
* @param supportedRouteMask an integer coming from
* {@link CallAudioState#getSupportedRouteMask()}.
* {@link android.telecom.CallAudioState#getSupportedRouteMask()}.
* @return a list of device names.
*/
@RequiresApi(api = Build.VERSION_CODES.M)
private static Set<String> routesToDeviceNames(int supportedRouteMask) {
Set<String> devices = new HashSet<>();
if ((supportedRouteMask & CallAudioState.ROUTE_EARPIECE)
== CallAudioState.ROUTE_EARPIECE) {
if ((supportedRouteMask & android.telecom.CallAudioState.ROUTE_EARPIECE)
== android.telecom.CallAudioState.ROUTE_EARPIECE) {
devices.add(DEVICE_EARPIECE);
}
if ((supportedRouteMask & CallAudioState.ROUTE_BLUETOOTH)
== CallAudioState.ROUTE_BLUETOOTH) {
if ((supportedRouteMask & android.telecom.CallAudioState.ROUTE_BLUETOOTH)
== android.telecom.CallAudioState.ROUTE_BLUETOOTH) {
devices.add(DEVICE_BLUETOOTH);
}
if ((supportedRouteMask & CallAudioState.ROUTE_SPEAKER)
== CallAudioState.ROUTE_SPEAKER) {
if ((supportedRouteMask & android.telecom.CallAudioState.ROUTE_SPEAKER)
== android.telecom.CallAudioState.ROUTE_SPEAKER) {
devices.add(DEVICE_SPEAKER);
}
if ((supportedRouteMask & CallAudioState.ROUTE_WIRED_HEADSET)
== CallAudioState.ROUTE_WIRED_HEADSET) {
if ((supportedRouteMask & android.telecom.CallAudioState.ROUTE_WIRED_HEADSET)
== android.telecom.CallAudioState.ROUTE_WIRED_HEADSET) {
devices.add(DEVICE_HEADPHONES);
}
return devices;
@@ -161,7 +160,7 @@ class AudioModeModule
/**
* Whether or not the ConnectionService is used for selecting audio devices.
*/
private static boolean useConnectionService() {
static boolean useConnectionService() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
}
@@ -272,7 +271,7 @@ class AudioModeModule
/**
* Used on API >= 26 to store the most recently reported audio devices.
* Makes it easier to compare for a change, because the devices are stored
* as a mask in the {@link CallAudioState}. The mask is populated into
* as a mask in the {@link android.telecom.CallAudioState}. The mask is populated into
* the {@link #availableDevices} on each update.
*/
@RequiresApi(api = Build.VERSION_CODES.O)
@@ -298,9 +297,9 @@ class AudioModeModule
= (AudioManager)
reactContext.getSystemService(Context.AUDIO_SERVICE);
// Starting Oreo the ConnectionImpl from ConnectionService us used to
// Starting Oreo the ConnectionImpl from ConnectionService is used to
// detect the available devices.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
if (!useConnectionService()) {
// Setup runtime device change detection.
setupAudioRouteChangeDetection();
@@ -433,7 +432,9 @@ class AudioModeModule
}
@RequiresApi(api = Build.VERSION_CODES.O)
void onCallAudioStateChange(final CallAudioState callAudioState) {
void onCallAudioStateChange(Object callAudioState_) {
final android.telecom.CallAudioState callAudioState
= (android.telecom.CallAudioState)callAudioState_;
runInAudioThread(new Runnable() {
@Override
public void run() {

View File

@@ -189,8 +189,11 @@ public class ConnectionService extends android.telecom.ConnectionService {
connection.setConnectionProperties(Connection.PROPERTY_SELF_MANAGED);
connection.setAddress(
request.getAddress(),
TelecomManager.PRESENTATION_ALLOWED);
TelecomManager.PRESENTATION_UNKNOWN);
connection.setExtras(request.getExtras());
connection.setAudioModeIsVoip(true);
// NOTE there's a time gap between the placeCall and this callback when
// things could get out of sync, but they are put back in sync once
// the startCall Promise is resolved below. That's because on
@@ -428,7 +431,7 @@ public class ConnectionService extends android.telecom.ConnectionService {
@Override
public String toString() {
return String.format(
"ConnectionImpl[adress=%s, uuid=%s]@%d",
"ConnectionImpl[address=%s, uuid=%s]@%d",
getAddress(), getCallUUID(), hashCode());
}
}

View File

@@ -57,8 +57,7 @@ class ReactInstanceManagerHolder {
new org.jitsi.meet.sdk.invite.InviteModule(reactContext),
new org.jitsi.meet.sdk.net.NAT64AddrInfoModule(reactContext)));
if (android.os.Build.VERSION.SDK_INT
>= android.os.Build.VERSION_CODES.O) {
if (AudioModeModule.useConnectionService()) {
nativeModules.add(new RNConnectionService(reactContext));
}