Revert "Add public API to use new interfaces from cas@1.1"

This reverts commit 818719dd45.

Reason for revert: <INSERT REASONING HERE>

Change-Id: I595c1949ed139700144f19ee5bd7f91a5f0a1edd
This commit is contained in:
Henry Fang
2019-01-31 00:46:05 +00:00
parent 818719dd45
commit cdcaed6acb
3 changed files with 7 additions and 88 deletions

View File

@@ -735,7 +735,6 @@ java_defaults {
"game-driver-protos",
"mediaplayer2-protos",
"android.hidl.base-V1.0-java",
"android.hardware.cas-V1.1-java",
"android.hardware.cas-V1.0-java",
"android.hardware.contexthub-V1.0-java",
"android.hardware.health-V1.0-java-constants",

View File

@@ -24007,8 +24007,7 @@ package android.media {
}
public static interface MediaCas.EventListener {
method public void onEvent(@NonNull android.media.MediaCas, int, int, @Nullable byte[]);
method public void onSessionEvent(@NonNull android.media.MediaCas, @NonNull android.media.MediaCas.Session, int, int, @Nullable byte[]);
method public void onEvent(android.media.MediaCas, int, int, @Nullable byte[]);
}
public static class MediaCas.PluginDescriptor {
@@ -24020,7 +24019,6 @@ package android.media {
method public void close();
method public void processEcm(@NonNull byte[], int, int) throws android.media.MediaCasException;
method public void processEcm(@NonNull byte[]) throws android.media.MediaCasException;
method public void sendSessionEvent(int, int, @Nullable byte[]) throws android.media.MediaCasException;
method public void setPrivateData(@NonNull byte[]) throws android.media.MediaCasException;
}

View File

@@ -18,12 +18,8 @@ package android.media;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.hardware.cas.V1_0.HidlCasPluginDescriptor;
import android.hardware.cas.V1_1.ICas;
import android.hardware.cas.V1_1.ICasListener;
import android.hardware.cas.V1_1.IMediaCasService;
import android.hardware.cas.V1_0.*;
import android.media.MediaCasException.*;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IHwBinder;
@@ -132,9 +128,6 @@ public final class MediaCas implements AutoCloseable {
private class EventHandler extends Handler
{
private static final int MSG_CAS_EVENT = 0;
private static final int MSG_CAS_SESSION_EVENT = 1;
private static final String SESSION_KEY = "sessionId";
private static final String DATA_KEY = "data";
public EventHandler(Looper looper) {
super(looper);
@@ -145,12 +138,6 @@ public final class MediaCas implements AutoCloseable {
if (msg.what == MSG_CAS_EVENT) {
mListener.onEvent(MediaCas.this, msg.arg1, msg.arg2,
toBytes((ArrayList<Byte>) msg.obj));
} else if (msg.what == MSG_CAS_SESSION_EVENT) {
Bundle bundle = msg.getData();
ArrayList<Byte> sessionId = toByteArray(bundle.getByteArray(SESSION_KEY));
mListener.onSessionEvent(MediaCas.this,
createFromSessionId(sessionId), msg.arg1, msg.arg2,
bundle.getByteArray(DATA_KEY));
}
}
}
@@ -162,20 +149,6 @@ public final class MediaCas implements AutoCloseable {
mEventHandler.sendMessage(mEventHandler.obtainMessage(
EventHandler.MSG_CAS_EVENT, event, arg, data));
}
@Override
public void onSessionEvent(@NonNull ArrayList<Byte> sessionId,
int event, int arg, @Nullable ArrayList<Byte> data)
throws RemoteException {
Message msg = mEventHandler.obtainMessage();
msg.what = EventHandler.MSG_CAS_SESSION_EVENT;
msg.arg1 = event;
msg.arg2 = arg;
Bundle bundle = new Bundle();
bundle.putByteArray(EventHandler.SESSION_KEY, toBytes(sessionId));
bundle.putByteArray(EventHandler.DATA_KEY, toBytes(data));
msg.setData(bundle);
mEventHandler.sendMessage(msg);
}
};
/**
@@ -248,20 +221,6 @@ public final class MediaCas implements AutoCloseable {
mSessionId = sessionId;
}
/**
* Query if an object equal current Session object.
*
* @param obj an object to compare to current Session object.
*
* @return Whether input object equal current Session object.
*/
public boolean equals(Object obj) {
if (obj instanceof Session) {
return mSessionId.equals(((Session) obj).mSessionId);
}
return false;
}
/**
* Set the private data for a session.
*
@@ -322,30 +281,6 @@ public final class MediaCas implements AutoCloseable {
processEcm(data, 0, data.length);
}
/**
* Send a session event to a CA system. The format of the event is
* scheme-specific and is opaque to the framework.
*
* @param event an integer denoting a scheme-specific event to be sent.
* @param arg a scheme-specific integer argument for the event.
* @param 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.
*/
public void sendSessionEvent(int event, int arg, @Nullable byte[] data)
throws MediaCasException {
validateInternalStates();
try {
MediaCasException.throwExceptionIfNeeded(
mICas.sendSessionEvent(mSessionId, event, arg, toByteArray(data)));
} catch (RemoteException e) {
cleanupAndRethrowIllegalState();
}
}
/**
* Close the session.
*
@@ -427,7 +362,7 @@ public final class MediaCas implements AutoCloseable {
*/
public MediaCas(int CA_system_id) throws UnsupportedCasException {
try {
mICas = getService().createPluginExt(CA_system_id, mBinder);
mICas = getService().createPlugin(CA_system_id, mBinder);
} catch(Exception e) {
Log.e(TAG, "Failed to create plugin: " + e);
mICas = null;
@@ -453,26 +388,13 @@ public final class MediaCas implements AutoCloseable {
/**
* Notify the listener of a scheme-specific event from the CA system.
*
* @param mediaCas the MediaCas object to receive this event.
* @param MediaCas the MediaCas object to receive this event.
* @param event an integer whose meaning is scheme-specific.
* @param arg an integer whose meaning is scheme-specific.
* @param data a byte array of data whose format and meaning are
* scheme-specific.
*/
void onEvent(@NonNull MediaCas mediaCas, int event, int arg, @Nullable byte[] data);
/**
* Notify the listener of a scheme-specific session event from CA system.
*
* @param mediaCas the MediaCas object to receive this event.
* @param session session object which the event is for.
* @param event an integer whose meaning is scheme-specific.
* @param arg an integer whose meaning is scheme-specific.
* @param data a byte array of data whose format and meaning are
* scheme-specific.
*/
void onSessionEvent(@NonNull MediaCas mediaCas, @NonNull Session session,
int event, int arg, @Nullable byte[] data);
void onEvent(MediaCas MediaCas, int event, int arg, @Nullable byte[] data);
}
/**
@@ -621,7 +543,7 @@ public final class MediaCas implements AutoCloseable {
}
}
/**
/**
* Initiate a provisioning operation for a CA system.
*
* @param provisionString string containing information needed for the
@@ -681,4 +603,4 @@ public final class MediaCas implements AutoCloseable {
protected void finalize() {
close();
}
}
}