That's the proximity sensor. It disable the screen to avoid accidental touch events.
what is the function of two lights near the front camera of samsung galaxy e7