Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Possible support for Android O #161

Open
DavideCannizzo opened this issue Sep 8, 2019 · 3 comments
Open

Possible support for Android O #161

DavideCannizzo opened this issue Sep 8, 2019 · 3 comments

Comments

@DavideCannizzo
Copy link

DavideCannizzo commented Sep 8, 2019

Maybe this is not an issue, but, as a developer, I can suggest you a very simple workaround for the problem that Android O doesn't allow to create overlays on top of the status bar. Really, that's not true, even if the Android Developers website says it is. Indeed, I'm not sure whether it is a bug or an expected but undocumented (as far as I was able to find out on the Internet) behavior. However, if you create an AccessibilityService (no flags needed) and then you create an overlay with the usual WindowManager, with TYPE_ACCESSIBILITY_OVERLAY, with the proper flags in the WindowManager.LayoutParams from within the onServiceConnected method, you should be able to draw on top of the status bar. I'm actually doing it. And it is on top of the lock screen as well. And also on top of the ambient display! It looks like you have superpowers when using TYPE_ACCESSIBILITY_OVERLAY as a type for the overlay being created. It would be enough for you to use this type of overlay and eventually add an accessibility service to your app (I used it a long time ago and I don't remember whether it already uses an accessibility service or not) and maybe change some overlay flags. It's extremely easy. I'm actually developing an app to replace the system quick settings, which works just this way.

@fennifith
Copy link
Owner

I would appreciate an effort to append suggestions to existing issues when possible so that the issue tracker isn't cluttered with duplicates, so I'll merge this into #87 - but thank you for the valuable information. I don't have an Android O device to test on, so I wasn't able to test the different types of overlays as thoroughly other than confirming that the system overlays did not work, but hopefully this can become a working solution! Thank you for your help.

@BrandonShihabi
Copy link

Which are the proper flags? I would like to know for my own personal project as well. I am doing the same thing with an accessibility service but it just doesn't seem to work :/

@DavideCannizzo
Copy link
Author

DavideCannizzo commented Sep 11, 2019 via email

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

No branches or pull requests

3 participants