Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on Pixel Watch 2 after selecting "Available Devices" #25

Open
mangoobyt opened this issue Oct 18, 2023 · 25 comments
Open

Crash on Pixel Watch 2 after selecting "Available Devices" #25

mangoobyt opened this issue Oct 18, 2023 · 25 comments

Comments

@mangoobyt
Copy link

Clicking on

@flostroehl
Copy link

I have the same issue.

To give some additional context: I could connect WearMouse with an already connected device (my phone) only once, but that was a one-off.
Now, even though my phone is "connected" in the watch settings, it is displayed as "disconnected" in wearmouse. Switching connection on-off, it is displayed as "connecting..." in the app, but without actually connecting. It goes to "disconnected" after a few seconds.
Re-installing the app didn't help either.

@Cyanogenbot
Copy link

Cyanogenbot commented Jan 7, 2024

@ginkage For context, this issue seems to be happening on wearAuthn too
Theory 1:
it primarily happens on devices running windows (11). It seems like something in windows 11 is blocking the bluetooth connection (the pixelwatch 2 shows that it is not connected, but windows says its connected to the watch) This makes it that the connection never exists. Testing the same situation on debian shows no problem whatsoever.

Theory 2:
google broke the bluetooth api with the pixel watch 2 and devices dont always register a connection

Some related but vague reports:
fmeum/WearAuthn#22
fmeum/WearAuthn#15

Logs:
wearable-bugreport-aurora-TWD9.231205.001-2024-01-07-02-54-44.zip

wearable-bugreport-aurora-TWD9.231205.001-2024-01-07-03-03-39.zip

@ginkage
Copy link
Owner

ginkage commented Jan 7, 2024

There are two separate issues. Clicking on "Available Devices" is one, for which I've captured the stack trace:

Exception java.lang.SecurityException:
  at android.os.Parcel.createExceptionOrNull (Parcel.java:3011)
  at android.os.Parcel.createException (Parcel.java:2995)
  at android.os.Parcel.readException (Parcel.java:2978)
  at android.os.Parcel.readException (Parcel.java:2920)
  at android.app.IActivityTaskManager$Stub$Proxy.startActivity (IActivityTaskManager.java:2064)
  at android.app.Instrumentation.execStartActivity (Instrumentation.java:1946)
  at android.app.Activity.startActivityForResult (Activity.java:6302)
  at android.app.Activity.startActivityFromFragment (Activity.java:6280)
  at android.app.Activity$HostCallbacks.onStartActivityFromFragment (Activity.java:8948)
  at android.app.Fragment.startActivityForResult (Fragment.java:1121)
  at android.app.Fragment.startActivityForResult (Fragment.java:1110)
  at com.ginkage.wearmouse.ui.devices.AvailableDevicesFragment.checkBluetoothState (AvailableDevicesFragment.java)
  at com.ginkage.wearmouse.ui.devices.AvailableDevicesFragment.onStart (AvailableDevicesFragment.java)
...
Caused by android.os.RemoteException: Remote stack trace:
  at com.android.server.wm.ActivityTaskSupervisor.checkStartAnyActivityPermission (ActivityTaskSupervisor.java:1108)
  at com.android.server.wm.ActivityStarter.executeRequest (ActivityStarter.java:1013)
  at com.android.server.wm.ActivityStarter.execute (ActivityStarter.java:702)

I think I can fix that one.

For Windows 11, please file a separate one.

@Cyanogenbot
Copy link

This log should contain connecting to a windows 11 device and pressing selecting these in the watchmouse app:
After pressing connect to device nothing works
wearable-bugreport-aurora-TWD9.231205.001-2024-01-07-20-00-58.zip

@fmeum Im tagging you too as I noticed that wearauthn is having the same issue where the connection to a windows 11 device doesnt seem to work. Here is a log: https://diededrive.designedbydie.de/index.php/s/8EFJQZExzB4yMkL
(File was too big for github)

@ginkage
Copy link
Owner

ginkage commented Jan 7, 2024

