Being able to operate apps that draw on top of other apps is a powerful feature of Android. Apps like Twilight take advantage of that to add a filter towards the display, but other applications just show a floating UI element. However , this can also be a security concern. Android O offers a handy notify when an app is showing an overlay with a link to turn it off.
[Update: Notification Channels] Google android O feature spotlight: Google android tells you if an application is displaying a display screen overlay was written by the particular awesome team at Android Police.