A free program for Android, by Artem Chepurnoy.
I developed Pocket Mode: Prevent accidental cover for Android phones because stock Android has a gap in the proximity sensor coverage when the screen is on and the phone is in your pocket. If you are using a Samsung Galaxy S, Note, or other Android device with a proximity sensor, Pocket Mode will lock your phone and prevent accidental covers.
How do I use Pocket Mode: Prevent accidental cover?
Install Pocket Mode: Prevent accidental cover and open the application.
Turn the screen on and define the time you want to turn the screen off.
This app is completely free and open source, the donations are welcome but do not provide any benefit for the user.