I'm developing an app which will be used by children.
I took over the home button by making my app a launcher. Now I'm trying to take over the long press of the home button which brings up the recent apps list.
I searched for and tried:
- taking over the button
- clearing the apps list
- killBackgroundProcesses() and Process.killProcess()
I'm able to get the tasks by ActivityManager.getRunningTasks(), but I can't seem to clear it in any way.
I've come across two possible solutions:
- listening to onWindowFocusChanged and Intent.ACTION_CLOSE_SYSTEM_DIALOGS => this is not an acceptable answer for my requirements
- doing it like ToddlerLock and flood the apps list with activities => this is a hack and in the future it might not work anymore
Is there another possibility (except building a custom rom) or am I missing something? Thanks in advance!
EDIT 1: I was able to kill other running processes but their entry remained in the recent apps list, so if you click it, it will just restart that application. Is there a way to refresh that list?
EDIT 2: I tried to do it like ToddlerLock and followed the directions of Robert's answer. I've got 18 dummy activities running and showing in the recent apps list, but this doesn't block the possibility to click previous active apps. Any help?