Search code examples
androidlong-pressandroid-homebuttontaskmanagerlong-click

Android - Is It possible to disable the long click of home button to avoid the task manager?


I am looking for a way to disable the task manager window once I long press on the home button. I managed to disable other device keys (such as volume, menu etc) and the normal click on the home button as I am the default launcher, but I don't know how to disable the task manager! Even Toddler Lock kids app show u the task manager screen following long click, so I assume it isn't easy to do so. I saw few answers say I shouldn't disable the task manager, but I want to have it from another key instead the long click on home button. If needed and will solve my problem, I can be rooted. Please help.

I found a way to do so with Android 2.3.5: Override home and back button is case a boolean is true (I used the piece of code from hotveryspicy) But, as written in this link, this solution isn't working with Android 4.0.3 Can u help me to find a solution for 4.0.3 as well?


Solution

  • To avoid the recent app dialog on the long click home button, you can listen on focus of your activity. When your activity is loosing focus, fire an Intent.ACTION_CLOSE_SYSTEM_DIALOGS intent.

    Sample code here: http://www.juliencavandoli.com/how-to-disable-recent-apps-dialog-on-long-press-home-button/

    I hope this will help you :)