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

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

abstract void close()

Closes this resource, relinquishing any underlying resources.

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 framework.

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.