/**@class android.media.MediaCas
 implements java.lang.AutoCloseable

@extends java.lang.Object

 MediaCas can be used to obtain keys for descrambling protected media streams, in
 conjunction with {@link android.media.MediaDescrambler}. The MediaCas APIs are
 designed to support conditional access such as those in the ISO/IEC13818-1.
 The CA system is identified by a 16-bit integer CA_system_id. The scrambling
 algorithms are usually proprietary and implemented by vendor-specific CA plugins
 installed on the device.
 <p>
 The app is responsible for constructing a MediaCas object for the CA system it
 intends to use. The app can query if a certain CA system is supported using static
 method {@link #isSystemIdSupported}. It can also obtain the entire list of supported
 CA systems using static method {@link #enumeratePlugins}.
 <p>
 Once the MediaCas object is constructed, the app should properly provision it by
 using method {@link #provision} and/or {@link #processEmm}. The EMMs (Entitlement
 management messages) can be distributed out-of-band, or in-band with the stream.
 <p>
 To descramble elementary streams, the app first calls {@link #openSession} to
 generate a {@link android.media.MediaCas.Session} object that will uniquely identify a session. A session
 provides a context for subsequent key updates and descrambling activities. The ECMs
 (Entitlement control messages) are sent to the session via method
 {@link android.media.MediaCas.Session#processEcm}.
 <p>
 The app next constructs a MediaDescrambler object, and initializes it with the
 session using {@link android.media.MediaDescrambler#setMediaCasSession}. This ties the
 descrambler to the session, and the descrambler can then be used to descramble
 content secured with the session's key, either during extraction, or during decoding
 with {@link android.media.MediaCodec}.
 <p>
 If the app handles sample extraction using its own extractor, it can use
 MediaDescrambler to descramble samples into clear buffers (if the session's license
 doesn't require secure decoders), or descramble a small amount of data to retrieve
 information necessary for the downstream pipeline to process the sample (if the
 session's license requires secure decoders).
 <p>
 If the session requires a secure decoder, a MediaDescrambler needs to be provided to
 MediaCodec to descramble samples queued by {@link android.media.MediaCodec#queueSecureInputBuffer}
 into protected buffers. The app should use {@link android.media.MediaCodec#configure(MediaFormat,
 android.view.Surface, int, MediaDescrambler)} instead of the normal {@link MediaCodec#configure(MediaFormat, android.view.Surface, android.media.MediaCrypto, int)} method
 to configure MediaCodec.
 <p>
 <h3>Using Android's MediaExtractor</h3>
 <p>
 If the app uses {@link android.media.MediaExtractor}, it can delegate the CAS session
 management to MediaExtractor by calling {@link android.media.MediaExtractor#setMediaCas}.
 MediaExtractor will take over and call {@link #openSession}, {@link #processEmm}
 and/or {@link android.media.MediaCas.Session#processEcm}, etc.. if necessary.
 <p>
 When using {@link android.media.MediaExtractor}, the app would still need a MediaDescrambler
 to use with {@link android.media.MediaCodec} if the licensing requires a secure decoder. The
 session associated with the descrambler of a track can be retrieved by calling
 {@link android.media.MediaExtractor#getCasInfo}, and used to initialize a MediaDescrambler
 object for MediaCodec.
 <p>
 <h3>Listeners</h3>
 <p>The app may register a listener to receive events from the CA system using
 method {@link #setEventListener}. The exact format of the event is scheme-specific
 and is not specified by this API.
*/
var MediaCas = {

/**Query if a certain CA system is supported on this device.
@param {Number} CA_system_id the id of the CA system.
@return {Boolean} Whether the specified CA system is supported on this device.
*/
isSystemIdSupported : function(  ) {},

/**List all available CA plugins on the device.
@return {Object {android.media.MediaCas.PluginDescriptor}} an array of descriptors for the available CA plugins.
*/
enumeratePlugins : function(  ) {},

/**Set an event listener to receive notifications from the MediaCas instance.
@param {Object {MediaCas.EventListener}} listener the event listener to be set.
@param {Object {Handler}} handler the handler whose looper the event listener will be called on.
 If handler is null, we'll try to use current thread's looper, or the main
 looper. If neither are available, an internal thread will be created instead.
*/
setEventListener : function(  ) {},

/**Send the private data for the CA system.
@param {Object {byte[]}} data byte array of the private data.
@throws IllegalStateException if the MediaCas instance is not valid.
@throws MediaCasException for CAS-specific errors.
@throws MediaCasStateException for CAS-specific state exceptions.
*/
setPrivateData : function(  ) {},

/**Open a session to descramble one or more streams scrambled by the
 conditional access system.
@return {Object {android.media.MediaCas.Session}} session the newly opened session.
@throws IllegalStateException if the MediaCas instance is not valid.
@throws MediaCasException for CAS-specific errors.
@throws MediaCasStateException for CAS-specific state exceptions.
*/
openSession : function(  ) {},

/**Send a received EMM packet to the CA system.
@param {Object {byte[]}} data byte array of the EMM data.
@param {Number} offset position within data where the EMM data begins.
@param {Number} length length of the data (starting from offset).
@throws IllegalStateException if the MediaCas instance is not valid.
@throws MediaCasException for CAS-specific errors.
@throws MediaCasStateException for CAS-specific state exceptions.
*/
processEmm : function(  ) {},

/**Send a received EMM packet to the CA system. This is similar to
 {@link #processEmm(byte[], int, int)} except that the entire byte
 array is sent.
@param {Object {byte[]}} data byte array of the EMM data.
@throws IllegalStateException if the MediaCas instance is not valid.
@throws MediaCasException for CAS-specific errors.
@throws MediaCasStateException for CAS-specific state exceptions.
*/
processEmm : function(  ) {},

/**Send an event to a CA system. The format of the event is scheme-specific
 and is opaque to the framework.
@param {Number} event an integer denoting a scheme-specific event to be sent.
@param {Number} arg a scheme-specific integer argument for the event.
@param {Object {byte[]}} data a byte array containing scheme-specific data for the event.
@throws IllegalStateException if the MediaCas instance is not valid.
@throws MediaCasException for CAS-specific errors.
@throws MediaCasStateException for CAS-specific state exceptions.
*/
sendEvent : function(  ) {},

/**Initiate a provisioning operation for a CA system.
@param {String} provisionString string containing information needed for the
 provisioning operation, the format of which is scheme and implementation
 specific.
@throws IllegalStateException if the MediaCas instance is not valid.
@throws MediaCasException for CAS-specific errors.
@throws MediaCasStateException for CAS-specific state exceptions.
*/
provision : function(  ) {},

/**Notify the CA system to refresh entitlement keys.
@param {Number} refreshType the type of the refreshment.
@param {Object {byte[]}} refreshData private data associated with the refreshment.
@throws IllegalStateException if the MediaCas instance is not valid.
@throws MediaCasException for CAS-specific errors.
@throws MediaCasStateException for CAS-specific state exceptions.
*/
refreshEntitlements : function(  ) {},

/**
*/
close : function(  ) {},


};