5

I know there is a way to detect if some app overlays my app, i.e. touch filtering(flag android:filterTouchesWhenObscured) against hijacking attacks. If you want to create some policy to handle touches you may override the method

public boolean onFilterTouchEventForSecurity(MotionEvent event)

of the View. For example, you want to show some dialog if your app is obscured by an other window. But all of these solutions you can do if a user touches the view. I want to show some dialog when the user opens the app. Is it possible? Also I tried to emulate touch event, but I don't know where I can get MotionEvent.FLAG_WINDOW_IS_OBSCURED and after that to set to motion event flags.

And the second question: is there a way to say what app is obscuring my app? For example, I know there are a lot of apps, such as twilight, that add some filter over your display. They use specific permission (android.permission.SYSTEM_ALERT_WINDOW) to do it.

Thanks.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
yugico
  • 161
  • 2
  • 11
  • Hi, did you ever find a solution to this question? – user1118764 Jul 04 '16 at 07:22
  • Unfortunately, I didn't find anything. I found that if some app wants to have the option to overlay some application, the app should have a special permission **android.permission.SYSTEM_ALERT_WINDOW**. But there are a lot of apps have this permission including facebook, different Samsung's apps and etc. So I can't say, what app overlays my app at the moment. If you will find something tell me ;) – yugico Jul 04 '16 at 10:55
  • I found that you can overlay on top of anything without that permission, just use another Window type, e.g. TYPE_TOAST, TYPE_PHONE, etc. You will be able to overlay on most other apps. However, I'm having trouble detecting for the existence of these overlays in the first place. The FLAG_WINDOW_IS_OBSCURED only works if the overlay relays touch events, AND if the touched coordinates is actually obscured. In cases where touch events aren't relayed, or in partial overlays where the touched coordinates isn't obscured, it won't detect the overlay. – user1118764 Jul 05 '16 at 03:59

0 Answers0