opentok / opentok-android-sdk-samples

Sample applications illustrating best practices using OpenTok Android SDK.
https://tokbox.com/developer/sdks/android/
MIT License
210 stars 169 forks source link

Bluetooth permission says its optional in documentation but crashes the app once removed #454

Closed jrdaher closed 1 year ago

jrdaher commented 1 year ago

Describe the bug added this to my manifest

<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" tools:node="remove"/>
<uses-permission android:name="android.permission.BLUETOOTH" tools:node="remove"/>

Expected behavior I expected nothing to happen as I the app we have dosent use bluetooth

Screenshots I got this crash upon booting a session on some devices

Logs

See the documentation of AudioTrack() for what to use instead with android.media.AudioAttributes to qualify your playback use case
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W  java.lang.SecurityException: Need BLUETOOTH permission: Neither user 10523 nor current process has android.permission.BLUETOOTH.
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W      at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W      at android.os.Parcel.createException(Parcel.java:2357)
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W      at android.os.Parcel.readException(Parcel.java:2340)
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W      at android.os.Parcel.readException(Parcel.java:2282)
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W      at android.bluetooth.IBluetoothManager$Stub$Proxy.registerStateChangeCallback(IBluetoothManager.java:509)
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W      at android.bluetooth.BluetoothHeadset.<init>(BluetoothHeadset.java:358)
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W      at android.bluetooth.BluetoothAdapter.getProfileProxy(BluetoothAdapter.java:2806)
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W      at com.opentok.android.BluetoothManager.forceInvokeConnectBluetooth(SourceFile:30)
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W      at com.opentok.android.DefaultAudioDevice.startRenderer(SourceFile:13)
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W  Caused by: android.os.RemoteException: Remote stack trace:
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W      at android.app.ContextImpl.enforce(ContextImpl.java:2018)
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W      at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:2046)
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W      at com.android.server.BluetoothManagerService.registerStateChangeCallback(BluetoothManagerService.java:661)
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W      at android.bluetooth.IBluetoothManager$Stub.onTransact(IBluetoothManager.java:262)
2023-03-23 12:18:56.476 26436-26933 System.err              com.varsitytutors.tutoringtools      W      at android.os.Binder.execTransactInternal(Binder.java:1154)

Device (please compete the following information): Google Pixel 2 XL - updated to max version

Additional context Add any other context about the problem here.

jintgeorge commented 1 year ago

@jrdaher That may be happening as you removed the BT permissions in your app. The SDK is trying to register the BT profile as it finds no permissions are given. The permission in the doc refers to the explicit permission user grants during the runtime.