If the screen turns on while the device is in a pocket, covered, or face down, it will turn it back off.
This is Smart Lock friendly.
Because of this, locking is slower and it requires root permission.
This solves a problem I was having while biking. I would check my pocket periodically to make sure my phone was still there. Sometimes the power button would be pressed by accident, the phone's screen would be on, and for some reason stay on. Maybe it was the moisture from my leg keeping it on, idk. But I no longer have a dead battery due to this.
This does not turn the screen of when you put your phone in your pocket. It turns the screen back off when it was turned on in your pocket.