Back in Android Marshmallow, Google introduced a feature that allows apps to be displayed on top of other apps. Things like Facebook Messenger and Twilight take advantage of this feature so they can essentially run on-screen at the same time as other apps in the foreground.