Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 625e1804 authored by Chong Zhang's avatar Chong Zhang
Browse files

MediaCas: combine openSession methods

Combine the two openSession methods into one that doesn't take
any arguments. This gives the client more flexibility in creating
sessions, they can better control how to share sessions across
different elementary streams.

bug: 22804304

Change-Id: I95ce75476b19e9ca851c40f873f46d5c7fa583ef
parent addc39ec
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -21823,8 +21823,7 @@ package android.media {
    method public void close();
    method public static android.media.MediaCas.PluginDescriptor[] enumeratePlugins();
    method public static boolean isSystemIdSupported(int);
    method public android.media.MediaCas.Session openSession(int) throws android.media.MediaCasException;
    method public android.media.MediaCas.Session openSession(int, int) throws android.media.MediaCasException;
    method public android.media.MediaCas.Session openSession() throws android.media.MediaCasException;
    method public void processEmm(byte[], int, int) throws android.media.MediaCasException;
    method public void processEmm(byte[]) throws android.media.MediaCasException;
    method public void provision(java.lang.String) throws android.media.MediaCasException;
+1 −2
Original line number Diff line number Diff line
@@ -23648,8 +23648,7 @@ package android.media {
    method public void close();
    method public static android.media.MediaCas.PluginDescriptor[] enumeratePlugins();
    method public static boolean isSystemIdSupported(int);
    method public android.media.MediaCas.Session openSession(int) throws android.media.MediaCasException;
    method public android.media.MediaCas.Session openSession(int, int) throws android.media.MediaCasException;
    method public android.media.MediaCas.Session openSession() throws android.media.MediaCasException;
    method public void processEmm(byte[], int, int) throws android.media.MediaCasException;
    method public void processEmm(byte[]) throws android.media.MediaCasException;
    method public void provision(java.lang.String) throws android.media.MediaCasException;
+1 −2
Original line number Diff line number Diff line
@@ -21936,8 +21936,7 @@ package android.media {
    method public void close();
    method public static android.media.MediaCas.PluginDescriptor[] enumeratePlugins();
    method public static boolean isSystemIdSupported(int);
    method public android.media.MediaCas.Session openSession(int) throws android.media.MediaCasException;
    method public android.media.MediaCas.Session openSession(int, int) throws android.media.MediaCasException;
    method public android.media.MediaCas.Session openSession() throws android.media.MediaCasException;
    method public void processEmm(byte[], int, int) throws android.media.MediaCasException;
    method public void processEmm(byte[]) throws android.media.MediaCasException;
    method public void provision(java.lang.String) throws android.media.MediaCasException;
+4 −31
Original line number Diff line number Diff line
@@ -506,34 +506,8 @@ public final class MediaCas implements AutoCloseable {
    }

    /**
     * Open a session for the specified program.
     *
     * @param programNumber program_number of the program (as in ISO/IEC13818-1).
     *
     * @return 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.
     */
    public Session openSession(int programNumber) throws MediaCasException {
        validateInternalStates();

        try {
            return createFromSessionId(mICas.openSession(programNumber));
        } catch (ServiceSpecificException e) {
            MediaCasException.throwExceptions(e);
        } catch (RemoteException e) {
            cleanupAndRethrowIllegalState();
        }
        return null;
    }

    /**
     * Open a session for the specified stream.
     *
     * @param programNumber program_number of the stream (as in ISO/IEC13818-1).
     * @param elementaryPID elementary_PID of the stream (as in ISO/IEC13818-1).
     * Open a session to descramble one or more streams scrambled by the
     * conditional access system.
     *
     * @return session the newly opened session.
     *
@@ -541,12 +515,11 @@ public final class MediaCas implements AutoCloseable {
     * @throws MediaCasException for CAS-specific errors.
     * @throws MediaCasStateException for CAS-specific state exceptions.
     */
    public Session openSession(int programNumber, int elementaryPID)
            throws MediaCasException {
    public Session openSession() throws MediaCasException {
        validateInternalStates();

        try {
            return createFromSessionId(mICas.openSessionForStream(programNumber, elementaryPID));
            return createFromSessionId(mICas.openSession());
        } catch (ServiceSpecificException e) {
            MediaCasException.throwExceptions(e);
        } catch (RemoteException e) {