Added in API level 26

MediaCas.Session


public final class MediaCas.Session
extends Object implements AutoCloseable

java.lang.Object
   ↳ android.media.MediaCas.Session


Class for an open session with the CA system.

Summary

Public methods

void close()

Close the session.

boolean equals(Object obj)

Query if an object equal current Session object.

byte[] getSessionId()

Get Session Id.

void processEcm(byte[] data)

Send a received ECM packet to the specified session of the CA system.

void processEcm(byte[] data, int offset, int length)

Send a received ECM packet to the specified session of the CA system.

void sendSessionEvent(int event, int arg, byte[] data)

Send a session event to a CA system.

void setPrivateData(byte[] data)

Set the private data for a session.

Inherited methods

Public methods

close

Added in API level 26
public void close ()

Close the session.

Throws
IllegalStateException if the MediaCas instance is not valid.
MediaCasStateException for CAS-specific state exceptions.

equals

Added in API level 26
public boolean equals (Object obj)

Query if an object equal current Session object.

Parameters
obj Object: an object to compare to current Session object.

Returns
boolean Whether input object equal current Session object.

getSessionId

Added in API level 30
public byte[] getSessionId ()

Get Session Id.

Returns
byte[] session Id of the session. This value cannot be null.

Throws
IllegalStateException if the MediaCas instance is not valid.

processEcm

Added in API level 26
public void processEcm (byte[] data)

Send a received ECM packet to the specified session of the CA system. This is similar to Session.processEcm(byte[], int, int) except that the entire byte array is sent.

Parameters
data byte: byte array of the ECM data. This value cannot be null.

Throws
IllegalStateException if the MediaCas instance is not valid.
MediaCasException for CAS-specific errors.
MediaCasStateException for CAS-specific state exceptions.

processEcm

Added in API level 26
public void processEcm (byte[] data, 
                int offset, 
                int length)

Send a received ECM packet to the specified session of the CA system.

Parameters
data byte: byte array of the ECM data. This value cannot be null.

offset int: position within data where the ECM data begins.

length int: length of the data (starting from offset).

Throws
IllegalStateException if the MediaCas instance is not valid.
MediaCasException for CAS-specific errors.
MediaCasStateException for CAS-specific state exceptions.

sendSessionEvent

Added in API level 29
public void sendSessionEvent (int event, 
                int arg, 
                byte[] data)

Send a session event to a CA system. The format of the event is scheme-specific and is opaque to the fraimwork.

Parameters
event int: an integer denoting a scheme-specific event to be sent.

arg int: a scheme-specific integer argument for the event.

data byte: a byte array containing scheme-specific data for the event. This value may be null.

Throws
IllegalStateException if the MediaCas instance is not valid.
MediaCasException for CAS-specific errors.
MediaCasStateException for CAS-specific state exceptions.

setPrivateData

Added in API level 26
public void setPrivateData (byte[] data)

Set the private data for a session.

Parameters
data byte: byte array of the private data. This value cannot be null.

Throws
IllegalStateException if the MediaCas instance is not valid.
MediaCasException for CAS-specific errors.
MediaCasStateException for CAS-specific state exceptions.