11

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?

Community
  • 1
  • 1
Amir
  • 153
  • 1
  • 1
  • 9
  • Why you want to play with android's default behaviour, there is no such api's to track home button. – Daud Arfin Aug 09 '12 at 11:45
  • I want to make sure the user doesn't get into the settings (or another recent activity displayed inside the task manager screen) and play around. – Amir Aug 09 '12 at 21:32
  • then who is going to use your apps if you are giving this much restriction ;) – Daud Arfin Aug 10 '12 at 03:40
  • We have the same requirement - we ship Android devices with our app preinstalled to control an industrial manufacturing process. It's the only app the user should be using. Our app is launched at power on so the user should not see any other app. But long press on Home brings up task manager which allows the user to get into all kinds of trouble. – user316117 Sep 10 '12 at 15:04
  • @DavidArfin This is for a kiosk app where the user experience has to be controlled. It's not even the user's phone! – Chloe Sep 13 '13 at 19:42

1 Answers1

16

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 :)

biegleux
  • 13,179
  • 11
  • 45
  • 52
jcavandoli
  • 297
  • 2
  • 9
  • Maybe you can help me with related question: http://stackoverflow.com/questions/12554140/android-change-the-long-click-functionality-of-the-home-button – Amir Sep 30 '12 at 23:14
  • Sorry I don't have a solution for that question. Good luck! – jcavandoli Oct 02 '12 at 09:18
  • @Amir i have same requirement and jcavandoli's solution works. but i have created my app as launcher app but on long pressing of home button it allow me to open google. I do not have to allow user to access system without our application. so please help me for the same. – Vishal Parekh Jul 04 '13 at 16:53
  • and while connecting a usb plug it open up popup in right side of task bar on clicking of it user is able to access setting window. I have to restrict user for this also. – Vishal Parekh Jul 04 '13 at 16:59
  • How about disabling app com.android.systemui? Does this have any "side-effects"? – JohnyTex Mar 20 '15 at 08:23