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

Shortcut not loading correct view after closing app using home button #1472

Closed
gadgetchnnel opened this issue Apr 1, 2021 · 10 comments · Fixed by #1486
Closed

Shortcut not loading correct view after closing app using home button #1472

gadgetchnnel opened this issue Apr 1, 2021 · 10 comments · Fixed by #1486
Labels
bug Something isn't working

Comments

@gadgetchnnel
Copy link
Contributor

gadgetchnnel commented Apr 1, 2021

Home Assistant Android version: beta-644-6e9ac72-full

Android version: 10 (EMUI 11.0.0)

Phone model: Huawei Mate 20 Pro

Home Assistant version: 2021.4.0b0

Last working Home Assistant release (if known):

Description of problem:

When opening a pinned or dynamic shortcut and then backing out of the app using the home button, opening a second shortcut will sometimes just open the app showing the last open view.

Have been able to reliably reproduce this by:

  • Open Home Assistant app
  • Close app with back button
  • Opening first shortcut
  • Back out of the app using the home button
  • Open second shortcut
  • Back out of the app using the home button
  • Open first shortcut again

If the app is closed using the back button, the shortcuts work as expected.

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:

Screen recording of a minimal reproduction using two test shortcuts and views:

SVID_20210401_215031_1.mp4

(Updated screen recording using debug build of app and showing the closing of the HA app)

Additional information:

Using Nova Launcher, but also been able to reproduce using Huawei Home launcher.

@gadgetchnnel gadgetchnnel added the bug Something isn't working label Apr 1, 2021
@dshokouhi
Copy link
Member

This is what I see when I perform the same steps on my Pixel 4 XL

https://photos.app.goo.gl/yecZMhPPYAStLTGP6

Do you see the same issue with actionable notifications? Have you tried a debug build that has a clean app state to see if its just bad data that needs to be cleaned up?

@gadgetchnnel
Copy link
Contributor Author

So after further tests, this is only happening if I have exited the HA app using the back button before using the first shortcut. If I use the Home button to exit the app the shortcuts take me to the right place.

The same think is happening with clickAction in notifications, but again only if the app was closed using the back button before receiving the notification.

@dshokouhi
Copy link
Member

hmm can you update the video with that finding so I can see if I can reproduce it here? I just tried to exit the app using back button and then launch shortcuts but they still work as expected lol. Also lets look at the raw logs to see what is happening here we should see something I think. I would also still check the debug build too to ensure its not data related.

@gadgetchnnel
Copy link
Contributor Author

I've updated the video sowing the closing of the HA app first, and also using the debug build to eliminate data issues.
What's the best way to check the logs to see what's happening?

@dshokouhi
Copy link
Member

Tahnks for the video I was able to reproduce it.

This is what I see in the logs when the same window is reused

2021-04-01 14:22:47.500 1583-4321/? D/WindowManager: relayoutVisibleWindow: Window{1b29959 u0 io.homeassistant.companion.android/io.homeassistant.companion.android.webview.WebViewActivity EXITING} mAnimatingExit=true, mRemoveOnExit=false, mDestroying=false
2021-04-01 14:22:47.527 1583-4332/? I/ActivityTaskManager: Activity reported stop, but no longer stopping: ActivityRecord{e22bb0f u0 io.homeassistant.companion.android/.webview.WebViewActivity t10031}

I think the issue here is that we are using the following flag in all instances of starting a new activity here:

https://developer.android.com/reference/android/content/Intent#FLAG_ACTIVITY_NEW_TASK

Might need to look into the other flags to see which we should use

possibly need to add: https://developer.android.com/reference/android/content/Intent#FLAG_ACTIVITY_MULTIPLE_TASK

@dshokouhi
Copy link
Member

It appears I was correct in my assumption, will continue testing as I wrap up another enhancement to shortcuts. Thank you for reporting and updating the videos it was very helpful :)

@gadgetchnnel
Copy link
Contributor Author

Thanks, I've also noticed that an entity shortcut will open the app showing the more info panel for that entity but this then disappears after around 1 second and shows the default view in the app instead. Would this also be down to using FLAG_ACTIVITY_NEW_TASK or is that a separate issue?

@dshokouhi
Copy link
Member

Thanks, I've also noticed that an entity shortcut will open the app showing the more info panel for that entity but this then disappears after around 1 second and shows the default view in the app instead. Would this also be down to using FLAG_ACTIVITY_NEW_TASK or is that a separate issue?

I have not noticed this behavior.

@gadgetchnnel
Copy link
Contributor Author

Looks like that other issue (with the entity shortcuts) may actually be caused by card-mod as, when I remove that from my Lovelace resources, the shortcut works without the default view being displayed after a second, so I'll raise an issue over there.

@dshokouhi
Copy link
Member

Looks like that other issue (with the entity shortcuts) may actually be caused by card-mod as, when I remove that from my Lovelace resources, the shortcut works without the default view being displayed after a second, so I'll raise an issue over there.

ah thanks for checking that :) in case they ask this is how we are calling the pop-up, a lil bit of JS

https://github.com/home-assistant/android/blob/master/app/src/main/java/io/homeassistant/companion/android/webview/WebViewActivity.kt#L219

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants