Open DavideCannizzo opened 5 years ago
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.
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 :/
flags = FLAG_NOT_FOCUSABLE | FLAG_NOT_TOUCH_MODAL | FLAG_TOUCHABLE_WHEN_WAKING | FLAG_SHOW_WHEN_LOCKED | FLAG_LAYOUT_NO_LIMITS | FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR;
One thing I'd like to remark is, you'll have to add the overlay view to the window manager from within the onServiceConnected method of the accessibility service or after that method is being called. If you create it, for example, within the onCreate method, it won't work.
On Wed, Sep 11, 2019, 8:47 AM BrandonShihabi notifications@github.com wrote:
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 :/
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fennifith/Status/issues/161?email_source=notifications&email_token=AFI7H5PVOXPVO4U2Q6NNVN3QJCH77A5CNFSM4IUSZZ22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6NOU5Q#issuecomment-530246262, or mute the thread https://github.com/notifications/unsubscribe-auth/AFI7H5LFIRBSAHNSSFLKWPTQJCH77ANCNFSM4IUSZZ2Q .
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 usualWindowManager
, withTYPE_ACCESSIBILITY_OVERLAY
, with the proper flags in theWindowManager.LayoutParams
from within theonServiceConnected
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 usingTYPE_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.