3

I'm having trouble making what I thought would be smaller app. Primary focus is having activity on top of incoming call screen, with custom controls which would give user custom control ability (blocking, selecting etc...). However after hours (days) of googling and search here on SO I have found quite a few non working examples.

I develop on Android 2.3.3 and would like to have that platform as minimal support but if moving to 4.x platform would take the pain away I would be able to switch.

I have tried many approaches but only one that seems to be working for now is to addView() to WindowManager with custom LayoutParams using TYPE_SYSTEM_OVERLAY or TYPE_SYSTEM_ERROR. Problem is not having any touch/key inputs as stated on this page.

I'm having BroadcastReceiver that is activated for PHONE_STATE broadcast, and on receiving broadcast I start new intent. Trouble is phone screen call activity kicks in and shows up, straight to the top.

  • Can I force my activity on top of incoming call activity? How?
  • Can I prevent broadcast further? I guess theoretically on 4.1+ for which PHONE_STATE is ordered broadcast I could but I'm skeptical; and how would I achieve same thing on 2.3.3 where PHONE_STATE is non ordered broadcast?
  • Can I somehow disable, hide incoming call activity?
  • If I have no choice but to use TYPE_SYSTEM_[OVERLAY|ERROR|...] how am I to handle user input (touch, click) ?

Thanks.

Community
  • 1
  • 1
edin-m
  • 3,021
  • 3
  • 17
  • 27
  • So you want to potentially hide or modify the incoming call screen or even block the broadcast? While I can imagine a few helpful uses for that, the potential for abuse is quite high. I doubt it's possible through documented methods. – 323go Jul 13 '14 at 01:33
  • While I understand security concern my intentions are not malicious and maybe my question would be better phrased as not hiding but aliasing incoming call screen. I understand this can be done since there are apps on Play that enables you to do this, and I'm looking at this from purely technical standpoint. – edin-m Jul 13 '14 at 08:42
  • I didn't mean to insinuate that *your* intentions are malicious, and based on your description above, I imagine that this is quite a useful app. I was just giving you a heads-up, saying that *because* of the potential for abuse, it's unlikely that it can be done through documented patterns and will work reliably on all platforms, or indefinitely. – 323go Jul 14 '14 at 11:47
  • Did you find the solution? – wonsuc Dec 15 '18 at 09:17
  • @wonsuc The key was setting: layoutParams = new android.view.WindowManager.LayoutParams(-1, -1, 2010, 0x2800a0, -1); I don't know where the magic number came from (probably few flags ORed). But this was Android 4. Let me know if it works on newer versions. – edin-m Dec 15 '18 at 17:18

0 Answers0