mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-28 01:24:03 +03:00
Merge pull request #2160 from nextcloud/bugfix/2132/android-build-dependend-bluetooth-permissions-2
Implement comments by PR #2139
This commit is contained in:
commit
a5677872b3
5 changed files with 41 additions and 43 deletions
|
@ -161,14 +161,14 @@ class ChatAndCallMessagingService : FirebaseMessagingService() {
|
||||||
decryptMessage(privateKey, base64DecodedSubject, subject, signature)
|
decryptMessage(privateKey, base64DecodedSubject, subject, signature)
|
||||||
}
|
}
|
||||||
} catch (e1: NoSuchAlgorithmException) {
|
} catch (e1: NoSuchAlgorithmException) {
|
||||||
Log.d(NotificationWorker.TAG, "No proper algorithm to decrypt the message " + e1.localizedMessage)
|
Log.e(NotificationWorker.TAG, "No proper algorithm to decrypt the message.", e1)
|
||||||
} catch (e1: NoSuchPaddingException) {
|
} catch (e1: NoSuchPaddingException) {
|
||||||
Log.d(NotificationWorker.TAG, "No proper padding to decrypt the message " + e1.localizedMessage)
|
Log.e(NotificationWorker.TAG, "No proper padding to decrypt the message.", e1)
|
||||||
} catch (e1: InvalidKeyException) {
|
} catch (e1: InvalidKeyException) {
|
||||||
Log.d(NotificationWorker.TAG, "Invalid private key " + e1.localizedMessage)
|
Log.e(NotificationWorker.TAG, "Invalid private key.", e1)
|
||||||
}
|
}
|
||||||
} catch (exception: Exception) {
|
} catch (exception: Exception) {
|
||||||
Log.d(NotificationWorker.TAG, "Something went very wrong " + exception.localizedMessage, exception)
|
Log.e(NotificationWorker.TAG, "Something went very wrong!", exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ class ChatAndCallMessagingService : FirebaseMessagingService() {
|
||||||
0,
|
0,
|
||||||
fullScreenIntent,
|
fullScreenIntent,
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
} else {
|
} else {
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT
|
PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,10 +95,10 @@ import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||||
import com.nextcloud.talk.utils.power.PowerManagerUtils;
|
import com.nextcloud.talk.utils.power.PowerManagerUtils;
|
||||||
import com.nextcloud.talk.utils.preferences.AppPreferences;
|
import com.nextcloud.talk.utils.preferences.AppPreferences;
|
||||||
import com.nextcloud.talk.utils.singletons.ApplicationWideCurrentRoomHolder;
|
import com.nextcloud.talk.utils.singletons.ApplicationWideCurrentRoomHolder;
|
||||||
import com.nextcloud.talk.webrtc.WebRtcAudioManger;
|
|
||||||
import com.nextcloud.talk.webrtc.MagicWebRTCUtils;
|
import com.nextcloud.talk.webrtc.MagicWebRTCUtils;
|
||||||
import com.nextcloud.talk.webrtc.MagicWebSocketInstance;
|
import com.nextcloud.talk.webrtc.MagicWebSocketInstance;
|
||||||
import com.nextcloud.talk.webrtc.PeerConnectionWrapper;
|
import com.nextcloud.talk.webrtc.PeerConnectionWrapper;
|
||||||
|
import com.nextcloud.talk.webrtc.WebRtcAudioManager;
|
||||||
import com.nextcloud.talk.webrtc.WebSocketConnectionHelper;
|
import com.nextcloud.talk.webrtc.WebSocketConnectionHelper;
|
||||||
import com.wooplr.spotlight.SpotlightView;
|
import com.wooplr.spotlight.SpotlightView;
|
||||||
|
|
||||||
|
@ -162,8 +162,7 @@ import me.zhanghai.android.effortlesspermissions.OpenAppDetailsDialogFragment;
|
||||||
import okhttp3.Cache;
|
import okhttp3.Cache;
|
||||||
import pub.devrel.easypermissions.AfterPermissionGranted;
|
import pub.devrel.easypermissions.AfterPermissionGranted;
|
||||||
|
|
||||||
import static android.app.PendingIntent.FLAG_MUTABLE;
|
import static android.app.PendingIntent.FLAG_IMMUTABLE;
|
||||||
import static android.app.PendingIntent.FLAG_MUTABLE;
|
|
||||||
import static com.nextcloud.talk.webrtc.Globals.JOB_ID;
|
import static com.nextcloud.talk.webrtc.Globals.JOB_ID;
|
||||||
import static com.nextcloud.talk.webrtc.Globals.PARTICIPANTS_UPDATE;
|
import static com.nextcloud.talk.webrtc.Globals.PARTICIPANTS_UPDATE;
|
||||||
import static com.nextcloud.talk.webrtc.Globals.ROOM_TOKEN;
|
import static com.nextcloud.talk.webrtc.Globals.ROOM_TOKEN;
|
||||||
|
@ -189,7 +188,7 @@ public class CallActivity extends CallBaseActivity {
|
||||||
|
|
||||||
public static final String TAG = "CallActivity";
|
public static final String TAG = "CallActivity";
|
||||||
|
|
||||||
public WebRtcAudioManger audioManager;
|
public WebRtcAudioManager audioManager;
|
||||||
|
|
||||||
private static final String[] PERMISSIONS_CALL = {
|
private static final String[] PERMISSIONS_CALL = {
|
||||||
Manifest.permission.CAMERA,
|
Manifest.permission.CAMERA,
|
||||||
|
@ -343,7 +342,6 @@ public class CallActivity extends CallBaseActivity {
|
||||||
updateSelfVideoViewPosition();
|
updateSelfVideoViewPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("InlinedApi")
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.S)
|
@RequiresApi(api = Build.VERSION_CODES.S)
|
||||||
private void requestBluetoothPermission() {
|
private void requestBluetoothPermission() {
|
||||||
if (ContextCompat.checkSelfPermission(
|
if (ContextCompat.checkSelfPermission(
|
||||||
|
@ -452,16 +450,16 @@ public class CallActivity extends CallBaseActivity {
|
||||||
|
|
||||||
// Create and audio manager that will take care of audio routing,
|
// Create and audio manager that will take care of audio routing,
|
||||||
// audio modes, audio device enumeration etc.
|
// audio modes, audio device enumeration etc.
|
||||||
audioManager = WebRtcAudioManger.create(getApplicationContext(), isVoiceOnlyCall);
|
audioManager = WebRtcAudioManager.create(getApplicationContext(), isVoiceOnlyCall);
|
||||||
// Store existing audio settings and change audio mode to
|
// Store existing audio settings and change audio mode to
|
||||||
// MODE_IN_COMMUNICATION for best possible VoIP performance.
|
// MODE_IN_COMMUNICATION for best possible VoIP performance.
|
||||||
Log.d(TAG, "Starting the audio manager...");
|
Log.d(TAG, "Starting the audio manager...");
|
||||||
audioManager.start(this::onAudioManagerDevicesChanged);
|
audioManager.start(this::onAudioManagerDevicesChanged);
|
||||||
|
|
||||||
if (isVoiceOnlyCall) {
|
if (isVoiceOnlyCall) {
|
||||||
setAudioOutputChannel(WebRtcAudioManger.AudioDevice.EARPIECE);
|
setAudioOutputChannel(WebRtcAudioManager.AudioDevice.EARPIECE);
|
||||||
} else {
|
} else {
|
||||||
setAudioOutputChannel(WebRtcAudioManger.AudioDevice.SPEAKER_PHONE);
|
setAudioOutputChannel(WebRtcAudioManager.AudioDevice.SPEAKER_PHONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
iceServers = new ArrayList<>();
|
iceServers = new ArrayList<>();
|
||||||
|
@ -495,14 +493,14 @@ public class CallActivity extends CallBaseActivity {
|
||||||
microphoneInitialization();
|
microphoneInitialization();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAudioOutputChannel(WebRtcAudioManger.AudioDevice selectedAudioDevice) {
|
public void setAudioOutputChannel(WebRtcAudioManager.AudioDevice selectedAudioDevice) {
|
||||||
if (audioManager != null) {
|
if (audioManager != null) {
|
||||||
audioManager.selectAudioDevice(selectedAudioDevice);
|
audioManager.selectAudioDevice(selectedAudioDevice);
|
||||||
updateAudioOutputButton(audioManager.getCurrentAudioDevice());
|
updateAudioOutputButton(audioManager.getCurrentAudioDevice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAudioOutputButton(WebRtcAudioManger.AudioDevice activeAudioDevice) {
|
private void updateAudioOutputButton(WebRtcAudioManager.AudioDevice activeAudioDevice) {
|
||||||
switch (activeAudioDevice) {
|
switch (activeAudioDevice) {
|
||||||
case BLUETOOTH:
|
case BLUETOOTH:
|
||||||
binding.audioOutputButton.getHierarchy().setPlaceholderImage(
|
binding.audioOutputButton.getHierarchy().setPlaceholderImage(
|
||||||
|
@ -796,14 +794,14 @@ public class CallActivity extends CallBaseActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onAudioManagerDevicesChanged(
|
private void onAudioManagerDevicesChanged(
|
||||||
final WebRtcAudioManger.AudioDevice currentDevice,
|
final WebRtcAudioManager.AudioDevice currentDevice,
|
||||||
final Set<WebRtcAudioManger.AudioDevice> availableDevices) {
|
final Set<WebRtcAudioManager.AudioDevice> availableDevices) {
|
||||||
Log.d(TAG, "onAudioManagerDevicesChanged: " + availableDevices + ", "
|
Log.d(TAG, "onAudioManagerDevicesChanged: " + availableDevices + ", "
|
||||||
+ "currentDevice: " + currentDevice);
|
+ "currentDevice: " + currentDevice);
|
||||||
|
|
||||||
final boolean shouldDisableProximityLock = (currentDevice.equals(WebRtcAudioManger.AudioDevice.WIRED_HEADSET)
|
final boolean shouldDisableProximityLock = (currentDevice.equals(WebRtcAudioManager.AudioDevice.WIRED_HEADSET)
|
||||||
|| currentDevice.equals(WebRtcAudioManger.AudioDevice.SPEAKER_PHONE)
|
|| currentDevice.equals(WebRtcAudioManager.AudioDevice.SPEAKER_PHONE)
|
||||||
|| currentDevice.equals(WebRtcAudioManger.AudioDevice.BLUETOOTH));
|
|| currentDevice.equals(WebRtcAudioManager.AudioDevice.BLUETOOTH));
|
||||||
|
|
||||||
if (shouldDisableProximityLock) {
|
if (shouldDisableProximityLock) {
|
||||||
powerManagerUtils.updatePhoneState(PowerManagerUtils.PhoneState.WITHOUT_PROXIMITY_SENSOR_LOCK);
|
powerManagerUtils.updatePhoneState(PowerManagerUtils.PhoneState.WITHOUT_PROXIMITY_SENSOR_LOCK);
|
||||||
|
@ -2614,7 +2612,7 @@ public class CallActivity extends CallBaseActivity {
|
||||||
|
|
||||||
int intentFlag;
|
int intentFlag;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
intentFlag = FLAG_MUTABLE;
|
intentFlag = FLAG_IMMUTABLE;
|
||||||
} else {
|
} else {
|
||||||
intentFlag = 0;
|
intentFlag = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.activities.CallActivity
|
import com.nextcloud.talk.activities.CallActivity
|
||||||
import com.nextcloud.talk.databinding.DialogAudioOutputBinding
|
import com.nextcloud.talk.databinding.DialogAudioOutputBinding
|
||||||
import com.nextcloud.talk.webrtc.WebRtcAudioManger
|
import com.nextcloud.talk.webrtc.WebRtcAudioManager
|
||||||
|
|
||||||
class AudioOutputDialog(val callActivity: CallActivity) : BottomSheetDialog(callActivity) {
|
class AudioOutputDialog(val callActivity: CallActivity) : BottomSheetDialog(callActivity) {
|
||||||
|
|
||||||
|
@ -47,26 +47,26 @@ class AudioOutputDialog(val callActivity: CallActivity) : BottomSheetDialog(call
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateOutputDeviceList() {
|
fun updateOutputDeviceList() {
|
||||||
if (callActivity.audioManager?.audioDevices?.contains(WebRtcAudioManger.AudioDevice.BLUETOOTH) == false) {
|
if (callActivity.audioManager?.audioDevices?.contains(WebRtcAudioManager.AudioDevice.BLUETOOTH) == false) {
|
||||||
dialogAudioOutputBinding.audioOutputBluetooth.visibility = View.GONE
|
dialogAudioOutputBinding.audioOutputBluetooth.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
dialogAudioOutputBinding.audioOutputBluetooth.visibility = View.VISIBLE
|
dialogAudioOutputBinding.audioOutputBluetooth.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callActivity.audioManager?.audioDevices?.contains(WebRtcAudioManger.AudioDevice.EARPIECE) == false) {
|
if (callActivity.audioManager?.audioDevices?.contains(WebRtcAudioManager.AudioDevice.EARPIECE) == false) {
|
||||||
dialogAudioOutputBinding.audioOutputEarspeaker.visibility = View.GONE
|
dialogAudioOutputBinding.audioOutputEarspeaker.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
dialogAudioOutputBinding.audioOutputEarspeaker.visibility = View.VISIBLE
|
dialogAudioOutputBinding.audioOutputEarspeaker.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callActivity.audioManager?.audioDevices?.contains(WebRtcAudioManger.AudioDevice.SPEAKER_PHONE) == false) {
|
if (callActivity.audioManager?.audioDevices?.contains(WebRtcAudioManager.AudioDevice.SPEAKER_PHONE) == false) {
|
||||||
dialogAudioOutputBinding.audioOutputSpeaker.visibility = View.GONE
|
dialogAudioOutputBinding.audioOutputSpeaker.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
dialogAudioOutputBinding.audioOutputSpeaker.visibility = View.VISIBLE
|
dialogAudioOutputBinding.audioOutputSpeaker.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callActivity.audioManager?.currentAudioDevice?.equals(
|
if (callActivity.audioManager?.currentAudioDevice?.equals(
|
||||||
WebRtcAudioManger.AudioDevice.WIRED_HEADSET
|
WebRtcAudioManager.AudioDevice.WIRED_HEADSET
|
||||||
) == true
|
) == true
|
||||||
) {
|
) {
|
||||||
dialogAudioOutputBinding.audioOutputEarspeaker.visibility = View.GONE
|
dialogAudioOutputBinding.audioOutputEarspeaker.visibility = View.GONE
|
||||||
|
@ -81,7 +81,7 @@ class AudioOutputDialog(val callActivity: CallActivity) : BottomSheetDialog(call
|
||||||
|
|
||||||
private fun highlightActiveOutputChannel() {
|
private fun highlightActiveOutputChannel() {
|
||||||
when (callActivity.audioManager?.currentAudioDevice) {
|
when (callActivity.audioManager?.currentAudioDevice) {
|
||||||
WebRtcAudioManger.AudioDevice.BLUETOOTH -> {
|
WebRtcAudioManager.AudioDevice.BLUETOOTH -> {
|
||||||
dialogAudioOutputBinding.audioOutputBluetoothIcon.setColorFilter(
|
dialogAudioOutputBinding.audioOutputBluetoothIcon.setColorFilter(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
context,
|
context,
|
||||||
|
@ -94,7 +94,7 @@ class AudioOutputDialog(val callActivity: CallActivity) : BottomSheetDialog(call
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtcAudioManger.AudioDevice.SPEAKER_PHONE -> {
|
WebRtcAudioManager.AudioDevice.SPEAKER_PHONE -> {
|
||||||
dialogAudioOutputBinding.audioOutputSpeakerIcon.setColorFilter(
|
dialogAudioOutputBinding.audioOutputSpeakerIcon.setColorFilter(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
context,
|
context,
|
||||||
|
@ -107,7 +107,7 @@ class AudioOutputDialog(val callActivity: CallActivity) : BottomSheetDialog(call
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtcAudioManger.AudioDevice.EARPIECE -> {
|
WebRtcAudioManager.AudioDevice.EARPIECE -> {
|
||||||
dialogAudioOutputBinding.audioOutputEarspeakerIcon.setColorFilter(
|
dialogAudioOutputBinding.audioOutputEarspeakerIcon.setColorFilter(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
context,
|
context,
|
||||||
|
@ -120,7 +120,7 @@ class AudioOutputDialog(val callActivity: CallActivity) : BottomSheetDialog(call
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtcAudioManger.AudioDevice.WIRED_HEADSET -> {
|
WebRtcAudioManager.AudioDevice.WIRED_HEADSET -> {
|
||||||
dialogAudioOutputBinding.audioOutputWiredHeadsetIcon.setColorFilter(
|
dialogAudioOutputBinding.audioOutputWiredHeadsetIcon.setColorFilter(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
context,
|
context,
|
||||||
|
@ -139,17 +139,17 @@ class AudioOutputDialog(val callActivity: CallActivity) : BottomSheetDialog(call
|
||||||
|
|
||||||
private fun initClickListeners() {
|
private fun initClickListeners() {
|
||||||
dialogAudioOutputBinding.audioOutputBluetooth.setOnClickListener {
|
dialogAudioOutputBinding.audioOutputBluetooth.setOnClickListener {
|
||||||
callActivity.setAudioOutputChannel(WebRtcAudioManger.AudioDevice.BLUETOOTH)
|
callActivity.setAudioOutputChannel(WebRtcAudioManager.AudioDevice.BLUETOOTH)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogAudioOutputBinding.audioOutputSpeaker.setOnClickListener {
|
dialogAudioOutputBinding.audioOutputSpeaker.setOnClickListener {
|
||||||
callActivity.setAudioOutputChannel(WebRtcAudioManger.AudioDevice.SPEAKER_PHONE)
|
callActivity.setAudioOutputChannel(WebRtcAudioManager.AudioDevice.SPEAKER_PHONE)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogAudioOutputBinding.audioOutputEarspeaker.setOnClickListener {
|
dialogAudioOutputBinding.audioOutputEarspeaker.setOnClickListener {
|
||||||
callActivity.setAudioOutputChannel(WebRtcAudioManger.AudioDevice.EARPIECE)
|
callActivity.setAudioOutputChannel(WebRtcAudioManager.AudioDevice.EARPIECE)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,8 @@ import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class WebRtcAudioManger {
|
public class WebRtcAudioManager {
|
||||||
private static final String TAG = WebRtcAudioManger.class.getCanonicalName();
|
private static final String TAG = WebRtcAudioManager.class.getSimpleName();
|
||||||
private final Context magicContext;
|
private final Context magicContext;
|
||||||
private final WebRtcBluetoothManager bluetoothManager;
|
private final WebRtcBluetoothManager bluetoothManager;
|
||||||
private final boolean useProximitySensor;
|
private final boolean useProximitySensor;
|
||||||
|
@ -79,7 +79,7 @@ public class WebRtcAudioManger {
|
||||||
|
|
||||||
private final PowerManagerUtils powerManagerUtils;
|
private final PowerManagerUtils powerManagerUtils;
|
||||||
|
|
||||||
private WebRtcAudioManger(Context context, boolean useProximitySensor) {
|
private WebRtcAudioManager(Context context, boolean useProximitySensor) {
|
||||||
Log.d(TAG, "ctor");
|
Log.d(TAG, "ctor");
|
||||||
ThreadUtils.checkIsOnMainThread();
|
ThreadUtils.checkIsOnMainThread();
|
||||||
magicContext = context;
|
magicContext = context;
|
||||||
|
@ -110,8 +110,8 @@ public class WebRtcAudioManger {
|
||||||
/**
|
/**
|
||||||
* Construction.
|
* Construction.
|
||||||
*/
|
*/
|
||||||
public static WebRtcAudioManger create(Context context, boolean useProximitySensor) {
|
public static WebRtcAudioManager create(Context context, boolean useProximitySensor) {
|
||||||
return new WebRtcAudioManger(context, useProximitySensor);
|
return new WebRtcAudioManager(context, useProximitySensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startBluetoothManager() {
|
public void startBluetoothManager() {
|
||||||
|
@ -141,7 +141,7 @@ public class WebRtcAudioManger {
|
||||||
.SENSOR_NEAR, null, null, null, null));
|
.SENSOR_NEAR, null, null, null, null));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setAudioDeviceInternal(WebRtcAudioManger.AudioDevice.SPEAKER_PHONE);
|
setAudioDeviceInternal(WebRtcAudioManager.AudioDevice.SPEAKER_PHONE);
|
||||||
Log.d(TAG, "switched to SPEAKER_PHONE because userSelectedAudioDevice was SPEAKER_PHONE and proximity=far");
|
Log.d(TAG, "switched to SPEAKER_PHONE because userSelectedAudioDevice was SPEAKER_PHONE and proximity=far");
|
||||||
|
|
||||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType
|
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType
|
|
@ -59,14 +59,14 @@ import java.util.Set;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
public class WebRtcBluetoothManager {
|
public class WebRtcBluetoothManager {
|
||||||
private static final String TAG = WebRtcBluetoothManager.class.getCanonicalName();
|
private static final String TAG = WebRtcBluetoothManager.class.getSimpleName();
|
||||||
|
|
||||||
// Timeout interval for starting or stopping audio to a Bluetooth SCO device.
|
// Timeout interval for starting or stopping audio to a Bluetooth SCO device.
|
||||||
private static final int BLUETOOTH_SCO_TIMEOUT_MS = 4000;
|
private static final int BLUETOOTH_SCO_TIMEOUT_MS = 4000;
|
||||||
// Maximum number of SCO connection attempts.
|
// Maximum number of SCO connection attempts.
|
||||||
private static final int MAX_SCO_CONNECTION_ATTEMPTS = 2;
|
private static final int MAX_SCO_CONNECTION_ATTEMPTS = 2;
|
||||||
private final Context apprtcContext;
|
private final Context apprtcContext;
|
||||||
private final WebRtcAudioManger webRtcAudioManager;
|
private final WebRtcAudioManager webRtcAudioManager;
|
||||||
private final AudioManager audioManager;
|
private final AudioManager audioManager;
|
||||||
private final Handler handler;
|
private final Handler handler;
|
||||||
private final BluetoothProfile.ServiceListener bluetoothServiceListener;
|
private final BluetoothProfile.ServiceListener bluetoothServiceListener;
|
||||||
|
@ -82,7 +82,7 @@ public class WebRtcBluetoothManager {
|
||||||
private final Runnable bluetoothTimeoutRunnable = this::bluetoothTimeout;
|
private final Runnable bluetoothTimeoutRunnable = this::bluetoothTimeout;
|
||||||
private boolean started = false;
|
private boolean started = false;
|
||||||
|
|
||||||
protected WebRtcBluetoothManager(Context context, WebRtcAudioManger audioManager) {
|
protected WebRtcBluetoothManager(Context context, WebRtcAudioManager audioManager) {
|
||||||
Log.d(TAG, "ctor");
|
Log.d(TAG, "ctor");
|
||||||
ThreadUtils.checkIsOnMainThread();
|
ThreadUtils.checkIsOnMainThread();
|
||||||
apprtcContext = context;
|
apprtcContext = context;
|
||||||
|
@ -97,7 +97,7 @@ public class WebRtcBluetoothManager {
|
||||||
/**
|
/**
|
||||||
* Construction.
|
* Construction.
|
||||||
*/
|
*/
|
||||||
static WebRtcBluetoothManager create(Context context, WebRtcAudioManger audioManager) {
|
static WebRtcBluetoothManager create(Context context, WebRtcAudioManager audioManager) {
|
||||||
return new WebRtcBluetoothManager(context, audioManager);
|
return new WebRtcBluetoothManager(context, audioManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue