Bug 1306196-[P1] Provide AIDL definiion for EME functionality on Fennec MediaManager Service.
MozReview-Commit-ID: IPr9WQQbGNB
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/aidl/org/mozilla/gecko/media/IMediaDrmBridge.aidl
@@ -0,0 +1,25 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko.media;
+
+// Non-default types used in interface.
+import org.mozilla.gecko.media.IMediaDrmBridgeCallbacks;
+
+interface IMediaDrmBridge {
+ void setCallbacks(in IMediaDrmBridgeCallbacks callbacks);
+
+ oneway void createSession(int createSessionToken,
+ int promiseId,
+ String initDataType,
+ in byte[] initData);
+
+ oneway void updateSession(int promiseId,
+ String sessionId,
+ in byte[] response);
+
+ oneway void closeSession(int promiseId, String sessionId);
+
+ oneway void release();
+}
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/aidl/org/mozilla/gecko/media/IMediaDrmBridgeCallbacks.aidl
@@ -0,0 +1,31 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko.media;
+
+// Non-default types used in interface.
+import org.mozilla.gecko.media.SessionKeyInfo;
+
+interface IMediaDrmBridgeCallbacks {
+
+ oneway void onSessionCreated(int createSessionToken,
+ int promiseId,
+ in byte[] sessionId,
+ in byte[] request);
+
+ oneway void onSessionUpdated(int promiseId, in byte[] sessionId);
+
+ oneway void onSessionClosed(int promiseId, in byte[] sessionId);
+
+ oneway void onSessionMessage(in byte[] sessionId,
+ int sessionMessageType,
+ in byte[] request);
+
+ oneway void onSessionError(in byte[] sessionId, String message);
+
+ oneway void onSessionBatchedKeyChanged(in byte[] sessionId,
+ in SessionKeyInfo[] keyInfos);
+
+ oneway void onRejectPromise(int promiseId, String message);
+}
--- a/mobile/android/base/aidl/org/mozilla/gecko/media/IMediaManager.aidl
+++ b/mobile/android/base/aidl/org/mozilla/gecko/media/IMediaManager.aidl
@@ -1,13 +1,18 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.media;
// Non-default types used in interface.
import org.mozilla.gecko.media.ICodec;
+import org.mozilla.gecko.media.IMediaDrmBridge;
interface IMediaManager {
/** Creates a remote ICodec object. */
ICodec createCodec();
+
+ /** Creates a remote IMediaDrmBridge object. */
+ IMediaDrmBridge createRemoteMediaDrmBridge(in String keySystem,
+ in String stubId);
}
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/aidl/org/mozilla/gecko/media/SessionKeyInfo.aidl
@@ -0,0 +1,7 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko.media;
+
+parcelable SessionKeyInfo;
\ No newline at end of file
--- a/mobile/android/base/java/org/mozilla/gecko/media/MediaManager.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/MediaManager.java
@@ -15,16 +15,23 @@ import org.mozilla.gecko.mozglue.GeckoLo
public final class MediaManager extends Service {
private static boolean sNativeLibLoaded;
private Binder mBinder = new IMediaManager.Stub() {
@Override
public ICodec createCodec() throws RemoteException {
return new Codec();
}
+
+ @Override
+ public IMediaDrmBridge createRemoteMediaDrmBridge(String keySystem,
+ String stubId)
+ throws RemoteException {
+ return null;
+ }
};
@Override
public synchronized void onCreate() {
if (!sNativeLibLoaded) {
GeckoLoader.doLoadLibrary(this, "mozglue");
sNativeLibLoaded = true;
}
--- a/mobile/android/base/java/org/mozilla/gecko/media/SessionKeyInfo.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/SessionKeyInfo.java
@@ -1,18 +1,51 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.media;
+import android.os.Parcel;
+import android.os.Parcelable;
import org.mozilla.gecko.annotation.WrapForJNI;
-@WrapForJNI
-public final class SessionKeyInfo {
+public final class SessionKeyInfo implements Parcelable {
+ @WrapForJNI
public byte[] keyId;
+
+ @WrapForJNI
public int status;
+ @WrapForJNI
public SessionKeyInfo(byte[] keyId, int status) {
this.keyId = keyId;
this.status = status;
}
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int parcelableFlags) {
+ dest.writeByteArray(keyId);
+ dest.writeInt(status);
+ }
+
+ public static final Creator<SessionKeyInfo> CREATOR = new Creator<SessionKeyInfo>() {
+ @Override
+ public SessionKeyInfo createFromParcel(Parcel in) {
+ return new SessionKeyInfo(in);
+ }
+
+ @Override
+ public SessionKeyInfo[] newArray(int size) {
+ return new SessionKeyInfo[size];
+ }
+ };
+
+ private SessionKeyInfo(Parcel src) {
+ keyId = src.createByteArray();
+ status = src.readInt();
+ }
}
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -1126,10 +1126,12 @@ DEFINES['TOPOBJDIR'] = TOPOBJDIR
OBJDIR_PP_FILES.mobile.android.base += [
'AndroidManifest.xml.in',
]
gbjar.sources += ['generated/org/mozilla/gecko/' + x for x in [
'media/ICodec.java',
'media/ICodecCallbacks.java',
+ 'media/IMediaDrmBridge.java',
+ 'media/IMediaDrmBridgeCallbacks.java',
'media/IMediaManager.java',
]]