TYPE_SYSTEM_OVERLAY in ICS
Asked Answered
B

2

12

In Honeycomb I was able to create a system overlay with TYPE_SYSTEM_OVERLAY and receive touches with FLAG_WATCH_OUTSIDE_TOUCH.

Now ICS has changed something. I can still create the system overlay, but i can't get touches.

Now, i am able to create the same with TYPE_SYSTEM_ALERT and get touches, but it just catches the touchevents, and not passing them on like in Honeycomb.

Any idea's?

Kind regards

Botticelli answered 11/3, 2012 at 15:20 Comment(0)
T
7

Everything you describe is true. It is presumably to tighten up security, as the former behavior was the source of tapjacking attacks. I wrote a blog post recently about this change.

Any idea's?

Don't use either of them.

Transmittal answered 11/3, 2012 at 15:26 Comment(4)
I just found a app that still does it in ICS, Swipepad. It allows to drag in every app from a pre-defined point to to the middle of the screen and then start a overlay, so there must be a wayBotticelli
@EdwinSchriek: That behavior sounds consistent with TYPE_SYSTEM_ALERT -- it seems reasonable that continuous touch events started via a tap on a system alert would be delivered to that system alert and not an underlying app.Transmittal
hmm, i guess it's not possible then, but i will keep looking. Thanks!Botticelli
@Edwin Schriek, Can you help me to solve my question?#65406016Co
C
24

To create an overlay view, when setting up the LayoutParams DON'T set the type to TYPE_SYSTEM_OVERLAY.

Instead set it to TYPE_PHONE.

Use the following flags:

FLAG_NOT_TOUCH_MODAL

FLAG_WATCH_OUTSIDE_TOUCH

FLAG_NOT_TOUCH_MODAL << I found this one to be quite important. Without it, focus is given to the overlay and soft-key (home, menu, etc.) presses are not passed to the activity below.

Crucify answered 4/1, 2013 at 1:40 Comment(6)
FYI jawsware has a full sample app here that works for ICS: jawsware.mobi/code_OverlayViewMyatt
Not able to catch click events on any of the veiws in it on 4.2.X, though works well on lower versions of Android. Any suggestions?Scharaga
Thanks. It worked for me - I had 'TYPE_SYSTEM_OVERLAY' and I changed it to 'TYPE_PHONE' with 'FLAG_NOT_TOUCH_MODAL' and set listener with 'setOnTouchListener' instead of 'setOnClickListener' to receive touches in a PopUp windows above my activity as well as in the activity below. In my case it was a default system incoming call notification with an overlaying window.Textbook
@kosiara, were you able to prevent Home Button click?Allomerism
@jawsware, do you know maybe how to prevent Home Button click?Allomerism
@Crucify , TNX! I was needed only fact of touch - true\false. Now it WORKS !Novelette
T
7

Everything you describe is true. It is presumably to tighten up security, as the former behavior was the source of tapjacking attacks. I wrote a blog post recently about this change.

Any idea's?

Don't use either of them.

Transmittal answered 11/3, 2012 at 15:26 Comment(4)
I just found a app that still does it in ICS, Swipepad. It allows to drag in every app from a pre-defined point to to the middle of the screen and then start a overlay, so there must be a wayBotticelli
@EdwinSchriek: That behavior sounds consistent with TYPE_SYSTEM_ALERT -- it seems reasonable that continuous touch events started via a tap on a system alert would be delivered to that system alert and not an underlying app.Transmittal
hmm, i guess it's not possible then, but i will keep looking. Thanks!Botticelli
@Edwin Schriek, Can you help me to solve my question?#65406016Co

© 2022 - 2024 — McMap. All rights reserved.