diff --git a/drm/drmserver/DrmManager.cpp b/drm/drmserver/DrmManager.cpp
index 44886f9..52527dc 100644
--- a/drm/drmserver/DrmManager.cpp
+++ b/drm/drmserver/DrmManager.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_NDEBUG 0
+//#define LOG_NDEBUG 0
 #define LOG_TAG "DrmManager(Native)"
 #include "utils/Log.h"
 
@@ -36,6 +36,7 @@
 
 using namespace android;
 
+Vector<int> DrmManager::mUniqueIdVector;
 const String8 DrmManager::EMPTY_STRING("");
 
 DrmManager::DrmManager() :
@@ -48,6 +49,42 @@
 
 }
 
+int DrmManager::addUniqueId(int uniqueId) {
+    if (0 == uniqueId) {
+        int temp = 0;
+        bool foundUniqueId = false;
+        srand(time(NULL));
+
+        while (!foundUniqueId) {
+            const int size = mUniqueIdVector.size();
+            temp = rand() % 100;
+
+            int index = 0;
+            for (; index < size; ++index) {
+                if (mUniqueIdVector.itemAt(index) == temp) {
+                    foundUniqueId = false;
+                    break;
+                }
+            }
+            if (index == size) {
+                foundUniqueId = true;
+            }
+        }
+        uniqueId = temp;
+    }
+    mUniqueIdVector.push(uniqueId);
+    return uniqueId;
+}
+
+void DrmManager::removeUniqueId(int uniqueId) {
+    for (unsigned int i = 0; i < mUniqueIdVector.size(); i++) {
+        if (uniqueId == mUniqueIdVector.itemAt(i)) {
+            mUniqueIdVector.removeAt(i);
+            break;
+        }
+    }
+}
+
 status_t DrmManager::loadPlugIns(int uniqueId) {
     String8 pluginDirPath("/system/lib/drm/plugins/native");
     return loadPlugIns(uniqueId, pluginDirPath);
@@ -82,10 +119,12 @@
         rDrmEngine.terminate(uniqueId);
     }
 
-    mConvertSessionMap.clear();
-    mDecryptSessionMap.clear();
-    mSupportInfoToPlugInIdMap.clear();
-    mPlugInManager.unloadPlugIns();
+    if (0 >= mUniqueIdVector.size()) {
+        mConvertSessionMap.clear();
+        mDecryptSessionMap.clear();
+        mSupportInfoToPlugInIdMap.clear();
+        mPlugInManager.unloadPlugIns();
+    }
     return DRM_NO_ERROR;
 }
 
@@ -159,13 +198,15 @@
     return NULL;
 }
 
