Convert libdrmframework and drmserver to Android.bp
See build/soong/README.md for more information.
Also moves a few headers into the same library as their
implementation, and fixes a few includes to go through the
global frameworks/av/include path instead of manually adding
frameworks/av/include/drm.
Test: m -j checkbuild
Change-Id: I0c2d2f2262e7ed78d80a0d44795705c64b797ff0
diff --git a/drm/libdrmframework/Android.bp b/drm/libdrmframework/Android.bp
new file mode 100644
index 0000000..43ba72b
--- /dev/null
+++ b/drm/libdrmframework/Android.bp
@@ -0,0 +1,42 @@
+//
+// Copyright (C) 2010 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_shared {
+ name: "libdrmframework",
+
+ srcs: [
+ "DrmManagerClientImpl.cpp",
+ "DrmManagerClient.cpp",
+ "NoOpDrmManagerClientImpl.cpp",
+ ],
+
+ shared_libs: [
+ "libutils",
+ "libcutils",
+ "liblog",
+ "libbinder",
+ "libdl",
+ ],
+
+ static_libs: ["libdrmframeworkcommon"],
+
+ export_include_dirs: ["include"],
+ export_static_lib_headers: ["libdrmframeworkcommon"],
+
+ cflags: ["-Werror"],
+}
+
+subdirs = ["plugins/*"]
diff --git a/drm/libdrmframework/Android.mk b/drm/libdrmframework/Android.mk
deleted file mode 100644
index cafcb94..0000000
--- a/drm/libdrmframework/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- DrmManagerClientImpl.cpp \
- DrmManagerClient.cpp \
- NoOpDrmManagerClientImpl.cpp
-
-LOCAL_MODULE:= libdrmframework
-
-LOCAL_SHARED_LIBRARIES := \
- libutils \
- libcutils \
- liblog \
- libbinder \
- libdl
-
-LOCAL_STATIC_LIBRARIES := \
- libdrmframeworkcommon
-
-LOCAL_C_INCLUDES += \
- $(TOP)/frameworks/av/drm/libdrmframework/include \
- $(TOP)/frameworks/av/include
-
-LOCAL_CFLAGS += -Werror
-
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/drm/libdrmframework/include/DrmManager.h b/drm/libdrmframework/include/DrmManager.h
deleted file mode 100644
index e7cdd36..0000000
--- a/drm/libdrmframework/include/DrmManager.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __DRM_MANAGER_H__
-#define __DRM_MANAGER_H__
-
-#include <utils/Errors.h>
-#include <utils/threads.h>
-#include <drm/drm_framework_common.h>
-#include "IDrmEngine.h"
-#include "PlugInManager.h"
-#include "IDrmServiceListener.h"
-
-namespace android {
-
-class IDrmManager;
-class DrmRegistrationInfo;
-class DrmUnregistrationInfo;
-class DrmRightsAcquisitionInfo;
-class DrmConstraints;
-class DrmMetadata;
-class DrmRights;
-class DrmInfo;
-class DrmInfoStatus;
-class DrmConvertedStatus;
-class DrmInfoRequest;
-class DrmSupportInfo;
-class ActionDescription;
-
-/**
- * This is implementation class for DRM Manager. This class delegates the
- * functionality to corresponding DRM Engine.
- *
- * The DrmManagerService class creates an instance of this class.
- *
- */
-class DrmManager : public IDrmEngine::OnInfoListener {
-public:
- DrmManager();
- virtual ~DrmManager();
-
-public:
- int addUniqueId(bool isNative);
-
- void removeUniqueId(int uniqueId);
-
- void addClient(int uniqueId);
-
- void removeClient(int uniqueId);
-
- status_t loadPlugIns();
-
- status_t loadPlugIns(const String8& plugInDirPath);
-
- status_t unloadPlugIns();
-
- status_t setDrmServiceListener(
- int uniqueId, const sp<IDrmServiceListener>& drmServiceListener);
-
- DrmConstraints* getConstraints(int uniqueId, const String8* path, const int action);
-
- DrmMetadata* getMetadata(int uniqueId, const String8* path);
-
- bool canHandle(int uniqueId, const String8& path, const String8& mimeType);
-
- DrmInfoStatus* processDrmInfo(int uniqueId, const DrmInfo* drmInfo);
-
- DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest);
-
- status_t saveRights(int uniqueId, const DrmRights& drmRights,
- const String8& rightsPath, const String8& contentPath);
-
- String8 getOriginalMimeType(int uniqueId, const String8& path, int fd);
-
- int getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType);
-
- int checkRightsStatus(int uniqueId, const String8& path, int action);
-
- status_t consumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve);
-
- status_t setPlaybackStatus(
- int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position);
-
- bool validateAction(
- int uniqueId, const String8& path, int action, const ActionDescription& description);
-
- status_t removeRights(int uniqueId, const String8& path);
-
- status_t removeAllRights(int uniqueId);
-
- int openConvertSession(int uniqueId, const String8& mimeType);
-
- DrmConvertedStatus* convertData(int uniqueId, int convertId, const DrmBuffer* inputData);
-
- DrmConvertedStatus* closeConvertSession(int uniqueId, int convertId);
-
- status_t getAllSupportInfo(int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray);
-
- DecryptHandle* openDecryptSession(
- int uniqueId, int fd, off64_t offset, off64_t length, const char* mime);
-
- DecryptHandle* openDecryptSession(int uniqueId, const char* uri, const char* mime);
-
- DecryptHandle* openDecryptSession(int uniqueId, const DrmBuffer& buf,
- const String8& mimeType);
-
- status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle);
-
- status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
- int decryptUnitId, const DrmBuffer* headerInfo);
-
- status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
- const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV);
-
- status_t finalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId);
-
- ssize_t pread(int uniqueId, DecryptHandle* decryptHandle,
- void* buffer, ssize_t numBytes, off64_t offset);
-
- void onInfo(const DrmInfoEvent& event);
-
-private:
- String8 getSupportedPlugInId(int uniqueId, const String8& path, const String8& mimeType);
-
- String8 getSupportedPlugInId(const String8& mimeType);
-
- String8 getSupportedPlugInIdFromPath(int uniqueId, const String8& path);
-
- bool canHandle(int uniqueId, const String8& path);
-
-private:
- enum {
- kMaxNumUniqueIds = 0x1000,
- };
-
- bool mUniqueIdArray[kMaxNumUniqueIds];
- static const String8 EMPTY_STRING;
-
- int mDecryptSessionId;
- int mConvertId;
- Mutex mLock;
- Mutex mListenerLock;
- Mutex mDecryptLock;
- Mutex mConvertLock;
- TPlugInManager<IDrmEngine> mPlugInManager;
- KeyedVector< DrmSupportInfo, String8 > mSupportInfoToPlugInIdMap;
- KeyedVector< int, IDrmEngine*> mConvertSessionMap;
- KeyedVector< int, sp<IDrmServiceListener> > mServiceListeners;
- KeyedVector< int, IDrmEngine*> mDecryptSessionMap;
-};
-
-};
-
-#endif /* __DRM_MANAGER_H__ */
-
diff --git a/drm/libdrmframework/include/DrmManagerService.h b/drm/libdrmframework/include/DrmManagerService.h
deleted file mode 100644
index 45cee2e..0000000
--- a/drm/libdrmframework/include/DrmManagerService.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __DRM_MANAGER_SERVICE_H__
-#define __DRM_MANAGER_SERVICE_H__
-
-#include <utils/RefBase.h>
-#include <utils/KeyedVector.h>
-#include <binder/IInterface.h>
-#include <binder/Parcel.h>
-#include "IDrmManagerService.h"
-#include "IDrmServiceListener.h"
-
-namespace android {
-
-class DrmManager;
-class String8;
-class Mutex;
-
-/**
- * This is the implementation class for DRM manager service. This delegates
- * the responsibility to DrmManager.
- *
- * The instance of this class is created while starting the DRM manager service.
- *
- */
-class DrmManagerService : public BnDrmManagerService {
-public:
- static void instantiate();
-
-private:
- enum drm_perm_t {
- CONSUME_RIGHTS = 0,
- SET_PLAYBACK_STATUS = 1,
- OPEN_DECRYPT_SESSION = 2,
- CLOSE_DECRYPT_SESSION = 3,
- INITIALIZE_DECRYPT_UNIT = 4,
- DECRYPT = 5,
- FINALIZE_DECRYPT_UNIT = 6,
- PREAD = 7,
- };
-
- static const char *const drm_perm_labels[];
-
- DrmManagerService();
- virtual ~DrmManagerService();
-
- static const char *get_perm_label(drm_perm_t perm);
-
- static bool selinuxIsProtectedCallAllowed(pid_t spid, drm_perm_t perm);
-
- static bool isProtectedCallAllowed(drm_perm_t perm);
-
-public:
- int addUniqueId(bool isNative);
-
- void removeUniqueId(int uniqueId);
-
- void addClient(int uniqueId);
-
- void removeClient(int uniqueId);
-
- status_t setDrmServiceListener(
- int uniqueId, const sp<IDrmServiceListener>& drmServiceListener);
-
- DrmConstraints* getConstraints(int uniqueId, const String8* path, const int action);
-
- DrmMetadata* getMetadata(int uniqueId, const String8* path);
-
- bool canHandle(int uniqueId, const String8& path, const String8& mimeType);
-
- DrmInfoStatus* processDrmInfo(int uniqueId, const DrmInfo* drmInfo);
-
- DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInforequest);
-
- status_t saveRights(int uniqueId, const DrmRights& drmRights,
- const String8& rightsPath, const String8& contentPath);
-
- String8 getOriginalMimeType(int uniqueId, const String8& path, int fd);
-
- int getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType);
-
- int checkRightsStatus(int uniqueId, const String8& path,int action);
-
- status_t consumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve);
-
- status_t setPlaybackStatus(
- int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position);
-
- bool validateAction(int uniqueId, const String8& path,
- int action, const ActionDescription& description);
-
- status_t removeRights(int uniqueId, const String8& path);
-
- status_t removeAllRights(int uniqueId);
-
- int openConvertSession(int uniqueId, const String8& mimeType);
-
- DrmConvertedStatus* convertData(int uniqueId, int convertId, const DrmBuffer* inputData);
-
- DrmConvertedStatus* closeConvertSession(int uniqueId, int convertId);
-
- status_t getAllSupportInfo(int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray);
-
- DecryptHandle* openDecryptSession(
- int uniqueId, int fd, off64_t offset, off64_t length, const char *mime);
-
- DecryptHandle* openDecryptSession(
- int uniqueId, const char* uri, const char* mime);
-
- DecryptHandle* openDecryptSession(int uniqueId, const DrmBuffer& buf,
- const String8& mimeType);
-
- status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle);
-
- status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
- int decryptUnitId, const DrmBuffer* headerInfo);
-
- status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
- const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV);
-
- status_t finalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId);
-
- ssize_t pread(int uniqueId, DecryptHandle* decryptHandle,
- void* buffer, ssize_t numBytes, off64_t offset);
-
- virtual status_t dump(int fd, const Vector<String16>& args);
-
-private:
- DrmManager* mDrmManager;
-};
-
-};
-
-#endif /* __DRM_MANAGER_SERVICE_H__ */
-
diff --git a/drm/libdrmframework/include/IDrmManagerService.h b/drm/libdrmframework/include/IDrmManagerService.h
deleted file mode 100644
index 0376b49..0000000
--- a/drm/libdrmframework/include/IDrmManagerService.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __IDRM_MANAGER_SERVICE_H__
-#define __IDRM_MANAGER_SERVICE_H__
-
-#include <utils/RefBase.h>
-#include <binder/IInterface.h>
-#include <binder/Parcel.h>
-#include <drm/drm_framework_common.h>
-#include "IDrmServiceListener.h"
-
-namespace android {
-
-class DrmConstraints;
-class DrmMetadata;
-class DrmRights;
-class DrmInfo;
-class DrmInfoStatus;
-class DrmInfoRequest;
-class DrmSupportInfo;
-class DrmConvertedStatus;
-class String8;
-class ActionDescription;
-
-/**
- * This is the interface class for DRM Manager service.
- *
- */
-class IDrmManagerService : public IInterface
-{
-public:
- enum {
- ADD_UNIQUEID = IBinder::FIRST_CALL_TRANSACTION,
- REMOVE_UNIQUEID,
- ADD_CLIENT,
- REMOVE_CLIENT,
- SET_DRM_SERVICE_LISTENER,
- INSTALL_DRM_ENGINE,
- GET_CONSTRAINTS_FROM_CONTENT,
- GET_METADATA_FROM_CONTENT,
- CAN_HANDLE,
- PROCESS_DRM_INFO,
- ACQUIRE_DRM_INFO,
- SAVE_RIGHTS,
- GET_ORIGINAL_MIMETYPE,
- GET_DRM_OBJECT_TYPE,
- CHECK_RIGHTS_STATUS,
- CONSUME_RIGHTS,
- SET_PLAYBACK_STATUS,
- VALIDATE_ACTION,
- REMOVE_RIGHTS,
- REMOVE_ALL_RIGHTS,
- OPEN_CONVERT_SESSION,
- CONVERT_DATA,
- CLOSE_CONVERT_SESSION,
- GET_ALL_SUPPORT_INFO,
- OPEN_DECRYPT_SESSION,
- OPEN_DECRYPT_SESSION_FROM_URI,
- OPEN_DECRYPT_SESSION_FOR_STREAMING,
- CLOSE_DECRYPT_SESSION,
- INITIALIZE_DECRYPT_UNIT,
- DECRYPT,
- FINALIZE_DECRYPT_UNIT,
- PREAD
- };
-
-public:
- DECLARE_META_INTERFACE(DrmManagerService);
-
-public:
- virtual int addUniqueId(bool isNative) = 0;
-
- virtual void removeUniqueId(int uniqueId) = 0;
-
- virtual void addClient(int uniqueId) = 0;
-
- virtual void removeClient(int uniqueId) = 0;
-
- virtual status_t setDrmServiceListener(
- int uniqueId, const sp<IDrmServiceListener>& infoListener) = 0;
-
- virtual DrmConstraints* getConstraints(
- int uniqueId, const String8* path, const int action) = 0;
-
- virtual DrmMetadata* getMetadata(int uniqueId, const String8* path) = 0;
-
- virtual bool canHandle(int uniqueId, const String8& path, const String8& mimeType) = 0;
-
- virtual DrmInfoStatus* processDrmInfo(int uniqueId, const DrmInfo* drmInfo) = 0;
-
- virtual DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInforequest) = 0;
-
- virtual status_t saveRights(int uniqueId, const DrmRights& drmRights,
- const String8& rightsPath, const String8& contentPath) = 0;
-
- virtual String8 getOriginalMimeType(int uniqueId, const String8& path, int fd) = 0;
-
- virtual int getDrmObjectType(
- int uniqueId, const String8& path, const String8& mimeType) = 0;
-
- virtual int checkRightsStatus(int uniqueId, const String8& path, int action) = 0;
-
- virtual status_t consumeRights(
- int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) = 0;
-
- virtual status_t setPlaybackStatus(
- int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) = 0;
-
- virtual bool validateAction(
- int uniqueId, const String8& path,
- int action, const ActionDescription& description) = 0;
-
- virtual status_t removeRights(int uniqueId, const String8& path) = 0;
-
- virtual status_t removeAllRights(int uniqueId) = 0;
-
- virtual int openConvertSession(int uniqueId, const String8& mimeType) = 0;
-
- virtual DrmConvertedStatus* convertData(
- int uniqueId, int convertId, const DrmBuffer* inputData) = 0;
-
- virtual DrmConvertedStatus* closeConvertSession(int uniqueId, int convertId) = 0;
-
- virtual status_t getAllSupportInfo(
- int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray) = 0;
-
- virtual DecryptHandle* openDecryptSession(
- int uniqueId, int fd, off64_t offset,
- off64_t length, const char* mime) = 0;
-
- virtual DecryptHandle* openDecryptSession(
- int uniqueId, const char* uri, const char* mime) = 0;
-
- virtual DecryptHandle* openDecryptSession(
- int uniqueId, const DrmBuffer& buf, const String8& mimeType) = 0;
-
- virtual status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0;
-
- virtual status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
- int decryptUnitId, const DrmBuffer* headerInfo) = 0;
-
- virtual status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
- const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) = 0;
-
- virtual status_t finalizeDecryptUnit(
- int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) = 0;
-
- virtual ssize_t pread(int uniqueId, DecryptHandle* decryptHandle,
- void* buffer, ssize_t numBytes,off64_t offset) = 0;
-};
-
-/**
- * This is the Binder implementation class for DRM Manager service.
- */
-class BpDrmManagerService: public BpInterface<IDrmManagerService>
-{
-public:
- explicit BpDrmManagerService(const sp<IBinder>& impl)
- : BpInterface<IDrmManagerService>(impl) {}
-
- virtual int addUniqueId(bool isNative);
-
- virtual void removeUniqueId(int uniqueId);
-
- virtual void addClient(int uniqueId);
-
- virtual void removeClient(int uniqueId);
-
- virtual status_t setDrmServiceListener(
- int uniqueId, const sp<IDrmServiceListener>& infoListener);
-
- virtual DrmConstraints* getConstraints(int uniqueId, const String8* path, const int action);
-
- virtual DrmMetadata* getMetadata(int uniqueId, const String8* path);
-
- virtual bool canHandle(int uniqueId, const String8& path, const String8& mimeType);
-
- virtual DrmInfoStatus* processDrmInfo(int uniqueId, const DrmInfo* drmInfo);
-
- virtual DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInforequest);
-
- virtual status_t saveRights(int uniqueId, const DrmRights& drmRights,
- const String8& rightsPath, const String8& contentPath);
-
- virtual String8 getOriginalMimeType(int uniqueId, const String8& path, int fd);
-
- virtual int getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType);
-
- virtual int checkRightsStatus(int uniqueId, const String8& path, int action);
-
- virtual status_t consumeRights(
- int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve);
-
- virtual status_t setPlaybackStatus(
- int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position);
-
- virtual bool validateAction(
- int uniqueId, const String8& path, int action, const ActionDescription& description);
-
- virtual status_t removeRights(int uniqueId, const String8& path);
-
- virtual status_t removeAllRights(int uniqueId);
-
- virtual int openConvertSession(int uniqueId, const String8& mimeType);
-
- virtual DrmConvertedStatus* convertData(
- int uniqueId, int convertId, const DrmBuffer* inputData);
-
- virtual DrmConvertedStatus* closeConvertSession(int uniqueId, int convertId);
-
- virtual status_t getAllSupportInfo(
- int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray);
-
- virtual DecryptHandle* openDecryptSession(
- int uniqueId, int fd, off64_t offset, off64_t length,
- const char* mime);
-
- virtual DecryptHandle* openDecryptSession(
- int uniqueId, const char* uri, const char* mime);
-
- virtual DecryptHandle* openDecryptSession(
- int uniqueId, const DrmBuffer& buf, const String8& mimeType);
-
- virtual status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle);
-
- virtual status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
- int decryptUnitId, const DrmBuffer* headerInfo);
-
- virtual status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
- const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV);
-
- virtual status_t finalizeDecryptUnit(
- int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId);
-
- virtual ssize_t pread(int uniqueId, DecryptHandle* decryptHandle,
- void* buffer, ssize_t numBytes, off64_t offset);
-};
-
-/**
- * This is the Binder implementation class for DRM Manager service.
- */
-class BnDrmManagerService: public BnInterface<IDrmManagerService>
-{
-public:
- virtual status_t onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0);
-};
-
-};
-
-#endif /* __IDRM_MANAGER_SERVICE_H__ */
-
diff --git a/drm/libdrmframework/include/IDrmServiceListener.h b/drm/libdrmframework/include/IDrmServiceListener.h
deleted file mode 100644
index 78c5d1a..0000000
--- a/drm/libdrmframework/include/IDrmServiceListener.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __IDRM_SERVICE_LISTENER_H__
-#define __IDRM_SERVICE_LISTENER_H__
-
-#include <utils/RefBase.h>
-#include <binder/IInterface.h>
-#include <binder/Parcel.h>
-
-namespace android {
-
-class DrmInfoEvent;
-
-/**
- * This is the interface class for DRM service listener.
- *
- */
-class IDrmServiceListener : public IInterface
-{
-public:
- enum {
- NOTIFY = IBinder::FIRST_CALL_TRANSACTION,
- };
-
-public:
- DECLARE_META_INTERFACE(DrmServiceListener);
-
-public:
- virtual status_t notify(const DrmInfoEvent& event) = 0;
-};
-
-/**
- * This is the Binder implementation class for DRM service listener.
- */
-class BpDrmServiceListener: public BpInterface<IDrmServiceListener>
-{
-public:
- explicit BpDrmServiceListener(const sp<IBinder>& impl)
- : BpInterface<IDrmServiceListener>(impl) {}
-
- virtual status_t notify(const DrmInfoEvent& event);
-};
-
-/**
- * This is the Binder implementation class for DRM service listener.
- */
-class BnDrmServiceListener: public BnInterface<IDrmServiceListener>
-{
-public:
- virtual status_t onTransact(
- uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0);
-};
-
-};
-
-#endif /* __IDRM_SERVICE_LISTENER_H__ */
-
diff --git a/drm/libdrmframework/include/PlugInManager.h b/drm/libdrmframework/include/PlugInManager.h
deleted file mode 100644
index 466844d..0000000
--- a/drm/libdrmframework/include/PlugInManager.h
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __PLUGIN_MANAGER_H__
-#define __PLUGIN_MANAGER_H__
-
-#include <dlfcn.h>
-#include <sys/types.h>
-#include <dirent.h>
-
-#include <utils/String8.h>
-#include <utils/Vector.h>
-#include <utils/KeyedVector.h>
-
-namespace android {
-
-const char* const PLUGIN_MANAGER_CREATE = "create";
-const char* const PLUGIN_MANAGER_DESTROY = "destroy";
-const char* const PLUGIN_EXTENSION = ".so";
-
-/**
- * This is the template class for Plugin manager.
- *
- * The DrmManager uses this class to handle the plugins.
- *
- */
-template<typename Type>
-class TPlugInManager {
-private:
- typedef void* HANDLE;
- typedef Type* create_t(void);
- typedef void destroy_t(Type*);
- typedef create_t* FPCREATE;
- typedef destroy_t* FPDESTORY;
-
- typedef struct _PlugInContainer {
- String8 sPath;
- HANDLE hHandle;
- FPCREATE fpCreate;
- FPDESTORY fpDestory;
- Type* pInstance;
-
- _PlugInContainer():
- sPath("")
- ,hHandle(NULL)
- ,fpCreate(NULL)
- ,fpDestory(NULL)
- ,pInstance(NULL)
- {}
- } PlugInContainer;
-
- typedef KeyedVector<String8, PlugInContainer*> PlugInMap;
- PlugInMap m_plugInMap;
-
- typedef Vector<String8> PlugInIdList;
- PlugInIdList m_plugInIdList;
-
-public:
- /**
- * Load all the plug-ins in the specified directory
- *
- * @param[in] rsPlugInDirPath
- * Directory path which plug-ins (dynamic library) are stored
- * @note Plug-ins should be implemented according to the specification
- */
- void loadPlugIns(const String8& rsPlugInDirPath) {
- Vector<String8> plugInFileList = getPlugInPathList(rsPlugInDirPath);
-
- if (!plugInFileList.isEmpty()) {
- for (size_t i = 0; i < plugInFileList.size(); ++i) {
- loadPlugIn(plugInFileList[i]);
- }
- }
- }
-
- /**
- * Unload all the plug-ins
- *
- */
- void unloadPlugIns() {
- for (size_t i = 0; i < m_plugInIdList.size(); ++i) {
- unloadPlugIn(m_plugInIdList[i]);
- }
- m_plugInIdList.clear();
- }
-
- /**
- * Get all the IDs of available plug-ins
- *
- * @return[in] plugInIdList
- * String type Vector in which all plug-in IDs are stored
- */
- Vector<String8> getPlugInIdList() const {
- return m_plugInIdList;
- }
-
- /**
- * Get a plug-in reference of specified ID
- *
- * @param[in] rsPlugInId
- * Plug-in ID to be used
- * @return plugIn
- * Reference of specified plug-in instance
- */
- Type& getPlugIn(const String8& rsPlugInId) {
- if (!contains(rsPlugInId)) {
- // This error case never happens
- }
- return *(m_plugInMap.valueFor(rsPlugInId)->pInstance);
- }
-
-public:
- /**
- * Load a plug-in stored in the specified path
- *
- * @param[in] rsPlugInPath
- * Plug-in (dynamic library) file path
- * @note Plug-in should be implemented according to the specification
- */
- void loadPlugIn(const String8& rsPlugInPath) {
- if (contains(rsPlugInPath)) {
- return;
- }
-
- PlugInContainer* pPlugInContainer = new PlugInContainer();
-
- pPlugInContainer->hHandle = dlopen(rsPlugInPath.string(), RTLD_LAZY);
-
- if (NULL == pPlugInContainer->hHandle) {
- delete pPlugInContainer;
- pPlugInContainer = NULL;
- return;
- }
-
- pPlugInContainer->sPath = rsPlugInPath;
- pPlugInContainer->fpCreate
- = (FPCREATE)dlsym(pPlugInContainer->hHandle, PLUGIN_MANAGER_CREATE);
- pPlugInContainer->fpDestory
- = (FPDESTORY)dlsym(pPlugInContainer->hHandle, PLUGIN_MANAGER_DESTROY);
-
- if (NULL != pPlugInContainer->fpCreate && NULL != pPlugInContainer->fpDestory) {
- pPlugInContainer->pInstance = (Type*)pPlugInContainer->fpCreate();
- m_plugInIdList.add(rsPlugInPath);
- m_plugInMap.add(rsPlugInPath, pPlugInContainer);
- } else {
- dlclose(pPlugInContainer->hHandle);
- delete pPlugInContainer;
- pPlugInContainer = NULL;
- return;
- }
- }
-
- /**
- * Unload a plug-in stored in the specified path
- *
- * @param[in] rsPlugInPath
- * Plug-in (dynamic library) file path
- */
- void unloadPlugIn(const String8& rsPlugInPath) {
- if (!contains(rsPlugInPath)) {
- return;
- }
-
- PlugInContainer* pPlugInContainer = m_plugInMap.valueFor(rsPlugInPath);
- pPlugInContainer->fpDestory(pPlugInContainer->pInstance);
- dlclose(pPlugInContainer->hHandle);
-
- m_plugInMap.removeItem(rsPlugInPath);
- delete pPlugInContainer;
- pPlugInContainer = NULL;
- }
-
-private:
- /**
- * True if TPlugInManager contains rsPlugInId
- */
- bool contains(const String8& rsPlugInId) {
- return m_plugInMap.indexOfKey(rsPlugInId) != NAME_NOT_FOUND;
- }
-
- /**
- * Return file path list of plug-ins stored in the specified directory
- *
- * @param[in] rsDirPath
- * Directory path in which plug-ins are stored
- * @return plugInFileList
- * String type Vector in which file path of plug-ins are stored
- */
- Vector<String8> getPlugInPathList(const String8& rsDirPath) {
- Vector<String8> fileList;
- DIR* pDir = opendir(rsDirPath.string());
- struct dirent* pEntry;
-
- while (NULL != pDir && NULL != (pEntry = readdir(pDir))) {
- if (!isPlugIn(pEntry)) {
- continue;
- }
- String8 plugInPath;
- plugInPath += rsDirPath;
- plugInPath += "/";
- plugInPath += pEntry->d_name;
-
- fileList.add(plugInPath);
- }
-
- if (NULL != pDir) {
- closedir(pDir);
- }
-
- return fileList;
- }
-
- /**
- * True if the input name denotes plug-in
- */
- bool isPlugIn(const struct dirent* pEntry) const {
- String8 sName(pEntry->d_name);
- String8 extension(sName.getPathExtension());
- // Note that the plug-in extension must exactly match case
- return extension == String8(PLUGIN_EXTENSION);
- }
-
- /**
- * True if input entry is directory
- */
- bool isDirectory(const struct dirent* pEntry) const {
- return DT_DIR == pEntry->d_type;
- }
-
- /**
- * True if input entry is regular file
- */
- bool isRegularFile(const struct dirent* pEntry) const {
- return DT_REG == pEntry->d_type;
- }
-
- /**
- * True if input entry is link
- */
- bool isLink(const struct dirent* pEntry) const {
- return DT_LNK == pEntry->d_type;
- }
-};
-
-};
-
-#endif /* __PLUGIN_MANAGER_H__ */
-
diff --git a/drm/libdrmframework/include/ReadWriteUtils.h b/drm/libdrmframework/include/ReadWriteUtils.h
deleted file mode 100644
index 529b342..0000000
--- a/drm/libdrmframework/include/ReadWriteUtils.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __READ_WRITE_UTILS_H__
-#define __READ_WRITE_UTILS_H__
-
-#include <utils/FileMap.h>
-#include <drm/drm_framework_common.h>
-
-namespace android {
-
-/**
- * This is an utility class which performs IO operations.
- *
- */
-class ReadWriteUtils {
-public:
- /**
- * Constructor for ReadWriteUtils
- */
- ReadWriteUtils() {}
-
- /**
- * Destructor for ReadWriteUtils
- */
- virtual ~ReadWriteUtils();
-
-public:
- /**
- * Reads the data from the file path provided
- *
- * @param[in] filePath Path of the file
- * @return Data read from the file
- */
- static String8 readBytes(const String8& filePath);
- /**
- * Reads the data into the given buffer from the file path provided
- *
- * @param[in] filePath Path of the file
- * @param[out] buffer Data read from the file
- * @return Length of the data read from the file
- */
- static int readBytes(const String8& filePath, char** buffer);
- /**
- * Writes the data into the file path provided
- *
- * @param[in] filePath Path of the file
- * @param[in] dataBuffer Data to write
- */
- static void writeToFile(const String8& filePath, const String8& data);
- /**
- * Appends the data into the file path provided
- *
- * @param[in] filePath Path of the file
- * @param[in] dataBuffer Data to append
- */
- static void appendToFile(const String8& filePath, const String8& data);
-
-private:
- FileMap* mFileMap;
-};
-
-};
-
-#endif /* __READ_WRITE_UTILS_H__ */
-
diff --git a/drm/libdrmframework/plugins/Android.mk b/drm/libdrmframework/plugins/Android.mk
deleted file mode 100644
index 9ee7961..0000000
--- a/drm/libdrmframework/plugins/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-include $(call all-subdir-makefiles)
diff --git a/drm/libdrmframework/plugins/common/Android.bp b/drm/libdrmframework/plugins/common/Android.bp
new file mode 100644
index 0000000..213e57f
--- /dev/null
+++ b/drm/libdrmframework/plugins/common/Android.bp
@@ -0,0 +1 @@
+subdirs = ["util"]
diff --git a/drm/libdrmframework/plugins/common/Android.mk b/drm/libdrmframework/plugins/common/Android.mk
deleted file mode 100644
index 9ee7961..0000000
--- a/drm/libdrmframework/plugins/common/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-include $(call all-subdir-makefiles)
diff --git a/drm/libdrmframework/plugins/common/include/DrmEngineBase.h b/drm/libdrmframework/plugins/common/include/DrmEngineBase.h
deleted file mode 100644
index 417107f..0000000
--- a/drm/libdrmframework/plugins/common/include/DrmEngineBase.h
+++ /dev/null
@@ -1,529 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __DRM_ENGINE_BASE_H__
-#define __DRM_ENGINE_BASE_H__
-
-#include <drm/drm_framework_common.h>
-#include "IDrmEngine.h"
-
-namespace android {
-
-/**
- * This class is an interface for plug-in developers
- *
- * Responsibility of this class is control the sequence of actual plug-in.
- * All each plug-in developer has to do is implement onXXX() type virtual interfaces.
- */
-class DrmEngineBase : public IDrmEngine {
-public:
- DrmEngineBase();
- virtual ~DrmEngineBase();
-
-public:
- DrmConstraints* getConstraints(int uniqueId, const String8* path, int action);
-
- DrmMetadata* getMetadata(int uniqueId, const String8* path);
-
- status_t initialize(int uniqueId);
-
- status_t setOnInfoListener(int uniqueId, const IDrmEngine::OnInfoListener* infoListener);
-
- status_t terminate(int uniqueId);
-
- bool canHandle(int uniqueId, const String8& path);
-
- DrmInfoStatus* processDrmInfo(int uniqueId, const DrmInfo* drmInfo);
-
- status_t saveRights(int uniqueId, const DrmRights& drmRights,
- const String8& rightsPath, const String8& contentPath);
-
- DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest);
-
- String8 getOriginalMimeType(int uniqueId, const String8& path, int fd);
-
- int getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType);
-
- int checkRightsStatus(int uniqueId, const String8& path, int action);
-
- status_t consumeRights(int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve);
-
- status_t setPlaybackStatus(
- int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position);
-
- bool validateAction(
- int uniqueId, const String8& path, int action, const ActionDescription& description);
-
- status_t removeRights(int uniqueId, const String8& path);
-
- status_t removeAllRights(int uniqueId);
-
- status_t openConvertSession(int uniqueId, int convertId);
-
- DrmConvertedStatus* convertData(int uniqueId, int convertId, const DrmBuffer* inputData);
-
- DrmConvertedStatus* closeConvertSession(int uniqueId, int convertId);
-
- DrmSupportInfo* getSupportInfo(int uniqueId);
-
- status_t openDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle,
- int fd, off64_t offset, off64_t length, const char* mime);
-
- status_t openDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle,
- const char* uri, const char* mime);
-
- status_t openDecryptSession(int uniqueId, DecryptHandle* decryptHandle,
- const DrmBuffer& buf, const String8& mimeType);
-
- status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle);
-
- status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
- int decryptUnitId, const DrmBuffer* headerInfo);
-
- status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
- const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV);
-
- status_t finalizeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId);
-
- ssize_t pread(int uniqueId, DecryptHandle* decryptHandle,
- void* buffer, ssize_t numBytes, off64_t offset);
-
-protected:
- /////////////////////////////////////////////////////
- // Interface for plug-in developers //
- // each plug-in has to implement following method //
- /////////////////////////////////////////////////////
- /**
- * Get constraint information associated with input content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path of the protected content
- * @param[in] action Actions defined such as,
- * Action::DEFAULT, Action::PLAY, etc
- * @return DrmConstraints
- * key-value pairs of constraint are embedded in it
- * @note
- * In case of error, return NULL
- */
- virtual DrmConstraints* onGetConstraints(
- int uniqueId, const String8* path, int action) = 0;
-
- /**
- * Get metadata information associated with input content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path of the protected content
- * @return DrmMetadata
- * key-value pairs of metadata
- * @note
- * In case of error, return NULL
- */
- virtual DrmMetadata* onGetMetadata(int uniqueId, const String8* path) = 0;
-
- /**
- * Initialize plug-in
- *
- * @param[in] uniqueId Unique identifier for a session
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t onInitialize(int uniqueId) = 0;
-
- /**
- * Register a callback to be invoked when the caller required to
- * receive necessary information
- *
- * @param[in] uniqueId Unique identifier for a session. uniqueId is a random
- * number generated in the DRM service. If the DrmManagerClient
- * is created in native code, uniqueId will be a number ranged
- * from 0x1000 to 0x1fff. If it comes from Java code, the uniqueId
- * will be a number ranged from 0x00 to 0xfff. So bit 0x1000 in
- * uniqueId could be used in DRM plugins to differentiate native
- * OnInfoListener and Java OnInfoListener.
- * @param[in] infoListener Listener
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t onSetOnInfoListener(
- int uniqueId, const IDrmEngine::OnInfoListener* infoListener) = 0;
-
- /**
- * Terminate the plug-in
- * and release resource bound to plug-in
- *
- * @param[in] uniqueId Unique identifier for a session
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t onTerminate(int uniqueId) = 0;
-
- /**
- * Get whether the given content can be handled by this plugin or not
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path the protected object
- * @return bool
- * Returns true if this plugin can handle , false in case of not able to handle
- */
- virtual bool onCanHandle(int uniqueId, const String8& path) = 0;
-
- /**
- * Executes given drm information based on its type
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] drmInfo Information needs to be processed
- * @return DrmInfoStatus
- * instance as a result of processing given input
- */
- virtual DrmInfoStatus* onProcessDrmInfo(int uniqueId, const DrmInfo* drmInfo) = 0;
-
- /**
- * Save DRM rights to specified rights path
- * and make association with content path
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] drmRights DrmRights to be saved
- * @param[in] rightsPath File path where rights to be saved
- * @param[in] contentPath File path where content was saved
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t onSaveRights(int uniqueId, const DrmRights& drmRights,
- const String8& rightspath, const String8& contentPath) = 0;
-
- /**
- * Retrieves necessary information for registration, unregistration or rights
- * acquisition information.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] drmInfoRequest Request information to retrieve drmInfo
- * @return DrmInfo
- * instance as a result of processing given input
- */
- virtual DrmInfo* onAcquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInforequest) = 0;
-
- /**
- * Retrieves the mime type embedded inside the original content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path of the protected content
- * @param[in] fd descriptor of the protected content as a file source
- * @return String8
- * Returns mime-type of the original content, such as "video/mpeg"
- */
- virtual String8 onGetOriginalMimeType(int uniqueId, const String8& path, int fd) = 0;
-
- /**
- * Retrieves the type of the protected object (content, rights, etc..)
- * using specified path or mimetype. At least one parameter should be non null
- * to retrieve DRM object type
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path of the content or null.
- * @param[in] mimeType Mime type of the content or null.
- * @return type of the DRM content,
- * such as DrmObjectType::CONTENT, DrmObjectType::RIGHTS_OBJECT
- */
- virtual int onGetDrmObjectType(
- int uniqueId, const String8& path, const String8& mimeType) = 0;
-
- /**
- * Check whether the given content has valid rights or not
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path of the protected content
- * @param[in] action Action to perform (Action::DEFAULT, Action::PLAY, etc)
- * @return the status of the rights for the protected content,
- * such as RightsStatus::RIGHTS_VALID, RightsStatus::RIGHTS_EXPIRED, etc.
- */
- virtual int onCheckRightsStatus(int uniqueId, const String8& path, int action) = 0;
-
- /**
- * Consumes the rights for a content.
- * If the reserve parameter is true the rights is reserved until the same
- * application calls this api again with the reserve parameter set to false.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the decryption session
- * @param[in] action Action to perform. (Action::DEFAULT, Action::PLAY, etc)
- * @param[in] reserve True if the rights should be reserved.
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t onConsumeRights(int uniqueId, DecryptHandle* decryptHandle,
- int action, bool reserve) = 0;
-
- /**
- * Informs the DRM Engine about the playback actions performed on the DRM files.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the decryption session
- * @param[in] playbackStatus Playback action (Playback::START, Playback::STOP, Playback::PAUSE)
- * @param[in] position Position in the file (in milliseconds) where the start occurs.
- * Only valid together with Playback::START.
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t onSetPlaybackStatus(
- int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) = 0;
-
- /**
- * Validates whether an action on the DRM content is allowed or not.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path of the protected content
- * @param[in] action Action to validate (Action::PLAY, Action::TRANSFER, etc)
- * @param[in] description Detailed description of the action
- * @return true if the action is allowed.
- */
- virtual bool onValidateAction(int uniqueId, const String8& path,
- int action, const ActionDescription& description) = 0;
-
- /**
- * Removes the rights associated with the given protected content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path of the protected content
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t onRemoveRights(int uniqueId, const String8& path) = 0;
-
- /**
- * Removes all the rights information of each plug-in associated with
- * DRM framework. Will be used in master reset
- *
- * @param[in] uniqueId Unique identifier for a session
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t onRemoveAllRights(int uniqueId) = 0;
-
- /**
- * This API is for Forward Lock based DRM scheme.
- * Each time the application tries to download a new DRM file
- * which needs to be converted, then the application has to
- * begin with calling this API.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] convertId Handle for the convert session
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t onOpenConvertSession(int uniqueId, int convertId) = 0;
-
- /**
- * Accepts and converts the input data which is part of DRM file.
- * The resultant converted data and the status is returned in the DrmConvertedInfo
- * object. This method will be called each time there are new block
- * of data received by the application.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] convertId Handle for the convert session
- * @param[in] inputData Input Data which need to be converted
- * @return Return object contains the status of the data conversion,
- * the output converted data and offset. In this case the
- * application will ignore the offset information.
- */
- virtual DrmConvertedStatus* onConvertData(
- int uniqueId, int convertId, const DrmBuffer* inputData) = 0;
-
- /**
- * Informs the Drm Agent when there is no more data which need to be converted
- * or when an error occurs. Upon successful conversion of the complete data,
- * the agent will inform that where the header and body signature
- * should be added. This signature appending is needed to integrity
- * protect the converted file.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] convertId Handle for the convert session
- * @return Return object contains the status of the data conversion,
- * the header and body signature data. It also informs
- * the application on which offset these signature data
- * should be appended.
- */
- virtual DrmConvertedStatus* onCloseConvertSession(int uniqueId, int convertId) = 0;
-
- /**
- * Returns the information about the Drm Engine capabilities which includes
- * supported MimeTypes and file suffixes.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @return DrmSupportInfo
- * instance which holds the capabilities of a plug-in
- */
- virtual DrmSupportInfo* onGetSupportInfo(int uniqueId) = 0;
-
- /**
- * Open the decrypt session to decrypt the given protected content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the current decryption session
- * @param[in] fd File descriptor of the protected content to be decrypted
- * @param[in] offset Start position of the content
- * @param[in] length The length of the protected content
- * @return
- * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
- */
- virtual status_t onOpenDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle,
- int fd, off64_t offset, off64_t length) = 0;
-
- /**
- * Open the decrypt session to decrypt the given protected content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the current decryption session
- * @param[in] fd File descriptor of the protected content to be decrypted
- * @param[in] offset Start position of the content
- * @param[in] length The length of the protected content
- * @param[in] mime Mime type of the protected content
- * drm plugin may do some optimization since the mime type is known.
- * @return
- * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
- */
- virtual status_t onOpenDecryptSession(
- int /* uniqueId */, DecryptHandle* /* decryptHandle */,
- int /* fd */, off64_t /* offset */, off64_t /* length */,
- const char* /* mime */) {
-
- return DRM_ERROR_CANNOT_HANDLE;
- }
-
- /**
- * Open the decrypt session to decrypt the given protected content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the current decryption session
- * @param[in] uri Path of the protected content to be decrypted
- * @return
- * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
- */
- virtual status_t onOpenDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle,
- const char* uri) = 0;
-
- /**
- * Open the decrypt session to decrypt the given protected content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the current decryption session
- * @param[in] uri Path of the protected content to be decrypted
- * @param[in] mime Mime type of the protected content. The corresponding
- * drm plugin may do some optimization since the mime type is known.
- * @return
- * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
- */
- virtual status_t onOpenDecryptSession(
- int /* uniqueId */, DecryptHandle* /* decryptHandle */,
- const char* /* uri */, const char* /* mime */) {
-
- return DRM_ERROR_CANNOT_HANDLE;
- }
-
- /**
- * Open the decrypt session to decrypt the given protected content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the current decryption session
- * @param[in] buf Data to initiate decrypt session
- * @param[in] mimeType Mime type of the protected content
- * @return
- * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
- */
- virtual status_t onOpenDecryptSession(int /* uniqueId */,
- DecryptHandle* /* decryptHandle */,
- const DrmBuffer& /* buf */,
- const String8& /* mimeType */) {
- return DRM_ERROR_CANNOT_HANDLE;
- }
-
- /**
- * Close the decrypt session for the given handle
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the decryption session
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t onCloseDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0;
-
- /**
- * Initialize decryption for the given unit of the protected content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptId Handle for the decryption session
- * @param[in] decryptUnitId ID Specifies decryption unit, such as track ID
- * @param[in] headerInfo Information for initializing decryption of this decrypUnit
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
- int decryptUnitId, const DrmBuffer* headerInfo) = 0;
-
- /**
- * Decrypt the protected content buffers for the given unit
- * This method will be called any number of times, based on number of
- * encrypted streams received from application.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptId Handle for the decryption session
- * @param[in] decryptUnitId ID Specifies decryption unit, such as track ID
- * @param[in] encBuffer Encrypted data block
- * @param[out] decBuffer Decrypted data block
- * @param[in] IV Optional buffer
- * @return status_t
- * Returns the error code for this API
- * DRM_NO_ERROR for success, and one of DRM_ERROR_UNKNOWN, DRM_ERROR_LICENSE_EXPIRED
- * DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED,
- * DRM_ERROR_DECRYPT for failure.
- */
- virtual status_t onDecrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
- const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) = 0;
-
- /**
- * Finalize decryption for the given unit of the protected content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the decryption session
- * @param[in] decryptUnitId ID Specifies decryption unit, such as track ID
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t onFinalizeDecryptUnit(
- int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) = 0;
-
- /**
- * Reads the specified number of bytes from an open DRM file.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the decryption session
- * @param[out] buffer Reference to the buffer that should receive the read data.
- * @param[in] numBytes Number of bytes to read.
- * @param[in] offset Offset with which to update the file position.
- *
- * @return Number of bytes read. Returns -1 for Failure.
- */
- virtual ssize_t onPread(int uniqueId, DecryptHandle* decryptHandle,
- void* buffer, ssize_t numBytes, off64_t offset) = 0;
-};
-
-};
-
-#endif /* __DRM_ENGINE_BASE_H__ */
-
diff --git a/drm/libdrmframework/plugins/common/include/IDrmEngine.h b/drm/libdrmframework/plugins/common/include/IDrmEngine.h
deleted file mode 100644
index acc8ed9..0000000
--- a/drm/libdrmframework/plugins/common/include/IDrmEngine.h
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __IDRM_ENGINE_H__
-#define __IDRM_ENGINE_H__
-
-#include <drm/drm_framework_common.h>
-
-namespace android {
-
-class DrmConstraints;
-class DrmMetadata;
-class DrmRights;
-class DrmInfo;
-class DrmInfoStatus;
-class DrmConvertedStatus;
-class DrmInfoRequest;
-class DrmSupportInfo;
-class DrmInfoEvent;
-
-/**
- * This class is an interface for plug-in user
- *
- * Responsibility of this class is provide generic interface to DRM Engine Manager.
- * Each interface need to be as abstract as possible.
- */
-class IDrmEngine {
-public:
- virtual ~IDrmEngine() {
- }
-
-public:
- class OnInfoListener {
-
- public:
- virtual void onInfo(const DrmInfoEvent& event) = 0;
-
- virtual ~OnInfoListener() { }
- };
-
-public:
-
- //////////////////////////////////
- // Implementation of IDrmEngine //
- //////////////////////////////////
-
- /**
- * Initialize plug-in
- *
- * @param[in] uniqueId Unique identifier for a session
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t initialize(int uniqueId) = 0;
-
- /**
- * Register a callback to be invoked when the caller required to
- * receive necessary information
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] infoListener Listener
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t setOnInfoListener(
- int uniqueId, const IDrmEngine::OnInfoListener* infoListener) = 0;
-
- /**
- * Terminate the plug-in
- * and release resource bound to plug-in
- * e.g.) release native resource
- *
- * @param[in] uniqueId Unique identifier for a session
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t terminate(int uniqueId) = 0;
-
- /**
- * Get constraint information associated with input content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path of the protected content
- * @param[in] action Actions defined such as,
- * Action::DEFAULT, Action::PLAY, etc
- * @return DrmConstraints
- * key-value pairs of constraint are embedded in it
- * @note
- * In case of error, return NULL
- */
- virtual DrmConstraints* getConstraints(
- int uniqueId, const String8* path, int action) = 0;
-
- /**
- * Get metadata information associated with input content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path of the protected content
- * @return DrmMetadata
- * key-value pairs of metadata
- * @note
- * In case of error, return NULL
- */
- virtual DrmMetadata* getMetadata(int uniqueId, const String8* path) = 0;
-
- /**
- * Get whether the given content can be handled by this plugin or not
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path the protected object
- * @return bool
- * true if this plugin can handle , false in case of not able to handle
- */
- virtual bool canHandle(int uniqueId, const String8& path) = 0;
-
- /**
- * Executes given drm information based on its type
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] drmInfo Information needs to be processed
- * @return DrmInfoStatus
- * instance as a result of processing given input
- */
- virtual DrmInfoStatus* processDrmInfo(int uniqueId, const DrmInfo* drmInfo) = 0;
-
- /**
- * Retrieves necessary information for registration, unregistration or rights
- * acquisition information.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] drmInfoRequest Request information to retrieve drmInfo
- * @return DrmInfo
- * instance as a result of processing given input
- */
- virtual DrmInfo* acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest) = 0;
-
- /**
- * Save DRM rights to specified rights path
- * and make association with content path
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] drmRights DrmRights to be saved
- * @param[in] rightsPath File path where rights to be saved
- * @param[in] contentPath File path where content was saved
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t saveRights(int uniqueId, const DrmRights& drmRights,
- const String8& rightsPath, const String8& contentPath) = 0;
-
- /**
- * Retrieves the mime type embedded inside the original content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path of the content or null.
- * @param[in] fd File descriptor of the protected content
- * @return String8
- * Returns mime-type of the original content, such as "video/mpeg"
- */
- virtual String8 getOriginalMimeType(int uniqueId, const String8& path, int fd) = 0;
-
- /**
- * Retrieves the type of the protected object (content, rights, etc..)
- * using specified path or mimetype. At least one parameter should be non null
- * to retrieve DRM object type
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path of the content or null.
- * @param[in] mimeType Mime type of the content or null.
- * @return type of the DRM content,
- * such as DrmObjectType::CONTENT, DrmObjectType::RIGHTS_OBJECT
- */
- virtual int getDrmObjectType(
- int uniqueId, const String8& path, const String8& mimeType) = 0;
-
- /**
- * Check whether the given content has valid rights or not
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path of the protected content
- * @param[in] action Action to perform (Action::DEFAULT, Action::PLAY, etc)
- * @return the status of the rights for the protected content,
- * such as RightsStatus::RIGHTS_VALID, RightsStatus::RIGHTS_EXPIRED, etc.
- */
- virtual int checkRightsStatus(int uniqueId, const String8& path, int action) = 0;
-
- /**
- * Consumes the rights for a content.
- * If the reserve parameter is true the rights is reserved until the same
- * application calls this api again with the reserve parameter set to false.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the decryption session
- * @param[in] action Action to perform. (Action::DEFAULT, Action::PLAY, etc)
- * @param[in] reserve True if the rights should be reserved.
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t consumeRights(
- int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) = 0;
-
- /**
- * Informs the DRM Engine about the playback actions performed on the DRM files.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the decryption session
- * @param[in] playbackStatus Playback action (Playback::START, Playback::STOP, Playback::PAUSE)
- * @param[in] position Position in the file (in milliseconds) where the start occurs.
- * Only valid together with Playback::START.
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t setPlaybackStatus(int uniqueId, DecryptHandle* decryptHandle,
- int playbackStatus, int64_t position) = 0;
-
- /**
- * Validates whether an action on the DRM content is allowed or not.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path of the protected content
- * @param[in] action Action to validate (Action::PLAY, Action::TRANSFER, etc)
- * @param[in] description Detailed description of the action
- * @return true if the action is allowed.
- */
- virtual bool validateAction(int uniqueId, const String8& path,
- int action, const ActionDescription& description) = 0;
-
- /**
- * Removes the rights associated with the given protected content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] path Path of the protected content
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t removeRights(int uniqueId, const String8& path) = 0;
-
- /**
- * Removes all the rights information of each plug-in associated with
- * DRM framework. Will be used in master reset
- *
- * @param[in] uniqueId Unique identifier for a session
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t removeAllRights(int uniqueId) = 0;
-
- /**
- * This API is for Forward Lock based DRM scheme.
- * Each time the application tries to download a new DRM file
- * which needs to be converted, then the application has to
- * begin with calling this API.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] convertId Handle for the convert session
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t openConvertSession(int uniqueId, int convertId) = 0;
-
- /**
- * Accepts and converts the input data which is part of DRM file.
- * The resultant converted data and the status is returned in the DrmConvertedInfo
- * object. This method will be called each time there are new block
- * of data received by the application.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] convertId Handle for the convert session
- * @param[in] inputData Input Data which need to be converted
- * @return Return object contains the status of the data conversion,
- * the output converted data and offset. In this case the
- * application will ignore the offset information.
- */
- virtual DrmConvertedStatus* convertData(
- int uniqueId, int convertId, const DrmBuffer* inputData) = 0;
-
- /**
- * Informs the Drm Agent when there is no more data which need to be converted
- * or when an error occurs. Upon successful conversion of the complete data,
- * the agent will inform that where the header and body signature
- * should be added. This signature appending is needed to integrity
- * protect the converted file.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] convertId Handle for the convert session
- * @return Return object contains the status of the data conversion,
- * the header and body signature data. It also informs
- * the application on which offset these signature data
- * should be appended.
- */
- virtual DrmConvertedStatus* closeConvertSession( int uniqueId, int convertId) = 0;
-
- /**
- * Returns the information about the Drm Engine capabilities which includes
- * supported MimeTypes and file suffixes.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @return DrmSupportInfo
- * instance which holds the capabilities of a plug-in
- */
- virtual DrmSupportInfo* getSupportInfo(int uniqueId) = 0;
-
- /**
- * Open the decrypt session to decrypt the given protected content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the current decryption session
- * @param[in] fd File descriptor of the protected content to be decrypted
- * @param[in] offset Start position of the content
- * @param[in] length The length of the protected content
- * @param[in] mime Mime type of the protected content if it is
- * not NULL or empty
- * @return
- * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
- */
- virtual status_t openDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle,
- int fd, off64_t offset, off64_t length, const char* mime) = 0;
-
- /**
- * Open the decrypt session to decrypt the given protected content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the current decryption session
- * @param[in] uri Path of the protected content to be decrypted
- * @param[in] mime Mime type of the protected content if it is
- * not NULL or empty
- * @return
- * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
- */
- virtual status_t openDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle,
- const char* uri, const char* mime) = 0;
-
- /**
- * Open the decrypt session to decrypt the given protected content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the current decryption session
- * @param[in] buf Data to initiate decrypt session
- * @param[in] mimeType Mime type of the protected content
- * @return
- * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
- */
- virtual status_t openDecryptSession(int uniqueId, DecryptHandle* decryptHandle,
- const DrmBuffer& buf, const String8& mimeType) = 0;
-
- /**
- * Close the decrypt session for the given handle
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the decryption session
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0;
-
- /**
- * Initialize decryption for the given unit of the protected content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the decryption session
- * @param[in] decryptUnitId ID which specifies decryption unit, such as track ID
- * @param[in] headerInfo Information for initializing decryption of this decrypUnit
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
- int decryptUnitId, const DrmBuffer* headerInfo) = 0;
-
- /**
- * Decrypt the protected content buffers for the given unit
- * This method will be called any number of times, based on number of
- * encrypted streams received from application.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the decryption session
- * @param[in] decryptUnitId ID which specifies decryption unit, such as track ID
- * @param[in] encBuffer Encrypted data block
- * @param[out] decBuffer Decrypted data block
- * @param[in] IV Optional buffer
- * @return status_t
- * Returns the error code for this API
- * DRM_NO_ERROR for success, and one of DRM_ERROR_UNKNOWN, DRM_ERROR_LICENSE_EXPIRED
- * DRM_ERROR_SESSION_NOT_OPENED, DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED,
- * DRM_ERROR_DECRYPT for failure.
- */
- virtual status_t decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
- const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) = 0;
-
- /**
- * Finalize decryption for the given unit of the protected content
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the decryption session
- * @param[in] decryptUnitId ID which specifies decryption unit, such as track ID
- * @return status_t
- * Returns DRM_NO_ERROR for success, DRM_ERROR_UNKNOWN for failure
- */
- virtual status_t finalizeDecryptUnit(
- int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) = 0;
-
- /**
- * Reads the specified number of bytes from an open DRM file.
- *
- * @param[in] uniqueId Unique identifier for a session
- * @param[in] decryptHandle Handle for the decryption session
- * @param[out] buffer Reference to the buffer that should receive the read data.
- * @param[in] numBytes Number of bytes to read.
- * @param[in] offset Offset with which to update the file position.
- *
- * @return Number of bytes read. Returns -1 for Failure.
- */
- virtual ssize_t pread(int uniqueId, DecryptHandle* decryptHandle,
- void* buffer, ssize_t numBytes, off64_t offset) = 0;
-};
-
-};
-
-#endif /* __IDRM_ENGINE_H__ */
-
diff --git a/drm/libdrmframework/plugins/common/util/Android.bp b/drm/libdrmframework/plugins/common/util/Android.bp
new file mode 100644
index 0000000..0c0b6f2
--- /dev/null
+++ b/drm/libdrmframework/plugins/common/util/Android.bp
@@ -0,0 +1,23 @@
+//
+// Copyright (C) 2010 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+ name: "libdrmutility",
+
+ srcs: ["src/MimeTypeUtil.cpp"],
+
+ export_include_dirs: ["include"],
+}
diff --git a/drm/libdrmframework/plugins/common/util/Android.mk b/drm/libdrmframework/plugins/common/util/Android.mk
deleted file mode 100644
index 2a7b01f..0000000
--- a/drm/libdrmframework/plugins/common/util/Android.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- src/MimeTypeUtil.cpp
-
-LOCAL_MODULE := libdrmutility
-
-base := frameworks/av
-
-LOCAL_C_INCLUDES += \
- $(base)/include \
- $(base)/include/drm \
- $(base)/include/drm/plugins \
- $(LOCAL_PATH)/include
-
-
-ifneq ($(TARGET_BUILD_VARIANT),user)
-LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/tools
-
-endif
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/drm/libdrmframework/plugins/forward-lock/Android.bp b/drm/libdrmframework/plugins/forward-lock/Android.bp
new file mode 100644
index 0000000..f884c14
--- /dev/null
+++ b/drm/libdrmframework/plugins/forward-lock/Android.bp
@@ -0,0 +1,4 @@
+subdirs = [
+ "FwdLockEngine",
+ "internal-format",
+]
diff --git a/drm/libdrmframework/plugins/forward-lock/Android.mk b/drm/libdrmframework/plugins/forward-lock/Android.mk
deleted file mode 100644
index 9ee7961..0000000
--- a/drm/libdrmframework/plugins/forward-lock/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-include $(call all-subdir-makefiles)
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/Android.bp b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/Android.bp
new file mode 100644
index 0000000..3f0f5f7
--- /dev/null
+++ b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/Android.bp
@@ -0,0 +1,50 @@
+//
+// Copyright (C) 2010 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//2
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_shared {
+ name: "libfwdlockengine",
+
+ cflags: [
+ "-DUSE_64BIT_DRM_API",
+ // The flag below turns on local debug printouts
+ //"-DDRM_OMA_FL_ENGINE_DEBUG",
+ ],
+
+ srcs: ["src/FwdLockEngine.cpp"],
+
+ shared_libs: [
+ "libicui18n",
+ "libicuuc",
+ "libutils",
+ "liblog",
+ "libdl",
+ "libcrypto",
+ "libssl",
+ "libdrmframework",
+ ],
+
+ static_libs: [
+ "libdrmutility",
+ "libdrmframeworkcommon",
+ "libfwdlock-common",
+ "libfwdlock-converter",
+ "libfwdlock-decoder",
+ ],
+
+ local_include_dirs: ["include"],
+
+ relative_install_path: "drm",
+}
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/Android.mk b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/Android.mk
deleted file mode 100644
index 933464f..0000000
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/Android.mk
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# The flag below turns on local debug printouts
-#LOCAL_CFLAGS += -DDRM_OMA_FL_ENGINE_DEBUG
-
-base := frameworks/av
-
-# Determine whether the DRM framework uses 64-bit data types for file offsets and do the same.
-ifneq ($(shell grep -c 'off64_t offset' $(base)/drm/libdrmframework/plugins/common/include/IDrmEngine.h), 0)
-LOCAL_CFLAGS += -DUSE_64BIT_DRM_API
-endif
-
-LOCAL_SRC_FILES:= \
- src/FwdLockEngine.cpp
-
-LOCAL_MODULE := libfwdlockengine
-
-LOCAL_SHARED_LIBRARIES := \
- libicui18n \
- libicuuc \
- libutils \
- liblog \
- libdl \
- libcrypto \
- libssl \
- libdrmframework
-
-LOCAL_STATIC_LIBRARIES := \
- libdrmutility \
- libdrmframeworkcommon \
- libfwdlock-common \
- libfwdlock-converter \
- libfwdlock-decoder
-
-
-
-LOCAL_C_INCLUDES += \
- $(base)/include/drm \
- $(base)/drm/libdrmframework/plugins/common/include \
- $(base)/drm/libdrmframework/plugins/common/util/include \
- $(base)/drm/libdrmframework/plugins/forward-lock/internal-format/common \
- $(base)/drm/libdrmframework/plugins/forward-lock/internal-format/converter \
- $(base)/drm/libdrmframework/plugins/forward-lock/internal-format/decoder \
- $(LOCAL_PATH)/include
-
-LOCAL_MODULE_RELATIVE_PATH := drm
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h
index d222703..a571b3a 100644
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h
+++ b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/include/FwdLockEngine.h
@@ -18,14 +18,14 @@
#define __FWDLOCKENGINE_H__
#include <DrmEngineBase.h>
-#include <DrmConstraints.h>
-#include <DrmRights.h>
-#include <DrmInfo.h>
-#include <DrmInfoStatus.h>
-#include <DrmConvertedStatus.h>
-#include <DrmInfoRequest.h>
-#include <DrmSupportInfo.h>
-#include <DrmInfoEvent.h>
+#include <drm/DrmConstraints.h>
+#include <drm/DrmRights.h>
+#include <drm/DrmInfo.h>
+#include <drm/DrmInfoStatus.h>
+#include <drm/DrmConvertedStatus.h>
+#include <drm/DrmInfoRequest.h>
+#include <drm/DrmSupportInfo.h>
+#include <drm/DrmInfoEvent.h>
#include "SessionMap.h"
#include "FwdLockConv.h"
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
index a495616..830def9 100644
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
+++ b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
@@ -20,17 +20,17 @@
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
-#include "drm_framework_common.h"
+#include <drm/drm_framework_common.h>
#include <fcntl.h>
#include <limits.h>
-#include <DrmRights.h>
-#include <DrmConstraints.h>
-#include <DrmMetadata.h>
-#include <DrmInfo.h>
-#include <DrmInfoStatus.h>
-#include <DrmInfoRequest.h>
-#include <DrmSupportInfo.h>
-#include <DrmConvertedStatus.h>
+#include <drm/DrmRights.h>
+#include <drm/DrmConstraints.h>
+#include <drm/DrmMetadata.h>
+#include <drm/DrmInfo.h>
+#include <drm/DrmInfoStatus.h>
+#include <drm/DrmInfoRequest.h>
+#include <drm/DrmSupportInfo.h>
+#include <drm/DrmConvertedStatus.h>
#include <utils/String8.h>
#include "FwdLockConv.h"
#include "FwdLockFile.h"
diff --git a/drm/libdrmframework/plugins/forward-lock/internal-format/Android.bp b/drm/libdrmframework/plugins/forward-lock/internal-format/Android.bp
new file mode 100644
index 0000000..9f58e26
--- /dev/null
+++ b/drm/libdrmframework/plugins/forward-lock/internal-format/Android.bp
@@ -0,0 +1,5 @@
+subdirs = [
+ "common",
+ "converter",
+ "decoder",
+]
diff --git a/drm/libdrmframework/plugins/forward-lock/internal-format/Android.mk b/drm/libdrmframework/plugins/forward-lock/internal-format/Android.mk
deleted file mode 100644
index 9ee7961..0000000
--- a/drm/libdrmframework/plugins/forward-lock/internal-format/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-include $(call all-subdir-makefiles)
diff --git a/drm/libdrmframework/plugins/forward-lock/internal-format/common/Android.bp b/drm/libdrmframework/plugins/forward-lock/internal-format/common/Android.bp
new file mode 100644
index 0000000..698f278
--- /dev/null
+++ b/drm/libdrmframework/plugins/forward-lock/internal-format/common/Android.bp
@@ -0,0 +1,25 @@
+//
+// Copyright (C) 2010 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+ name: "libfwdlock-common",
+
+ srcs: ["FwdLockGlue.c"],
+
+ shared_libs: ["libcrypto"],
+
+ export_include_dirs: ["."],
+}
diff --git a/drm/libdrmframework/plugins/forward-lock/internal-format/common/Android.mk b/drm/libdrmframework/plugins/forward-lock/internal-format/common/Android.mk
deleted file mode 100644
index 3b4c8b4..0000000
--- a/drm/libdrmframework/plugins/forward-lock/internal-format/common/Android.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- FwdLockGlue.c
-
-LOCAL_SHARED_LIBRARIES := libcrypto
-
-LOCAL_MODULE := libfwdlock-common
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/drm/libdrmframework/plugins/forward-lock/internal-format/converter/Android.bp b/drm/libdrmframework/plugins/forward-lock/internal-format/converter/Android.bp
new file mode 100644
index 0000000..33f2fe0
--- /dev/null
+++ b/drm/libdrmframework/plugins/forward-lock/internal-format/converter/Android.bp
@@ -0,0 +1,26 @@
+//
+// Copyright (C) 2010 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+ name: "libfwdlock-converter",
+
+ srcs: ["FwdLockConv.c"],
+
+ shared_libs: ["libcrypto"],
+ static_libs: ["libfwdlock-common"],
+
+ export_include_dirs: ["."],
+}
diff --git a/drm/libdrmframework/plugins/forward-lock/internal-format/converter/Android.mk b/drm/libdrmframework/plugins/forward-lock/internal-format/converter/Android.mk
deleted file mode 100644
index 2f51f0c..0000000
--- a/drm/libdrmframework/plugins/forward-lock/internal-format/converter/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- FwdLockConv.c
-
-LOCAL_C_INCLUDES := \
- frameworks/av/drm/libdrmframework/plugins/forward-lock/internal-format/common
-
-LOCAL_SHARED_LIBRARIES := libcrypto
-
-LOCAL_MODULE := libfwdlock-converter
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/drm/libdrmframework/plugins/forward-lock/internal-format/decoder/Android.bp b/drm/libdrmframework/plugins/forward-lock/internal-format/decoder/Android.bp
new file mode 100644
index 0000000..b6d7a06
--- /dev/null
+++ b/drm/libdrmframework/plugins/forward-lock/internal-format/decoder/Android.bp
@@ -0,0 +1,26 @@
+//
+// Copyright (C) 2010 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+ name: "libfwdlock-decoder",
+
+ srcs: ["FwdLockFile.c"],
+
+ shared_libs: ["libcrypto"],
+ static_libs: ["libfwdlock-common"],
+
+ export_include_dirs: ["."],
+}
diff --git a/drm/libdrmframework/plugins/forward-lock/internal-format/decoder/Android.mk b/drm/libdrmframework/plugins/forward-lock/internal-format/decoder/Android.mk
deleted file mode 100644
index 3399ae5..0000000
--- a/drm/libdrmframework/plugins/forward-lock/internal-format/decoder/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- FwdLockFile.c
-
-LOCAL_C_INCLUDES := \
- frameworks/av/drm/libdrmframework/plugins/forward-lock/internal-format/common
-
-LOCAL_SHARED_LIBRARIES := libcrypto
-
-LOCAL_MODULE := libfwdlock-decoder
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/drm/libdrmframework/plugins/passthru/Android.bp b/drm/libdrmframework/plugins/passthru/Android.bp
new file mode 100644
index 0000000..1dcf89c
--- /dev/null
+++ b/drm/libdrmframework/plugins/passthru/Android.bp
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2010 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_shared {
+ name: "libdrmpassthruplugin",
+
+ srcs: ["src/DrmPassthruPlugIn.cpp"],
+
+ static_libs: ["libdrmframeworkcommon"],
+
+ shared_libs: [
+ "libutils",
+ "liblog",
+ "libdl",
+ ],
+
+ local_include_dirs: ["include"],
+
+ cflags: [
+ // Set the following flag to enable the decryption passthru flow
+ //"-DENABLE_PASSTHRU_DECRYPTION",
+ ],
+}
diff --git a/drm/libdrmframework/plugins/passthru/Android.mk b/drm/libdrmframework/plugins/passthru/Android.mk
deleted file mode 100644
index cb3a2e2..0000000
--- a/drm/libdrmframework/plugins/passthru/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- src/DrmPassthruPlugIn.cpp
-
-LOCAL_MODULE := libdrmpassthruplugin
-
-LOCAL_STATIC_LIBRARIES := libdrmframeworkcommon
-
-LOCAL_SHARED_LIBRARIES := \
- libutils \
- liblog \
- libdl
-
-
-LOCAL_C_INCLUDES += \
- $(TOP)/frameworks/av/drm/libdrmframework/include \
- $(TOP)/frameworks/av/drm/libdrmframework/plugins/passthru/include \
- $(TOP)/frameworks/av/drm/libdrmframework/plugins/common/include \
- $(TOP)/frameworks/av/include
-
-# Set the following flag to enable the decryption passthru flow
-#LOCAL_CFLAGS += -DENABLE_PASSTHRU_DECRYPTION
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
index 7f5b0ec..d7f2d28 100644
--- a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
+++ b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
@@ -245,6 +245,8 @@
decryptHandle->status = DRM_NO_ERROR;
decryptHandle->decryptInfo = NULL;
return DRM_NO_ERROR;
+#else
+ (void)(decryptHandle); // unused
#endif
return DRM_ERROR_CANNOT_HANDLE;