From time to time, my Galaxy S4 seems to forget how to work properly with the proximity sensor during calls. It basically goes to a black screen when needed, but then does not return to its normal state unless you press the come button for a while. It doesn’t lets you to hang.
Warning: following this instructions means forcing editing config files. It’s dangerous. Do it at your own risk.
I found the clue to fix it thanks to Markweiser, a user of the Cyanogenmod forum:
#1: Root privileges
You need to have root privileges. If you found this text because you are exactly in the same situation that I am dealing with, i.e. you are using Cyanogenmod, chances are that you already have root privileges. But if you are not, note that I’m not sure if it works with other operating systems or Android distros. Anyway, you can learn more on rooting from Wikipedia or from the Cyanogenmod wiki.
#2: manual recalibration of the proximity sensor
You need to run a few commands. Easiest way to do that is installing a terminal emulator from Google Play. Another quite easy way to do so using a PC keyboard is installing an SSH server from Google play and then working in your phone through SSH.
$ su $ echo -en $'\x74' > /efs/prox_cal $ chown system:system /efs/prox_cal $ chmod 644 /efs/prox_cal $ sync $ reboot
The last command will reboot your phone.
#3: manual recalibration of the proximity sensor
$ su $ echo 0 > /sys/class/sensors/proximity_sensor/prox_cal $ echo 1 > /sys/class/sensors/proximity_sensor/prox_cal $ reboot
Again the phone will reboot.
It worked for me.
Photo by Kārlis Dambrāns.