@@ -640,6 +640,33 @@ DecryptHandle* BpDrmManagerService::openDecryptSession(int uniqueId, const char*
640640 return handle;
641641}
642642
643+ DecryptHandle* BpDrmManagerService::openDecryptSession (
644+ int uniqueId, const DrmBuffer& buf, const String8& mimeType) {
645+ ALOGV (" Entering BpDrmManagerService::openDecryptSession" );
646+ Parcel data, reply;
647+
648+ data.writeInterfaceToken (IDrmManagerService::getInterfaceDescriptor ());
649+ data.writeInt32 (uniqueId);
650+ if (buf.data != NULL && buf.length > 0 ) {
651+ data.writeInt32 (buf.length );
652+ data.write (buf.data , buf.length );
653+ } else {
654+ data.writeInt32 (0 );
655+ }
656+ data.writeString8 (mimeType);
657+
658+ remote ()->transact (OPEN_DECRYPT_SESSION_FOR_STREAMING, data, &reply);
659+
660+ DecryptHandle* handle = NULL ;
661+ if (0 != reply.dataAvail ()) {
662+ handle = new DecryptHandle ();
663+ readDecryptHandleFromParcelData (handle, reply);
664+ } else {
665+ ALOGV (" no decryptHandle is generated in service side" );
666+ }
667+ return handle;
668+ }
669+
643670status_t BpDrmManagerService::closeDecryptSession (int uniqueId, DecryptHandle* decryptHandle) {
644671 ALOGV (" closeDecryptSession" );
645672 Parcel data, reply;
@@ -1297,6 +1324,30 @@ status_t BnDrmManagerService::onTransact(
12971324 return DRM_NO_ERROR;
12981325 }
12991326
1327+ case OPEN_DECRYPT_SESSION_FOR_STREAMING:
1328+ {
1329+ ALOGV (" BnDrmManagerService::onTransact :OPEN_DECRYPT_SESSION_FOR_STREAMING" );
1330+ CHECK_INTERFACE (IDrmManagerService, data, reply);
1331+
1332+ const int uniqueId = data.readInt32 ();
1333+ const int bufferSize = data.readInt32 ();
1334+ DrmBuffer buf ((bufferSize > 0 ) ? (char *)data.readInplace (bufferSize) : NULL ,
1335+ bufferSize);
1336+ const String8 mimeType (data.readString8 ());
1337+
1338+ DecryptHandle* handle = openDecryptSession (uniqueId, buf, mimeType);
1339+
1340+ if (handle != NULL ) {
1341+ writeDecryptHandleToParcelData (handle, reply);
1342+ clearDecryptHandle (handle);
1343+ delete handle;
1344+ handle = NULL ;
1345+ } else {
1346+ ALOGV (" NULL decryptHandle is returned" );
1347+ }
1348+ return DRM_NO_ERROR;
1349+ }
1350+
13001351 case CLOSE_DECRYPT_SESSION:
13011352 {
13021353 ALOGV (" BnDrmManagerService::onTransact :CLOSE_DECRYPT_SESSION" );
0 commit comments