Tuesday, 23 March 2021

How do apps detect that SAW permission is currently being used?

Background

I've noticed many times, that when I use an app that uses SAW (system-alert-window, AKA "display over other apps) permission (example here), and I open Chrome web browser and reach some website that requires a permission (example here, taken from here), it won't let me grant/deny the permission:

enter image description here

The problem

I can't find how they did it, and from which Android version it's possible to check it.

What I've found

Sadly as much as I've searched, I actually had more questions.

For example, how come the web browser can't detect which app is showing on top, and tell us to disable it?

Or, now that Android 12 might arrive, there seem to be a new permission to block SAW (here) :

HIDE_OVERLAY_WINDOWS Added in Android S

public static final String HIDE_OVERLAY_WINDOWS Allows an app to prevent non-system-overlay windows from being drawn on top of it

Constant Value: "android.permission.HIDE_OVERLAY_WINDOWS"

Perhaps for this case there aren't many that have asked about it, or for some reason I didn't choose the correct things to write in order to search for an answer.

The questions

  1. How can I detect if some app is using SAW permission while I show something?

  2. Is there a way to detect which app does that?

  3. What can the API offer for this, and from which version is it available?

  4. I remember I was told that accessibility can be used to draw on top. Sadly I failed to find a tutorial on how to do this, and also of an example of such apps. Would this API be able to detect them too? Or this isn't considered as SAW? Where can I find a tutorial on how to do it, so that I could check it out?

  5. Bonus: how on Android S do you use the new permission to hide SAW?



from How do apps detect that SAW permission is currently being used?

No comments:

Post a Comment