How to judge whether the screen is on or off

How to judge whether the screen is on or off