ref(AudioModeModule): check 1 method to enable ConnectionService

This commit is contained in:
paweldomas 2019-03-21 13:19:22 -05:00 committed by Saúl Ibarra Corretgé
parent ac02a17943
commit 6d0b6bee85
2 changed files with 4 additions and 5 deletions

View File

@ -158,7 +158,7 @@ class AudioModeModule extends ReactContextBaseJavaModule
/** /**
* Whether or not the ConnectionService is used for selecting audio devices. * 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; return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
} }
@ -295,9 +295,9 @@ class AudioModeModule extends ReactContextBaseJavaModule
= (AudioManager) = (AudioManager)
reactContext.getSystemService(Context.AUDIO_SERVICE); 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. // detect the available devices.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { if (!useConnectionService()) {
// Setup runtime device change detection. // Setup runtime device change detection.
setupAudioRouteChangeDetection(); setupAudioRouteChangeDetection();

View File

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