google/hover

Screen overlay detected

ljoaquin opened this issue · 9 comments

When the floating menu is running, other apps can not request permissions. When I request permissions on my another app, the permission dialog came up. No matter I choose deny or allow. The infamous "Screen overlay detected" appeared.

Hi. Which version of Android are you using?

Also, can you attach a screenshot or a GIF of the problem occurring?

Android 6.0.1
Nexus 6
No matter I click deny or allow, the "Screen overlay detected" came up.
25216d12-2d26-478c-958e-670966e180db
93f74b90-7cdf-43ee-b2fe-41e79c01bade

I found out that Facebook Messenger has a similar hover menu. But it doesn't cause this problem.

How do I fix this problem on my cell phone.
Its not letting me do anything.

I'm trying to reproduce. A few more questions:

  • are you both running the latest version of the library, 0.9.7?
  • what did you do before this happened? Did you already enable the overlay in Settings for your app? Are there any other steps that I might need to know?
  • was the Hover menu already launched and then your app asked for permissions for something else?
  • what is your target API version for your app?
  • where is your logic that asks for the overlay permission?

Nevermind, I got the problem to repro.

Please read this:
https://www.howtogeek.com/271519/how-to-fix-the-screen-overlay-detected-error-on-android/

It doesn't look like there is anything we can do about this, it's a "feature" in Android M. My recommendation would be to have your app close the Hover menu when you need to request permissions, and then open the Hover menu back up when the permission interaction is done.

I'll add something the roadmap to see if I can make this easier to do.

Please let me know if you have any further questions/comments on the issue.

Note that I mentioned that Facebook Messenger has a similar hover menu but it doesn't cause this problem.
I think the reason for this is that HoverMenuView is a full screen layout whether expanded or collapsed.
I tried to add a ImageView to WindowManager on a demo project, if the imageview is not on top of the premission dialog, it will be fine.
But if on top of the premission dialog, the "Screen overlay detected" came up.

If that's the case then Hover will continue to have this issue, at least for some time, because changing to a non-fullscreen layout would require a major modification to the structure of the menu itself. Even in the large refactor that I have coming soon, the menu remains fullscreen.

I'll consider modifying the layout to deal with this problem at some point, but it won't be soon. Android O will require that overlays use a different window type, so maybe if we're lucky it won't be a problem any more. We'll see.

Alright. I realized that too. It's a huge job to make Hover non-fullscreen even just when collapsed.