Before you say that it is not posible look at Touch Lock App. This app efficiently disables all buttons.
So far I have successfully managed to disable all buttons except recent apps button. I have disabled it by listening on window out of focus change but this is not efficient enough.
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(!hasFocus) {
Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(closeDialog);
}
}
The thing i noticed in the Touch Lock App is that when I click back or recent app button while the lock is on the buttons don't highlight at all.
Unlike Touch Lock App, in other apps for disabling buttons and in my app, the buttons back and recent apps highlight on press. I disabled back button by overriding onBackPressed() but on click it still highlights.
Does anyone has a clue how to disable the recent apps button or what is the key to highlighting recent apps and back button?
Buttons when being locked by Touch Lock App
Buttons when being locked by other apps or mine
Obviousely there must be a way to override the click since the buttons doesn't highlight. Also, the vibration from button press triggers even in the Touch Lock App.
Can someone explain what exactly(deep in android system) happens when user clicks on the button, what functions are triggered. Meaning, what function triggers vibration from the button click and what function triggers the button highlight? Can you at least point me in some direction?