Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in API level 21

android.media.projection

Classes

MediaProjection A token granting applications the ability to capture screen contents and/or record system audio. 
MediaProjection.Callback Callbacks for the projection session. 
MediaProjectionManager Manages the retrieval of certain types of MediaProjection tokens.