joaomgcd / TaskerSettings

Helper app for Tasker
328 stars 6 forks source link

Can not connect to specific bluetooth device #38

Open PsychodelEKS opened 8 months ago

PsychodelEKS commented 8 months ago

After the latest updates, my BT connection task stopped working on my SGS10, I'm on the latest Tasker (from Google Play) and Tasker Settings 1.7.1, getting the following error (just a simple Bluetooth connect to a MAC task):

02.57.45/LicenseCheckerTasker Checking cached only
02.57.45/LicenseCheckerTasker cache validity left -138841
02.57.45/LicenseCheckerTasker Cached status: Licensed
02.57.45/LicenseCheckerTasker Cached only: Licensed
02.57.45/Ew add wait type EasyAction1 time 2147483647
02.57.45/Ew add wait type EasyAction1 done
02.57.45/E add wait task
02.57.45/E Error: 1
02.57.45/E Need BLUETOOTH_PRIVILEGED permission: Neither user 10355 nor current process has android.permission.BLUETOOTH_PRIVILEGED.

I've tried rebooting, revoking/giving "BT and neaby devices" permission, giving permissions with ADB, etc. - nothing helps/changes. Bluetooth Priviliged is indeed not given to Tasker itself and can not be allowed with ADB, Tasker Settings do not request it (at least I don't see it in the permissions list in ADB AppControl).

Tried adding the permission with pm, but it results in an error.

PM error log ``` beyond1:/ $ pm grant com.joaomgcd.taskersettings android.permission.BLUETOOTH_PRIVILEGED Exception occurred while executing 'grant': java.lang.SecurityException: Permission android.permission.BLUETOOTH_PRIVILEGED requested by com.joaomgcd.taskersettings is not a changeable permission type at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermissionInternal(PermissionManagerService.java:1565) at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermission(PermissionManagerService.java:1493) at android.permission.PermissionManager.grantRuntimePermission(PermissionManager.java:378) at com.android.server.pm.PackageManagerShellCommand.runGrantRevokePermission(PackageManagerShellCommand.java:2457) at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:274) at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97) at android.os.ShellCommand.exec(ShellCommand.java:38) at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:29818) at android.os.Binder.shellCommand(Binder.java:986) at android.os.Binder.onTransact(Binder.java:860) at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:5411) at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:9923) at android.os.Binder.execTransactInternal(Binder.java:1220) at android.os.Binder.execTransact(Binder.java:1179) ```

Device info:

SDK: 31
Release: 12
Model SM-G973F
joaomgcd commented 8 months ago

Hhmm, this is done with Tasker itself as of now, not with Tasker Settings. It must've been the update to API target 33 that triggered it. Maybe I'll need to add this to Tasker Settings too! Do you know if connecting to other devices has the same issue as well?

PsychodelEKS commented 8 months ago

@joaomgcd Hm, indeed I've tried implicit connection to my BT speaker - works fine... Dunno what's the difference, both are marked as "non-lock" devices in Smart Lock and both utilize media/calls functions. Though the speaker definitely has higher bluetooth version and the car audio is windows ce based (pretty oldschool), but never thought it can affect connection. Can I perform any additional testing/logging to pinpoint the issue? Currently it looks like the car audio device is somehow marked in the system, as the task fails immediately without even trying to connect anywhere, if I turn off the bt speaker the phone tries to search for it for some time and then fails with "can not connect".

PsychodelEKS commented 8 months ago

@joaomgcd I've tried testing in the car - the issue persists when the device IS availale, I`ve tried both connect by MAC and by name - same error. From the system UI the connection is established seamlessly.