Welp, that bugreport only shows that I did things correctly, according to the documentation, yet the app is still crashing due to not having some permission (supposed to be BLUETOOTH_ADVERTISE, and the app asks for it on startup). Probably a bug with the device itself.

@Cyanogenbot
Copy link

Welp, that bugreport only shows that I did things correctly, according to the documentation, yet the app is still crashing due to not having some permission (supposed to be BLUETOOTH_ADVERTISE, and the app asks for it on startup). Probably a bug with the device itself.

Could very well be a problem with wearOS 4.0, had a buddy on a galaxy watch on wearOS 4 try it out, which he had the same issue. Time to contact google haha

@ginkage
Copy link
Owner

ginkage commented Jan 7, 2024

The thing is, I have a Galaxy Watch with wearOS 4, and I don't have that issue...
Did you accept all the permissions at the app start? You can also try removing the app and installing it again, so that it definitely asks you for the missing permissions.

@Cyanogenbot
Copy link

Cyanogenbot commented Jan 7, 2024

yeah i accepted the permissions... Are you running win 11 too?

@Cyanogenbot
Copy link

Reinstalling didnt do the job either :?, I think its a pixelwatch 2 issue then, the setting pane doesnt ever show it as being connected either. I dont think it can finish the connection..
screenshot-2024-01-07-23-58-13

@Cyanogenbot
Copy link

@ginkage for context, when connecting the pixelwatch to an ipad, your app works perfectly other than the available devices button, so It must be on googles side

@ginkage
Copy link
Owner

ginkage commented Jan 13, 2024

Thank you for the information. As soon as I get a chance to get my hands on a Pixel Watch with Wear OS 4 (that might take a few days or a few weeks), I'll try to reproduce it and hopefully find a way around it.
I don't think it's a matter of what you're connecting to, be it an iPad or Windows 11: since it does connect fine with a device it's already paired to, the problem is clearly in the way the app is requesting the Bluetooth stack to enable its visibility to other devices when you tap the "Available Devices" button.
In theory (that is, according to the official documentation), it should be enough to have the BLUETOOTH_ADVERTISE run-time permission granted and accepted by the user to request the Bluetooth visibility from the OS. But, as the crash happens within the checkStartAnyActivityPermission method, I think the issue is that the Pixel Watch 2 System UI does not have android:exported="true" set on the activity that is resolved for that Intent, which would indeed be a bug on Google side (extra note: this does not happen on Samsung with Wear OS 4).
Again, I am following the documentation to the letter for this functionality, so there's little I can do but to escalate this matter back up to Google.

@Cyanogenbot
Copy link

In that case, there definitely seem to be multiple bugs on googles pixel watch stack, namely the connection to devices and the permissions as you said. lets hope that those will be fixed. The problem I was referring to is that the pixel watch can’t even pair properly to windows devices haha, already files a bug report through Google support on that but I doubt it will be read. Thank you for the effort on the other issues though, let’s hope we can get these devices supported :)

@Dtrieb
Copy link

Dtrieb commented Mar 6, 2024

Same on my Pixel Watch 1.
It crashed if I searched for available devices.

@rodolforfq
Copy link

Happening on OnePlus Watch 2 as well.

If I accept the permission request and enable precise location, it just crashes/closes. If I limit it to approximate location instead, screen goes black instead of simply crashing back to the previous screen.

Happy to provide more info or perform tests, if it's any help.

@TheBarii
Copy link

I have a Oneplus Watch 2 as well! It is also happening for me and WowMouse is also not working either. This is an important app that'll help me with making my daily life better. Really is unfortunate.

Willing to help in any way, please ask away here.

@TheBarii
Copy link

I also cannot connect to any devices at all. Clicking "connect" simply does absolutely nothing.
Available devices causes a crash.

@Munka9
Copy link

Munka9 commented Sep 21, 2024

Same issue for me (Pixel Watch 2), was this ever fixed/worked around?

@ginkage
Copy link
Owner

ginkage commented Oct 12, 2024

