How to kill chat-heads like app form other app programmatically?

764 views Asked by At

I'm writing an application managing access to other applications. User can decide which app he would like to block on device, If someone start blocked app he see screen informing him about blockade. I have my own launcher and background process which check if currently open activity is blocked one. To check top activity I use package and class name from ActivityManager getRunningTasks(); If this app is blocked I cover it with my own View by adding it to WindowManager. This works for every app, except this which also use WindowManager like facebook chat heads or multitasking brought by LG - QSLIDE. This application isn't on top. Of course I can find her process using getRunningAppProcesses, but I cant kill it. Android.os.Process.killprocess don't work also. I know this is not a good idea but I don't have other one.

Is there a possibility to recognize that some app added something to WindowManager and eventually block it? Or just remove view or kill the app?

1

There are 1 answers

0
RyPope On BEST ANSWER

Facebook (and many other apps) draw to the Window with SYSTEM_ALERT to manage their little chat heads. As of writing this (6.0.1) there is no API to listen for views being added and/or gather any information about that view.