feat(android) adds ability to disable the requestFocus on Android

This commit is contained in:
tmoldovan8x8 2021-02-05 09:05:55 +02:00 committed by GitHub
parent 12680c35ca
commit 9ed1969f7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -6,6 +6,13 @@
*/
export const ADD_PEOPLE_ENABLED = 'add-people.enabled';
/**
* Flag indicating if the SDK should not require the audio focus.
* Used by apps that do not use Jitsi audio.
* Default: disabled (false)
*/
export const ANDROID_AUDIO_FOCUS_DISABLED = 'android.audio-focus.disabled';
/**
* Flag indicating if the audio mute button should be displayed.
* Default: enabled (true).

View File

@ -1,6 +1,5 @@
// @flow
import { NativeEventEmitter, NativeModules } from 'react-native';
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../base/app';
import { SET_AUDIO_ONLY } from '../../base/audio-only';
@ -10,6 +9,7 @@ import {
CONFERENCE_JOINED,
getCurrentConference
} from '../../base/conference';
import { getFeatureFlag, ANDROID_AUDIO_FOCUS_DISABLED } from '../../base/flags';
import { MiddlewareRegistry } from '../../base/redux';
import { _SET_AUDIOMODE_DEVICES, _SET_AUDIOMODE_SUBSCRIPTIONS } from './actionTypes';
@ -140,7 +140,9 @@ function _updateAudioMode({ getState }, next, action) {
const { enabled: audioOnly } = state['features/base/audio-only'];
let mode;
if (conference) {
if (Platform.OS === 'android' && getFeatureFlag(state, ANDROID_AUDIO_FOCUS_DISABLED, false)) {
mode = AudioMode.DEFAULT;
} else if (conference) {
mode = audioOnly ? AudioMode.AUDIO_CALL : AudioMode.VIDEO_CALL;
} else {
mode = AudioMode.DEFAULT;