GrapheneOS / os-issue-tracker

Issue tracker for GrapheneOS Android Open Source Project hardening work. Standalone projects like Auditor, AttestationServer and hardened_malloc have their own dedicated trackers.
https://grapheneos.org/
351 stars 19 forks source link

Pairing with TicWatch Pro 3 GPS fails. #1740

Closed 0x1a8510f2 closed 1 year ago

0x1a8510f2 commented 1 year ago

I have attempted to pair the same watch with 3 phones total. 2 phones with their stock OS (one of which is signed into the same Google account as the GrapheneOS phone) pair successfully every time. Meanwhile, the GrapheneOS phone always fails with the following screen:

IMG_20221127_203100.jpg

Exiting and re-opening the WearOS app shows a screen as though the watch was paired but without any data filled in in the UI. The watch remains on the "continue setup on your phone" screen and eventually times out.

I will try to get a logcat from the WearOS app but I'm not sure how do debug further.

thestinger commented 1 year ago

Did you grant the required permissions which at minimum includes Nearby devices?

0x1a8510f2 commented 1 year ago

Thanks for the quick reply!

I've granted the following to the WearOS app:

Nearby Devices
Network
Notifications
Sensors

I also got the ADB logcat for the WearOS app which is included below starting from the point where I selected the watch in the system Bluetooth dialog. The MAC address and date/time has been edited for privacy.

ADB Logcat ``` 01-01 00:00:58.322 21177 21177 I WizardManager: onNext resultCode = -1, Stack = [com.google.android.wearable.app/xml/clockwork_setup_consolidated_welcome#discover] 01-01 00:00:58.382 21177 21177 D AutoManageHelper: starting AutoManage for client 4 false null 01-01 00:00:58.392 21177 21177 D AutoManageHelper: onStart true {4=com.google.android.gms.common.api.internal.AutoManageLifecycleHelper$ClientInfo@a7bc045} 01-01 00:00:58.400 21177 21177 I PairingController: unknown status: 1 01-01 00:00:58.436 21177 21284 W Parcel : Expecting binder but got null! 01-01 00:00:58.467 21177 21177 I PairingController: pairing started 01-01 00:00:58.468 21177 21177 I CwSetup.SetupService: Starting service for action: com.google.android.clockwork.action.SETUP_WEARABLE 01-01 00:00:58.495 21177 21746 I CwSetup.RemoveBond: removing Bluetooth bond for: 00:00:DE:AD:BE:EF 01-01 00:00:58.497 21177 21746 I BluetoothDevice: removeBond() for device 00:00:DE:AD:BE:EF called by pid: 21177 tid: 21746 01-01 00:00:58.563 21177 21177 I RemoveBtBondAction: RemoveBondActionReceiver received state: 10 01-01 00:00:58.563 21177 21177 I RemoveBtBondAction: bond successfully removed for device: 00:00:DE:AD:BE:EF 01-01 00:00:58.565 21177 21746 I CwSetup.CreateBond: creating Bluetooth bond for: 00:00:DE:AD:BE:EF 01-01 00:00:03.606 21177 21177 I CreateBtBondAction: CreateBondActionReceiver received state: 11, previous state: 10 01-01 00:00:21.980 21177 21177 I PairingController: pairing in progress 01-01 00:00:22.726 21177 21177 I CreateBtBondAction: CreateBondActionReceiver received state: 12, previous state: 11 01-01 00:00:22.729 21177 21746 I CwSetup.CreateConfig: creating ConnectionConfiguration for: 00:00:DE:AD:BE:EF 01-01 00:00:22.735 21177 21177 I PairingController: device bonded 01-01 00:00:22.776 21177 21746 I CwSetup.CreateConfig: trying to find connected ConnectionConfiguration 01-01 00:00:07.791 21177 21746 I CwSetup.CreateConfig: re-enabling connection 01-01 00:00:07.792 21177 21746 E CwSetup.CreateConfig: Unable to enable connection. 01-01 00:00:07.793 21177 21746 I CwSetup.CreateConfig: finished creating ConnectionConfiguration: CreateConfigTask.Result{ isSuccess=false, mConfig=null } 01-01 00:00:07.793 21177 21746 E CwSetup.SetupJob: Failed to create ConnectionConfiguration 01-01 00:00:07.808 21177 21177 E PairingController: pairing failed 01-01 00:00:07.815 21177 21746 I BluetoothDevice: cancelBondProcess() for device 00:00:DE:AD:BE:EF called by pid: 21177 tid: 21746 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: Error calling BluetoothDevice.cancelBondProcess method 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: java.lang.reflect.InvocationTargetException 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at java.lang.reflect.Method.invoke(Native Method) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at com.google.android.clockwork.companion.bluetooth.BluetoothDeviceCompatBase.cancelBluetoothBondProcess$ar$ds$b7179e34_0(AW773954160:1) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at com.google.android.clockwork.companion.bluetooth.ConnectionUtil.cancelBluetoothBondProcess$ar$ds(AW773954160:1) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at com.google.android.clockwork.companion.bluetooth.CreateBluetoothBondAction.cancelBondAction(AW773954160:3) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at com.google.android.clockwork.companion.relink.RelinkDeviceNotificationServiceController$2.run(AW773954160:42) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at android.os.Handler.handleCallback(Handler.java:942) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at android.os.Handler.dispatchMessage(Handler.java:99) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at android.os.Looper.loopOnce(Looper.java:201) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at android.os.Looper.loop(Looper.java:288) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at android.os.HandlerThread.run(HandlerThread.java:67) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: Caused by: java.lang.SecurityException: Need BLUETOOTH PRIVILEGED permission: Neither user 10212 nor current process has android.permission.BLUETOOTH_PRIVILEGED. 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at android.app.ContextImpl.enforce(ContextImpl.java:2285) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:2313) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:948) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at com.android.bluetooth.Utils.enforceBluetoothPrivilegedPermission(Utils.java:408) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at com.android.bluetooth.btservice.AdapterService$AdapterServiceBinder.cancelBondProcess(AdapterService.java:2218) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at com.android.bluetooth.btservice.AdapterService$AdapterServiceBinder.cancelBondProcess(AdapterService.java:2204) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at android.bluetooth.IBluetooth$Stub.onTransact(IBluetooth.java:672) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at android.os.Binder.execTransactInternal(Binder.java:1307) 01-01 00:00:07.832 21177 21746 W BluetoothDeviceCompat: at android.os.Binder.execTransact(Binder.java:1265) ```

Some additional research indicates that this is likely caused by the fact that the WearOS/Google app (WearOS depends on the Google app) are installed as non-system/third party apps: https://developer.android.com/reference/android/Manifest.permission#BLUETOOTH_PRIVILEGED. I assume an extra permission could be added to GrapheneOS much like the network permission to solve this? Or is there any way to fix this without any changes needed to Graphene?

thestinger commented 1 year ago

Start by trying giving Nearby Devices to Play services too.

0x1a8510f2 commented 1 year ago

Well, that was simple enough!

In summary:

WearOS App:

com.google.android.wearable.app

Google App:

com.google.android.googlequicksearchbox

Google Play services App:

com.google.android.gms

(Eek)

These are likely not the minimum required, but they work. Thanks for the help!