-
Notifications
You must be signed in to change notification settings - Fork 591
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
Android 12 brings back High Accuracy mode notification lingers issue #1813
Comments
This might be fixed by #1807 not sure though. |
sounds good - i'm happy to test if needed. |
Can you grab the logs next time this happens so we can see where the failure is this time? |
will do. |
two log files captured:
homeassistant_companion_log_9-21-2021_16-54-27.txt second sequence a minute or so after first:
homeassistant_companion_log_9-21-2021_16-56-49.txt i hope this helps - happy to gather more information. |
interesting it seems that the app still thinks the device is connected according to the first log, you don't happen to have 2 BT devices with the same name do you? |
many BT devices but all with unique names. two are close but still unique: XAV-AX5000 and XAV-5500 but they are miles apart currently. each of those are in the list for High Accuracy trigger along with a third device. just to note: i waited a 5-10 seconds after the BT device disconnected the first time before grabbing the log and then a minute or so more before trying the second connect/disconnect -> log sequence. in the second sequence the High Accuracy notification went away almost immediately after the BT device showed disconnected on the Android 12 Pixel 5. |
Do you by chance have the Bluetooth connection sensor enabled in the app? |
all bluetooth sensors are disabled. currently only battery and location sensors enabled - 9 total. |
If you enable just the Bluetooth connection sensor does the situation get better? |
it doesn't appear to change anything - same symptoms. |
Maybe if @chriss158 is around they have some ideas as to what could be the cause here. What is most strange is that android is reporting the device is still connected based on the logs. |
Is only the notification not removed or does the GPS also remain active? Right now i cannot test this, because i cannot update to android 12. But pixel 6 is on it's way. Maybe i have the same issue |
GPS is still active - the notification itself updates every few seconds with accuracy changes. |
Okay, this could be a permission issue. With Android 12 there a several new BT permissions added. Looks like the |
@crowedavid it sounds like you can very easily reproduce it. Can you try this debug APK to see if its still reproducible? https://github.com/home-assistant/android/actions/runs/1366300760 it will install side by side the production version of the app and you can remove once done. I know google made some changes regarding the behavior of foreground services (the notification) and reading connected bluetooth devices so I wonder if there is a bug in Android 12 about this. Both of the changes I mention should only impact apps once they target android 12, and the current app version you have installed targets android 11. The debug APK up above has the changes that @chriss158 is referring to and once you turn on location tracking it should prompt you to grant the new permission for nearby devices. |
Yes exactly, this should fix the permission issue. But maybe he needs to switch the sensor off and on again to get the permission dialog again. Don't know. |
yea theres no easy way to handle a breaking change like updating and having to grant the new permission for Nearby Devices. However based on google docs in the version OP has installed it shouldn't be an issue :) My thoughts on the sensor earlier was to be registered for the bluetooth connection intents, I thought it would help trigger the update lol. LocationSensorManager does not register those intents shouldn't we also check on this? Admittedly I wonder how it triggers so fast without these intents lol. |
will have a chance to test the debug version shortly. |
well, the new debug version adds new and different issues to the mix. for reference, i turned off all the location update settings on the 2021.10.0-full version so i didn't get mixed notifications. i installed the new debug version and configured the same location settings that were on the release version. at first i forgot to also re-enable the background access but after a first time through testing i went back and added it. after all of the above i did the following sequences: first:
homeassistant_companion_log_9-22-2021_14-9-47.txt second:
homeassistant_companion_log_9-22-2021_14-10-42.txt while playing with the connect / disconnect sequence in the new debug app it was pretty confusing since the notification wouldn't appear until i opened the app and then would disappear when i opened it a second time. it looks like the background operations aren't quite working so i'm not sure whether that has something to do with the release app also being installed or the new debug app just not properly running in the background. not sure what else would be helpful for debug logs in this situation either. another sequence i noted but didn't grab logs for: if i stayed with the new debug app in the foreground after the first connect / disconnect sequence it wouldn't trigger any further notifications. i stayed in the app and connected/disconnected the BT device a few times but it never triggered the notification again. this might be something best left for you to debug when you get an Android 12 handset. i can live with the release app for awhile. also, regarding the permissions: both the release app and the new debug version have Location (all the time), Nearby Share, Files and Media permissions. the release version also has Phone permission but that was probably leftover from when i had those sensors turned on. |
just tried to reproduce this but was unable to, the notification shows up and disappears fine when I use the notification command
so in order for the app to be notified when a BT device connects/disconnects the app needs to be registered for the intents, this was why I asked you to do that test earlier because we are indeed registered for those intents but ATM they are only tied to the bluetooth connection sensor. Still trying to review the code to find where it picks up on the BT device being connected based on the intent. |
quick update: i spent some more time this morning looking at what is happening on my phone and this looks to be an Android 12 bug and probably not companion app issue. i just noticed that the car headunit i am using to trigger the High Accuracy mode is being left in the "connected" list but not as an audio or headset device. i missed this detail - i thought the section it was sitting in was the "Previously connected" devices but it finally dawned on me that list was further down the scrollable display. sometimes when i leave the car the headunit shows in the connected list and sometimes not and this tracks with when the High Accuracy mode notification is there as well. |
That would definitely explain why the logs look the way they do :) how long does the disconnected device stay there? I haven't really paid attention to when my phone connects in the car but I'll try to keep a closer eye on it. With that said I have seen times where my phone holds on to the wifi signal a bit longer than normal and it triggers the wifi disconnect when ive been long off wifi but the phone didnt get the update to report it. |
i've only been watching closely since this morning but the phone seems to hold it in that state until the next connection. for instance (and the reason i was looking closely again this morning) last night the High Accuracy notification was on overnight and into this morning. when i connected this morning it went away after i disconnected the next time. i redid the bluetooth connection on phone and car as well and the same behavior shows on the phone. odd bug. the car headunit is definitely off so not sure what android this the device is doing. it's like it thinks it is a BLE device or something. |
Now that my Pixel 6 arrived, i suffered from this issue too. Should be fixed with #1854 |
sorry for commenting on a closed issue - if you want a new issue opened for this i'll be happy to. not being sure when a new release was going to be pushed out i joined the beta in the play store and updated to beta-1626-edc4142. while this update acts better it doesn't fully fix the issue. the High Accuracy mode notification now lingers until i actually open the Home Assistant app. this appears to be consistent in short testing today. |
Weird. Since this commit i have no problems at all. Just to make sure: The app is allowed to run in background? maybe for more you need to open a new issue with new logs. Then i will have a closer look at this. |
Home Assistant Android version:
2021.10.0-full
Android version:
12
Phone model:
Pixel 5
Home Assistant version:
core-2021.9.7
Last working Home Assistant release (if known):
Description of problem:
After upgrading to Android 12 the symptoms of issue #1509 have returned.
Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs):
Screenshot of problem:
Additional information:
I didn't change any other settings in the app or Home Assistant itself - just upgraded to Android 12 yesterday. I use BT devices to trigger High Accuracy mode and the notification will remain after the first connection and then go away after the second. This pattern has been consistently repeatable so far but only 24+ hours since I upgraded.
The text was updated successfully, but these errors were encountered: