Background
I've made a live wallpaper that can handle touch events .
The problem
There are some cases which I don't want it to handle touches (or listen to other events). This help prevent weird drawing and also save on the battery a bit.
For example, on Lollipop, I've noticed that when you show the recent tasks screen, the live wallpaper still has focus. This didn't happen on pre-Lollipop, because the recent tasks screen took over everything on the screen.
Another example is the wallpaper-chooser, even if you just show thumbnails of all live wallpapers, you would still show your own and handle touch events, as if the user is on the launcher.
However, when you show the notification bar or the menu of the launcher (by pressing the menu button), the live wallpaper will not get any touch events.
You can see those issues on other live wallpapers, like "Magic fluids free" for example.
Again, the problem is that on some cases, there is no way to disable the touch events, because you can't know when they happen (recent tasks and wallpaper chooser are such examples).
What I've tried
There isn't much to do. all of the methods of the Engine class failed to find the state of the sceneraios I've written about:
onOffsetsChanged, onVisibilityChanged, onSurfaceChanged, onSurfaceRedrawNeeded, onOffsetsChanged
The question
Is there any way to overcome this issue? To stop listening to events in case the live wallpaper isn't on focus?