Aymeric is a friend working as a developer at Flashgap. He helped me to build a fast working prototype to explain the interaction. You can see thanks to the video that once the screen is covered, an animation is played. Android studio looks very complicated for someone not used to this type of interface. I managed to install it with a lot of bugs, and when solving 3 problems 116 new appeared. Aymeric did save me a great amount of time.
To create this prototype, Aymeric used the proximity sensor of my device. This device may vary according to the model of the phone. For example mine only detects if it’s “far” or “close”. Some other devices are more precise since they can tell a real distance between the phone and the screen. It wasn’t a problem for me since I just need to create two conditions: open or closed. As a security, I could had a timer of 500ms before playing the animation. It could prevent the user from locking his phone by mistake. Thanks Aymeric ;)