- Root access
- (For Android 6.0+) Go to Settings --> Apps. Press the settings cog up top, then go to Default Apps. Enter "Assist & Voice Input" and for the "Assist App" choose Tasker. Be warned that doing this will stop the "OK Google" on every screen (and off) from working, but if you're okay with that then go ahead and change it!
- (For Android < 6.0) Clear the default app that is set for swiping up from the home button. You will enable Tasker as your default app after you're done following the rest of the steps below.
- Create a new profile and name it whatever you want, then choose the Event context. Go to UI, then choose Assistance Request.
- Back out, and create a new task named 'Overscan' or whatever else you want.
Now, we'll make the actions needed for the task itself.
- Task --> If. Set the condition to %Overscan eq 1.
- Code --> Run Shell. For the Command, type in wm overscan reset. Check "Use Root" and then back out.
- Variables --> Variable Set. Under Name, choose %Overscan, and set it to 0.
- Task --> Else.
- Code --> Run Shell. For the command, type in wm overscan LEFT,TOP,RIGHT,BOTTOM where each of the directions are the pixel counts that the screen will shift in. On my Nexus 6p, I've set it to wm overscan 0,845,0,0. See my article for examples.
- Variables --> Variable Set. For Name choose %Overscan and set it to 1.
- Task --> End If.
That's it! Now when you swipe-up/long press the home button, you'll launch the Overscan tasker task which will shift your screen depending on whether or not it has already been shifted. The %Overscan variable is a global variable that is set to 1 if the screen is shifted and 0 if not.
Of course, this isn't the only thing you can do with long-pressing the home button. You can also do and set the Assistance Request to open a web-search overlay on any app.