diff --git a/drm/common/DrmConstraints.cpp b/drm/common/DrmConstraints.cpp
index 11ce410..4a4d798 100644
--- a/drm/common/DrmConstraints.cpp
+++ b/drm/common/DrmConstraints.cpp
@@ -75,12 +75,10 @@
 DrmConstraints::KeyIterator::KeyIterator(const DrmConstraints::KeyIterator& keyIterator)
     : mDrmConstraints(keyIterator.mDrmConstraints),
       mIndex(keyIterator.mIndex) {
-    LOGV("DrmConstraints::KeyIterator::KeyIterator");
 }
 
 DrmConstraints::KeyIterator& DrmConstraints::KeyIterator::operator=(
     const DrmConstraints::KeyIterator& keyIterator) {
-    LOGV("DrmConstraints::KeyIterator::operator=");
     mDrmConstraints = keyIterator.mDrmConstraints;
     mIndex = keyIterator.mIndex;
     return *this;
@@ -94,12 +92,10 @@
 DrmConstraints::Iterator::Iterator(const DrmConstraints::Iterator& iterator) :
     mDrmConstraints(iterator.mDrmConstraints),
     mIndex(iterator.mIndex) {
-    LOGV("DrmConstraints::Iterator::Iterator");
 }
 
 DrmConstraints::Iterator& DrmConstraints::Iterator::operator=(
     const DrmConstraints::Iterator& iterator) {
-    LOGV("DrmConstraints::Iterator::operator=");
     mDrmConstraints = iterator.mDrmConstraints;
     mIndex = iterator.mIndex;
     return *this;
diff --git a/drm/common/DrmEngineBase.cpp b/drm/common/DrmEngineBase.cpp
index 70398e8..17cdf54 100644
--- a/drm/common/DrmEngineBase.cpp
+++ b/drm/common/DrmEngineBase.cpp
@@ -52,7 +52,7 @@
     return onProcessDrmInfo(uniqueId, drmInfo);
 }
 
-void DrmEngineBase::saveRights(
+status_t DrmEngineBase::saveRights(
             int uniqueId, const DrmRights& drmRights,
             const String8& rightsPath, const String8& contentPath) {
     return onSaveRights(uniqueId, drmRights, rightsPath, contentPath);
@@ -74,14 +74,14 @@
     return onCheckRightsStatus(uniqueId, path, action);
 }
 
-void DrmEngineBase::consumeRights(
+status_t DrmEngineBase::consumeRights(
     int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) {
-    onConsumeRights(uniqueId, decryptHandle, action, reserve);
+    return onConsumeRights(uniqueId, decryptHandle, action, reserve);
 }
 
-void DrmEngineBase::setPlaybackStatus(
+status_t DrmEngineBase::setPlaybackStatus(
     int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) {
-    onSetPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
+    return onSetPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
 }
 
 bool DrmEngineBase::validateAction(
@@ -90,16 +90,16 @@
     return onValidateAction(uniqueId, path, action, description);
 }
 
-void DrmEngineBase::removeRights(int uniqueId, const String8& path) {
-    onRemoveRights(uniqueId, path);
+status_t DrmEngineBase::removeRights(int uniqueId, const String8& path) {
+    return onRemoveRights(uniqueId, path);
 }
 
-void DrmEngineBase::removeAllRights(int uniqueId) {
-    onRemoveAllRights(uniqueId);
+status_t DrmEngineBase::removeAllRights(int uniqueId) {
+    return onRemoveAllRights(uniqueId);
 }
 
-void DrmEngineBase::openConvertSession(int uniqueId, int convertId) {
-    onOpenConvertSession(uniqueId, convertId);
+status_t DrmEngineBase::openConvertSession(int uniqueId, int convertId) {
+    return onOpenConvertSession(uniqueId, convertId);
 }
 
 DrmConvertedStatus* DrmEngineBase::convertData(
@@ -120,24 +120,24 @@
     return onOpenDecryptSession(uniqueId, decryptHandle, fd, offset, length);
 }
 
-void DrmEngineBase::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
-    onCloseDecryptSession(uniqueId, decryptHandle);
+status_t DrmEngineBase::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
+    return onCloseDecryptSession(uniqueId, decryptHandle);
 }
 
-void DrmEngineBase::initializeDecryptUnit(
+status_t DrmEngineBase::initializeDecryptUnit(
     int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) {
-    onInitializeDecryptUnit(uniqueId, decryptHandle, decryptUnitId, headerInfo);
+    return onInitializeDecryptUnit(uniqueId, decryptHandle, decryptUnitId, headerInfo);
 }
 
 status_t DrmEngineBase::decrypt(
     int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
-    const DrmBuffer* encBuffer, DrmBuffer** decBuffer) {
-    return onDecrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer);
+    const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
+    return onDecrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV);
 }
 
-void DrmEngineBase::finalizeDecryptUnit(
+status_t DrmEngineBase::finalizeDecryptUnit(
     int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
-    onFinalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId);
+    return onFinalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId);
 }
 
 ssize_t DrmEngineBase::pread(
diff --git a/drm/common/DrmInfoEvent.cpp b/drm/common/DrmInfoEvent.cpp
index eb58129..8d115a8 100644
--- a/drm/common/DrmInfoEvent.cpp
+++ b/drm/common/DrmInfoEvent.cpp
@@ -14,10 +14,6 @@
  * limitations under the License.
  */
 
-#define LOG_NDEBUG 0
-#define LOG_TAG "DrmInfoEvent"
-#include "utils/Log.h"
-
 #include <utils/String8.h>
 #include <drm/DrmInfoEvent.h>
 
diff --git a/drm/common/DrmRights.cpp b/drm/common/DrmRights.cpp
index dc1e6c5..3aecb3d 100644
--- a/drm/common/DrmRights.cpp
+++ b/drm/common/DrmRights.cpp
@@ -15,14 +15,21 @@
  */
 
 #include <drm/DrmRights.h>
+#include <ReadWriteUtils.h>
 
 using namespace android;
 
 DrmRights::DrmRights(const String8& rightsFilePath, const String8& mimeType,
-            const String8& accountId, const String8& subscriptionId) {
-    /**
-     * TODO Read DrmRights from rights file
-     */
+            const String8& accountId, const String8& subscriptionId) :
+    mMimeType(mimeType),
+    mAccountId(accountId),
+    mSubscriptionId(subscriptionId),
+    mRightsFromFile(NULL) {
+    int rightsLength = 0;
+    if (String8("") != rightsFilePath) {
+        rightsLength = ReadWriteUtils::readBytes(rightsFilePath, &mRightsFromFile);
+    }
+    mData = DrmBuffer(mRightsFromFile, rightsLength);
 }
 
 DrmRights::DrmRights(const DrmBuffer& rightsData, const String8& mimeType,
@@ -30,7 +37,12 @@
     mData(rightsData),
     mMimeType(mimeType),
     mAccountId(accountId),
-    mSubscriptionId(subscriptionId) {
+    mSubscriptionId(subscriptionId),
+    mRightsFromFile(NULL) {
+}
+
+DrmRights::~DrmRights() {
+    delete[] mRightsFromFile; mRightsFromFile = NULL;
 }
 
 const DrmBuffer& DrmRights::getData(void) const {
diff --git a/drm/common/DrmSupportInfo.cpp b/drm/common/DrmSupportInfo.cpp
index 35e83fc..ffc8953 100644
--- a/drm/common/DrmSupportInfo.cpp
+++ b/drm/common/DrmSupportInfo.cpp
@@ -42,7 +42,7 @@
 }
 
 bool DrmSupportInfo::isSupportedMimeType(const String8& mimeType) const {
-    for (int i = 0; i < mMimeTypeVector.size(); i++) {
+    for (unsigned int i = 0; i < mMimeTypeVector.size(); i++) {
         const String8 item = mMimeTypeVector.itemAt(i);
 
         if (String8("") != mimeType && item.find(mimeType) != -1) {
@@ -53,7 +53,7 @@
 }
 
 bool DrmSupportInfo::isSupportedFileSuffix(const String8& fileType) const {
-    for (int i = 0; i < mFileSuffixVector.size(); i++) {
+    for (unsigned int i = 0; i < mFileSuffixVector.size(); i++) {
         const String8 item = mFileSuffixVector.itemAt(i);
 
         if (String8("") != fileType && item.find(fileType) != -1) {
diff --git a/drm/common/IDrmIOService.cpp b/drm/common/IDrmIOService.cpp
index 7ce45e7..e44ca55 100644
--- a/drm/common/IDrmIOService.cpp
+++ b/drm/common/IDrmIOService.cpp
@@ -14,10 +14,6 @@
  * limitations under the License.
  */
 
-#define LOG_NDEBUG 0
-#define LOG_TAG "IDrmIOService"
-#include <utils/Log.h>
-
 #include <stdint.h>
 #include <sys/types.h>
 #include <binder/Parcel.h>
diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp
index 4fc828a..c28527c 100644
--- a/drm/common/IDrmManagerService.cpp
+++ b/drm/common/IDrmManagerService.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_NDEBUG 0
+//#define LOG_NDEBUG 0
 #define LOG_TAG "IDrmManagerService(Native)"
 #include <utils/Log.h>
 
@@ -36,6 +36,23 @@
 
 using namespace android;
 
+int BpDrmManagerService::addUniqueId(int uniqueId) {
+    LOGV("add uniqueid");
+    Parcel data, reply;
+    data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
+    data.writeInt32(uniqueId);
+    remote()->transact(ADD_UNIQUEID, data, &reply);
+    return reply.readInt32();
+}
+
+void BpDrmManagerService::removeUniqueId(int uniqueId) {
+    LOGV("remove uniqueid");
+    Parcel data, reply;
+    data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
+    data.writeInt32(uniqueId);
+    remote()->transact(REMOVE_UNIQUEID, data, &reply);
+}
+
 status_t BpDrmManagerService::loadPlugIns(int uniqueId) {
     LOGV("load plugins");
     Parcel data, reply;
@@ -237,7 +254,7 @@
     return drmInfo;
 }
 
-void BpDrmManagerService::saveRights(
+status_t BpDrmManagerService::saveRights(
             int uniqueId, const DrmRights& drmRights,
             const String8& rightsPath, const String8& contentPath) {
     LOGV("Save Rights");
@@ -264,6 +281,7 @@
     data.writeString8((contentPath == String8("")) ? String8("NULL") : contentPath);
 
     remote()->transact(SAVE_RIGHTS, data, &reply);
+    return reply.readInt32();
 }
 
 String8 BpDrmManagerService::getOriginalMimeType(int uniqueId, const String8& path) {
@@ -307,10 +325,10 @@
     return reply.readInt32();
 }
 
-void BpDrmManagerService::consumeRights(
+status_t BpDrmManagerService::consumeRights(
             int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) {
     LOGV("consumeRights");
-        Parcel data, reply;
+    Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
     data.writeInt32(uniqueId);
@@ -330,9 +348,10 @@
     data.writeInt32(static_cast< int>(reserve));
 
     remote()->transact(CONSUME_RIGHTS, data, &reply);
+    return reply.readInt32();
 }
 
-void BpDrmManagerService::setPlaybackStatus(
+status_t BpDrmManagerService::setPlaybackStatus(
             int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) {
     LOGV("setPlaybackStatus");
     Parcel data, reply;
@@ -355,6 +374,7 @@
     data.writeInt32(position);
 
     remote()->transact(SET_PLAYBACK_STATUS, data, &reply);
+    return reply.readInt32();
 }
 
 bool BpDrmManagerService::validateAction(
@@ -375,7 +395,7 @@
     return static_cast<bool>(reply.readInt32());
 }
 
-void BpDrmManagerService::removeRights(int uniqueId, const String8& path) {
+status_t BpDrmManagerService::removeRights(int uniqueId, const String8& path) {
     LOGV("removeRights");
     Parcel data, reply;
 
@@ -384,9 +404,10 @@
     data.writeString8(path);
 
     remote()->transact(REMOVE_RIGHTS, data, &reply);
+    return reply.readInt32();
 }
 
-void BpDrmManagerService::removeAllRights(int uniqueId) {
+status_t BpDrmManagerService::removeAllRights(int uniqueId) {
     LOGV("removeAllRights");
     Parcel data, reply;
 
@@ -394,6 +415,7 @@
     data.writeInt32(uniqueId);
 
     remote()->transact(REMOVE_ALL_RIGHTS, data, &reply);
+    return reply.readInt32();
 }
 
 int BpDrmManagerService::openConvertSession(int uniqueId, const String8& mimeType) {
@@ -517,15 +539,12 @@
     Parcel data, reply;
 
     const String16 interfaceDescriptor = IDrmManagerService::getInterfaceDescriptor();
-    LOGV("BpDrmManagerService::openDecryptSession: InterfaceDescriptor name is %s",
-        interfaceDescriptor.string());
     data.writeInterfaceToken(interfaceDescriptor);
     data.writeInt32(uniqueId);
     data.writeFileDescriptor(fd);
     data.writeInt32(offset);
     data.writeInt32(length);
 
-    LOGV("try to invoke remote onTransact() with code OPEN_DECRYPT_SESSION");
     remote()->transact(OPEN_DECRYPT_SESSION, data, &reply);
 
     DecryptHandle* handle = NULL;
@@ -546,7 +565,7 @@
     return handle;
 }
 
-void BpDrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
+status_t BpDrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
     LOGV("closeDecryptSession");
     Parcel data, reply;
 
@@ -571,9 +590,10 @@
         delete decryptHandle->decryptInfo; decryptHandle->decryptInfo = NULL;
     }
     delete decryptHandle; decryptHandle = NULL;
+    return reply.readInt32();
 }
 
-void BpDrmManagerService::initializeDecryptUnit(
+status_t BpDrmManagerService::initializeDecryptUnit(
             int uniqueId, DecryptHandle* decryptHandle,
             int decryptUnitId, const DrmBuffer* headerInfo) {
     LOGV("initializeDecryptUnit");
@@ -598,11 +618,12 @@
     data.write(headerInfo->data, headerInfo->length);
 
     remote()->transact(INITIALIZE_DECRYPT_UNIT, data, &reply);
+    return reply.readInt32();
 }
 
 status_t BpDrmManagerService::decrypt(
             int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
-            const DrmBuffer* encBuffer, DrmBuffer** decBuffer) {
+            const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
     LOGV("decrypt");
     Parcel data, reply;
 
@@ -626,6 +647,11 @@
     data.writeInt32(encBuffer->length);
     data.write(encBuffer->data, encBuffer->length);
 
+    if (NULL != IV) {
+        data.writeInt32(IV->length);
+        data.write(IV->data, IV->length);
+    }
+
     remote()->transact(DECRYPT, data, &reply);
 
     const status_t status = reply.readInt32();
@@ -638,7 +664,7 @@
     return status;
 }
 
-void BpDrmManagerService::finalizeDecryptUnit(
+status_t BpDrmManagerService::finalizeDecryptUnit(
             int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
     LOGV("finalizeDecryptUnit");
     Parcel data, reply;
@@ -660,6 +686,7 @@
     data.writeInt32(decryptUnitId);
 
     remote()->transact(FINALIZE_DECRYPT_UNIT, data, &reply);
+    return reply.readInt32();
 }
 
 ssize_t BpDrmManagerService::pread(
@@ -702,6 +729,23 @@
     LOGV("Entering BnDrmManagerService::onTransact with code %d", code);
 
     switch (code) {
+    case ADD_UNIQUEID:
+    {
+        LOGV("BnDrmManagerService::onTransact :ADD_UNIQUEID");
+        CHECK_INTERFACE(IDrmManagerService, data, reply);
+        int uniqueId = addUniqueId(data.readInt32());
+        reply->writeInt32(uniqueId);
+        return DRM_NO_ERROR;
+    }
+
+    case REMOVE_UNIQUEID:
+    {
+        LOGV("BnDrmManagerService::onTransact :REMOVE_UNIQUEID");
+        CHECK_INTERFACE(IDrmManagerService, data, reply);
+        removeUniqueId(data.readInt32());
+        return DRM_NO_ERROR;
+    }
+
     case LOAD_PLUGINS:
     {
         LOGV("BnDrmManagerService::onTransact :LOAD_PLUGINS");
@@ -711,7 +755,6 @@
 
         reply->writeInt32(status);
         return DRM_NO_ERROR;
-
     }
 
     case LOAD_PLUGINS_FROM_PATH:
@@ -745,7 +788,8 @@
         LOGV("BnDrmManagerService::onTransact :UNLOAD_PLUGINS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
-        status_t status = unloadPlugIns(data.readInt32());
+        const int uniqueId = data.readInt32();
+        status_t status = unloadPlugIns(uniqueId);
 
         reply->writeInt32(status);
         return DRM_NO_ERROR;
@@ -923,10 +967,11 @@
                             ((accountId == String8("NULL")) ? String8("") : accountId),
                             ((subscriptionId == String8("NULL")) ? String8("") : subscriptionId));
 
-        saveRights(uniqueId, drmRights,
+        const status_t status = saveRights(uniqueId, drmRights,
                             ((rightsPath == String8("NULL")) ? String8("") : rightsPath),
                             ((contentPath == String8("NULL")) ? String8("") : contentPath));
 
+        reply->writeInt32(status);
         return DRM_NO_ERROR;
     }
 
@@ -985,7 +1030,10 @@
             handle.decryptInfo->decryptBufferLength = bufferLength;
         }
 
-        consumeRights(uniqueId, &handle, data.readInt32(), static_cast<bool>(data.readInt32()));
+        const status_t status
+            = consumeRights(uniqueId, &handle, data.readInt32(),
+                static_cast<bool>(data.readInt32()));
+        reply->writeInt32(status);
 
         delete handle.decryptInfo; handle.decryptInfo = NULL;
         return DRM_NO_ERROR;
@@ -1011,7 +1059,9 @@
             handle.decryptInfo->decryptBufferLength = bufferLength;
         }
 
-        setPlaybackStatus(uniqueId, &handle, data.readInt32(), data.readInt32());
+        const status_t status
+            = setPlaybackStatus(uniqueId, &handle, data.readInt32(), data.readInt32());
+        reply->writeInt32(status);
 
         delete handle.decryptInfo; handle.decryptInfo = NULL;
         return DRM_NO_ERROR;
@@ -1037,7 +1087,8 @@
         LOGV("BnDrmManagerService::onTransact :REMOVE_RIGHTS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
-        removeRights(data.readInt32(), data.readString8());
+        const status_t status = removeRights(data.readInt32(), data.readString8());
+        reply->writeInt32(status);
 
         return DRM_NO_ERROR;
     }
@@ -1047,7 +1098,8 @@
         LOGV("BnDrmManagerService::onTransact :REMOVE_ALL_RIGHTS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
-        removeAllRights(data.readInt32());
+        const status_t status = removeAllRights(data.readInt32());
+        reply->writeInt32(status);
 
         return DRM_NO_ERROR;
     }
@@ -1207,7 +1259,8 @@
             handle->decryptInfo->decryptBufferLength = bufferLength;
         }
 
-        closeDecryptSession(uniqueId, handle);
+        const status_t status = closeDecryptSession(uniqueId, handle);
+        reply->writeInt32(status);
         return DRM_NO_ERROR;
     }
 
@@ -1237,7 +1290,9 @@
         DrmBuffer* headerInfo = NULL;
         headerInfo = new DrmBuffer((char *)data.readInplace(bufferSize), bufferSize);
 
-        initializeDecryptUnit(uniqueId, &handle, decryptUnitId, headerInfo);
+        const status_t status
+            = initializeDecryptUnit(uniqueId, &handle, decryptUnitId, headerInfo);
+        reply->writeInt32(status);
 
         delete handle.decryptInfo; handle.decryptInfo = NULL;
         delete headerInfo; headerInfo = NULL;
@@ -1274,7 +1329,14 @@
         buffer = new char[decBufferSize];
         DrmBuffer* decBuffer = new DrmBuffer(buffer, decBufferSize);
 
-        const status_t status = decrypt(uniqueId, &handle, decryptUnitId, encBuffer, &decBuffer);
+        DrmBuffer* IV = NULL;
+        if (0 != data.dataAvail()) {
+            const int ivBufferlength = data.readInt32();
+            IV = new DrmBuffer((char *)data.readInplace(ivBufferlength), ivBufferlength);
+        }
+
+        const status_t status
+            = decrypt(uniqueId, &handle, decryptUnitId, encBuffer, &decBuffer, IV);
 
         reply->writeInt32(status);
 
@@ -1286,6 +1348,7 @@
         delete encBuffer; encBuffer = NULL;
         delete decBuffer; decBuffer = NULL;
         delete [] buffer; buffer = NULL;
+        delete IV; IV = NULL;
         return DRM_NO_ERROR;
     }
 
@@ -1309,7 +1372,8 @@
             handle.decryptInfo->decryptBufferLength = bufferLength;
         }
 
-        finalizeDecryptUnit(uniqueId, &handle, data.readInt32());
+        const status_t status = finalizeDecryptUnit(uniqueId, &handle, data.readInt32());
+        reply->writeInt32(status);
 
         delete handle.decryptInfo; handle.decryptInfo = NULL;
         return DRM_NO_ERROR;
diff --git a/drm/common/IDrmServiceListener.cpp b/drm/common/IDrmServiceListener.cpp
index 0a69115..6eeea40 100644
--- a/drm/common/IDrmServiceListener.cpp
+++ b/drm/common/IDrmServiceListener.cpp
@@ -14,10 +14,6 @@
  * limitations under the License.
  */
 
-#define LOG_NDEBUG 0
-#define LOG_TAG "IDrmServiceListener"
-#include <utils/Log.h>
-
 #include <stdint.h>
 #include <sys/types.h>
 #include <binder/Parcel.h>
diff --git a/drm/common/ReadWriteUtils.cpp b/drm/common/ReadWriteUtils.cpp
index 4319c1c..7ec4fa2 100644
--- a/drm/common/ReadWriteUtils.cpp
+++ b/drm/common/ReadWriteUtils.cpp
@@ -14,6 +14,10 @@
  * limitations under the License.
  */
 
+//#define LOG_NDEBUG 0
+#define LOG_TAG "ReadWriteUtils"
+#include <utils/Log.h>
+
 #include <ReadWriteUtils.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
@@ -22,7 +26,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <utils/FileMap.h>
 #include <utils/String8.h>
 
 using namespace android;
@@ -39,18 +42,39 @@
         struct stat sb;
 
         if (fstat(fd, &sb) == 0 && sb.st_size > 0) {
-            FileMap* fileMap = new FileMap();
-            if (fileMap->create(filePath.string(), fd, 0, sb.st_size, true)) {
-                char* addr = (char*)fileMap->getDataPtr();
-                string.append(addr, sb.st_size);
-                fileMap->release();
+            int length = sb.st_size;
+            char* bytes = new char[length];
+            if (length == read(fd, (void*) bytes, length)) {
+                string.append(bytes, length);
             }
+            delete bytes;
         }
         fclose(file);
     }
     return string;
 }
 
+int ReadWriteUtils::readBytes(const String8& filePath, char** buffer) {
+    FILE* file = NULL;
+    file = fopen(filePath.string(), "r");
+    int length = 0;
+
+    if (NULL != file) {
+        int fd = fileno(file);
+        struct stat sb;
+
+        if (fstat(fd, &sb) == 0 && sb.st_size > 0) {
+            length = sb.st_size;
+            *buffer = new char[length];
+            if (length != read(fd, (void*) *buffer, length)) {
+                length = FAILURE;
+            }
+        }
+        fclose(file);
+    }
+    return length;
+}
+
 void ReadWriteUtils::writeToFile(const String8& filePath, const String8& data) {
     FILE* file = NULL;
     file = fopen(filePath.string(), "w+");
@@ -60,12 +84,8 @@
 
         int size = data.size();
         if (FAILURE != ftruncate(fd, size)) {
-            FileMap* fileMap = NULL;
-            fileMap = new FileMap();
-            if (fileMap->create(filePath.string(), fd, 0, size, false)) {
-                char* addr = (char*)fileMap->getDataPtr();
-                memcpy(addr, data.string(), size);
-                fileMap->release();
+            if (size != write(fd, data.string(), size)) {
+                LOGE("Failed to write the data to: %s", filePath.string());
             }
         }
         fclose(file);
@@ -79,20 +99,9 @@
     if (NULL != file) {
         int fd = fileno(file);
 
-        int offset = lseek(fd, 0, SEEK_END);
-        if (FAILURE != offset) {
-            int newEntrySize = data.size();
-            int fileSize = offset + newEntrySize;
-
-            if (FAILURE != ftruncate(fd, fileSize)) {
-                FileMap* fileMap = NULL;
-                fileMap = new FileMap();
-                if (fileMap->create(filePath.string(), fd, offset, fileSize, false)) {
-                    char* addr = (char*)fileMap->getDataPtr();
-                    memcpy(addr, data.string(), data.size());
-                    fileMap->release();
-                }
-            }
+        int size = data.size();
+        if (size != write(fd, data.string(), size)) {
+            LOGE("Failed to write the data to: %s", filePath.string());
         }
         fclose(file);
     }
