1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __NO_OP_DRM_MANAGER_CLIENT_IMPL_H__ 18 #define __NO_OP_DRM_MANAGER_CLIENT_IMPL_H__ 19 20 #include "DrmManagerClientImpl.h" 21 22 namespace android { 23 24 class NoOpDrmManagerClientImpl : public DrmManagerClientImpl { 25 public: NoOpDrmManagerClientImpl()26 NoOpDrmManagerClientImpl() { } 27 28 void remove(int uniqueId); 29 void addClient(int uniqueId); 30 void removeClient(int uniqueId); 31 status_t setOnInfoListener( 32 int uniqueId, const sp<DrmManagerClient::OnInfoListener>& infoListener); 33 DrmConstraints* getConstraints(int uniqueId, const String8* path, const int action); 34 35 DrmMetadata* getMetadata(int uniqueId, const String8* path); 36 bool canHandle(int uniqueId, const String8& path, const String8& mimeType); 37 DrmInfoStatus* processDrmInfo(int uniqueId, const DrmInfo* drmInfo); 38 DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest); 39 status_t saveRights(int uniqueId, const DrmRights& drmRights, 40 const String8& rightsPath, const String8& contentPath); 41 String8 getOriginalMimeType(int uniqueId, const String8& path, int fd); 42 int getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType); 43 int checkRightsStatus(int uniqueId, const String8& path, int action); 44 status_t consumeRights(int uniqueId, sp<DecryptHandle> &decryptHandle, int action, bool reserve); 45 status_t setPlaybackStatus( 46 int uniqueId, sp<DecryptHandle> &decryptHandle, int playbackStatus, int64_t position); 47 bool validateAction( 48 int uniqueId, const String8& path, int action, const ActionDescription& description); 49 status_t removeRights(int uniqueId, const String8& path); 50 status_t removeAllRights(int uniqueId); 51 int openConvertSession(int uniqueId, const String8& mimeType); 52 DrmConvertedStatus* convertData(int uniqueId, int convertId, const DrmBuffer* inputData); 53 DrmConvertedStatus* closeConvertSession(int uniqueId, int convertId); 54 status_t getAllSupportInfo(int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray); 55 sp<DecryptHandle> openDecryptSession( 56 int uniqueId, int fd, off64_t offset, off64_t length, const char* mime); 57 sp<DecryptHandle> openDecryptSession( 58 int uniqueId, const char* uri, const char* mime); 59 sp<DecryptHandle> openDecryptSession(int uniqueId, const DrmBuffer& buf, 60 const String8& mimeType); 61 status_t closeDecryptSession(int uniqueId, sp<DecryptHandle> &decryptHandle); 62 status_t initializeDecryptUnit(int uniqueId, sp<DecryptHandle> &decryptHandle, 63 int decryptUnitId, const DrmBuffer* headerInfo); 64 status_t decrypt(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId, 65 const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV); 66 status_t finalizeDecryptUnit(int uniqueId, sp<DecryptHandle> &decryptHandle, int decryptUnitId); 67 ssize_t pread(int uniqueId, sp<DecryptHandle> &decryptHandle, 68 void* buffer, ssize_t numBytes, off64_t offset); 69 status_t notify(const DrmInfoEvent& event); 70 }; 71 72 } 73 74 #endif // __NO_OP_DRM_MANAGER_CLIENT_IMPL_H 75