[ZenFone 2 Q&A, Help & Troubleshooting] kokoko3k:
Made another version of the script.

This one solves the problem of the long press tap (you can keep the finger pushed and it will understand "long press" action).

Be aware that it is less tested and more error prone.

Also, it uses shared memory; if you run it under android and not chroot, please replace /dev/shm with another existing temporary directory you have write access to of your choice.

#!/bin/bash

#Command needed to escape chroot (comment if not running in chroot)
unchroot=/root/scripts/unchroot/unchroot.exec.sh

#Touch device
I=/dev/input/event1

#Original vertical resolution
Ymin=1920

#New size
SIZE=720x1280
#SIZE=540x960
#New dpi
DPI=320
#DPI=240

#Buttons coordinates, min, max
BACK_0=150
BACK_1=250
HOME_0=500
HOME_1=600
RECENT_0=827
RECENT_1=927

#Long presso duration (seconds)
LONG_PRESS_TIME=1.00

#Do not configure below this line----------------------------------------------

#May be needed since we use floats
LC_ALL=C

#Function to exit cleanly
exit_function() {
echo "Quitting..."
killall evtest
kill $back_pid
rm /dev/shm/wait_tap_up &
$unchroot "wm size reset"
$unchroot "wm density reset"
sleep 1
$unchroot "wm density reset"
sleep 5
kill `pidof org.pocketworkstation.pckeyboard`
exit 0
}

#Restore resolution and clean on exit
trap exit_function SIGINT SIGTERM EXIT

#Set resolution and dpi
$unchroot "wm size $SIZE"
$unchroot "wm density $DPI"
sleep 1
#Set it again to correct some glitches
$unchroot "wm density $DPI"
sleep 2
#Hacker's keyboard does not like resolution changes...
kill `pidof org.pocketworkstation.pckeyboard`

#Hacky: kill leftover evtest processes
killall evtest

check_long_press() {
Y=${Line_Y##* } #get last field (space delimited string) (Y coordinate)
#Check that Y is on the Navigation bar
if [[ $Y -ge $Ymin ]] ; then
#Short or long press?
#read with timeout from /dev/shm/wait_tap_up fifo
read -t $LONG_PRESS_TIME some_var <> /dev/shm/wait_tap_up
RETVAL=$?
#echo "TAP UP DETECTED"
if (( "$RETVAL" > 0 )); then
LP='--longpress'
echo "long press, removing and recreating stale fifo"
rm /dev/shm/wait_tap_up
mkfifo /dev/shm/wait_tap_up
else
LP=''
echo "short press"
fi

#Check what key we pressed and emit keyevent
X=${Line_X##* } #get last field (space delimited string) (X coordinate)
if [ "$X" -ge $BACK_0 -a "$X" -le $BACK_1 ]; then
#echo BACK
$unchroot "input keyevent $LP KEYCODE_BACK"
elif [ "$X" -ge $HOME_0 -a "$X" -le $HOME_1 ]; then
$unchroot "input keyevent $LP KEYCODE_HOME"
#echo HOME
elif [ "$X" -ge $RECENT_0 -a "$X" -le $RECENT_1 ]; then
$unchroot "input keyevent $LP KEYCODE_APP_SWITCH"

#echo RECENT
fi
fi
#tap_up feeded this function through named pipes
#Set our pid to an unexistant value (0) so that
#tap_up will not try to feed me, since i'm no more.
back_pid=0
return
}

#Make a fifo, needed to pass/raise the tap_down event to the background function
rm /dev/shm/wait_tap_up ; mkfifo /dev/shm/wait_tap_up

#Be nice now...
renice -n 19 $$

#Start main "sniffing" cycle:
evtest $I | grep 'BTN_TOUCH' -B10 --line-buffered | \
while read line; do
case $line in
*'ABS_MT_POSITION_X'*) #X coordinate
#Store X position line, will extract coordinate later
Line_X=$line
;;
*'ABS_MT_POSITION_Y'*) #Y coordinate
#Store Y position line, will extract coordinate later
Line_Y=$line
;;

*'(BTN_TOUCH), value 1'*) #Tap Down
#Store the full evtest line, it will be used later to check press time
down_line=$line
check_long_press &
back_pid=$!
;;
*'(BTN_TOUCH), value 0'*) #Tap Up
#feed check_long_press() with tap_up data, but only if it is running.
if [ -e /proc/$back_pid ] ; then
echo something > /dev/shm/wait_tap_up
fi
;;

esac
done