Let me unpack this a bit...

AndroidRuntime: java.lang.SecurityException: Permission Denial: starting Intent { act=android.bluetooth.adapter.action.REQUEST_DISCOVERABLE cmp=com.google.android.apps.wearable.settings/onnectivity.bluetooth.BluetoothRequestDiscoverableActivity } from ProcessRecord{6dd0129 12368:com.ginkage.wearmouse/u0a118} (pid=12368, uid=10118) requires android.permission.BLUETOOTH

My AndroidManifest has this:

<uses-permission android:name="android.permission.BLUETOOTH"
 android:maxSdkVersion="30" />

as, according to the documentation, requesting android.permission.BLUETOOTH permission for API above 30 is wrong, see https://developer.android.com/develop/connectivity/bluetooth/bt-permissions
So, on WearOS 4 this Intent (android.bluetooth.adapter.action.REQUEST_DISCOVERABLE) should check for a different permission, android.permission.BLUETOOTH_ADVERTISE instead of android.permission.BLUETOOTH: https://developer.android.com/reference/android/bluetooth/BluetoothAdapter#ACTION_REQUEST_DISCOVERABLE
Thus, the fix should be made on the OS side, specifically in the AndroidManifest of the Settings app, in com.google.android.apps.wearable.settings/onnectivity.bluetooth.BluetoothRequestDiscoverableActivity.
As @Cyanogenbot has correctly mentioned, the same issue was present in WearAuthn as well. So, I'm putting in a workaround: now I'll request android.permission.BLUETOOTH on all API versions (even though this is incorrect!).
The bug for this was filed at Google back in January, but you know them... Also, reportedly this issue was fixed in Wear OS 5.
I've staged an updated version for review, so fingers crossed, maybe it will go through shortly.

@ginkage
Copy link
Owner

ginkage commented Oct 16, 2024

If I'm reading it correctly, the update should be live (as of yesterday). Can anyone on the thread confirm if it works?

@rodolforfq
Copy link

I can confirm it's all working for me (OnePlus Watch 2). Thanks @ginkage ! 🥇

@ginkage
Copy link
Owner

ginkage commented Oct 16, 2024

Alright, sounds like we're out of the woods. Thanks everyone for your input and patience. I only wish Google could fix its bugs (reported back in January!) quicker, but oh well, at least we can work around it.
A PR with the workaround will be merged soon. Have a nice day everyone.

@ginkage ginkage closed this as completed Oct 16, 2024
@TheBarii
Copy link

TheBarii commented Oct 17, 2024

Alright, sounds like we're out of the woods. Thanks everyone for your input and patience. I only wish Google could fix its bugs (reported back in January!) quicker, but oh well, at least we can work around it. A PR with the workaround will be merged soon. Have a nice day everyone.

im sorry to say but the issue hasn't been fully fixed yet. In the Wear Mouse app, Whenever I click my PC's username from the Paired Devices list, and then click Connect, it does not seem to work at all and it does nothing.
Edit: I've reinstalled the app and it's stuck at "Connecting". Clicking my PC from the list again shows a Disconnect option instead.

While trying to connect from the Bluetooth settings on my oneplus watch 2, it says "Couldn't connect".
But on my PC it says the watch is: "Connected, mic"
An alternative to your app, WowMouse has this similar bluetooth connectivity issue with oneplus watch 2. Any suggestions? I'm using the Play Store version.
image

@rodolforfq
Copy link

I should have probably mentioned my tests were performed with a Macbook. Not Windows.

It shouldn't matter all that much but worth putting that out there since @TheBarii isn't having much luck with Windows.

@ginkage ginkage reopened this Oct 17, 2024
@TheBarii
Copy link

I'd also like to mention that I'm not able to connect to my phone. From the devices list, it says it's Disconnected while it clearly is not. I fear it's something to do with the "Connected, mic" issue.

If there is any way for me to help, please let me know.

@Suranjandas7
Copy link

facing the same issue on oneplus watch 2r as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants