The proximity sensor, which is found on top of your Android device, prevents accidental button presses whenever an object is near the screen. Once it detects anything close to the phone, the proximity sensor will then dim the screen.