-void DrmManager::saveRights(int uniqueId, const DrmRights& drmRights,
+status_t DrmManager::saveRights(int uniqueId, const DrmRights& drmRights,
             const String8& rightsPath, const String8& contentPath) {
     const String8 plugInId = getSupportedPlugInId(drmRights.getMimeType());
+    status_t result = DRM_ERROR_UNKNOWN;
     if (EMPTY_STRING != plugInId) {
         IDrmEngine& rDrmEngine = mPlugInManager.getPlugIn(plugInId);
-        rDrmEngine.saveRights(uniqueId, drmRights, rightsPath, contentPath);
+        result = rDrmEngine.saveRights(uniqueId, drmRights, rightsPath, contentPath);
     }
+    return result;
 }
 
 String8 DrmManager::getOriginalMimeType(int uniqueId, const String8& path) {
@@ -195,21 +236,24 @@
     return RightsStatus::RIGHTS_INVALID;
 }
 
-void DrmManager::consumeRights(
+status_t DrmManager::consumeRights(
     int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) {
+    status_t result = DRM_ERROR_UNKNOWN;
     if (mDecryptSessionMap.indexOfKey(decryptHandle->decryptId) != NAME_NOT_FOUND) {
         IDrmEngine* drmEngine = mDecryptSessionMap.valueFor(decryptHandle->decryptId);
-        drmEngine->consumeRights(uniqueId, decryptHandle, action, reserve);
+        result = drmEngine->consumeRights(uniqueId, decryptHandle, action, reserve);
     }
+    return result;
 }
 
-void DrmManager::setPlaybackStatus(
+status_t DrmManager::setPlaybackStatus(
     int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) {
-
+    status_t result = DRM_ERROR_UNKNOWN;
     if (mDecryptSessionMap.indexOfKey(decryptHandle->decryptId) != NAME_NOT_FOUND) {
         IDrmEngine* drmEngine = mDecryptSessionMap.valueFor(decryptHandle->decryptId);
-        drmEngine->setPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
+        result = drmEngine->setPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
     }
+    return result;
 }
 
 bool DrmManager::validateAction(
@@ -222,21 +266,27 @@
     return false;
 }
 
-void DrmManager::removeRights(int uniqueId, const String8& path) {
+status_t DrmManager::removeRights(int uniqueId, const String8& path) {
     const String8 plugInId = getSupportedPlugInIdFromPath(uniqueId, path);
+    status_t result = DRM_ERROR_UNKNOWN;
     if (EMPTY_STRING != plugInId) {
         IDrmEngine& rDrmEngine = mPlugInManager.getPlugIn(plugInId);
-        rDrmEngine.removeRights(uniqueId, path);
+        result = rDrmEngine.removeRights(uniqueId, path);
     }
+    return result;
 }
 
-void DrmManager::removeAllRights(int uniqueId) {
+status_t DrmManager::removeAllRights(int uniqueId) {
     Vector<String8> plugInIdList = mPlugInManager.getPlugInIdList();
-
+    status_t result = DRM_ERROR_UNKNOWN;
     for (unsigned int index = 0; index < plugInIdList.size(); index++) {
         IDrmEngine& rDrmEngine = mPlugInManager.getPlugIn(plugInIdList.itemAt(index));
-        rDrmEngine.removeAllRights(uniqueId);
+        result = rDrmEngine.removeAllRights(uniqueId);
+        if (DRM_NO_ERROR != result) {
+            break;
+        }
     }
+    return result;
 }
 
 int DrmManager::openConvertSession(int uniqueId, const String8& mimeType) {
@@ -246,12 +296,12 @@
     if (EMPTY_STRING != plugInId) {
         IDrmEngine& rDrmEngine = mPlugInManager.getPlugIn(plugInId);
 
-        Mutex::Autolock _l(mConvertLock);
-        ++mConvertId;
-        convertId = mConvertId;
-        mConvertSessionMap.add(mConvertId, &rDrmEngine);
-
-        rDrmEngine.openConvertSession(uniqueId, mConvertId);
+        if (DRM_NO_ERROR == rDrmEngine.openConvertSession(uniqueId, mConvertId + 1)) {
+            Mutex::Autolock _l(mConvertLock);
+            ++mConvertId;
+            convertId = mConvertId;
+            mConvertSessionMap.add(convertId, &rDrmEngine);
+        }
     }
     return convertId;
 }
@@ -310,7 +360,6 @@
 }
 
 DecryptHandle* DrmManager::openDecryptSession(int uniqueId, int fd, int offset, int length) {
-    LOGV("Entering DrmManager::openDecryptSession");
     status_t result = DRM_ERROR_CANNOT_HANDLE;
     Vector<String8> plugInIdList = mPlugInManager.getPlugInIdList();
 
@@ -324,18 +373,15 @@
             IDrmEngine& rDrmEngine = mPlugInManager.getPlugIn(plugInId);
             result = rDrmEngine.openDecryptSession(uniqueId, handle, fd, offset, length);
 
-            LOGV("plug-in %s return value = %d", plugInId.string(), result);
-
             if (DRM_NO_ERROR == result) {
                 ++mDecryptSessionId;
                 mDecryptSessionMap.add(mDecryptSessionId, &rDrmEngine);
-                LOGV("plug-in %s is selected", plugInId.string());
                 break;
             }
         }
     }
 
-    if (DRM_ERROR_CANNOT_HANDLE == result) {
+    if (DRM_NO_ERROR != result) {
         delete handle; handle = NULL;
         LOGE("DrmManager::openDecryptSession: no capable plug-in found");
     }
@@ -343,39 +389,47 @@
     return handle;
 }
 
-void DrmManager::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
+status_t DrmManager::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
+    status_t result = DRM_ERROR_UNKNOWN;
     if (mDecryptSessionMap.indexOfKey(decryptHandle->decryptId) != NAME_NOT_FOUND) {
         IDrmEngine* drmEngine = mDecryptSessionMap.valueFor(decryptHandle->decryptId);
-        drmEngine->closeDecryptSession(uniqueId, decryptHandle);
-
-        mDecryptSessionMap.removeItem(decryptHandle->decryptId);
+        result = drmEngine->closeDecryptSession(uniqueId, decryptHandle);
+        if (DRM_NO_ERROR == result) {
+            mDecryptSessionMap.removeItem(decryptHandle->decryptId);
+        }
     }
+    return result;
 }
 
-void DrmManager::initializeDecryptUnit(
+status_t DrmManager::initializeDecryptUnit(
     int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) {
+    status_t result = DRM_ERROR_UNKNOWN;
     if (mDecryptSessionMap.indexOfKey(decryptHandle->decryptId) != NAME_NOT_FOUND) {
         IDrmEngine* drmEngine = mDecryptSessionMap.valueFor(decryptHandle->decryptId);
-        drmEngine->initializeDecryptUnit(uniqueId, decryptHandle, decryptUnitId, headerInfo);
+        result = drmEngine->initializeDecryptUnit(uniqueId, decryptHandle, decryptUnitId, headerInfo);
     }
+    return result;
 }
 
-status_t DrmManager::decrypt(int uniqueId, DecryptHandle* decryptHandle,
-            int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer) {
-    status_t status = DRM_ERROR_UNKNOWN;
+status_t DrmManager::decrypt(int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
+            const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
+    status_t result = DRM_ERROR_UNKNOWN;
     if (mDecryptSessionMap.indexOfKey(decryptHandle->decryptId) != NAME_NOT_FOUND) {
         IDrmEngine* drmEngine = mDecryptSessionMap.valueFor(decryptHandle->decryptId);
-        status = drmEngine->decrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer);
+        result = drmEngine->decrypt(
+                uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV);
     }
-    return status;
+    return result;
 }
 
-void DrmManager::finalizeDecryptUnit(
+status_t DrmManager::finalizeDecryptUnit(
             int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
+    status_t result = DRM_ERROR_UNKNOWN;
     if (mDecryptSessionMap.indexOfKey(decryptHandle->decryptId) != NAME_NOT_FOUND) {
         IDrmEngine* drmEngine = mDecryptSessionMap.valueFor(decryptHandle->decryptId);
-        drmEngine->finalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId);
+        result = drmEngine->finalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId);
     }
+    return result;
 }
 
 ssize_t DrmManager::pread(int uniqueId, DecryptHandle* decryptHandle,
diff --git a/drm/drmserver/DrmManagerService.cpp b/drm/drmserver/DrmManagerService.cpp
index 9d000e9..843dddb 100644
--- a/drm/drmserver/DrmManagerService.cpp
+++ b/drm/drmserver/DrmManagerService.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_NDEBUG 0
+//#define LOG_NDEBUG 0
 #define LOG_TAG "DrmManagerService(Native)"
 #include <utils/Log.h>
 
@@ -29,20 +29,23 @@
 
 #define SUCCESS 0
 #define DRM_DIRECTORY_PERMISSION 0700
+#define DRM_PLUGINS_ROOT "/data/drm/plugins"
+#define DRM_PLUGINS_NATIVE "/data/drm/plugins/native"
+#define DRM_PLUGINS_NATIVE_DATABASES "/data/drm/plugins/native/databases"
 
 void DrmManagerService::instantiate() {
     LOGV("instantiate");
 
-    int res = mkdir("/data/drm/plugins", DRM_DIRECTORY_PERMISSION);
-    if (SUCCESS == res || EEXIST == errno) {
-        res = mkdir("/data/drm/plugins/native", DRM_DIRECTORY_PERMISSION);
-        if (SUCCESS == res || EEXIST == errno) {
-            res = mkdir("/data/drm/plugins/native/databases", DRM_DIRECTORY_PERMISSION);
-            if (SUCCESS == res || EEXIST == errno) {
-                defaultServiceManager()
-                    ->addService(String16("drm.drmManager"), new DrmManagerService());
-            }
-        }
+    int res = mkdir(DRM_PLUGINS_ROOT, DRM_DIRECTORY_PERMISSION);
+    if (SUCCESS == res || EEXIST == errno) {
+        res = mkdir(DRM_PLUGINS_NATIVE, DRM_DIRECTORY_PERMISSION);
+        if (SUCCESS == res || EEXIST == errno) {
+            res = mkdir(DRM_PLUGINS_NATIVE_DATABASES, DRM_DIRECTORY_PERMISSION);
+            if (SUCCESS == res || EEXIST == errno) {
+                defaultServiceManager()
+                    ->addService(String16("drm.drmManager"), new DrmManagerService());
+            }
+        }
     }
 }
 
@@ -57,6 +60,14 @@
     delete mDrmManager; mDrmManager = NULL;
 }
 
+int DrmManagerService::addUniqueId(int uniqueId) {
+    return mDrmManager->addUniqueId(uniqueId);
+}
+
+void DrmManagerService::removeUniqueId(int uniqueId) {
+    mDrmManager->removeUniqueId(uniqueId);
+}
+
 status_t DrmManagerService::loadPlugIns(int uniqueId) {
     LOGV("Entering load plugins");
     return mDrmManager->loadPlugIns(uniqueId);
@@ -105,7 +116,7 @@
     return mDrmManager->acquireDrmInfo(uniqueId, drmInfoRequest);
 }
 
-void DrmManagerService::saveRights(
+status_t DrmManagerService::saveRights(
             int uniqueId, const DrmRights& drmRights,
             const String8& rightsPath, const String8& contentPath) {
     LOGV("Entering saveRights");
@@ -129,16 +140,16 @@
     return mDrmManager->checkRightsStatus(uniqueId, path, action);
 }
 
-void DrmManagerService::consumeRights(
+status_t DrmManagerService::consumeRights(
             int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) {
     LOGV("Entering consumeRights");
-    mDrmManager->consumeRights(uniqueId, decryptHandle, action, reserve);
+    return mDrmManager->consumeRights(uniqueId, decryptHandle, action, reserve);
 }
 
-void DrmManagerService::setPlaybackStatus(
+status_t DrmManagerService::setPlaybackStatus(
             int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) {
     LOGV("Entering setPlaybackStatus");
-    mDrmManager->setPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
+    return mDrmManager->setPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
 }
 
 bool DrmManagerService::validateAction(
@@ -148,14 +159,14 @@
     return mDrmManager->validateAction(uniqueId, path, action, description);
 }
 
-void DrmManagerService::removeRights(int uniqueId, const String8& path) {
+status_t DrmManagerService::removeRights(int uniqueId, const String8& path) {
     LOGV("Entering removeRights");
-    mDrmManager->removeRights(uniqueId, path);
+    return mDrmManager->removeRights(uniqueId, path);
 }
 
-void DrmManagerService::removeAllRights(int uniqueId) {
+status_t DrmManagerService::removeAllRights(int uniqueId) {
     LOGV("Entering removeAllRights");
-    mDrmManager->removeAllRights(uniqueId);
+    return mDrmManager->removeAllRights(uniqueId);
 }
 
 int DrmManagerService::openConvertSession(int uniqueId, const String8& mimeType) {
@@ -186,28 +197,28 @@
     return mDrmManager->openDecryptSession(uniqueId, fd, offset, length);
 }
 
-void DrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
+status_t DrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
     LOGV("Entering closeDecryptSession");
-    mDrmManager->closeDecryptSession(uniqueId, decryptHandle);
+    return mDrmManager->closeDecryptSession(uniqueId, decryptHandle);
 }
 
-void DrmManagerService::initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
+status_t DrmManagerService::initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
             int decryptUnitId, const DrmBuffer* headerInfo) {
     LOGV("Entering initializeDecryptUnit");
-    mDrmManager->initializeDecryptUnit(uniqueId,decryptHandle, decryptUnitId, headerInfo);
+    return mDrmManager->initializeDecryptUnit(uniqueId,decryptHandle, decryptUnitId, headerInfo);
 }
 
 status_t DrmManagerService::decrypt(
-            int uniqueId, DecryptHandle* decryptHandle,
-            int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer) {
+            int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
+            const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
     LOGV("Entering decrypt");
-    return mDrmManager->decrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer);
+    return mDrmManager->decrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV);
 }
 
-void DrmManagerService::finalizeDecryptUnit(
+status_t DrmManagerService::finalizeDecryptUnit(
             int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
     LOGV("Entering finalizeDecryptUnit");
-    mDrmManager->finalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId);
+    return mDrmManager->finalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId);
 }
 
 ssize_t DrmManagerService::pread(int uniqueId, DecryptHandle* decryptHandle,
diff --git a/drm/drmserver/StringTokenizer.cpp b/drm/drmserver/StringTokenizer.cpp
index 367c9bd..2130a00 100644
--- a/drm/drmserver/StringTokenizer.cpp
+++ b/drm/drmserver/StringTokenizer.cpp
@@ -45,12 +45,10 @@
 StringTokenizer::Iterator::Iterator(const StringTokenizer::Iterator& iterator) :
     mStringTokenizer(iterator.mStringTokenizer),
     mIndex(iterator.mIndex) {
-    LOGV("StringTokenizer::Iterator::Iterator");
 }
 
 StringTokenizer::Iterator& StringTokenizer::Iterator::operator=(
             const StringTokenizer::Iterator& iterator) {
-    LOGV("StringTokenizer::Iterator::operator=");
     mStringTokenizer = iterator.mStringTokenizer;
     mIndex = iterator.mIndex;
     return *this;
