DrmConstraints* BpDrmManagerService::getConstraints( int uniqueId, const String8* path, const int action) { LOGV("Get Constraints"); Parcel data, reply; data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor()); data.writeInt32(uniqueId); data.writeString8(*path); data.writeInt32(action); remote()->transact(GET_CONSTRAINTS_FROM_CONTENT, data, &reply); DrmConstraints* drmConstraints = NULL; if (0 != reply.dataAvail()) { //Filling Drm Constraints drmConstraints = new DrmConstraints(); const int size = reply.readInt32(); for (int index = 0; index < size; ++index) { const String8 key(reply.readString8()); const int bufferSize = reply.readInt32(); char* data = NULL; if (0 < bufferSize) { data = new char[bufferSize]; reply.read(data, bufferSize); } drmConstraints->put(&key, data); } } return drmConstraints; }
DrmConstraints* DrmPassthruPlugIn::onGetConstraints( int uniqueId, const String8* path, int action) { ALOGV("DrmPassthruPlugIn::onGetConstraints From Path: %d", uniqueId); DrmConstraints* drmConstraints = new DrmConstraints(); String8 value("dummy_available_time"); char* charValue = NULL; charValue = new char[value.length() + 1]; strncpy(charValue, value.string(), value.length()); //Just add dummy available time for verification drmConstraints->put(&(DrmConstraints::LICENSE_AVAILABLE_TIME), charValue); return drmConstraints; }