Bug 1306196-[P1] Provide AIDL definiion for EME functionality on Fennec MediaManager Service. r=cpearce,jchen

MozReview-Commit-ID: IPr9WQQbGNB

--HG--
extra : rebase_source : f375ac50d49e8b28906072f99551c9e95841d06b
This commit is contained in:
Kilik Kuo 2016-11-01 19:27:18 +08:00
parent 27f99e13e4
commit 6f5d80e5ab
7 changed files with 112 additions and 2 deletions

View File

@ -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();
}

View File

@ -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);
}

View File

@ -6,8 +6,13 @@ 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);
}

View File

@ -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;

View File

@ -20,6 +20,13 @@ public final class MediaManager extends Service {
public ICodec createCodec() throws RemoteException {
return new Codec();
}
@Override
public IMediaDrmBridge createRemoteMediaDrmBridge(String keySystem,
String stubId)
throws RemoteException {
return null;
}
};
@Override

View File

@ -4,15 +4,48 @@
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();
}
}

View File

@ -1131,5 +1131,7 @@ OBJDIR_PP_FILES.mobile.android.base += [
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',
]]