Repository navigation
Finish AssistActivity when it is stopped - #7756
gustavomorozi wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Ending conversations on all non-configuration stops requires UX-policy confirmation and broader validation of permission, app-switch, screen-lock, and wake-word transitions than the single-device testing provides.
No open issues 🎉
What changed in this PR
This PR finishes hidden Assist activities so their wake-word listener and pipeline do not keep running, allowing the background listener to resume. It does not address the separate stall reported in #7746.
Changes:
- Calls
finish()fromonStop(), closing Assist when dismissed or otherwise hidden. - Skips finishing during configuration changes, when already finishing, or when microphone permission is missing.
| File | Description |
|---|---|
app/src/main/kotlin/io/homeassistant/companion/android/assist/AssistActivity.kt |
Adds guarded onStop() cleanup and documents its purpose. |
Review effort: Balanced
|
I think it is ok to close when locking the screen that's the current behavior of Gemini. |
|
Thanks for the fix. I tested it on a Pixel 6 and the change does what we need: pressing Home, switching apps through recents, or locking the screen now destroys the activity, the screen's own wake word engine is closed, and the background listener restarts about half a second later. The next "Hey Jarvis" One correction on the trigger though. Tapping outside the sheet does not go through this path. Could you update the PR description and the comment in |
There was a problem hiding this comment.
Hello @gustavomorozi,
When attempting to inspect the commits of your pull request for CLA signature status among all authors we encountered commit(s) which were not linked to a GitHub account, thus not allowing us to determine their status(es).
The commits that are missing a linked GitHub account are the following:
255e02f11c3e38ca7a089abacf5f374d142d9aba- This commit has something that looks like an email address (gustavodesouzamorozi@gmail.com). Maybe try linking that to GitHub?.
Unfortunately, we are unable to accept this pull request until this situation is corrected.
Here are your options:
-
If you had an email address set for the commit that simply wasn't linked to your GitHub account you can link that email now and it will retroactively apply to your commits. The simplest way to do this is to click the link to one of the above commits and look for a blue question mark in a blue circle in the top left. Hovering over that bubble will show you what email address you used. Clicking on that button will take you to your email address settings on GitHub. Just add the email address on that page and you're all set. GitHub has more information about this option in their help center.
-
If you didn't use an email address at all, it was an invalid email, or it's one you can't link to your GitHub, you will need to change the authorship information of the commit and your global Git settings so this doesn't happen again going forward. GitHub provides some great instructions on how to change your authorship information in their help center.
- If you only made a single commit you should be able to run
(substituting "Author Name" and "
git commit --amend --author="Author Name <email@address.com>"email@address.com" for your actual information) to set the authorship information. - If you made more than one commit and the commit with the missing authorship information is not the most recent one you have two options:
- You can re-create all commits missing authorship information. This is going to be the easiest solution for developers that aren't extremely confident in their Git and command line skills.
- You can use this script that GitHub provides to rewrite history. Please note: this should be used only if you are very confident in your abilities and understand its impacts.
- Whichever method you choose, I will come by to re-check the pull request once you push the fixes to this branch.
- If you only made a single commit you should be able to run
We apologize for this inconvenience, especially since it usually bites new contributors to Home Assistant. We hope you understand the need for us to protect ourselves and the great community we all have built legally. The best thing to come out of this is that you only need to fix this once and it benefits the entire Home Assistant and GitHub community.
Thanks, I look forward to checking this PR again soon! ❤️
Summary
Some ways of leaving the Assist screen only stop
AssistActivitywithout finishing it: pressing Home, switching apps or opening recents, and locking the screen. (Tapping outside the sheet is not one of them:HAModalBottomSheetforwards that toonDismissRequest, and the activity already callsfinish()there.) After one of those, its own wake word listener and pipeline keep running without a visible screen. On my device (Galaxy S25 Ultra, Android 37) the next "Hey Jarvis" was then often ignored (the first or second attempt did nothing and the third worked), and the background listener was not resumed, because the resume is only requested fromonDestroy.In the logcat, after leaving Assist this way, the engine inside the hidden screen kept running and detected the wake word with no Assist UI shown.
This finishes the activity in
onStop, except on configuration changes, when it is already finishing, or when the microphone permission is missing (the permission dialog also stops the activity).What I know and what I don't:
AssistActivityand I did not add one.This is separate from #7746 (a different 20 to 25 s Assist stall in the websocket queue, whose cause I could not confirm); this PR does not claim to fix it.
Checklist
Select exactly one option that describes AI usage in this contribution:
Screenshots
Link to pull request in documentation repositories
User Documentation: home-assistant/companion.home-assistant#
Contributor Documentation: home-assistant/contributors.home-assistant.io#
Any other notes
Verification:
ktlint,detektand the wholePull Requestworkflow (lint, builds, unit, screenshot and automotive/Wear OS instrumentation tests) pass on my fork. The related wake word changes (an idempotent resume of the listener and a warm-up of a new engine) will follow as separate PRs, each independent of this one.AI disclosure: I used an AI assistant (Claude Code) to help write this change and the description. I tested it myself on a Galaxy S25 Ultra.