Search for permission android.permission.SYSTEM_ALERT_WINDOW and WindowManager.LayoutParams.TYPE_SYSTEM_ALERT.
See this blogpost by Daniel Jankowski and his WindowHead sample on GitHub.
In addition to the duplicate answer already listed, also see:
- Having application running above other app
- Disappearing facebook chat heads