diff --git a/camera/Camera.cpp b/camera/Camera.cpp
index 7ac3cc1..da21d1a 100644
--- a/camera/Camera.cpp
+++ b/camera/Camera.cpp
@@ -70,7 +70,7 @@
 // construct a camera client from an existing camera remote
 sp<Camera> Camera::create(const sp<ICamera>& camera)
 {
-     LOGV("create");
+     ALOGV("create");
      if (camera == 0) {
          LOGE("camera remote is a NULL pointer");
          return 0;
@@ -117,7 +117,7 @@
 
 sp<Camera> Camera::connect(int cameraId)
 {
-    LOGV("connect");
+    ALOGV("connect");
     sp<Camera> c = new Camera();
     const sp<ICameraService>& cs = getCameraService();
     if (cs != 0) {
@@ -134,7 +134,7 @@
 
 void Camera::disconnect()
 {
-    LOGV("disconnect");
+    ALOGV("disconnect");
     if (mCamera != 0) {
         mCamera->disconnect();
         mCamera->asBinder()->unlinkToDeath(this);
@@ -144,7 +144,7 @@
 
 status_t Camera::reconnect()
 {
-    LOGV("reconnect");
+    ALOGV("reconnect");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->connect(this);
@@ -172,7 +172,7 @@
 // pass the buffered Surface to the camera service
 status_t Camera::setPreviewDisplay(const sp<Surface>& surface)
 {
-    LOGV("setPreviewDisplay(%p)", surface.get());
+    ALOGV("setPreviewDisplay(%p)", surface.get());
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     if (surface != 0) {
@@ -186,7 +186,7 @@
 // pass the buffered ISurfaceTexture to the camera service
 status_t Camera::setPreviewTexture(const sp<ISurfaceTexture>& surfaceTexture)
 {
-    LOGV("setPreviewTexture(%p)", surfaceTexture.get());
+    ALOGV("setPreviewTexture(%p)", surfaceTexture.get());
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     if (surfaceTexture != 0) {
@@ -200,7 +200,7 @@
 // start preview mode
 status_t Camera::startPreview()
 {
-    LOGV("startPreview");
+    ALOGV("startPreview");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->startPreview();
@@ -208,7 +208,7 @@
 
 status_t Camera::storeMetaDataInBuffers(bool enabled)
 {
-    LOGV("storeMetaDataInBuffers: %s",
+    ALOGV("storeMetaDataInBuffers: %s",
             enabled? "true": "false");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
@@ -218,7 +218,7 @@
 // start recording mode, must call setPreviewDisplay first
 status_t Camera::startRecording()
 {
-    LOGV("startRecording");
+    ALOGV("startRecording");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->startRecording();
@@ -227,7 +227,7 @@
 // stop preview mode
 void Camera::stopPreview()
 {
-    LOGV("stopPreview");
+    ALOGV("stopPreview");
     sp <ICamera> c = mCamera;
     if (c == 0) return;
     c->stopPreview();
@@ -236,7 +236,7 @@
 // stop recording mode
 void Camera::stopRecording()
 {
-    LOGV("stopRecording");
+    ALOGV("stopRecording");
     {
         Mutex::Autolock _l(mLock);
         mRecordingProxyListener.clear();
@@ -249,7 +249,7 @@
 // release a recording frame
 void Camera::releaseRecordingFrame(const sp<IMemory>& mem)
 {
-    LOGV("releaseRecordingFrame");
+    ALOGV("releaseRecordingFrame");
     sp <ICamera> c = mCamera;
     if (c == 0) return;
     c->releaseRecordingFrame(mem);
@@ -258,7 +258,7 @@
 // get preview state
 bool Camera::previewEnabled()
 {
-    LOGV("previewEnabled");
+    ALOGV("previewEnabled");
     sp <ICamera> c = mCamera;
     if (c == 0) return false;
     return c->previewEnabled();
@@ -267,7 +267,7 @@
 // get recording state
 bool Camera::recordingEnabled()
 {
-    LOGV("recordingEnabled");
+    ALOGV("recordingEnabled");
     sp <ICamera> c = mCamera;
     if (c == 0) return false;
     return c->recordingEnabled();
@@ -275,7 +275,7 @@
 
 status_t Camera::autoFocus()
 {
-    LOGV("autoFocus");
+    ALOGV("autoFocus");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->autoFocus();
@@ -283,7 +283,7 @@
 
 status_t Camera::cancelAutoFocus()
 {
-    LOGV("cancelAutoFocus");
+    ALOGV("cancelAutoFocus");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->cancelAutoFocus();
@@ -292,7 +292,7 @@
 // take a picture
 status_t Camera::takePicture(int msgType)
 {
-    LOGV("takePicture: 0x%x", msgType);
+    ALOGV("takePicture: 0x%x", msgType);
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->takePicture(msgType);
@@ -301,7 +301,7 @@
 // set preview/capture parameters - key/value pairs
 status_t Camera::setParameters(const String8& params)
 {
-    LOGV("setParameters");
+    ALOGV("setParameters");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->setParameters(params);
@@ -310,7 +310,7 @@
 // get preview/capture parameters - key/value pairs
 String8 Camera::getParameters() const
 {
-    LOGV("getParameters");
+    ALOGV("getParameters");
     String8 params;
     sp <ICamera> c = mCamera;
     if (c != 0) params = mCamera->getParameters();
@@ -320,7 +320,7 @@
 // send command to camera driver
 status_t Camera::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2)
 {
-    LOGV("sendCommand");
+    ALOGV("sendCommand");
     sp <ICamera> c = mCamera;
     if (c == 0) return NO_INIT;
     return c->sendCommand(cmd, arg1, arg2);
@@ -340,7 +340,7 @@
 
 void Camera::setPreviewCallbackFlags(int flag)
 {
-    LOGV("setPreviewCallbackFlags");
+    ALOGV("setPreviewCallbackFlags");
     sp <ICamera> c = mCamera;
     if (c == 0) return;
     mCamera->setPreviewCallbackFlag(flag);
@@ -408,20 +408,20 @@
 }
 
 void Camera::DeathNotifier::binderDied(const wp<IBinder>& who) {
-    LOGV("binderDied");
+    ALOGV("binderDied");
     Mutex::Autolock _l(Camera::mLock);
     Camera::mCameraService.clear();
     LOGW("Camera server died!");
 }
 
 sp<ICameraRecordingProxy> Camera::getRecordingProxy() {
-    LOGV("getProxy");
+    ALOGV("getProxy");
     return new RecordingProxy(this);
 }
 
 status_t Camera::RecordingProxy::startRecording(const sp<ICameraRecordingProxyListener>& listener)
 {
-    LOGV("RecordingProxy::startRecording");
+    ALOGV("RecordingProxy::startRecording");
     mCamera->setRecordingProxyListener(listener);
     mCamera->reconnect();
     return mCamera->startRecording();
@@ -429,13 +429,13 @@
 
 void Camera::RecordingProxy::stopRecording()
 {
-    LOGV("RecordingProxy::stopRecording");
+    ALOGV("RecordingProxy::stopRecording");
     mCamera->stopRecording();
 }
 
 void Camera::RecordingProxy::releaseRecordingFrame(const sp<IMemory>& mem)
 {
-    LOGV("RecordingProxy::releaseRecordingFrame");
+    ALOGV("RecordingProxy::releaseRecordingFrame");
     mCamera->releaseRecordingFrame(mem);
 }
 
diff --git a/camera/ICamera.cpp b/camera/ICamera.cpp
index 5f6e5ef..70f5dbc 100644
--- a/camera/ICamera.cpp
+++ b/camera/ICamera.cpp
@@ -60,7 +60,7 @@
     // disconnect from camera service
     void disconnect()
     {
-        LOGV("disconnect");
+        ALOGV("disconnect");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(DISCONNECT, data, &reply);
@@ -69,7 +69,7 @@
     // pass the buffered Surface to the camera service
     status_t setPreviewDisplay(const sp<Surface>& surface)
     {
-        LOGV("setPreviewDisplay");
+        ALOGV("setPreviewDisplay");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         Surface::writeToParcel(surface, &data);
@@ -80,7 +80,7 @@
     // pass the buffered SurfaceTexture to the camera service
     status_t setPreviewTexture(const sp<ISurfaceTexture>& surfaceTexture)
     {
-        LOGV("setPreviewTexture");
+        ALOGV("setPreviewTexture");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         sp<IBinder> b(surfaceTexture->asBinder());
@@ -93,7 +93,7 @@
     // preview are handled. See Camera.h for details.
     void setPreviewCallbackFlag(int flag)
     {
-        LOGV("setPreviewCallbackFlag(%d)", flag);
+        ALOGV("setPreviewCallbackFlag(%d)", flag);
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         data.writeInt32(flag);
@@ -103,7 +103,7 @@
     // start preview mode, must call setPreviewDisplay first
     status_t startPreview()
     {
-        LOGV("startPreview");
+        ALOGV("startPreview");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(START_PREVIEW, data, &reply);
@@ -113,7 +113,7 @@
     // start recording mode, must call setPreviewDisplay first
     status_t startRecording()
     {
-        LOGV("startRecording");
+        ALOGV("startRecording");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(START_RECORDING, data, &reply);
@@ -123,7 +123,7 @@
     // stop preview mode
     void stopPreview()
     {
-        LOGV("stopPreview");
+        ALOGV("stopPreview");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(STOP_PREVIEW, data, &reply);
@@ -132,7 +132,7 @@
     // stop recording mode
     void stopRecording()
     {
-        LOGV("stopRecording");
+        ALOGV("stopRecording");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(STOP_RECORDING, data, &reply);
@@ -140,7 +140,7 @@
 
     void releaseRecordingFrame(const sp<IMemory>& mem)
     {
-        LOGV("releaseRecordingFrame");
+        ALOGV("releaseRecordingFrame");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         data.writeStrongBinder(mem->asBinder());
@@ -149,7 +149,7 @@
 
     status_t storeMetaDataInBuffers(bool enabled)
     {
-        LOGV("storeMetaDataInBuffers: %s", enabled? "true": "false");
+        ALOGV("storeMetaDataInBuffers: %s", enabled? "true": "false");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         data.writeInt32(enabled);
@@ -160,7 +160,7 @@
     // check preview state
     bool previewEnabled()
     {
-        LOGV("previewEnabled");
+        ALOGV("previewEnabled");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(PREVIEW_ENABLED, data, &reply);
@@ -170,7 +170,7 @@
     // check recording state
     bool recordingEnabled()
     {
-        LOGV("recordingEnabled");
+        ALOGV("recordingEnabled");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(RECORDING_ENABLED, data, &reply);
@@ -180,7 +180,7 @@
     // auto focus
     status_t autoFocus()
     {
-        LOGV("autoFocus");
+        ALOGV("autoFocus");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(AUTO_FOCUS, data, &reply);
@@ -191,7 +191,7 @@
     // cancel focus
     status_t cancelAutoFocus()
     {
-        LOGV("cancelAutoFocus");
+        ALOGV("cancelAutoFocus");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(CANCEL_AUTO_FOCUS, data, &reply);
@@ -202,7 +202,7 @@
     // take a picture - returns an IMemory (ref-counted mmap)
     status_t takePicture(int msgType)
     {
-        LOGV("takePicture: 0x%x", msgType);
+        ALOGV("takePicture: 0x%x", msgType);
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         data.writeInt32(msgType);
@@ -214,7 +214,7 @@
     // set preview/capture parameters - key/value pairs
     status_t setParameters(const String8& params)
     {
-        LOGV("setParameters");
+        ALOGV("setParameters");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         data.writeString8(params);
@@ -225,7 +225,7 @@
     // get preview/capture parameters - key/value pairs
     String8 getParameters() const
     {
-        LOGV("getParameters");
+        ALOGV("getParameters");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         remote()->transact(GET_PARAMETERS, data, &reply);
@@ -233,7 +233,7 @@
     }
     virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2)
     {
-        LOGV("sendCommand");
+        ALOGV("sendCommand");
         Parcel data, reply;
         data.writeInterfaceToken(ICamera::getInterfaceDescriptor());
         data.writeInt32(cmd);
@@ -275,116 +275,116 @@
 {
     switch(code) {
         case DISCONNECT: {
-            LOGV("DISCONNECT");
+            ALOGV("DISCONNECT");
             CHECK_INTERFACE(ICamera, data, reply);
             disconnect();
             return NO_ERROR;
         } break;
         case SET_PREVIEW_DISPLAY: {
-            LOGV("SET_PREVIEW_DISPLAY");
+            ALOGV("SET_PREVIEW_DISPLAY");
             CHECK_INTERFACE(ICamera, data, reply);
             sp<Surface> surface = Surface::readFromParcel(data);
             reply->writeInt32(setPreviewDisplay(surface));
             return NO_ERROR;
         } break;
         case SET_PREVIEW_TEXTURE: {
-            LOGV("SET_PREVIEW_TEXTURE");
+            ALOGV("SET_PREVIEW_TEXTURE");
             CHECK_INTERFACE(ICamera, data, reply);
             sp<ISurfaceTexture> st = interface_cast<ISurfaceTexture>(data.readStrongBinder());
             reply->writeInt32(setPreviewTexture(st));
             return NO_ERROR;
         } break;
         case SET_PREVIEW_CALLBACK_FLAG: {
-            LOGV("SET_PREVIEW_CALLBACK_TYPE");
+            ALOGV("SET_PREVIEW_CALLBACK_TYPE");
             CHECK_INTERFACE(ICamera, data, reply);
             int callback_flag = data.readInt32();
             setPreviewCallbackFlag(callback_flag);
             return NO_ERROR;
         } break;
         case START_PREVIEW: {
-            LOGV("START_PREVIEW");
+            ALOGV("START_PREVIEW");
             CHECK_INTERFACE(ICamera, data, reply);
             reply->writeInt32(startPreview());
             return NO_ERROR;
         } break;
         case START_RECORDING: {
-            LOGV("START_RECORDING");
+            ALOGV("START_RECORDING");
             CHECK_INTERFACE(ICamera, data, reply);
             reply->writeInt32(startRecording());
             return NO_ERROR;
         } break;
         case STOP_PREVIEW: {
-            LOGV("STOP_PREVIEW");
+            ALOGV("STOP_PREVIEW");
             CHECK_INTERFACE(ICamera, data, reply);
             stopPreview();
             return NO_ERROR;
         } break;
         case STOP_RECORDING: {
-            LOGV("STOP_RECORDING");
+            ALOGV("STOP_RECORDING");
             CHECK_INTERFACE(ICamera, data, reply);
             stopRecording();
             return NO_ERROR;
         } break;
         case RELEASE_RECORDING_FRAME: {
-            LOGV("RELEASE_RECORDING_FRAME");
+            ALOGV("RELEASE_RECORDING_FRAME");
             CHECK_INTERFACE(ICamera, data, reply);
             sp<IMemory> mem = interface_cast<IMemory>(data.readStrongBinder());
             releaseRecordingFrame(mem);
             return NO_ERROR;
         } break;
         case STORE_META_DATA_IN_BUFFERS: {
-            LOGV("STORE_META_DATA_IN_BUFFERS");
+            ALOGV("STORE_META_DATA_IN_BUFFERS");
             CHECK_INTERFACE(ICamera, data, reply);
             bool enabled = data.readInt32();
             reply->writeInt32(storeMetaDataInBuffers(enabled));
             return NO_ERROR;
         } break;
         case PREVIEW_ENABLED: {
-            LOGV("PREVIEW_ENABLED");
+            ALOGV("PREVIEW_ENABLED");
             CHECK_INTERFACE(ICamera, data, reply);
             reply->writeInt32(previewEnabled());
             return NO_ERROR;
         } break;
         case RECORDING_ENABLED: {
-            LOGV("RECORDING_ENABLED");
+            ALOGV("RECORDING_ENABLED");
             CHECK_INTERFACE(ICamera, data, reply);
             reply->writeInt32(recordingEnabled());
             return NO_ERROR;
         } break;
         case AUTO_FOCUS: {
-            LOGV("AUTO_FOCUS");
+            ALOGV("AUTO_FOCUS");
             CHECK_INTERFACE(ICamera, data, reply);
             reply->writeInt32(autoFocus());
             return NO_ERROR;
         } break;
         case CANCEL_AUTO_FOCUS: {
-            LOGV("CANCEL_AUTO_FOCUS");
+            ALOGV("CANCEL_AUTO_FOCUS");
             CHECK_INTERFACE(ICamera, data, reply);
             reply->writeInt32(cancelAutoFocus());
             return NO_ERROR;
         } break;
         case TAKE_PICTURE: {
-            LOGV("TAKE_PICTURE");
+            ALOGV("TAKE_PICTURE");
             CHECK_INTERFACE(ICamera, data, reply);
             int msgType = data.readInt32();
             reply->writeInt32(takePicture(msgType));
             return NO_ERROR;
         } break;
         case SET_PARAMETERS: {
-            LOGV("SET_PARAMETERS");
+            ALOGV("SET_PARAMETERS");
             CHECK_INTERFACE(ICamera, data, reply);
             String8 params(data.readString8());
             reply->writeInt32(setParameters(params));
             return NO_ERROR;
          } break;
         case GET_PARAMETERS: {
-            LOGV("GET_PARAMETERS");
+            ALOGV("GET_PARAMETERS");
             CHECK_INTERFACE(ICamera, data, reply);
              reply->writeString8(getParameters());
             return NO_ERROR;
          } break;
         case SEND_COMMAND: {
-            LOGV("SEND_COMMAND");
+            ALOGV("SEND_COMMAND");
             CHECK_INTERFACE(ICamera, data, reply);
             int command = data.readInt32();
             int arg1 = data.readInt32();
diff --git a/camera/ICameraClient.cpp b/camera/ICameraClient.cpp
index 183429a..205c8ba 100644
--- a/camera/ICameraClient.cpp
+++ b/camera/ICameraClient.cpp
@@ -41,7 +41,7 @@
     // generic callback from camera service to app
     void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2)
     {
-        LOGV("notifyCallback");
+        ALOGV("notifyCallback");
         Parcel data, reply;
         data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
         data.writeInt32(msgType);
@@ -54,7 +54,7 @@
     void dataCallback(int32_t msgType, const sp<IMemory>& imageData,
                       camera_frame_metadata_t *metadata)
     {
-        LOGV("dataCallback");
+        ALOGV("dataCallback");
         Parcel data, reply;
         data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
         data.writeInt32(msgType);
@@ -69,7 +69,7 @@
     // generic data callback from camera service to app with image data
     void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& imageData)
     {
-        LOGV("dataCallback");
+        ALOGV("dataCallback");
         Parcel data, reply;
         data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
         data.writeInt64(timestamp);
@@ -88,7 +88,7 @@
 {
     switch(code) {
         case NOTIFY_CALLBACK: {
-            LOGV("NOTIFY_CALLBACK");
+            ALOGV("NOTIFY_CALLBACK");
             CHECK_INTERFACE(ICameraClient, data, reply);
             int32_t msgType = data.readInt32();
             int32_t ext1 = data.readInt32();
@@ -97,7 +97,7 @@
             return NO_ERROR;
         } break;
         case DATA_CALLBACK: {
-            LOGV("DATA_CALLBACK");
+            ALOGV("DATA_CALLBACK");
             CHECK_INTERFACE(ICameraClient, data, reply);
             int32_t msgType = data.readInt32();
             sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder());
@@ -113,7 +113,7 @@
             return NO_ERROR;
         } break;
         case DATA_CALLBACK_TIMESTAMP: {
-            LOGV("DATA_CALLBACK_TIMESTAMP");
+            ALOGV("DATA_CALLBACK_TIMESTAMP");
             CHECK_INTERFACE(ICameraClient, data, reply);
             nsecs_t timestamp = data.readInt64();
             int32_t msgType = data.readInt32();
diff --git a/camera/ICameraRecordingProxy.cpp b/camera/ICameraRecordingProxy.cpp
index 64b6a5c..7223b6d 100644
--- a/camera/ICameraRecordingProxy.cpp
+++ b/camera/ICameraRecordingProxy.cpp
@@ -42,7 +42,7 @@
 
     status_t startRecording(const sp<ICameraRecordingProxyListener>& listener)
     {
-        LOGV("startRecording");
+        ALOGV("startRecording");
         Parcel data, reply;
         data.writeInterfaceToken(ICameraRecordingProxy::getInterfaceDescriptor());
         data.writeStrongBinder(listener->asBinder());
@@ -52,7 +52,7 @@
 
     void stopRecording()
     {
-        LOGV("stopRecording");
+        ALOGV("stopRecording");
         Parcel data, reply;
         data.writeInterfaceToken(ICameraRecordingProxy::getInterfaceDescriptor());
         remote()->transact(STOP_RECORDING, data, &reply);
@@ -60,7 +60,7 @@
 
     void releaseRecordingFrame(const sp<IMemory>& mem)
     {
-        LOGV("releaseRecordingFrame");
+        ALOGV("releaseRecordingFrame");
         Parcel data, reply;
         data.writeInterfaceToken(ICameraRecordingProxy::getInterfaceDescriptor());
         data.writeStrongBinder(mem->asBinder());
@@ -77,7 +77,7 @@
 {
     switch(code) {
         case START_RECORDING: {
-            LOGV("START_RECORDING");
+            ALOGV("START_RECORDING");
             CHECK_INTERFACE(ICameraRecordingProxy, data, reply);
             sp<ICameraRecordingProxyListener> listener =
                 interface_cast<ICameraRecordingProxyListener>(data.readStrongBinder());
@@ -85,13 +85,13 @@
             return NO_ERROR;
         } break;
         case STOP_RECORDING: {
-            LOGV("STOP_RECORDING");
+            ALOGV("STOP_RECORDING");
             CHECK_INTERFACE(ICameraRecordingProxy, data, reply);
             stopRecording();
             return NO_ERROR;
         } break;
         case RELEASE_RECORDING_FRAME: {
-            LOGV("RELEASE_RECORDING_FRAME");
+            ALOGV("RELEASE_RECORDING_FRAME");
             CHECK_INTERFACE(ICameraRecordingProxy, data, reply);
             sp<IMemory> mem = interface_cast<IMemory>(data.readStrongBinder());
             releaseRecordingFrame(mem);
diff --git a/camera/ICameraRecordingProxyListener.cpp b/camera/ICameraRecordingProxyListener.cpp
index f8cece5..cb17f19 100644
--- a/camera/ICameraRecordingProxyListener.cpp
+++ b/camera/ICameraRecordingProxyListener.cpp
@@ -37,7 +37,7 @@
 
     void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& imageData)
     {
-        LOGV("dataCallback");
+        ALOGV("dataCallback");
         Parcel data, reply;
         data.writeInterfaceToken(ICameraRecordingProxyListener::getInterfaceDescriptor());
         data.writeInt64(timestamp);
@@ -56,7 +56,7 @@
 {
     switch(code) {
         case DATA_CALLBACK_TIMESTAMP: {
-            LOGV("DATA_CALLBACK_TIMESTAMP");
+            ALOGV("DATA_CALLBACK_TIMESTAMP");
             CHECK_INTERFACE(ICameraRecordingProxyListener, data, reply);
             nsecs_t timestamp = data.readInt64();
             int32_t msgType = data.readInt32();
diff --git a/cmds/stagefright/sf2.cpp b/cmds/stagefright/sf2.cpp
index f547e01..7551d31 100644
--- a/cmds/stagefright/sf2.cpp
+++ b/cmds/stagefright/sf2.cpp
@@ -500,7 +500,7 @@
                 break;  // Don't coalesce
             }
 
-            LOGV("coalesced %d input buffers", n);
+            ALOGV("coalesced %d input buffers", n);
 
             if (outBuffer->size() == 0) {
                 CHECK_NE(mFinalResult, (status_t)OK);
diff --git a/cmds/stagefright/stream.cpp b/cmds/stagefright/stream.cpp
index bd430d1..24403dc 100644
--- a/cmds/stagefright/stream.cpp
+++ b/cmds/stagefright/stream.cpp
@@ -308,7 +308,7 @@
     ssize_t displayWidth = composerClient->getDisplayWidth(0);
     ssize_t displayHeight = composerClient->getDisplayHeight(0);
 
-    LOGV("display is %d x %d\n", displayWidth, displayHeight);
+    ALOGV("display is %d x %d\n", displayWidth, displayHeight);
 
     sp<SurfaceControl> control =
         composerClient->createSurface(
diff --git a/drm/common/DrmMetadata.cpp b/drm/common/DrmMetadata.cpp
index 6cc5ec1..2a4b8c8 100644
--- a/drm/common/DrmMetadata.cpp
+++ b/drm/common/DrmMetadata.cpp
@@ -78,11 +78,11 @@
 DrmMetadata::KeyIterator::KeyIterator(const DrmMetadata::KeyIterator& keyIterator) :
     mDrmMetadata(keyIterator.mDrmMetadata),
     mIndex(keyIterator.mIndex) {
-    LOGV("DrmMetadata::KeyIterator::KeyIterator");
+    ALOGV("DrmMetadata::KeyIterator::KeyIterator");
 }
 
 DrmMetadata::KeyIterator& DrmMetadata::KeyIterator::operator=(const DrmMetadata::KeyIterator& keyIterator) {
-    LOGV("DrmMetadata::KeyIterator::operator=");
+    ALOGV("DrmMetadata::KeyIterator::operator=");
     mDrmMetadata = keyIterator.mDrmMetadata;
     mIndex = keyIterator.mIndex;
     return *this;
@@ -96,11 +96,11 @@
 DrmMetadata::Iterator::Iterator(const DrmMetadata::Iterator& iterator) :
     mDrmMetadata(iterator.mDrmMetadata),
     mIndex(iterator.mIndex) {
-    LOGV("DrmMetadata::Iterator::Iterator");
+    ALOGV("DrmMetadata::Iterator::Iterator");
 }
 
 DrmMetadata::Iterator& DrmMetadata::Iterator::operator=(const DrmMetadata::Iterator& iterator) {
-    LOGV("DrmMetadata::Iterator::operator=");
+    ALOGV("DrmMetadata::Iterator::operator=");
     mDrmMetadata = iterator.mDrmMetadata;
     mIndex = iterator.mIndex;
     return *this;
diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp
index 0b76a36..3ed8ade 100644
--- a/drm/common/IDrmManagerService.cpp
+++ b/drm/common/IDrmManagerService.cpp
@@ -111,7 +111,7 @@
 }
 
 int BpDrmManagerService::addUniqueId(bool isNative) {
-    LOGV("add uniqueid");
+    ALOGV("add uniqueid");
     Parcel data, reply;
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
     data.writeInt32(isNative);
@@ -120,7 +120,7 @@
 }
 
 void BpDrmManagerService::removeUniqueId(int uniqueId) {
-    LOGV("remove uniqueid");
+    ALOGV("remove uniqueid");
     Parcel data, reply;
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
     data.writeInt32(uniqueId);
@@ -143,7 +143,7 @@
 
 status_t BpDrmManagerService::setDrmServiceListener(
             int uniqueId, const sp<IDrmServiceListener>& drmServiceListener) {
-    LOGV("setDrmServiceListener");
+    ALOGV("setDrmServiceListener");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -154,7 +154,7 @@
 }
 
 status_t BpDrmManagerService::installDrmEngine(int uniqueId, const String8& drmEngineFile) {
-    LOGV("Install DRM Engine");
+    ALOGV("Install DRM Engine");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -167,7 +167,7 @@
 
 DrmConstraints* BpDrmManagerService::getConstraints(
             int uniqueId, const String8* path, const int action) {
-    LOGV("Get Constraints");
+    ALOGV("Get Constraints");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -198,7 +198,7 @@
 }
 
 DrmMetadata* BpDrmManagerService::getMetadata(int uniqueId, const String8* path) {
-    LOGV("Get Metadata");
+    ALOGV("Get Metadata");
     Parcel data, reply;
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
     data.writeInt32(uniqueId);
@@ -227,7 +227,7 @@
 }
 
 bool BpDrmManagerService::canHandle(int uniqueId, const String8& path, const String8& mimeType) {
-    LOGV("Can Handle");
+    ALOGV("Can Handle");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -242,7 +242,7 @@
 }
 
 DrmInfoStatus* BpDrmManagerService::processDrmInfo(int uniqueId, const DrmInfo* drmInfo) {
-    LOGV("Process DRM Info");
+    ALOGV("Process DRM Info");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -293,7 +293,7 @@
 }
 
 DrmInfo* BpDrmManagerService::acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInforequest) {
-    LOGV("Acquire DRM Info");
+    ALOGV("Acquire DRM Info");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -341,7 +341,7 @@
 status_t BpDrmManagerService::saveRights(
             int uniqueId, const DrmRights& drmRights,
             const String8& rightsPath, const String8& contentPath) {
-    LOGV("Save Rights");
+    ALOGV("Save Rights");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -369,7 +369,7 @@
 }
 
 String8 BpDrmManagerService::getOriginalMimeType(int uniqueId, const String8& path) {
-    LOGV("Get Original MimeType");
+    ALOGV("Get Original MimeType");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -382,7 +382,7 @@
 
 int BpDrmManagerService::getDrmObjectType(
             int uniqueId, const String8& path, const String8& mimeType) {
-    LOGV("Get Drm object type");
+    ALOGV("Get Drm object type");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -396,7 +396,7 @@
 }
 
 int BpDrmManagerService::checkRightsStatus(int uniqueId, const String8& path, int action) {
-    LOGV("checkRightsStatus");
+    ALOGV("checkRightsStatus");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -411,7 +411,7 @@
 
 status_t BpDrmManagerService::consumeRights(
             int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) {
-    LOGV("consumeRights");
+    ALOGV("consumeRights");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -428,7 +428,7 @@
 
 status_t BpDrmManagerService::setPlaybackStatus(
             int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) {
-    LOGV("setPlaybackStatus");
+    ALOGV("setPlaybackStatus");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -446,7 +446,7 @@
 bool BpDrmManagerService::validateAction(
             int uniqueId, const String8& path,
             int action, const ActionDescription& description) {
-    LOGV("validateAction");
+    ALOGV("validateAction");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -462,7 +462,7 @@
 }
 
 status_t BpDrmManagerService::removeRights(int uniqueId, const String8& path) {
-    LOGV("removeRights");
+    ALOGV("removeRights");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -474,7 +474,7 @@
 }
 
 status_t BpDrmManagerService::removeAllRights(int uniqueId) {
-    LOGV("removeAllRights");
+    ALOGV("removeAllRights");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -485,7 +485,7 @@
 }
 
 int BpDrmManagerService::openConvertSession(int uniqueId, const String8& mimeType) {
-    LOGV("openConvertSession");
+    ALOGV("openConvertSession");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -498,7 +498,7 @@
 
 DrmConvertedStatus* BpDrmManagerService::convertData(
             int uniqueId, int convertId, const DrmBuffer* inputData) {
-    LOGV("convertData");
+    ALOGV("convertData");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -532,7 +532,7 @@
 }
 
 DrmConvertedStatus* BpDrmManagerService::closeConvertSession(int uniqueId, int convertId) {
-    LOGV("closeConvertSession");
+    ALOGV("closeConvertSession");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -565,7 +565,7 @@
 
 status_t BpDrmManagerService::getAllSupportInfo(
             int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray) {
-    LOGV("Get All Support Info");
+    ALOGV("Get All Support Info");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -601,7 +601,7 @@
 
 DecryptHandle* BpDrmManagerService::openDecryptSession(
             int uniqueId, int fd, off64_t offset, off64_t length) {
-    LOGV("Entering BpDrmManagerService::openDecryptSession");
+    ALOGV("Entering BpDrmManagerService::openDecryptSession");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -621,7 +621,7 @@
 }
 
 DecryptHandle* BpDrmManagerService::openDecryptSession(int uniqueId, const char* uri) {
-    LOGV("Entering BpDrmManagerService::openDecryptSession");
+    ALOGV("Entering BpDrmManagerService::openDecryptSession");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -635,13 +635,13 @@
         handle = new DecryptHandle();
         readDecryptHandleFromParcelData(handle, reply);
     } else {
-        LOGV("no decryptHandle is generated in service side");
+        ALOGV("no decryptHandle is generated in service side");
     }
     return handle;
 }
 
 status_t BpDrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
-    LOGV("closeDecryptSession");
+    ALOGV("closeDecryptSession");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -657,7 +657,7 @@
 status_t BpDrmManagerService::initializeDecryptUnit(
             int uniqueId, DecryptHandle* decryptHandle,
             int decryptUnitId, const DrmBuffer* headerInfo) {
-    LOGV("initializeDecryptUnit");
+    ALOGV("initializeDecryptUnit");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -677,7 +677,7 @@
 status_t BpDrmManagerService::decrypt(
             int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
             const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
-    LOGV("decrypt");
+    ALOGV("decrypt");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -699,7 +699,7 @@
     remote()->transact(DECRYPT, data, &reply);
 
     const status_t status = reply.readInt32();
-    LOGV("Return value of decrypt() is %d", status);
+    ALOGV("Return value of decrypt() is %d", status);
 
     const int size = reply.readInt32();
     (*decBuffer)->length = size;
@@ -710,7 +710,7 @@
 
 status_t BpDrmManagerService::finalizeDecryptUnit(
             int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
-    LOGV("finalizeDecryptUnit");
+    ALOGV("finalizeDecryptUnit");
     Parcel data, reply;
 
     data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
@@ -727,7 +727,7 @@
 ssize_t BpDrmManagerService::pread(
             int uniqueId, DecryptHandle* decryptHandle, void* buffer,
             ssize_t numBytes, off64_t offset) {
-    LOGV("read");
+    ALOGV("read");
     Parcel data, reply;
     int result;
 
@@ -752,12 +752,12 @@
 status_t BnDrmManagerService::onTransact(
             uint32_t code, const Parcel& data,
             Parcel* reply, uint32_t flags) {
-    LOGV("Entering BnDrmManagerService::onTransact with code %d", code);
+    ALOGV("Entering BnDrmManagerService::onTransact with code %d", code);
 
     switch (code) {
     case ADD_UNIQUEID:
     {
-        LOGV("BnDrmManagerService::onTransact :ADD_UNIQUEID");
+        ALOGV("BnDrmManagerService::onTransact :ADD_UNIQUEID");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
         int uniqueId = addUniqueId(data.readInt32());
         reply->writeInt32(uniqueId);
@@ -766,7 +766,7 @@
 
     case REMOVE_UNIQUEID:
     {
-        LOGV("BnDrmManagerService::onTransact :REMOVE_UNIQUEID");
+        ALOGV("BnDrmManagerService::onTransact :REMOVE_UNIQUEID");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
         removeUniqueId(data.readInt32());
         return DRM_NO_ERROR;
@@ -774,7 +774,7 @@
 
     case ADD_CLIENT:
     {
-        LOGV("BnDrmManagerService::onTransact :ADD_CLIENT");
+        ALOGV("BnDrmManagerService::onTransact :ADD_CLIENT");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
         addClient(data.readInt32());
         return DRM_NO_ERROR;
@@ -782,7 +782,7 @@
 
     case REMOVE_CLIENT:
     {
-        LOGV("BnDrmManagerService::onTransact :REMOVE_CLIENT");
+        ALOGV("BnDrmManagerService::onTransact :REMOVE_CLIENT");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
         removeClient(data.readInt32());
         return DRM_NO_ERROR;
@@ -790,7 +790,7 @@
 
     case SET_DRM_SERVICE_LISTENER:
     {
-        LOGV("BnDrmManagerService::onTransact :SET_DRM_SERVICE_LISTENER");
+        ALOGV("BnDrmManagerService::onTransact :SET_DRM_SERVICE_LISTENER");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -805,7 +805,7 @@
 
     case INSTALL_DRM_ENGINE:
     {
-        LOGV("BnDrmManagerService::onTransact :INSTALL_DRM_ENGINE");
+        ALOGV("BnDrmManagerService::onTransact :INSTALL_DRM_ENGINE");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -818,7 +818,7 @@
 
     case GET_CONSTRAINTS_FROM_CONTENT:
     {
-        LOGV("BnDrmManagerService::onTransact :GET_CONSTRAINTS_FROM_CONTENT");
+        ALOGV("BnDrmManagerService::onTransact :GET_CONSTRAINTS_FROM_CONTENT");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -850,7 +850,7 @@
 
     case GET_METADATA_FROM_CONTENT:
     {
-        LOGV("BnDrmManagerService::onTransact :GET_METADATA_FROM_CONTENT");
+        ALOGV("BnDrmManagerService::onTransact :GET_METADATA_FROM_CONTENT");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -882,7 +882,7 @@
 
     case CAN_HANDLE:
     {
-        LOGV("BnDrmManagerService::onTransact :CAN_HANDLE");
+        ALOGV("BnDrmManagerService::onTransact :CAN_HANDLE");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -897,7 +897,7 @@
 
     case PROCESS_DRM_INFO:
     {
-        LOGV("BnDrmManagerService::onTransact :PROCESS_DRM_INFO");
+        ALOGV("BnDrmManagerService::onTransact :PROCESS_DRM_INFO");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -945,7 +945,7 @@
 
     case ACQUIRE_DRM_INFO:
     {
-        LOGV("BnDrmManagerService::onTransact :ACQUIRE_DRM_INFO");
+        ALOGV("BnDrmManagerService::onTransact :ACQUIRE_DRM_INFO");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -993,7 +993,7 @@
 
     case SAVE_RIGHTS:
     {
-        LOGV("BnDrmManagerService::onTransact :SAVE_RIGHTS");
+        ALOGV("BnDrmManagerService::onTransact :SAVE_RIGHTS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1023,7 +1023,7 @@
 
     case GET_ORIGINAL_MIMETYPE:
     {
-        LOGV("BnDrmManagerService::onTransact :GET_ORIGINAL_MIMETYPE");
+        ALOGV("BnDrmManagerService::onTransact :GET_ORIGINAL_MIMETYPE");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1036,7 +1036,7 @@
 
     case GET_DRM_OBJECT_TYPE:
     {
-        LOGV("BnDrmManagerService::onTransact :GET_DRM_OBJECT_TYPE");
+        ALOGV("BnDrmManagerService::onTransact :GET_DRM_OBJECT_TYPE");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1050,7 +1050,7 @@
 
     case CHECK_RIGHTS_STATUS:
     {
-        LOGV("BnDrmManagerService::onTransact :CHECK_RIGHTS_STATUS");
+        ALOGV("BnDrmManagerService::onTransact :CHECK_RIGHTS_STATUS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1064,7 +1064,7 @@
 
     case CONSUME_RIGHTS:
     {
-        LOGV("BnDrmManagerService::onTransact :CONSUME_RIGHTS");
+        ALOGV("BnDrmManagerService::onTransact :CONSUME_RIGHTS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1084,7 +1084,7 @@
 
     case SET_PLAYBACK_STATUS:
     {
-        LOGV("BnDrmManagerService::onTransact :SET_PLAYBACK_STATUS");
+        ALOGV("BnDrmManagerService::onTransact :SET_PLAYBACK_STATUS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1104,7 +1104,7 @@
 
     case VALIDATE_ACTION:
     {
-        LOGV("BnDrmManagerService::onTransact :VALIDATE_ACTION");
+        ALOGV("BnDrmManagerService::onTransact :VALIDATE_ACTION");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1121,7 +1121,7 @@
 
     case REMOVE_RIGHTS:
     {
-        LOGV("BnDrmManagerService::onTransact :REMOVE_RIGHTS");
+        ALOGV("BnDrmManagerService::onTransact :REMOVE_RIGHTS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         int uniqueId = data.readInt32();
@@ -1134,7 +1134,7 @@
 
     case REMOVE_ALL_RIGHTS:
     {
-        LOGV("BnDrmManagerService::onTransact :REMOVE_ALL_RIGHTS");
+        ALOGV("BnDrmManagerService::onTransact :REMOVE_ALL_RIGHTS");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const status_t status = removeAllRights(data.readInt32());
@@ -1145,7 +1145,7 @@
 
     case OPEN_CONVERT_SESSION:
     {
-        LOGV("BnDrmManagerService::onTransact :OPEN_CONVERT_SESSION");
+        ALOGV("BnDrmManagerService::onTransact :OPEN_CONVERT_SESSION");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1158,7 +1158,7 @@
 
     case CONVERT_DATA:
     {
-        LOGV("BnDrmManagerService::onTransact :CONVERT_DATA");
+        ALOGV("BnDrmManagerService::onTransact :CONVERT_DATA");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1193,7 +1193,7 @@
 
     case CLOSE_CONVERT_SESSION:
     {
-        LOGV("BnDrmManagerService::onTransact :CLOSE_CONVERT_SESSION");
+        ALOGV("BnDrmManagerService::onTransact :CLOSE_CONVERT_SESSION");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1223,7 +1223,7 @@
 
     case GET_ALL_SUPPORT_INFO:
     {
-        LOGV("BnDrmManagerService::onTransact :GET_ALL_SUPPORT_INFO");
+        ALOGV("BnDrmManagerService::onTransact :GET_ALL_SUPPORT_INFO");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1257,7 +1257,7 @@
 
     case OPEN_DECRYPT_SESSION:
     {
-        LOGV("BnDrmManagerService::onTransact :OPEN_DECRYPT_SESSION");
+        ALOGV("BnDrmManagerService::onTransact :OPEN_DECRYPT_SESSION");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1278,7 +1278,7 @@
 
     case OPEN_DECRYPT_SESSION_FROM_URI:
     {
-        LOGV("BnDrmManagerService::onTransact :OPEN_DECRYPT_SESSION_FROM_URI");
+        ALOGV("BnDrmManagerService::onTransact :OPEN_DECRYPT_SESSION_FROM_URI");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1292,14 +1292,14 @@
             clearDecryptHandle(handle);
             delete handle; handle = NULL;
         } else {
-            LOGV("NULL decryptHandle is returned");
+            ALOGV("NULL decryptHandle is returned");
         }
         return DRM_NO_ERROR;
     }
 
     case CLOSE_DECRYPT_SESSION:
     {
-        LOGV("BnDrmManagerService::onTransact :CLOSE_DECRYPT_SESSION");
+        ALOGV("BnDrmManagerService::onTransact :CLOSE_DECRYPT_SESSION");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1314,7 +1314,7 @@
 
     case INITIALIZE_DECRYPT_UNIT:
     {
-        LOGV("BnDrmManagerService::onTransact :INITIALIZE_DECRYPT_UNIT");
+        ALOGV("BnDrmManagerService::onTransact :INITIALIZE_DECRYPT_UNIT");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1340,7 +1340,7 @@
 
     case DECRYPT:
     {
-        LOGV("BnDrmManagerService::onTransact :DECRYPT");
+        ALOGV("BnDrmManagerService::onTransact :DECRYPT");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1384,7 +1384,7 @@
 
     case FINALIZE_DECRYPT_UNIT:
     {
-        LOGV("BnDrmManagerService::onTransact :FINALIZE_DECRYPT_UNIT");
+        ALOGV("BnDrmManagerService::onTransact :FINALIZE_DECRYPT_UNIT");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
@@ -1401,7 +1401,7 @@
 
     case PREAD:
     {
-        LOGV("BnDrmManagerService::onTransact :READ");
+        ALOGV("BnDrmManagerService::onTransact :READ");
         CHECK_INTERFACE(IDrmManagerService, data, reply);
 
         const int uniqueId = data.readInt32();
diff --git a/drm/drmserver/DrmManager.cpp b/drm/drmserver/DrmManager.cpp
index b2fa053..3abf3d3 100644
--- a/drm/drmserver/DrmManager.cpp
+++ b/drm/drmserver/DrmManager.cpp
@@ -476,7 +476,7 @@
     }
     if (DRM_NO_ERROR != result) {
         delete handle; handle = NULL;
-        LOGV("DrmManager::openDecryptSession: no capable plug-in found");
+        ALOGV("DrmManager::openDecryptSession: no capable plug-in found");
     }
     return handle;
 }
diff --git a/drm/drmserver/DrmManagerService.cpp b/drm/drmserver/DrmManagerService.cpp
index 7ebcac3..df17ac5 100644
--- a/drm/drmserver/DrmManagerService.cpp
+++ b/drm/drmserver/DrmManagerService.cpp
@@ -52,7 +52,7 @@
 }
 
 void DrmManagerService::instantiate() {
-    LOGV("instantiate");
+    ALOGV("instantiate");
     defaultServiceManager()->addService(String16("drm.drmManager"), new DrmManagerService());
 
     if (0 >= trustedUids.size()) {
@@ -67,13 +67,13 @@
 
 DrmManagerService::DrmManagerService() :
         mDrmManager(NULL) {
-    LOGV("created");
+    ALOGV("created");
     mDrmManager = new DrmManager();
     mDrmManager->loadPlugIns();
 }
 
 DrmManagerService::~DrmManagerService() {
-    LOGV("Destroyed");
+    ALOGV("Destroyed");
     mDrmManager->unloadPlugIns();
     delete mDrmManager; mDrmManager = NULL;
 }
@@ -96,120 +96,120 @@
 
 status_t DrmManagerService::setDrmServiceListener(
             int uniqueId, const sp<IDrmServiceListener>& drmServiceListener) {
-    LOGV("Entering setDrmServiceListener");
+    ALOGV("Entering setDrmServiceListener");
     mDrmManager->setDrmServiceListener(uniqueId, drmServiceListener);
     return DRM_NO_ERROR;
 }
 
 status_t DrmManagerService::installDrmEngine(int uniqueId, const String8& drmEngineFile) {
-    LOGV("Entering installDrmEngine");
+    ALOGV("Entering installDrmEngine");
     return mDrmManager->installDrmEngine(uniqueId, drmEngineFile);
 }
 
 DrmConstraints* DrmManagerService::getConstraints(
             int uniqueId, const String8* path, const int action) {
-    LOGV("Entering getConstraints from content");
+    ALOGV("Entering getConstraints from content");
     return mDrmManager->getConstraints(uniqueId, path, action);
 }
 
 DrmMetadata* DrmManagerService::getMetadata(int uniqueId, const String8* path) {
-    LOGV("Entering getMetadata from content");
+    ALOGV("Entering getMetadata from content");
     return mDrmManager->getMetadata(uniqueId, path);
 }
 
 bool DrmManagerService::canHandle(int uniqueId, const String8& path, const String8& mimeType) {
-    LOGV("Entering canHandle");
+    ALOGV("Entering canHandle");
     return mDrmManager->canHandle(uniqueId, path, mimeType);
 }
 
 DrmInfoStatus* DrmManagerService::processDrmInfo(int uniqueId, const DrmInfo* drmInfo) {
-    LOGV("Entering processDrmInfo");
+    ALOGV("Entering processDrmInfo");
     return mDrmManager->processDrmInfo(uniqueId, drmInfo);
 }
 
 DrmInfo* DrmManagerService::acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmInfoRequest) {
-    LOGV("Entering acquireDrmInfo");
+    ALOGV("Entering acquireDrmInfo");
     return mDrmManager->acquireDrmInfo(uniqueId, drmInfoRequest);
 }
 
 status_t DrmManagerService::saveRights(
             int uniqueId, const DrmRights& drmRights,
             const String8& rightsPath, const String8& contentPath) {
-    LOGV("Entering saveRights");
+    ALOGV("Entering saveRights");
     return mDrmManager->saveRights(uniqueId, drmRights, rightsPath, contentPath);
 }
 
 String8 DrmManagerService::getOriginalMimeType(int uniqueId, const String8& path) {
-    LOGV("Entering getOriginalMimeType");
+    ALOGV("Entering getOriginalMimeType");
     return mDrmManager->getOriginalMimeType(uniqueId, path);
 }
 
 int DrmManagerService::getDrmObjectType(
            int uniqueId, const String8& path, const String8& mimeType) {
-    LOGV("Entering getDrmObjectType");
+    ALOGV("Entering getDrmObjectType");
     return mDrmManager->getDrmObjectType(uniqueId, path, mimeType);
 }
 
 int DrmManagerService::checkRightsStatus(
             int uniqueId, const String8& path, int action) {
-    LOGV("Entering checkRightsStatus");
+    ALOGV("Entering checkRightsStatus");
     return mDrmManager->checkRightsStatus(uniqueId, path, action);
 }
 
 status_t DrmManagerService::consumeRights(
             int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) {
-    LOGV("Entering consumeRights");
+    ALOGV("Entering consumeRights");
     return mDrmManager->consumeRights(uniqueId, decryptHandle, action, reserve);
 }
 
 status_t DrmManagerService::setPlaybackStatus(
             int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int64_t position) {
-    LOGV("Entering setPlaybackStatus");
+    ALOGV("Entering setPlaybackStatus");
     return mDrmManager->setPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
 }
 
 bool DrmManagerService::validateAction(
             int uniqueId, const String8& path,
             int action, const ActionDescription& description) {
-    LOGV("Entering validateAction");
+    ALOGV("Entering validateAction");
     return mDrmManager->validateAction(uniqueId, path, action, description);
 }
 
 status_t DrmManagerService::removeRights(int uniqueId, const String8& path) {
-    LOGV("Entering removeRights");
+    ALOGV("Entering removeRights");
     return mDrmManager->removeRights(uniqueId, path);
 }
 
 status_t DrmManagerService::removeAllRights(int uniqueId) {
-    LOGV("Entering removeAllRights");
+    ALOGV("Entering removeAllRights");
     return mDrmManager->removeAllRights(uniqueId);
 }
 
 int DrmManagerService::openConvertSession(int uniqueId, const String8& mimeType) {
-    LOGV("Entering openConvertSession");
+    ALOGV("Entering openConvertSession");
     return mDrmManager->openConvertSession(uniqueId, mimeType);
 }
 
 DrmConvertedStatus* DrmManagerService::convertData(
             int uniqueId, int convertId, const DrmBuffer* inputData) {
-    LOGV("Entering convertData");
+    ALOGV("Entering convertData");
     return mDrmManager->convertData(uniqueId, convertId, inputData);
 }
 
 DrmConvertedStatus* DrmManagerService::closeConvertSession(int uniqueId, int convertId) {
-    LOGV("Entering closeConvertSession");
+    ALOGV("Entering closeConvertSession");
     return mDrmManager->closeConvertSession(uniqueId, convertId);
 }
 
 status_t DrmManagerService::getAllSupportInfo(
             int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray) {
-    LOGV("Entering getAllSupportInfo");
+    ALOGV("Entering getAllSupportInfo");
     return mDrmManager->getAllSupportInfo(uniqueId, length, drmSupportInfoArray);
 }
 
 DecryptHandle* DrmManagerService::openDecryptSession(
             int uniqueId, int fd, off64_t offset, off64_t length) {
-    LOGV("Entering DrmManagerService::openDecryptSession");
+    ALOGV("Entering DrmManagerService::openDecryptSession");
     if (isProtectedCallAllowed()) {
         return mDrmManager->openDecryptSession(uniqueId, fd, offset, length);
     }
@@ -219,7 +219,7 @@
 
 DecryptHandle* DrmManagerService::openDecryptSession(
             int uniqueId, const char* uri) {
-    LOGV("Entering DrmManagerService::openDecryptSession with uri");
+    ALOGV("Entering DrmManagerService::openDecryptSession with uri");
     if (isProtectedCallAllowed()) {
         return mDrmManager->openDecryptSession(uniqueId, uri);
     }
@@ -228,32 +228,32 @@
 }
 
 status_t DrmManagerService::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
-    LOGV("Entering closeDecryptSession");
+    ALOGV("Entering closeDecryptSession");
     return mDrmManager->closeDecryptSession(uniqueId, decryptHandle);
 }
 
 status_t DrmManagerService::initializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
             int decryptUnitId, const DrmBuffer* headerInfo) {
-    LOGV("Entering initializeDecryptUnit");
+    ALOGV("Entering initializeDecryptUnit");
     return mDrmManager->initializeDecryptUnit(uniqueId,decryptHandle, decryptUnitId, headerInfo);
 }
 
 status_t DrmManagerService::decrypt(
             int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
             const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
-    LOGV("Entering decrypt");
+    ALOGV("Entering decrypt");
     return mDrmManager->decrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV);
 }
 
 status_t DrmManagerService::finalizeDecryptUnit(
             int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
-    LOGV("Entering finalizeDecryptUnit");
+    ALOGV("Entering finalizeDecryptUnit");
     return mDrmManager->finalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId);
 }
 
 ssize_t DrmManagerService::pread(int uniqueId, DecryptHandle* decryptHandle,
             void* buffer, ssize_t numBytes, off64_t offset) {
-    LOGV("Entering pread");
+    ALOGV("Entering pread");
     return mDrmManager->pread(uniqueId, decryptHandle, buffer, numBytes, offset);
 }
 
diff --git a/drm/drmserver/main_drmserver.cpp b/drm/drmserver/main_drmserver.cpp
index 6d10646..e61b269 100644
--- a/drm/drmserver/main_drmserver.cpp
+++ b/drm/drmserver/main_drmserver.cpp
@@ -14,6 +14,9 @@
  * limitations under the License.
  */
 
+#define LOG_TAG "drmserver"
+//#define LOG_NDEBUG 0
+
 #include <sys/types.h>
 #include <unistd.h>
 #include <grp.h>
@@ -32,7 +35,7 @@
 {
     sp<ProcessState> proc(ProcessState::self());
     sp<IServiceManager> sm = defaultServiceManager();
-    LOGI("ServiceManager: %p", sm.get());
+    ALOGV("ServiceManager: %p", sm.get());
     DrmManagerService::instantiate();
     ProcessState::self()->startThreadPool();
     IPCThreadState::self()->joinThreadPool();
diff --git a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
index e184545..7799040 100644
--- a/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
+++ b/drm/libdrmframework/plugins/forward-lock/FwdLockEngine/src/FwdLockEngine.cpp
@@ -43,7 +43,7 @@
 
 #ifdef DRM_OMA_FL_ENGINE_DEBUG
 #define LOG_NDEBUG 0
-#define LOG_VERBOSE(...) LOGV(__VA_ARGS__)
+#define LOG_VERBOSE(...) ALOGV(__VA_ARGS__)
 #else
 #define LOG_VERBOSE(...)
 #endif
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h
index 605680a..2fb69b6 100644
--- a/include/media/AudioRecord.h
+++ b/include/media/AudioRecord.h
@@ -385,6 +385,8 @@
     uint32_t                mChannelMask;
     audio_io_handle_t       mInput;
     int                     mSessionId;
+    int                     mPreviousPriority;          // before start()
+    int                     mPreviousSchedulingGroup;
 };
 
 }; // namespace android
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index d1a8105..cb3d833 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -38,7 +38,7 @@
 
 // ----------------------------------------------------------------------------
 
-class AudioTrack
+class AudioTrack : virtual public RefBase
 {
 public:
     enum channel_index {
@@ -487,6 +487,8 @@
     int                     mAuxEffectId;
     Mutex                   mLock;
     status_t                mRestoreStatus;
+    int                     mPreviousPriority;          // before start()
+    int                     mPreviousSchedulingGroup;
 };
 
 
diff --git a/include/media/JetPlayer.h b/include/media/JetPlayer.h
index 16764a9..6d53989 100644
--- a/include/media/JetPlayer.h
+++ b/include/media/JetPlayer.h
@@ -65,7 +65,6 @@
 
 
 private:
-    static  int         renderThread(void*);
     int                 render();
     void                fireUpdateOnStatusChange();
     void                fireEventsFromJetQueue();
@@ -97,6 +96,28 @@
 
     char                mJetFilePath[256];
 
+    class JetPlayerThread : public Thread {
+    public:
+        JetPlayerThread(JetPlayer *player) : mPlayer(player) {
+        }
+
+    protected:
+        virtual ~JetPlayerThread() {}
+
+    private:
+        JetPlayer *mPlayer;
+
+        bool threadLoop() {
+            int result;
+            result = mPlayer->render();
+            return false;
+        }
+
+        JetPlayerThread(const JetPlayerThread &);
+        JetPlayerThread &operator=(const JetPlayerThread &);
+    };
+
+    sp<JetPlayerThread> mThread;
 
 }; // end class JetPlayer
 
diff --git a/include/private/gui/ComposerService.h b/include/private/gui/ComposerService.h
new file mode 100644
index 0000000..d04491a
--- /dev/null
+++ b/include/private/gui/ComposerService.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2011 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 ANDROID_PRIVATE_GUI_COMPOSER_SERVICE_H
+#define ANDROID_PRIVATE_GUI_COMPOSER_SERVICE_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <utils/Singleton.h>
+#include <utils/StrongPointer.h>
+
+
+namespace android {
+
+// ---------------------------------------------------------------------------
+
+class IMemoryHeap;
+class ISurfaceComposer;
+class surface_flinger_cblk_t;
+
+// ---------------------------------------------------------------------------
+
+class ComposerService : public Singleton<ComposerService>
+{
+    // these are constants
+    sp<ISurfaceComposer> mComposerService;
+    sp<IMemoryHeap> mServerCblkMemory;
+    surface_flinger_cblk_t volatile* mServerCblk;
+    ComposerService();
+    friend class Singleton<ComposerService>;
+public:
+    static sp<ISurfaceComposer> getComposerService();
+    static surface_flinger_cblk_t const volatile * getControlBlock();
+};
+
+// ---------------------------------------------------------------------------
+}; // namespace android
+
+#endif // ANDROID_PRIVATE_GUI_COMPOSER_SERVICE_H
diff --git a/media/libeffects/factory/EffectsFactory.c b/media/libeffects/factory/EffectsFactory.c
index d333510..ee2279a 100644
--- a/media/libeffects/factory/EffectsFactory.c
+++ b/media/libeffects/factory/EffectsFactory.c
@@ -188,7 +188,7 @@
     *pNumEffects = gNumEffects;
     gCanQueryEffect = 1;
     pthread_mutex_unlock(&gLibLock);
-    LOGV("EffectQueryNumberEffects(): %d", *pNumEffects);
+    ALOGV("EffectQueryNumberEffects(): %d", *pNumEffects);
     return ret;
 }
 
@@ -230,7 +230,7 @@
 #if (LOG_NDEBUG == 0)
     char str[256];
     dumpEffectDescriptor(pDescriptor, str, 256);
-    LOGV("EffectQueryEffect() desc:%s", str);
+    ALOGV("EffectQueryEffect() desc:%s", str);
 #endif
     pthread_mutex_unlock(&gLibLock);
     return ret;
@@ -271,7 +271,7 @@
         return -EINVAL;
     }
 
-    LOGV("EffectCreate() UUID: %08X-%04X-%04X-%04X-%02X%02X%02X%02X%02X%02X\n",
+    ALOGV("EffectCreate() UUID: %08X-%04X-%04X-%04X-%02X%02X%02X%02X%02X%02X\n",
             uuid->timeLow, uuid->timeMid, uuid->timeHiAndVersion,
             uuid->clockSeq, uuid->node[0], uuid->node[1],uuid->node[2],
             uuid->node[3],uuid->node[4],uuid->node[5]);
@@ -302,10 +302,10 @@
     fx->subItfe = itfe;
     if ((*itfe)->process_reverse != NULL) {
         fx->itfe = (struct effect_interface_s *)&gInterfaceWithReverse;
-        LOGV("EffectCreate() gInterfaceWithReverse");
+        ALOGV("EffectCreate() gInterfaceWithReverse");
     }   else {
         fx->itfe = (struct effect_interface_s *)&gInterface;
-        LOGV("EffectCreate() gInterface");
+        ALOGV("EffectCreate() gInterface");
     }
     fx->lib = l;
 
@@ -316,7 +316,7 @@
 
     *pHandle = (effect_handle_t)fx;
 
-    LOGV("EffectCreate() created entry %p with sub itfe %p in library %s", *pHandle, itfe, l->name);
+    ALOGV("EffectCreate() created entry %p with sub itfe %p in library %s", *pHandle, itfe, l->name);
 
 exit:
     pthread_mutex_unlock(&gLibLock);
@@ -401,7 +401,7 @@
 
     updateNumEffects();
     gInitDone = 1;
-    LOGV("init() done");
+    ALOGV("init() done");
     return 0;
 }
 
@@ -492,7 +492,7 @@
     e->next = gLibraryList;
     gLibraryList = e;
     pthread_mutex_unlock(&gLibLock);
-    LOGV("getLibrary() linked library %p for path %s", l, node->value);
+    ALOGV("getLibrary() linked library %p for path %s", l, node->value);
 
     return 0;
 
@@ -558,7 +558,7 @@
 #if (LOG_NDEBUG==0)
     char s[256];
     dumpEffectDescriptor(d, s, 256);
-    LOGV("loadEffect() read descriptor %p:%s",d, s);
+    ALOGV("loadEffect() read descriptor %p:%s",d, s);
 #endif
     if (EFFECT_API_VERSION_MAJOR(d->apiVersion) !=
             EFFECT_API_VERSION_MAJOR(EFFECT_CONTROL_API_VERSION)) {
@@ -657,10 +657,10 @@
         e = e->next;
     }
     if (!found) {
-        LOGV("findEffect() effect not found");
+        ALOGV("findEffect() effect not found");
         ret = -ENOENT;
     } else {
-        LOGV("findEffect() found effect: %s in lib %s", d->name, l->name);
+        ALOGV("findEffect() found effect: %s in lib %s", d->name, l->name);
         *lib = l;
         if (desc) {
             *desc = d;
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index 5a1e93a..b02ca38 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -32,19 +32,19 @@
 
 #define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc){\
         if (LvmStatus == LVM_NULLADDRESS){\
-            LOGV("\tLVM_ERROR : Parameter error - "\
+            ALOGV("\tLVM_ERROR : Parameter error - "\
                     "null pointer returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
         if (LvmStatus == LVM_ALIGNMENTERROR){\
-            LOGV("\tLVM_ERROR : Parameter error - "\
+            ALOGV("\tLVM_ERROR : Parameter error - "\
                     "bad alignment returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
         if (LvmStatus == LVM_INVALIDNUMSAMPLES){\
-            LOGV("\tLVM_ERROR : Parameter error - "\
+            ALOGV("\tLVM_ERROR : Parameter error - "\
                     "bad number of samples returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
         if (LvmStatus == LVM_OUTOFRANGE){\
-            LOGV("\tLVM_ERROR : Parameter error - "\
+            ALOGV("\tLVM_ERROR : Parameter error - "\
                     "out of range returned by %s in %s\n", callingFunc, calledFunc);\
         }\
     }
@@ -71,7 +71,7 @@
 /* local functions */
 #define CHECK_ARG(cond) {                     \
     if (!(cond)) {                            \
-        LOGV("\tLVM_ERROR : Invalid argument: "#cond);      \
+        ALOGV("\tLVM_ERROR : Invalid argument: "#cond);      \
         return -EINVAL;                       \
     }                                         \
 }
@@ -158,39 +158,39 @@
 
 /* Effect Library Interface Implementation */
 extern "C" int EffectQueryNumberEffects(uint32_t *pNumEffects){
-    LOGV("\n\tEffectQueryNumberEffects start");
+    ALOGV("\n\tEffectQueryNumberEffects start");
     *pNumEffects = 4;
-    LOGV("\tEffectQueryNumberEffects creating %d effects", *pNumEffects);
-    LOGV("\tEffectQueryNumberEffects end\n");
+    ALOGV("\tEffectQueryNumberEffects creating %d effects", *pNumEffects);
+    ALOGV("\tEffectQueryNumberEffects end\n");
     return 0;
 }     /* end EffectQueryNumberEffects */
 
 extern "C" int EffectQueryEffect(uint32_t index, effect_descriptor_t *pDescriptor){
-    LOGV("\n\tEffectQueryEffect start");
-    LOGV("\tEffectQueryEffect processing index %d", index);
+    ALOGV("\n\tEffectQueryEffect start");
+    ALOGV("\tEffectQueryEffect processing index %d", index);
 
     if (pDescriptor == NULL){
-        LOGV("\tLVM_ERROR : EffectQueryEffect was passed NULL pointer");
+        ALOGV("\tLVM_ERROR : EffectQueryEffect was passed NULL pointer");
         return -EINVAL;
     }
     if (index > 3){
-        LOGV("\tLVM_ERROR : EffectQueryEffect index out of range %d", index);
+        ALOGV("\tLVM_ERROR : EffectQueryEffect index out of range %d", index);
         return -ENOENT;
     }
     if(index == LVM_BASS_BOOST){
-        LOGV("\tEffectQueryEffect processing LVM_BASS_BOOST");
+        ALOGV("\tEffectQueryEffect processing LVM_BASS_BOOST");
         memcpy(pDescriptor, &gBassBoostDescriptor,   sizeof(effect_descriptor_t));
     }else if(index == LVM_VIRTUALIZER){
-        LOGV("\tEffectQueryEffect processing LVM_VIRTUALIZER");
+        ALOGV("\tEffectQueryEffect processing LVM_VIRTUALIZER");
         memcpy(pDescriptor, &gVirtualizerDescriptor, sizeof(effect_descriptor_t));
     } else if(index == LVM_EQUALIZER){
-        LOGV("\tEffectQueryEffect processing LVM_EQUALIZER");
+        ALOGV("\tEffectQueryEffect processing LVM_EQUALIZER");
         memcpy(pDescriptor, &gEqualizerDescriptor,   sizeof(effect_descriptor_t));
     } else if(index == LVM_VOLUME){
-        LOGV("\tEffectQueryEffect processing LVM_VOLUME");
+        ALOGV("\tEffectQueryEffect processing LVM_VOLUME");
         memcpy(pDescriptor, &gVolumeDescriptor, sizeof(effect_descriptor_t));
     }
-    LOGV("\tEffectQueryEffect end\n");
+    ALOGV("\tEffectQueryEffect end\n");
     return 0;
 }     /* end EffectQueryEffect */
 
@@ -205,17 +205,17 @@
     bool newBundle = false;
     SessionContext *pSessionContext;
 
-    LOGV("\n\tEffectCreate start session %d", sessionId);
+    ALOGV("\n\tEffectCreate start session %d", sessionId);
 
     if (pHandle == NULL || uuid == NULL){
-        LOGV("\tLVM_ERROR : EffectCreate() called with NULL pointer");
+        ALOGV("\tLVM_ERROR : EffectCreate() called with NULL pointer");
         ret = -EINVAL;
         goto exit;
     }
 
     if(LvmInitFlag == LVM_FALSE){
         LvmInitFlag = LVM_TRUE;
-        LOGV("\tEffectCreate - Initializing all global memory");
+        ALOGV("\tEffectCreate - Initializing all global memory");
         LvmGlobalBundle_init();
     }
 
@@ -224,13 +224,13 @@
         if((SessionIndex[i] == LVM_UNUSED_SESSION)||(SessionIndex[i] == sessionId)){
             sessionNo       = i;
             SessionIndex[i] = sessionId;
-            LOGV("\tEffectCreate: Allocating SessionNo %d for SessionId %d\n", sessionNo,sessionId);
+            ALOGV("\tEffectCreate: Allocating SessionNo %d for SessionId %d\n", sessionNo,sessionId);
             break;
         }
     }
 
     if(i==LVM_MAX_SESSIONS){
-        LOGV("\tLVM_ERROR : Cannot find memory to allocate for current session");
+        ALOGV("\tLVM_ERROR : Cannot find memory to allocate for current session");
         ret = -EINVAL;
         goto exit;
     }
@@ -239,7 +239,7 @@
 
     // If this is the first create in this session
     if(GlobalSessionMemory[sessionNo].bBundledEffectsEnabled == LVM_FALSE){
-        LOGV("\tEffectCreate - This is the first effect in current sessionId %d sessionNo %d",
+        ALOGV("\tEffectCreate - This is the first effect in current sessionId %d sessionNo %d",
                 sessionId, sessionNo);
 
         GlobalSessionMemory[sessionNo].bBundledEffectsEnabled = LVM_TRUE;
@@ -265,7 +265,7 @@
         snprintf(fileName, 256, "/data/tmp/bundle_%p_pcm_in.pcm", pContext->pBundledContext);
         pContext->pBundledContext->PcmInPtr = fopen(fileName, "w");
         if (pContext->pBundledContext->PcmInPtr == NULL) {
-            LOGV("cannot open %s", fileName);
+            ALOGV("cannot open %s", fileName);
             ret = -EINVAL;
             goto exit;
         }
@@ -273,7 +273,7 @@
         snprintf(fileName, 256, "/data/tmp/bundle_%p_pcm_out.pcm", pContext->pBundledContext);
         pContext->pBundledContext->PcmOutPtr = fopen(fileName, "w");
         if (pContext->pBundledContext->PcmOutPtr == NULL) {
-            LOGV("cannot open %s", fileName);
+            ALOGV("cannot open %s", fileName);
             fclose(pContext->pBundledContext->PcmInPtr);
            pContext->pBundledContext->PcmInPtr = NULL;
            ret = -EINVAL;
@@ -298,28 +298,28 @@
         pContext->pBundledContext->SamplesToExitCountBb     = 0;
         pContext->pBundledContext->SamplesToExitCountEq     = 0;
 
-        LOGV("\tEffectCreate - Calling LvmBundle_init");
+        ALOGV("\tEffectCreate - Calling LvmBundle_init");
         ret = LvmBundle_init(pContext);
 
         if (ret < 0){
-            LOGV("\tLVM_ERROR : EffectCreate() Bundle init failed");
+            ALOGV("\tLVM_ERROR : EffectCreate() Bundle init failed");
             goto exit;
         }
     }
     else{
-        LOGV("\tEffectCreate - Assigning memory for previously created effect on sessionNo %d",
+        ALOGV("\tEffectCreate - Assigning memory for previously created effect on sessionNo %d",
                 sessionNo);
         pContext->pBundledContext =
                 GlobalSessionMemory[sessionNo].pBundledContext;
     }
-    LOGV("\tEffectCreate - pBundledContext is %p", pContext->pBundledContext);
+    ALOGV("\tEffectCreate - pBundledContext is %p", pContext->pBundledContext);
 
     pSessionContext = &GlobalSessionMemory[pContext->pBundledContext->SessionNo];
 
     // Create each Effect
     if (memcmp(uuid, &gBassBoostDescriptor.uuid, sizeof(effect_uuid_t)) == 0){
         // Create Bass Boost
-        LOGV("\tEffectCreate - Effect to be created is LVM_BASS_BOOST");
+        ALOGV("\tEffectCreate - Effect to be created is LVM_BASS_BOOST");
         pSessionContext->bBassInstantiated = LVM_TRUE;
         pContext->pBundledContext->SamplesToExitCountBb = 0;
 
@@ -327,7 +327,7 @@
         pContext->EffectType = LVM_BASS_BOOST;
     } else if (memcmp(uuid, &gVirtualizerDescriptor.uuid, sizeof(effect_uuid_t)) == 0){
         // Create Virtualizer
-        LOGV("\tEffectCreate - Effect to be created is LVM_VIRTUALIZER");
+        ALOGV("\tEffectCreate - Effect to be created is LVM_VIRTUALIZER");
         pSessionContext->bVirtualizerInstantiated=LVM_TRUE;
         pContext->pBundledContext->SamplesToExitCountVirt = 0;
 
@@ -335,7 +335,7 @@
         pContext->EffectType = LVM_VIRTUALIZER;
     } else if (memcmp(uuid, &gEqualizerDescriptor.uuid, sizeof(effect_uuid_t)) == 0){
         // Create Equalizer
-        LOGV("\tEffectCreate - Effect to be created is LVM_EQUALIZER");
+        ALOGV("\tEffectCreate - Effect to be created is LVM_EQUALIZER");
         pSessionContext->bEqualizerInstantiated = LVM_TRUE;
         pContext->pBundledContext->SamplesToExitCountEq = 0;
 
@@ -343,14 +343,14 @@
         pContext->EffectType = LVM_EQUALIZER;
     } else if (memcmp(uuid, &gVolumeDescriptor.uuid, sizeof(effect_uuid_t)) == 0){
         // Create Volume
-        LOGV("\tEffectCreate - Effect to be created is LVM_VOLUME");
+        ALOGV("\tEffectCreate - Effect to be created is LVM_VOLUME");
         pSessionContext->bVolumeInstantiated = LVM_TRUE;
 
         pContext->itfe       = &gLvmEffectInterface;
         pContext->EffectType = LVM_VOLUME;
     }
     else{
-        LOGV("\tLVM_ERROR : EffectCreate() invalid UUID");
+        ALOGV("\tLVM_ERROR : EffectCreate() invalid UUID");
         ret = -EINVAL;
         goto exit;
     }
@@ -369,17 +369,17 @@
     } else {
         *pHandle = (effect_handle_t)pContext;
     }
-    LOGV("\tEffectCreate end..\n\n");
+    ALOGV("\tEffectCreate end..\n\n");
     return ret;
 } /* end EffectCreate */
 
 extern "C" int EffectRelease(effect_handle_t handle){
-    LOGV("\n\tEffectRelease start %p", handle);
+    ALOGV("\n\tEffectRelease start %p", handle);
     EffectContext * pContext = (EffectContext *)handle;
 
-    LOGV("\tEffectRelease start handle: %p, context %p", handle, pContext->pBundledContext);
+    ALOGV("\tEffectRelease start handle: %p, context %p", handle, pContext->pBundledContext);
     if (pContext == NULL){
-        LOGV("\tLVM_ERROR : EffectRelease called with NULL pointer");
+        ALOGV("\tLVM_ERROR : EffectRelease called with NULL pointer");
         return -EINVAL;
     }
 
@@ -388,34 +388,34 @@
     // Clear the instantiated flag for the effect
     // protect agains the case where an effect is un-instantiated without being disabled
     if(pContext->EffectType == LVM_BASS_BOOST) {
-        LOGV("\tEffectRelease LVM_BASS_BOOST Clearing global intstantiated flag");
+        ALOGV("\tEffectRelease LVM_BASS_BOOST Clearing global intstantiated flag");
         pSessionContext->bBassInstantiated = LVM_FALSE;
         if(pContext->pBundledContext->SamplesToExitCountBb > 0){
             pContext->pBundledContext->NumberEffectsEnabled--;
         }
         pContext->pBundledContext->SamplesToExitCountBb = 0;
     } else if(pContext->EffectType == LVM_VIRTUALIZER) {
-        LOGV("\tEffectRelease LVM_VIRTUALIZER Clearing global intstantiated flag");
+        ALOGV("\tEffectRelease LVM_VIRTUALIZER Clearing global intstantiated flag");
         pSessionContext->bVirtualizerInstantiated = LVM_FALSE;
         if(pContext->pBundledContext->SamplesToExitCountVirt > 0){
             pContext->pBundledContext->NumberEffectsEnabled--;
         }
         pContext->pBundledContext->SamplesToExitCountVirt = 0;
     } else if(pContext->EffectType == LVM_EQUALIZER) {
-        LOGV("\tEffectRelease LVM_EQUALIZER Clearing global intstantiated flag");
+        ALOGV("\tEffectRelease LVM_EQUALIZER Clearing global intstantiated flag");
         pSessionContext->bEqualizerInstantiated =LVM_FALSE;
         if(pContext->pBundledContext->SamplesToExitCountEq > 0){
             pContext->pBundledContext->NumberEffectsEnabled--;
         }
         pContext->pBundledContext->SamplesToExitCountEq = 0;
     } else if(pContext->EffectType == LVM_VOLUME) {
-        LOGV("\tEffectRelease LVM_VOLUME Clearing global intstantiated flag");
+        ALOGV("\tEffectRelease LVM_VOLUME Clearing global intstantiated flag");
         pSessionContext->bVolumeInstantiated = LVM_FALSE;
         if (pContext->pBundledContext->bVolumeEnabled == LVM_TRUE){
             pContext->pBundledContext->NumberEffectsEnabled--;
         }
     } else {
-        LOGV("\tLVM_ERROR : EffectRelease : Unsupported effect\n\n\n\n\n\n\n");
+        ALOGV("\tLVM_ERROR : EffectRelease : Unsupported effect\n\n\n\n\n\n\n");
     }
 
     // Disable effect, in this case ignore errors (return codes)
@@ -444,18 +444,18 @@
         for(int i=0; i<LVM_MAX_SESSIONS; i++){
             if(SessionIndex[i] == pContext->pBundledContext->SessionId){
                 SessionIndex[i] = LVM_UNUSED_SESSION;
-                LOGV("\tEffectRelease: Clearing SessionIndex SessionNo %d for SessionId %d\n",
+                ALOGV("\tEffectRelease: Clearing SessionIndex SessionNo %d for SessionId %d\n",
                         i, pContext->pBundledContext->SessionId);
                 break;
             }
         }
 
-        LOGV("\tEffectRelease: All effects are no longer instantiated\n");
+        ALOGV("\tEffectRelease: All effects are no longer instantiated\n");
         pSessionContext->bBundledEffectsEnabled = LVM_FALSE;
         pSessionContext->pBundledContext = LVM_NULL;
-        LOGV("\tEffectRelease: Freeing LVM Bundle memory\n");
+        ALOGV("\tEffectRelease: Freeing LVM Bundle memory\n");
         LvmEffect_free(pContext);
-        LOGV("\tEffectRelease: Deleting LVM Bundle context %p\n", pContext->pBundledContext);
+        ALOGV("\tEffectRelease: Deleting LVM Bundle context %p\n", pContext->pBundledContext);
         if (pContext->pBundledContext->workBuffer != NULL) {
             free(pContext->pBundledContext->workBuffer);
         }
@@ -465,7 +465,7 @@
     // free the effect context for current effect
     delete pContext;
 
-    LOGV("\tEffectRelease end\n");
+    ALOGV("\tEffectRelease end\n");
     return 0;
 
 } /* end EffectRelease */
@@ -475,7 +475,7 @@
     const effect_descriptor_t *desc = NULL;
 
     if (pDescriptor == NULL || uuid == NULL){
-        LOGV("EffectGetDescriptor() called with NULL pointer");
+        ALOGV("EffectGetDescriptor() called with NULL pointer");
         return -EINVAL;
     }
 
@@ -499,7 +499,7 @@
 } /* end EffectGetDescriptor */
 
 void LvmGlobalBundle_init(){
-    LOGV("\tLvmGlobalBundle_init start");
+    ALOGV("\tLvmGlobalBundle_init start");
     for(int i=0; i<LVM_MAX_SESSIONS; i++){
         GlobalSessionMemory[i].bBundledEffectsEnabled   = LVM_FALSE;
         GlobalSessionMemory[i].bVolumeInstantiated      = LVM_FALSE;
@@ -528,7 +528,7 @@
 int LvmBundle_init(EffectContext *pContext){
     int status;
 
-    LOGV("\tLvmBundle_init start");
+    ALOGV("\tLvmBundle_init start");
 
     pContext->config.inputCfg.accessMode                    = EFFECT_BUFFER_ACCESS_READ;
     pContext->config.inputCfg.channels                      = AUDIO_CHANNEL_OUT_STEREO;
@@ -550,12 +550,12 @@
     CHECK_ARG(pContext != NULL);
 
     if (pContext->pBundledContext->hInstance != NULL){
-        LOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
+        ALOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
                 "-> Calling pContext->pBassBoost->free()");
 
         LvmEffect_free(pContext);
 
-        LOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
+        ALOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
                 "-> Called pContext->pBassBoost->free()");
     }
 
@@ -582,7 +582,7 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetMemoryTable", "LvmBundle_init")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    LOGV("\tCreateInstance Succesfully called LVM_GetMemoryTable\n");
+    ALOGV("\tCreateInstance Succesfully called LVM_GetMemoryTable\n");
 
     /* Allocate memory */
     for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
@@ -590,11 +590,11 @@
             MemTab.Region[i].pBaseAddress = malloc(MemTab.Region[i].Size);
 
             if (MemTab.Region[i].pBaseAddress == LVM_NULL){
-                LOGV("\tLVM_ERROR :LvmBundle_init CreateInstance Failed to allocate %ld bytes "
+                ALOGV("\tLVM_ERROR :LvmBundle_init CreateInstance Failed to allocate %ld bytes "
                         "for region %u\n", MemTab.Region[i].Size, i );
                 bMallocFailure = LVM_TRUE;
             }else{
-                LOGV("\tLvmBundle_init CreateInstance allocated %ld bytes for region %u at %p\n",
+                ALOGV("\tLvmBundle_init CreateInstance allocated %ld bytes for region %u at %p\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
             }
         }
@@ -606,10 +606,10 @@
     if(bMallocFailure == LVM_TRUE){
         for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
             if (MemTab.Region[i].pBaseAddress == LVM_NULL){
-                LOGV("\tLVM_ERROR :LvmBundle_init CreateInstance Failed to allocate %ld bytes "
+                ALOGV("\tLVM_ERROR :LvmBundle_init CreateInstance Failed to allocate %ld bytes "
                         "for region %u Not freeing\n", MemTab.Region[i].Size, i );
             }else{
-                LOGV("\tLVM_ERROR :LvmBundle_init CreateInstance Failed: but allocated %ld bytes "
+                ALOGV("\tLVM_ERROR :LvmBundle_init CreateInstance Failed: but allocated %ld bytes "
                      "for region %u at %p- free\n",
                      MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
                 free(MemTab.Region[i].pBaseAddress);
@@ -617,7 +617,7 @@
         }
         return -EINVAL;
     }
-    LOGV("\tLvmBundle_init CreateInstance Succesfully malloc'd memory\n");
+    ALOGV("\tLvmBundle_init CreateInstance Succesfully malloc'd memory\n");
 
     /* Initialise */
     pContext->pBundledContext->hInstance = LVM_NULL;
@@ -630,7 +630,7 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetInstanceHandle", "LvmBundle_init")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    LOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_GetInstanceHandle\n");
+    ALOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_GetInstanceHandle\n");
 
     /* Set the initial process parameters */
     /* General parameters */
@@ -692,7 +692,7 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmBundle_init")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    LOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_SetControlParameters\n");
+    ALOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_SetControlParameters\n");
 
     /* Set the headroom parameters */
     HeadroomBandDef[0].Limit_Low          = 20;
@@ -711,8 +711,8 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetHeadroomParams", "LvmBundle_init")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    LOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_SetHeadroomParams\n");
-    LOGV("\tLvmBundle_init End");
+    ALOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_SetHeadroomParams\n");
+    ALOGV("\tLvmBundle_init End");
     return 0;
 }   /* end LvmBundle_init */
 
@@ -757,7 +757,7 @@
         }
         pOutTmp = pContext->pBundledContext->workBuffer;
     }else{
-        LOGV("LVM_ERROR : LvmBundle_process invalid access mode");
+        ALOGV("LVM_ERROR : LvmBundle_process invalid access mode");
         return -EINVAL;
     }
 
@@ -766,7 +766,7 @@
     fflush(pContext->pBundledContext->PcmInPtr);
     #endif
 
-    //LOGV("Calling LVM_Process");
+    //ALOGV("Calling LVM_Process");
 
     /* Process the samples */
     LvmStatus = LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */
@@ -804,7 +804,7 @@
 //----------------------------------------------------------------------------
 
 int LvmEffect_enable(EffectContext *pContext){
-    //LOGV("\tLvmEffect_enable start");
+    //ALOGV("\tLvmEffect_enable start");
 
     LVM_ControlParams_t     ActiveParams;                           /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;                /* Function call status */
@@ -815,30 +815,30 @@
 
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "LvmEffect_enable")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
-    //LOGV("\tLvmEffect_enable Succesfully called LVM_GetControlParameters\n");
+    //ALOGV("\tLvmEffect_enable Succesfully called LVM_GetControlParameters\n");
 
     if(pContext->EffectType == LVM_BASS_BOOST) {
-        LOGV("\tLvmEffect_enable : Enabling LVM_BASS_BOOST");
+        ALOGV("\tLvmEffect_enable : Enabling LVM_BASS_BOOST");
         ActiveParams.BE_OperatingMode       = LVM_BE_ON;
     }
     if(pContext->EffectType == LVM_VIRTUALIZER) {
-        LOGV("\tLvmEffect_enable : Enabling LVM_VIRTUALIZER");
+        ALOGV("\tLvmEffect_enable : Enabling LVM_VIRTUALIZER");
         ActiveParams.VirtualizerOperatingMode   = LVM_MODE_ON;
     }
     if(pContext->EffectType == LVM_EQUALIZER) {
-        LOGV("\tLvmEffect_enable : Enabling LVM_EQUALIZER");
+        ALOGV("\tLvmEffect_enable : Enabling LVM_EQUALIZER");
         ActiveParams.EQNB_OperatingMode     = LVM_EQNB_ON;
     }
     if(pContext->EffectType == LVM_VOLUME) {
-        LOGV("\tLvmEffect_enable : Enabling LVM_VOLUME");
+        ALOGV("\tLvmEffect_enable : Enabling LVM_VOLUME");
     }
 
     LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmEffect_enable")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tLvmEffect_enable Succesfully called LVM_SetControlParameters\n");
-    //LOGV("\tLvmEffect_enable end");
+    //ALOGV("\tLvmEffect_enable Succesfully called LVM_SetControlParameters\n");
+    //ALOGV("\tLvmEffect_enable end");
     return 0;
 }
 
@@ -855,7 +855,7 @@
 //----------------------------------------------------------------------------
 
 int LvmEffect_disable(EffectContext *pContext){
-    //LOGV("\tLvmEffect_disable start");
+    //ALOGV("\tLvmEffect_disable start");
 
     LVM_ControlParams_t     ActiveParams;                           /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;                /* Function call status */
@@ -865,30 +865,30 @@
 
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "LvmEffect_disable")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
-    //LOGV("\tLvmEffect_disable Succesfully called LVM_GetControlParameters\n");
+    //ALOGV("\tLvmEffect_disable Succesfully called LVM_GetControlParameters\n");
 
     if(pContext->EffectType == LVM_BASS_BOOST) {
-        LOGV("\tLvmEffect_disable : Disabling LVM_BASS_BOOST");
+        ALOGV("\tLvmEffect_disable : Disabling LVM_BASS_BOOST");
         ActiveParams.BE_OperatingMode       = LVM_BE_OFF;
     }
     if(pContext->EffectType == LVM_VIRTUALIZER) {
-        LOGV("\tLvmEffect_disable : Disabling LVM_VIRTUALIZER");
+        ALOGV("\tLvmEffect_disable : Disabling LVM_VIRTUALIZER");
         ActiveParams.VirtualizerOperatingMode   = LVM_MODE_OFF;
     }
     if(pContext->EffectType == LVM_EQUALIZER) {
-        LOGV("\tLvmEffect_disable : Disabling LVM_EQUALIZER");
+        ALOGV("\tLvmEffect_disable : Disabling LVM_EQUALIZER");
         ActiveParams.EQNB_OperatingMode     = LVM_EQNB_OFF;
     }
     if(pContext->EffectType == LVM_VOLUME) {
-        LOGV("\tLvmEffect_disable : Disabling LVM_VOLUME");
+        ALOGV("\tLvmEffect_disable : Disabling LVM_VOLUME");
     }
 
     LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmEffect_disable")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tLvmEffect_disable Succesfully called LVM_SetControlParameters\n");
-    //LOGV("\tLvmEffect_disable end");
+    //ALOGV("\tLvmEffect_disable Succesfully called LVM_SetControlParameters\n");
+    //ALOGV("\tLvmEffect_disable end");
     return 0;
 }
 
@@ -919,15 +919,15 @@
     for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
         if (MemTab.Region[i].Size != 0){
             if (MemTab.Region[i].pBaseAddress != NULL){
-                LOGV("\tLvmEffect_free - START freeing %ld bytes for region %u at %p\n",
+                ALOGV("\tLvmEffect_free - START freeing %ld bytes for region %u at %p\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
 
                 free(MemTab.Region[i].pBaseAddress);
 
-                LOGV("\tLvmEffect_free - END   freeing %ld bytes for region %u at %p\n",
+                ALOGV("\tLvmEffect_free - END   freeing %ld bytes for region %u at %p\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
             }else{
-                LOGV("\tLVM_ERROR : LvmEffect_free - trying to free with NULL pointer %ld bytes "
+                ALOGV("\tLVM_ERROR : LvmEffect_free - trying to free with NULL pointer %ld bytes "
                         "for region %u at %p ERROR\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
             }
@@ -951,7 +951,7 @@
 
 int Effect_configure(EffectContext *pContext, effect_config_t *pConfig){
     LVM_Fs_en   SampleRate;
-    //LOGV("\tEffect_configure start");
+    //ALOGV("\tEffect_configure start");
 
     CHECK_ARG(pContext != NULL);
     CHECK_ARG(pConfig != NULL);
@@ -992,7 +992,7 @@
         pContext->pBundledContext->SamplesPerSecond = 48000*2; // 2 secs Stereo
         break;
     default:
-        LOGV("\tEffect_Configure invalid sampling rate %d", pConfig->inputCfg.samplingRate);
+        ALOGV("\tEffect_Configure invalid sampling rate %d", pConfig->inputCfg.samplingRate);
         return -EINVAL;
     }
 
@@ -1001,7 +1001,7 @@
         LVM_ControlParams_t     ActiveParams;
         LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;
 
-        LOGV("\tEffect_configure change sampling rate to %d", SampleRate);
+        ALOGV("\tEffect_configure change sampling rate to %d", SampleRate);
 
         /* Get the current settings */
         LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
@@ -1013,14 +1013,14 @@
         LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
 
         LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "Effect_configure")
-        LOGV("\tEffect_configure Succesfully called LVM_SetControlParameters\n");
+        ALOGV("\tEffect_configure Succesfully called LVM_SetControlParameters\n");
         pContext->pBundledContext->SampleRate = SampleRate;
 
     }else{
-        //LOGV("\tEffect_configure keep sampling rate at %d", SampleRate);
+        //ALOGV("\tEffect_configure keep sampling rate at %d", SampleRate);
     }
 
-    //LOGV("\tEffect_configure End....");
+    //ALOGV("\tEffect_configure End....");
     return 0;
 }   /* end Effect_configure */
 
@@ -1039,7 +1039,7 @@
 //----------------------------------------------------------------------------
 
 uint32_t BassGetStrength(EffectContext *pContext){
-    //LOGV("\tBassGetStrength() (0-1000) -> %d\n", pContext->pBundledContext->BassStrengthSaved);
+    //ALOGV("\tBassGetStrength() (0-1000) -> %d\n", pContext->pBundledContext->BassStrengthSaved);
 
     LVM_ControlParams_t     ActiveParams;                           /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;                /* Function call status */
@@ -1050,18 +1050,18 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "BassGetStrength")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tBassGetStrength Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tBassGetStrength Succesfully returned from LVM_GetControlParameters\n");
 
     /* Check that the strength returned matches the strength that was set earlier */
     if(ActiveParams.BE_EffectLevel !=
        (LVM_INT16)((15*pContext->pBundledContext->BassStrengthSaved)/1000)){
-        LOGV("\tLVM_ERROR : BassGetStrength module strength does not match savedStrength %d %d\n",
+        ALOGV("\tLVM_ERROR : BassGetStrength module strength does not match savedStrength %d %d\n",
                 ActiveParams.BE_EffectLevel, pContext->pBundledContext->BassStrengthSaved);
         return -EINVAL;
     }
 
-    //LOGV("\tBassGetStrength() (0-15)   -> %d\n", ActiveParams.BE_EffectLevel );
-    //LOGV("\tBassGetStrength() (saved)  -> %d\n", pContext->pBundledContext->BassStrengthSaved );
+    //ALOGV("\tBassGetStrength() (0-15)   -> %d\n", ActiveParams.BE_EffectLevel );
+    //ALOGV("\tBassGetStrength() (saved)  -> %d\n", pContext->pBundledContext->BassStrengthSaved );
     return pContext->pBundledContext->BassStrengthSaved;
 }    /* end BassGetStrength */
 
@@ -1078,7 +1078,7 @@
 //----------------------------------------------------------------------------
 
 void BassSetStrength(EffectContext *pContext, uint32_t strength){
-    //LOGV("\tBassSetStrength(%d)", strength);
+    //ALOGV("\tBassSetStrength(%d)", strength);
 
     pContext->pBundledContext->BassStrengthSaved = (int)strength;
 
@@ -1090,19 +1090,19 @@
                                          &ActiveParams);
 
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "BassSetStrength")
-    //LOGV("\tBassSetStrength Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tBassSetStrength Succesfully returned from LVM_GetControlParameters\n");
 
     /* Bass Enhancement parameters */
     ActiveParams.BE_EffectLevel    = (LVM_INT16)((15*strength)/1000);
     ActiveParams.BE_CentreFreq     = LVM_BE_CENTRE_90Hz;
 
-    //LOGV("\tBassSetStrength() (0-15)   -> %d\n", ActiveParams.BE_EffectLevel );
+    //ALOGV("\tBassSetStrength() (0-15)   -> %d\n", ActiveParams.BE_EffectLevel );
 
     /* Activate the initial settings */
     LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
 
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "BassSetStrength")
-    //LOGV("\tBassSetStrength Succesfully called LVM_SetControlParameters\n");
+    //ALOGV("\tBassSetStrength Succesfully called LVM_SetControlParameters\n");
 }    /* end BassSetStrength */
 
 //----------------------------------------------------------------------------
@@ -1120,7 +1120,7 @@
 //----------------------------------------------------------------------------
 
 uint32_t VirtualizerGetStrength(EffectContext *pContext){
-    //LOGV("\tVirtualizerGetStrength (0-1000) -> %d\n",pContext->pBundledContext->VirtStrengthSaved);
+    //ALOGV("\tVirtualizerGetStrength (0-1000) -> %d\n",pContext->pBundledContext->VirtStrengthSaved);
 
     LVM_ControlParams_t     ActiveParams;                           /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;                /* Function call status */
@@ -1130,8 +1130,8 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VirtualizerGetStrength")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVirtualizerGetStrength Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tVirtualizerGetStrength() (0-100)   -> %d\n", ActiveParams.VirtualizerReverbLevel*10);
+    //ALOGV("\tVirtualizerGetStrength Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tVirtualizerGetStrength() (0-100)   -> %d\n", ActiveParams.VirtualizerReverbLevel*10);
     return pContext->pBundledContext->VirtStrengthSaved;
 }    /* end getStrength */
 
@@ -1148,7 +1148,7 @@
 //----------------------------------------------------------------------------
 
 void VirtualizerSetStrength(EffectContext *pContext, uint32_t strength){
-    //LOGV("\tVirtualizerSetStrength(%d)", strength);
+    //ALOGV("\tVirtualizerSetStrength(%d)", strength);
     LVM_ControlParams_t     ActiveParams;              /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus=LVM_SUCCESS;     /* Function call status */
 
@@ -1158,18 +1158,18 @@
     LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,&ActiveParams);
 
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VirtualizerSetStrength")
-    //LOGV("\tVirtualizerSetStrength Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tVirtualizerSetStrength Succesfully returned from LVM_GetControlParameters\n");
 
     /* Virtualizer parameters */
     ActiveParams.CS_EffectLevel             = (int)((strength*32767)/1000);
 
-    //LOGV("\tVirtualizerSetStrength() (0-1000)   -> %d\n", strength );
-    //LOGV("\tVirtualizerSetStrength() (0- 100)   -> %d\n", ActiveParams.CS_EffectLevel );
+    //ALOGV("\tVirtualizerSetStrength() (0-1000)   -> %d\n", strength );
+    //ALOGV("\tVirtualizerSetStrength() (0- 100)   -> %d\n", ActiveParams.CS_EffectLevel );
 
     /* Activate the initial settings */
     LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "VirtualizerSetStrength")
-    //LOGV("\tVirtualizerSetStrength Succesfully called LVM_SetControlParameters\n\n");
+    //ALOGV("\tVirtualizerSetStrength Succesfully called LVM_SetControlParameters\n\n");
 }    /* end setStrength */
 
 //----------------------------------------------------------------------------
@@ -1199,8 +1199,8 @@
     BandDef = ActiveParams.pEQNB_BandDefinition;
     Gain    = (int32_t)BandDef[band].Gain*100;    // Convert to millibels
 
-    //LOGV("\tEqualizerGetBandLevel -> %d\n", Gain );
-    //LOGV("\tEqualizerGetBandLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tEqualizerGetBandLevel -> %d\n", Gain );
+    //ALOGV("\tEqualizerGetBandLevel Succesfully returned from LVM_GetControlParameters\n");
     return Gain;
 }
 
@@ -1225,7 +1225,7 @@
     }else{
         gainRounded = (int)((Gain-50)/100);
     }
-    //LOGV("\tEqualizerSetBandLevel(%d)->(%d)", Gain, gainRounded);
+    //ALOGV("\tEqualizerSetBandLevel(%d)->(%d)", Gain, gainRounded);
 
 
     LVM_ControlParams_t     ActiveParams;              /* Current control Parameters */
@@ -1235,8 +1235,8 @@
     /* Get the current settings */
     LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "EqualizerSetBandLevel")
-    //LOGV("\tEqualizerSetBandLevel Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tEqualizerSetBandLevel just Got -> %d\n",ActiveParams.pEQNB_BandDefinition[band].Gain);
+    //ALOGV("\tEqualizerSetBandLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tEqualizerSetBandLevel just Got -> %d\n",ActiveParams.pEQNB_BandDefinition[band].Gain);
 
     /* Set local EQ parameters */
     BandDef = ActiveParams.pEQNB_BandDefinition;
@@ -1245,7 +1245,7 @@
     /* Activate the initial settings */
     LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "EqualizerSetBandLevel")
-    //LOGV("\tEqualizerSetBandLevel just Set -> %d\n",ActiveParams.pEQNB_BandDefinition[band].Gain);
+    //ALOGV("\tEqualizerSetBandLevel just Set -> %d\n",ActiveParams.pEQNB_BandDefinition[band].Gain);
 
     pContext->pBundledContext->CurPreset = PRESET_CUSTOM;
     return;
@@ -1277,8 +1277,8 @@
     BandDef   = ActiveParams.pEQNB_BandDefinition;
     Frequency = (int32_t)BandDef[band].Frequency*1000;     // Convert to millibels
 
-    //LOGV("\tEqualizerGetCentreFrequency -> %d\n", Frequency );
-    //LOGV("\tEqualizerGetCentreFrequency Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tEqualizerGetCentreFrequency -> %d\n", Frequency );
+    //ALOGV("\tEqualizerGetCentreFrequency Succesfully returned from LVM_GetControlParameters\n");
     return Frequency;
 }
 
@@ -1372,7 +1372,7 @@
 //----------------------------------------------------------------------------
 void EqualizerSetPreset(EffectContext *pContext, int preset){
 
-    //LOGV("\tEqualizerSetPreset(%d)", preset);
+    //ALOGV("\tEqualizerSetPreset(%d)", preset);
     pContext->pBundledContext->CurPreset = preset;
 
     LVM_ControlParams_t     ActiveParams;              /* Current control Parameters */
@@ -1381,7 +1381,7 @@
     /* Get the current settings */
     LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "EqualizerSetPreset")
-    //LOGV("\tEqualizerSetPreset Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tEqualizerSetPreset Succesfully returned from LVM_GetControlParameters\n");
 
     //ActiveParams.pEQNB_BandDefinition = &BandDefs[0];
     for (int i=0; i<FIVEBAND_NUMBANDS; i++)
@@ -1395,7 +1395,7 @@
     LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "EqualizerSetPreset")
 
-    //LOGV("\tEqualizerSetPreset Succesfully called LVM_SetControlParameters\n");
+    //ALOGV("\tEqualizerSetPreset Succesfully called LVM_SetControlParameters\n");
     return;
 }
 
@@ -1415,13 +1415,13 @@
 //
 //-------------------------------------------------------------------------
 const char * EqualizerGetPresetName(int32_t preset){
-    //LOGV("\tEqualizerGetPresetName start(%d)", preset);
+    //ALOGV("\tEqualizerGetPresetName start(%d)", preset);
     if (preset == PRESET_CUSTOM) {
         return "Custom";
     } else {
         return gEqualizerPresets[preset].name;
     }
-    //LOGV("\tEqualizerGetPresetName end(%d)", preset);
+    //ALOGV("\tEqualizerGetPresetName end(%d)", preset);
     return 0;
 }
 
@@ -1441,35 +1441,35 @@
     LVM_ControlParams_t     ActiveParams;              /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus=LVM_SUCCESS;     /* Function call status */
 
-    //LOGV("\tVolumeSetVolumeLevel Level to be set is %d %d\n", level, (LVM_INT16)(level/100));
+    //ALOGV("\tVolumeSetVolumeLevel Level to be set is %d %d\n", level, (LVM_INT16)(level/100));
     /* Get the current settings */
     LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeSetVolumeLevel")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
-    //LOGV("\tVolumeSetVolumeLevel Succesfully returned from LVM_GetControlParameters got: %d\n",
+    //ALOGV("\tVolumeSetVolumeLevel Succesfully returned from LVM_GetControlParameters got: %d\n",
     //ActiveParams.VC_EffectLevel);
 
     /* Volume parameters */
     ActiveParams.VC_EffectLevel  = (LVM_INT16)(level/100);
-    //LOGV("\tVolumeSetVolumeLevel() (-96dB -> 0dB)   -> %d\n", ActiveParams.VC_EffectLevel );
+    //ALOGV("\tVolumeSetVolumeLevel() (-96dB -> 0dB)   -> %d\n", ActiveParams.VC_EffectLevel );
 
     /* Activate the initial settings */
     LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "VolumeSetVolumeLevel")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeSetVolumeLevel Succesfully called LVM_SetControlParameters\n");
+    //ALOGV("\tVolumeSetVolumeLevel Succesfully called LVM_SetControlParameters\n");
 
     /* Get the current settings */
     LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeSetVolumeLevel")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeSetVolumeLevel just set (-96dB -> 0dB)   -> %d\n",ActiveParams.VC_EffectLevel );
+    //ALOGV("\tVolumeSetVolumeLevel just set (-96dB -> 0dB)   -> %d\n",ActiveParams.VC_EffectLevel );
     if(pContext->pBundledContext->firstVolume == LVM_TRUE){
         LvmStatus = LVM_SetVolumeNoSmoothing(pContext->pBundledContext->hInstance, &ActiveParams);
         LVM_ERROR_CHECK(LvmStatus, "LVM_SetVolumeNoSmoothing", "LvmBundle_process")
-        LOGV("\tLVM_VOLUME: Disabling Smoothing for first volume change to remove spikes/clicks");
+        ALOGV("\tLVM_VOLUME: Disabling Smoothing for first volume change to remove spikes/clicks");
         pContext->pBundledContext->firstVolume = LVM_FALSE;
     }
     return 0;
@@ -1487,7 +1487,7 @@
 
 int VolumeGetVolumeLevel(EffectContext *pContext, int16_t *level){
 
-    //LOGV("\tVolumeGetVolumeLevel start");
+    //ALOGV("\tVolumeGetVolumeLevel start");
 
     LVM_ControlParams_t     ActiveParams;                           /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;                /* Function call status */
@@ -1496,11 +1496,11 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeGetVolumeLevel")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeGetVolumeLevel() (-96dB -> 0dB) -> %d\n", ActiveParams.VC_EffectLevel );
-    //LOGV("\tVolumeGetVolumeLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tVolumeGetVolumeLevel() (-96dB -> 0dB) -> %d\n", ActiveParams.VC_EffectLevel );
+    //ALOGV("\tVolumeGetVolumeLevel Succesfully returned from LVM_GetControlParameters\n");
 
     *level = ActiveParams.VC_EffectLevel*100;     // Convert dB to millibels
-    //LOGV("\tVolumeGetVolumeLevel end");
+    //ALOGV("\tVolumeGetVolumeLevel end");
     return 0;
 }    /* end VolumeGetVolumeLevel */
 
@@ -1516,7 +1516,7 @@
 //----------------------------------------------------------------------------
 
 int32_t VolumeSetMute(EffectContext *pContext, uint32_t mute){
-    //LOGV("\tVolumeSetMute start(%d)", mute);
+    //ALOGV("\tVolumeSetMute start(%d)", mute);
 
     pContext->pBundledContext->bMuteEnabled = mute;
 
@@ -1528,8 +1528,8 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeSetMute")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeSetMute Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tVolumeSetMute to %d, level was %d\n", mute, ActiveParams.VC_EffectLevel );
+    //ALOGV("\tVolumeSetMute Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tVolumeSetMute to %d, level was %d\n", mute, ActiveParams.VC_EffectLevel );
 
     /* Set appropriate volume level */
     if(pContext->pBundledContext->bMuteEnabled == LVM_TRUE){
@@ -1544,8 +1544,8 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "VolumeSetMute")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeSetMute Succesfully called LVM_SetControlParameters\n");
-    //LOGV("\tVolumeSetMute end");
+    //ALOGV("\tVolumeSetMute Succesfully called LVM_SetControlParameters\n");
+    //ALOGV("\tVolumeSetMute end");
     return 0;
 }    /* end setMute */
 
@@ -1562,17 +1562,17 @@
 //----------------------------------------------------------------------------
 
 int32_t VolumeGetMute(EffectContext *pContext, uint32_t *mute){
-    //LOGV("\tVolumeGetMute start");
+    //ALOGV("\tVolumeGetMute start");
     if((pContext->pBundledContext->bMuteEnabled == LVM_FALSE)||
        (pContext->pBundledContext->bMuteEnabled == LVM_TRUE)){
         *mute = pContext->pBundledContext->bMuteEnabled;
         return 0;
     }else{
-        LOGV("\tLVM_ERROR : VolumeGetMute read an invalid value from context %d",
+        ALOGV("\tLVM_ERROR : VolumeGetMute read an invalid value from context %d",
               pContext->pBundledContext->bMuteEnabled);
         return -EINVAL;
     }
-    //LOGV("\tVolumeGetMute end");
+    //ALOGV("\tVolumeGetMute end");
 }    /* end getMute */
 
 int16_t VolumeConvertStereoPosition(int16_t position){
@@ -1606,43 +1606,43 @@
     pContext->pBundledContext->positionSaved = position;
     Balance = VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
 
-    //LOGV("\tVolumeSetStereoPosition start pContext->pBundledContext->positionSaved = %d",
+    //ALOGV("\tVolumeSetStereoPosition start pContext->pBundledContext->positionSaved = %d",
     //pContext->pBundledContext->positionSaved);
 
     if(pContext->pBundledContext->bStereoPositionEnabled == LVM_TRUE){
 
-        //LOGV("\tVolumeSetStereoPosition Position to be set is %d %d\n", position, Balance);
+        //ALOGV("\tVolumeSetStereoPosition Position to be set is %d %d\n", position, Balance);
         pContext->pBundledContext->positionSaved = position;
         /* Get the current settings */
         LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
         LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeSetStereoPosition")
         if(LvmStatus != LVM_SUCCESS) return -EINVAL;
-        //LOGV("\tVolumeSetStereoPosition Succesfully returned from LVM_GetControlParameters got:"
+        //ALOGV("\tVolumeSetStereoPosition Succesfully returned from LVM_GetControlParameters got:"
         //     " %d\n", ActiveParams.VC_Balance);
 
         /* Volume parameters */
         ActiveParams.VC_Balance  = Balance;
-        //LOGV("\tVolumeSetStereoPosition() (-96dB -> +96dB)   -> %d\n", ActiveParams.VC_Balance );
+        //ALOGV("\tVolumeSetStereoPosition() (-96dB -> +96dB)   -> %d\n", ActiveParams.VC_Balance );
 
         /* Activate the initial settings */
         LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
         LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "VolumeSetStereoPosition")
         if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-        //LOGV("\tVolumeSetStereoPosition Succesfully called LVM_SetControlParameters\n");
+        //ALOGV("\tVolumeSetStereoPosition Succesfully called LVM_SetControlParameters\n");
 
         /* Get the current settings */
         LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
         LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeSetStereoPosition")
         if(LvmStatus != LVM_SUCCESS) return -EINVAL;
-        //LOGV("\tVolumeSetStereoPosition Succesfully returned from LVM_GetControlParameters got: "
+        //ALOGV("\tVolumeSetStereoPosition Succesfully returned from LVM_GetControlParameters got: "
         //     "%d\n", ActiveParams.VC_Balance);
     }
     else{
-        //LOGV("\tVolumeSetStereoPosition Position attempting to set, but not enabled %d %d\n",
+        //ALOGV("\tVolumeSetStereoPosition Position attempting to set, but not enabled %d %d\n",
         //position, Balance);
     }
-    //LOGV("\tVolumeSetStereoPosition end pContext->pBundledContext->positionSaved = %d\n",
+    //ALOGV("\tVolumeSetStereoPosition end pContext->pBundledContext->positionSaved = %d\n",
     //pContext->pBundledContext->positionSaved);
     return 0;
 }    /* end VolumeSetStereoPosition */
@@ -1661,21 +1661,21 @@
 //----------------------------------------------------------------------------
 
 int32_t VolumeGetStereoPosition(EffectContext *pContext, int16_t *position){
-    //LOGV("\tVolumeGetStereoPosition start");
+    //ALOGV("\tVolumeGetStereoPosition start");
 
     LVM_ControlParams_t     ActiveParams;                           /* Current control Parameters */
     LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;                /* Function call status */
     LVM_INT16               balance;
 
-    //LOGV("\tVolumeGetStereoPosition start pContext->pBundledContext->positionSaved = %d",
+    //ALOGV("\tVolumeGetStereoPosition start pContext->pBundledContext->positionSaved = %d",
     //pContext->pBundledContext->positionSaved);
 
     LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeGetStereoPosition")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeGetStereoPosition -> %d\n", ActiveParams.VC_Balance);
-    //LOGV("\tVolumeGetStereoPosition Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tVolumeGetStereoPosition -> %d\n", ActiveParams.VC_Balance);
+    //ALOGV("\tVolumeGetStereoPosition Succesfully returned from LVM_GetControlParameters\n");
 
     balance = VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
 
@@ -1685,7 +1685,7 @@
         }
     }
     *position = (LVM_INT16)pContext->pBundledContext->positionSaved;     // Convert dB to millibels
-    //LOGV("\tVolumeGetStereoPosition end returning pContext->pBundledContext->positionSaved =%d\n",
+    //ALOGV("\tVolumeGetStereoPosition end returning pContext->pBundledContext->positionSaved =%d\n",
     //pContext->pBundledContext->positionSaved);
     return 0;
 }    /* end VolumeGetStereoPosition */
@@ -1702,7 +1702,7 @@
 //----------------------------------------------------------------------------
 
 int32_t VolumeEnableStereoPosition(EffectContext *pContext, uint32_t enabled){
-    //LOGV("\tVolumeEnableStereoPosition start()");
+    //ALOGV("\tVolumeEnableStereoPosition start()");
 
     pContext->pBundledContext->bStereoPositionEnabled = enabled;
 
@@ -1714,8 +1714,8 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeEnableStereoPosition")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeEnableStereoPosition Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tVolumeEnableStereoPosition to %d, position was %d\n",
+    //ALOGV("\tVolumeEnableStereoPosition Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tVolumeEnableStereoPosition to %d, position was %d\n",
     //     enabled, ActiveParams.VC_Balance );
 
     /* Set appropriate stereo position */
@@ -1731,8 +1731,8 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "VolumeEnableStereoPosition")
     if(LvmStatus != LVM_SUCCESS) return -EINVAL;
 
-    //LOGV("\tVolumeEnableStereoPosition Succesfully called LVM_SetControlParameters\n");
-    //LOGV("\tVolumeEnableStereoPosition end()\n");
+    //ALOGV("\tVolumeEnableStereoPosition Succesfully called LVM_SetControlParameters\n");
+    //ALOGV("\tVolumeEnableStereoPosition end()\n");
     return 0;
 }    /* end VolumeEnableStereoPosition */
 
@@ -1767,26 +1767,26 @@
     int32_t param2;
     char *name;
 
-    //LOGV("\tBassBoost_getParameter start");
+    //ALOGV("\tBassBoost_getParameter start");
 
     switch (param){
         case BASSBOOST_PARAM_STRENGTH_SUPPORTED:
             if (*pValueSize != sizeof(uint32_t)){
-                LOGV("\tLVM_ERROR : BassBoost_getParameter() invalid pValueSize1 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : BassBoost_getParameter() invalid pValueSize1 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(uint32_t);
             break;
         case BASSBOOST_PARAM_STRENGTH:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : BassBoost_getParameter() invalid pValueSize2 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : BassBoost_getParameter() invalid pValueSize2 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
 
         default:
-            LOGV("\tLVM_ERROR : BassBoost_getParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : BassBoost_getParameter() invalid param %d", param);
             return -EINVAL;
     }
 
@@ -1794,24 +1794,24 @@
         case BASSBOOST_PARAM_STRENGTH_SUPPORTED:
             *(uint32_t *)pValue = 1;
 
-            //LOGV("\tBassBoost_getParameter() BASSBOOST_PARAM_STRENGTH_SUPPORTED Value is %d",
+            //ALOGV("\tBassBoost_getParameter() BASSBOOST_PARAM_STRENGTH_SUPPORTED Value is %d",
             //        *(uint32_t *)pValue);
             break;
 
         case BASSBOOST_PARAM_STRENGTH:
             *(int16_t *)pValue = BassGetStrength(pContext);
 
-            //LOGV("\tBassBoost_getParameter() BASSBOOST_PARAM_STRENGTH Value is %d",
+            //ALOGV("\tBassBoost_getParameter() BASSBOOST_PARAM_STRENGTH Value is %d",
             //        *(int16_t *)pValue);
             break;
 
         default:
-            LOGV("\tLVM_ERROR : BassBoost_getParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : BassBoost_getParameter() invalid param %d", param);
             status = -EINVAL;
             break;
     }
 
-    //LOGV("\tBassBoost_getParameter end");
+    //ALOGV("\tBassBoost_getParameter end");
     return status;
 } /* end BassBoost_getParameter */
 
@@ -1835,22 +1835,22 @@
     int16_t strength;
     int32_t *pParamTemp = (int32_t *)pParam;
 
-    //LOGV("\tBassBoost_setParameter start");
+    //ALOGV("\tBassBoost_setParameter start");
 
     switch (*pParamTemp){
         case BASSBOOST_PARAM_STRENGTH:
             strength = *(int16_t *)pValue;
-            //LOGV("\tBassBoost_setParameter() BASSBOOST_PARAM_STRENGTH value is %d", strength);
-            //LOGV("\tBassBoost_setParameter() Calling pBassBoost->BassSetStrength");
+            //ALOGV("\tBassBoost_setParameter() BASSBOOST_PARAM_STRENGTH value is %d", strength);
+            //ALOGV("\tBassBoost_setParameter() Calling pBassBoost->BassSetStrength");
             BassSetStrength(pContext, (int32_t)strength);
-            //LOGV("\tBassBoost_setParameter() Called pBassBoost->BassSetStrength");
+            //ALOGV("\tBassBoost_setParameter() Called pBassBoost->BassSetStrength");
            break;
         default:
-            LOGV("\tLVM_ERROR : BassBoost_setParameter() invalid param %d", *pParamTemp);
+            ALOGV("\tLVM_ERROR : BassBoost_setParameter() invalid param %d", *pParamTemp);
             break;
     }
 
-    //LOGV("\tBassBoost_setParameter end");
+    //ALOGV("\tBassBoost_setParameter end");
     return status;
 } /* end BassBoost_setParameter */
 
@@ -1885,26 +1885,26 @@
     int32_t param2;
     char *name;
 
-    //LOGV("\tVirtualizer_getParameter start");
+    //ALOGV("\tVirtualizer_getParameter start");
 
     switch (param){
         case VIRTUALIZER_PARAM_STRENGTH_SUPPORTED:
             if (*pValueSize != sizeof(uint32_t)){
-                LOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid pValueSize %d",*pValueSize);
+                ALOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid pValueSize %d",*pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(uint32_t);
             break;
         case VIRTUALIZER_PARAM_STRENGTH:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid pValueSize2 %d",*pValueSize);
+                ALOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid pValueSize2 %d",*pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid param %d", param);
             return -EINVAL;
     }
 
@@ -1912,24 +1912,24 @@
         case VIRTUALIZER_PARAM_STRENGTH_SUPPORTED:
             *(uint32_t *)pValue = 1;
 
-            //LOGV("\tVirtualizer_getParameter() VIRTUALIZER_PARAM_STRENGTH_SUPPORTED Value is %d",
+            //ALOGV("\tVirtualizer_getParameter() VIRTUALIZER_PARAM_STRENGTH_SUPPORTED Value is %d",
             //        *(uint32_t *)pValue);
             break;
 
         case VIRTUALIZER_PARAM_STRENGTH:
             *(int16_t *)pValue = VirtualizerGetStrength(pContext);
 
-            //LOGV("\tVirtualizer_getParameter() VIRTUALIZER_PARAM_STRENGTH Value is %d",
+            //ALOGV("\tVirtualizer_getParameter() VIRTUALIZER_PARAM_STRENGTH Value is %d",
             //        *(int16_t *)pValue);
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Virtualizer_getParameter() invalid param %d", param);
             status = -EINVAL;
             break;
     }
 
-    //LOGV("\tVirtualizer_getParameter end");
+    //ALOGV("\tVirtualizer_getParameter end");
     return status;
 } /* end Virtualizer_getParameter */
 
@@ -1954,22 +1954,22 @@
     int32_t *pParamTemp = (int32_t *)pParam;
     int32_t param = *pParamTemp++;
 
-    //LOGV("\tVirtualizer_setParameter start");
+    //ALOGV("\tVirtualizer_setParameter start");
 
     switch (param){
         case VIRTUALIZER_PARAM_STRENGTH:
             strength = *(int16_t *)pValue;
-            //LOGV("\tVirtualizer_setParameter() VIRTUALIZER_PARAM_STRENGTH value is %d", strength);
-            //LOGV("\tVirtualizer_setParameter() Calling pVirtualizer->setStrength");
+            //ALOGV("\tVirtualizer_setParameter() VIRTUALIZER_PARAM_STRENGTH value is %d", strength);
+            //ALOGV("\tVirtualizer_setParameter() Calling pVirtualizer->setStrength");
             VirtualizerSetStrength(pContext, (int32_t)strength);
-            //LOGV("\tVirtualizer_setParameter() Called pVirtualizer->setStrength");
+            //ALOGV("\tVirtualizer_setParameter() Called pVirtualizer->setStrength");
            break;
         default:
-            LOGV("\tLVM_ERROR : Virtualizer_setParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Virtualizer_setParameter() invalid param %d", param);
             break;
     }
 
-    //LOGV("\tVirtualizer_setParameter end");
+    //ALOGV("\tVirtualizer_setParameter end");
     return status;
 } /* end Virtualizer_setParameter */
 
@@ -2004,7 +2004,7 @@
     int32_t param2;
     char *name;
 
-    //LOGV("\tEqualizer_getParameter start");
+    //ALOGV("\tEqualizer_getParameter start");
 
     switch (param) {
     case EQ_PARAM_NUM_BANDS:
@@ -2013,7 +2013,7 @@
     case EQ_PARAM_BAND_LEVEL:
     case EQ_PARAM_GET_BAND:
         if (*pValueSize < sizeof(int16_t)) {
-            LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 1  %d", *pValueSize);
+            ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 1  %d", *pValueSize);
             return -EINVAL;
         }
         *pValueSize = sizeof(int16_t);
@@ -2021,14 +2021,14 @@
 
     case EQ_PARAM_LEVEL_RANGE:
         if (*pValueSize < 2 * sizeof(int16_t)) {
-            LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 2  %d", *pValueSize);
+            ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 2  %d", *pValueSize);
             return -EINVAL;
         }
         *pValueSize = 2 * sizeof(int16_t);
         break;
     case EQ_PARAM_BAND_FREQ_RANGE:
         if (*pValueSize < 2 * sizeof(int32_t)) {
-            LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 3  %d", *pValueSize);
+            ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 3  %d", *pValueSize);
             return -EINVAL;
         }
         *pValueSize = 2 * sizeof(int32_t);
@@ -2036,7 +2036,7 @@
 
     case EQ_PARAM_CENTER_FREQ:
         if (*pValueSize < sizeof(int32_t)) {
-            LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 5  %d", *pValueSize);
+            ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 5  %d", *pValueSize);
             return -EINVAL;
         }
         *pValueSize = sizeof(int32_t);
@@ -2047,27 +2047,27 @@
 
     case EQ_PARAM_PROPERTIES:
         if (*pValueSize < (2 + FIVEBAND_NUMBANDS) * sizeof(uint16_t)) {
-            LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 1  %d", *pValueSize);
+            ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid pValueSize 1  %d", *pValueSize);
             return -EINVAL;
         }
         *pValueSize = (2 + FIVEBAND_NUMBANDS) * sizeof(uint16_t);
         break;
 
     default:
-        LOGV("\tLVM_ERROR : Equalizer_getParameter unknown param %d", param);
+        ALOGV("\tLVM_ERROR : Equalizer_getParameter unknown param %d", param);
         return -EINVAL;
     }
 
     switch (param) {
     case EQ_PARAM_NUM_BANDS:
         *(uint16_t *)pValue = (uint16_t)FIVEBAND_NUMBANDS;
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_NUM_BANDS %d", *(int16_t *)pValue);
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_NUM_BANDS %d", *(int16_t *)pValue);
         break;
 
     case EQ_PARAM_LEVEL_RANGE:
         *(int16_t *)pValue = -1500;
         *((int16_t *)pValue + 1) = 1500;
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_LEVEL_RANGE min %d, max %d",
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_LEVEL_RANGE min %d, max %d",
         //      *(int16_t *)pValue, *((int16_t *)pValue + 1));
         break;
 
@@ -2078,7 +2078,7 @@
             break;
         }
         *(int16_t *)pValue = (int16_t)EqualizerGetBandLevel(pContext, param2);
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_BAND_LEVEL band %d, level %d",
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_BAND_LEVEL band %d, level %d",
         //      param2, *(int32_t *)pValue);
         break;
 
@@ -2089,7 +2089,7 @@
             break;
         }
         *(int32_t *)pValue = EqualizerGetCentreFrequency(pContext, param2);
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_CENTER_FREQ band %d, frequency %d",
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_CENTER_FREQ band %d, frequency %d",
         //      param2, *(int32_t *)pValue);
         break;
 
@@ -2100,25 +2100,25 @@
             break;
         }
         EqualizerGetBandFreqRange(pContext, param2, (uint32_t *)pValue, ((uint32_t *)pValue + 1));
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_BAND_FREQ_RANGE band %d, min %d, max %d",
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_BAND_FREQ_RANGE band %d, min %d, max %d",
         //      param2, *(int32_t *)pValue, *((int32_t *)pValue + 1));
         break;
 
     case EQ_PARAM_GET_BAND:
         param2 = *pParamTemp;
         *(uint16_t *)pValue = (uint16_t)EqualizerGetBand(pContext, param2);
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_GET_BAND frequency %d, band %d",
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_GET_BAND frequency %d, band %d",
         //      param2, *(uint16_t *)pValue);
         break;
 
     case EQ_PARAM_CUR_PRESET:
         *(uint16_t *)pValue = (uint16_t)EqualizerGetPreset(pContext);
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_CUR_PRESET %d", *(int32_t *)pValue);
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_CUR_PRESET %d", *(int32_t *)pValue);
         break;
 
     case EQ_PARAM_GET_NUM_OF_PRESETS:
         *(uint16_t *)pValue = (uint16_t)EqualizerGetNumPresets();
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_GET_NUM_OF_PRESETS %d", *(int16_t *)pValue);
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_GET_NUM_OF_PRESETS %d", *(int16_t *)pValue);
         break;
 
     case EQ_PARAM_GET_PRESET_NAME:
@@ -2132,13 +2132,13 @@
         strncpy(name, EqualizerGetPresetName(param2), *pValueSize - 1);
         name[*pValueSize - 1] = 0;
         *pValueSize = strlen(name) + 1;
-        //LOGV("\tEqualizer_getParameter() EQ_PARAM_GET_PRESET_NAME preset %d, name %s len %d",
+        //ALOGV("\tEqualizer_getParameter() EQ_PARAM_GET_PRESET_NAME preset %d, name %s len %d",
         //      param2, gEqualizerPresets[param2].name, *pValueSize);
         break;
 
     case EQ_PARAM_PROPERTIES: {
         int16_t *p = (int16_t *)pValue;
-        LOGV("\tEqualizer_getParameter() EQ_PARAM_PROPERTIES");
+        ALOGV("\tEqualizer_getParameter() EQ_PARAM_PROPERTIES");
         p[0] = (int16_t)EqualizerGetPreset(pContext);
         p[1] = (int16_t)FIVEBAND_NUMBANDS;
         for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
@@ -2147,7 +2147,7 @@
     } break;
 
     default:
-        LOGV("\tLVM_ERROR : Equalizer_getParameter() invalid param %d", param);
+        ALOGV("\tLVM_ERROR : Equalizer_getParameter() invalid param %d", param);
         status = -EINVAL;
         break;
     }
@@ -2179,12 +2179,12 @@
     int32_t param = *pParamTemp++;
 
 
-    //LOGV("\tEqualizer_setParameter start");
+    //ALOGV("\tEqualizer_setParameter start");
     switch (param) {
     case EQ_PARAM_CUR_PRESET:
         preset = (int32_t)(*(uint16_t *)pValue);
 
-        //LOGV("\tEqualizer_setParameter() EQ_PARAM_CUR_PRESET %d", preset);
+        //ALOGV("\tEqualizer_setParameter() EQ_PARAM_CUR_PRESET %d", preset);
         if ((preset >= EqualizerGetNumPresets())||(preset < 0)) {
             status = -EINVAL;
             break;
@@ -2194,7 +2194,7 @@
     case EQ_PARAM_BAND_LEVEL:
         band =  *pParamTemp;
         level = (int32_t)(*(int16_t *)pValue);
-        //LOGV("\tEqualizer_setParameter() EQ_PARAM_BAND_LEVEL band %d, level %d", band, level);
+        //ALOGV("\tEqualizer_setParameter() EQ_PARAM_BAND_LEVEL band %d, level %d", band, level);
         if (band >= FIVEBAND_NUMBANDS) {
             status = -EINVAL;
             break;
@@ -2202,7 +2202,7 @@
         EqualizerSetBandLevel(pContext, band, level);
         break;
     case EQ_PARAM_PROPERTIES: {
-        //LOGV("\tEqualizer_setParameter() EQ_PARAM_PROPERTIES");
+        //ALOGV("\tEqualizer_setParameter() EQ_PARAM_PROPERTIES");
         int16_t *p = (int16_t *)pValue;
         if ((int)p[0] >= EqualizerGetNumPresets()) {
             status = -EINVAL;
@@ -2221,12 +2221,12 @@
         }
     } break;
     default:
-        LOGV("\tLVM_ERROR : Equalizer_setParameter() invalid param %d", param);
+        ALOGV("\tLVM_ERROR : Equalizer_setParameter() invalid param %d", param);
         status = -EINVAL;
         break;
     }
 
-    //LOGV("\tEqualizer_setParameter end");
+    //ALOGV("\tEqualizer_setParameter end");
     return status;
 } /* end Equalizer_setParameter */
 
@@ -2261,14 +2261,14 @@
     int32_t param = *pParamTemp++;;
     char *name;
 
-    //LOGV("\tVolume_getParameter start");
+    //ALOGV("\tVolume_getParameter start");
 
     switch (param){
         case VOLUME_PARAM_LEVEL:
         case VOLUME_PARAM_MAXLEVEL:
         case VOLUME_PARAM_STEREOPOSITION:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Volume_getParameter() invalid pValueSize 1  %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Volume_getParameter() invalid pValueSize 1  %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
@@ -2277,55 +2277,55 @@
         case VOLUME_PARAM_MUTE:
         case VOLUME_PARAM_ENABLESTEREOPOSITION:
             if (*pValueSize < sizeof(int32_t)){
-                LOGV("\tLVM_ERROR : Volume_getParameter() invalid pValueSize 2  %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Volume_getParameter() invalid pValueSize 2  %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int32_t);
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Volume_getParameter unknown param %d", param);
+            ALOGV("\tLVM_ERROR : Volume_getParameter unknown param %d", param);
             return -EINVAL;
     }
 
     switch (param){
         case VOLUME_PARAM_LEVEL:
             status = VolumeGetVolumeLevel(pContext, (int16_t *)(pValue));
-            //LOGV("\tVolume_getParameter() VOLUME_PARAM_LEVEL Value is %d",
+            //ALOGV("\tVolume_getParameter() VOLUME_PARAM_LEVEL Value is %d",
             //        *(int16_t *)pValue);
             break;
 
         case VOLUME_PARAM_MAXLEVEL:
             *(int16_t *)pValue = 0;
-            //LOGV("\tVolume_getParameter() VOLUME_PARAM_MAXLEVEL Value is %d",
+            //ALOGV("\tVolume_getParameter() VOLUME_PARAM_MAXLEVEL Value is %d",
             //        *(int16_t *)pValue);
             break;
 
         case VOLUME_PARAM_STEREOPOSITION:
             VolumeGetStereoPosition(pContext, (int16_t *)pValue);
-            //LOGV("\tVolume_getParameter() VOLUME_PARAM_STEREOPOSITION Value is %d",
+            //ALOGV("\tVolume_getParameter() VOLUME_PARAM_STEREOPOSITION Value is %d",
             //        *(int16_t *)pValue);
             break;
 
         case VOLUME_PARAM_MUTE:
             status = VolumeGetMute(pContext, (uint32_t *)pValue);
-            LOGV("\tVolume_getParameter() VOLUME_PARAM_MUTE Value is %d",
+            ALOGV("\tVolume_getParameter() VOLUME_PARAM_MUTE Value is %d",
                     *(uint32_t *)pValue);
             break;
 
         case VOLUME_PARAM_ENABLESTEREOPOSITION:
             *(int32_t *)pValue = pContext->pBundledContext->bStereoPositionEnabled;
-            //LOGV("\tVolume_getParameter() VOLUME_PARAM_ENABLESTEREOPOSITION Value is %d",
+            //ALOGV("\tVolume_getParameter() VOLUME_PARAM_ENABLESTEREOPOSITION Value is %d",
             //        *(uint32_t *)pValue);
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Volume_getParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Volume_getParameter() invalid param %d", param);
             status = -EINVAL;
             break;
     }
 
-    //LOGV("\tVolume_getParameter end");
+    //ALOGV("\tVolume_getParameter end");
     return status;
 } /* end Volume_getParameter */
 
@@ -2354,46 +2354,46 @@
     int32_t *pParamTemp = (int32_t *)pParam;
     int32_t param = *pParamTemp++;
 
-    //LOGV("\tVolume_setParameter start");
+    //ALOGV("\tVolume_setParameter start");
 
     switch (param){
         case VOLUME_PARAM_LEVEL:
             level = *(int16_t *)pValue;
-            //LOGV("\tVolume_setParameter() VOLUME_PARAM_LEVEL value is %d", level);
-            //LOGV("\tVolume_setParameter() Calling pVolume->setVolumeLevel");
+            //ALOGV("\tVolume_setParameter() VOLUME_PARAM_LEVEL value is %d", level);
+            //ALOGV("\tVolume_setParameter() Calling pVolume->setVolumeLevel");
             status = VolumeSetVolumeLevel(pContext, (int16_t)level);
-            //LOGV("\tVolume_setParameter() Called pVolume->setVolumeLevel");
+            //ALOGV("\tVolume_setParameter() Called pVolume->setVolumeLevel");
             break;
 
         case VOLUME_PARAM_MUTE:
             mute = *(uint32_t *)pValue;
-            //LOGV("\tVolume_setParameter() Calling pVolume->setMute, mute is %d", mute);
-            //LOGV("\tVolume_setParameter() Calling pVolume->setMute");
+            //ALOGV("\tVolume_setParameter() Calling pVolume->setMute, mute is %d", mute);
+            //ALOGV("\tVolume_setParameter() Calling pVolume->setMute");
             status = VolumeSetMute(pContext, mute);
-            //LOGV("\tVolume_setParameter() Called pVolume->setMute");
+            //ALOGV("\tVolume_setParameter() Called pVolume->setMute");
             break;
 
         case VOLUME_PARAM_ENABLESTEREOPOSITION:
             positionEnabled = *(uint32_t *)pValue;
             status = VolumeEnableStereoPosition(pContext, positionEnabled);
             status = VolumeSetStereoPosition(pContext, pContext->pBundledContext->positionSaved);
-            //LOGV("\tVolume_setParameter() VOLUME_PARAM_ENABLESTEREOPOSITION called");
+            //ALOGV("\tVolume_setParameter() VOLUME_PARAM_ENABLESTEREOPOSITION called");
             break;
 
         case VOLUME_PARAM_STEREOPOSITION:
             position = *(int16_t *)pValue;
-            //LOGV("\tVolume_setParameter() VOLUME_PARAM_STEREOPOSITION value is %d", position);
-            //LOGV("\tVolume_setParameter() Calling pVolume->VolumeSetStereoPosition");
+            //ALOGV("\tVolume_setParameter() VOLUME_PARAM_STEREOPOSITION value is %d", position);
+            //ALOGV("\tVolume_setParameter() Calling pVolume->VolumeSetStereoPosition");
             status = VolumeSetStereoPosition(pContext, (int16_t)position);
-            //LOGV("\tVolume_setParameter() Called pVolume->VolumeSetStereoPosition");
+            //ALOGV("\tVolume_setParameter() Called pVolume->VolumeSetStereoPosition");
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Volume_setParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Volume_setParameter() invalid param %d", param);
             break;
     }
 
-    //LOGV("\tVolume_setParameter end");
+    //ALOGV("\tVolume_setParameter end");
     return status;
 } /* end Volume_setParameter */
 
@@ -2459,7 +2459,7 @@
 
 int Effect_setEnabled(EffectContext *pContext, bool enabled)
 {
-    LOGV("\tEffect_setEnabled() type %d, enabled %d", pContext->EffectType, enabled);
+    ALOGV("\tEffect_setEnabled() type %d, enabled %d", pContext->EffectType, enabled);
 
     if (enabled) {
         // Bass boost or Virtualizer can be temporarily disabled if playing over device speaker due
@@ -2468,7 +2468,7 @@
         switch (pContext->EffectType) {
             case LVM_BASS_BOOST:
                 if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
-                     LOGV("\tEffect_setEnabled() LVM_BASS_BOOST is already enabled");
+                     ALOGV("\tEffect_setEnabled() LVM_BASS_BOOST is already enabled");
                      return -EINVAL;
                 }
                 if(pContext->pBundledContext->SamplesToExitCountBb <= 0){
@@ -2481,7 +2481,7 @@
                 break;
             case LVM_EQUALIZER:
                 if (pContext->pBundledContext->bEqualizerEnabled == LVM_TRUE) {
-                    LOGV("\tEffect_setEnabled() LVM_EQUALIZER is already enabled");
+                    ALOGV("\tEffect_setEnabled() LVM_EQUALIZER is already enabled");
                     return -EINVAL;
                 }
                 if(pContext->pBundledContext->SamplesToExitCountEq <= 0){
@@ -2493,7 +2493,7 @@
                 break;
             case LVM_VIRTUALIZER:
                 if (pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE) {
-                    LOGV("\tEffect_setEnabled() LVM_VIRTUALIZER is already enabled");
+                    ALOGV("\tEffect_setEnabled() LVM_VIRTUALIZER is already enabled");
                     return -EINVAL;
                 }
                 if(pContext->pBundledContext->SamplesToExitCountVirt <= 0){
@@ -2506,14 +2506,14 @@
                 break;
             case LVM_VOLUME:
                 if (pContext->pBundledContext->bVolumeEnabled == LVM_TRUE) {
-                    LOGV("\tEffect_setEnabled() LVM_VOLUME is already enabled");
+                    ALOGV("\tEffect_setEnabled() LVM_VOLUME is already enabled");
                     return -EINVAL;
                 }
                 pContext->pBundledContext->NumberEffectsEnabled++;
                 pContext->pBundledContext->bVolumeEnabled = LVM_TRUE;
                 break;
             default:
-                LOGV("\tEffect_setEnabled() invalid effect type");
+                ALOGV("\tEffect_setEnabled() invalid effect type");
                 return -EINVAL;
         }
         if (!tempDisabled) {
@@ -2523,34 +2523,34 @@
         switch (pContext->EffectType) {
             case LVM_BASS_BOOST:
                 if (pContext->pBundledContext->bBassEnabled == LVM_FALSE) {
-                    LOGV("\tEffect_setEnabled() LVM_BASS_BOOST is already disabled");
+                    ALOGV("\tEffect_setEnabled() LVM_BASS_BOOST is already disabled");
                     return -EINVAL;
                 }
                 pContext->pBundledContext->bBassEnabled = LVM_FALSE;
                 break;
             case LVM_EQUALIZER:
                 if (pContext->pBundledContext->bEqualizerEnabled == LVM_FALSE) {
-                    LOGV("\tEffect_setEnabled() LVM_EQUALIZER is already disabled");
+                    ALOGV("\tEffect_setEnabled() LVM_EQUALIZER is already disabled");
                     return -EINVAL;
                 }
                 pContext->pBundledContext->bEqualizerEnabled = LVM_FALSE;
                 break;
             case LVM_VIRTUALIZER:
                 if (pContext->pBundledContext->bVirtualizerEnabled == LVM_FALSE) {
-                    LOGV("\tEffect_setEnabled() LVM_VIRTUALIZER is already disabled");
+                    ALOGV("\tEffect_setEnabled() LVM_VIRTUALIZER is already disabled");
                     return -EINVAL;
                 }
                 pContext->pBundledContext->bVirtualizerEnabled = LVM_FALSE;
                 break;
             case LVM_VOLUME:
                 if (pContext->pBundledContext->bVolumeEnabled == LVM_FALSE) {
-                    LOGV("\tEffect_setEnabled() LVM_VOLUME is already disabled");
+                    ALOGV("\tEffect_setEnabled() LVM_VOLUME is already disabled");
                     return -EINVAL;
                 }
                 pContext->pBundledContext->bVolumeEnabled = LVM_FALSE;
                 break;
             default:
-                LOGV("\tEffect_setEnabled() invalid effect type");
+                ALOGV("\tEffect_setEnabled() invalid effect type");
                 return -EINVAL;
         }
         LvmEffect_disable(pContext);
@@ -2595,77 +2595,77 @@
     LVM_INT16   *in  = (LVM_INT16 *)inBuffer->raw;
     LVM_INT16   *out = (LVM_INT16 *)outBuffer->raw;
 
-//LOGV("\tEffect_process Start : Enabled = %d     Called = %d (%8d %8d %8d)",
+//ALOGV("\tEffect_process Start : Enabled = %d     Called = %d (%8d %8d %8d)",
 //pContext->pBundledContext->NumberEffectsEnabled,pContext->pBundledContext->NumberEffectsCalled,
 //    pContext->pBundledContext->SamplesToExitCountBb,
 //    pContext->pBundledContext->SamplesToExitCountVirt,
 //    pContext->pBundledContext->SamplesToExitCountEq);
 
     if (pContext == NULL){
-        LOGV("\tLVM_ERROR : Effect_process() ERROR pContext == NULL");
+        ALOGV("\tLVM_ERROR : Effect_process() ERROR pContext == NULL");
         return -EINVAL;
     }
 
     //if(pContext->EffectType == LVM_BASS_BOOST){
-    //  LOGV("\tEffect_process: Effect type is BASS_BOOST");
+    //  ALOGV("\tEffect_process: Effect type is BASS_BOOST");
     //}else if(pContext->EffectType == LVM_EQUALIZER){
-    //  LOGV("\tEffect_process: Effect type is LVM_EQUALIZER");
+    //  ALOGV("\tEffect_process: Effect type is LVM_EQUALIZER");
     //}else if(pContext->EffectType == LVM_VIRTUALIZER){
-    //  LOGV("\tEffect_process: Effect type is LVM_VIRTUALIZER");
+    //  ALOGV("\tEffect_process: Effect type is LVM_VIRTUALIZER");
     //}
 
     if (inBuffer == NULL  || inBuffer->raw == NULL  ||
             outBuffer == NULL || outBuffer->raw == NULL ||
             inBuffer->frameCount != outBuffer->frameCount){
-        LOGV("\tLVM_ERROR : Effect_process() ERROR NULL INPUT POINTER OR FRAME COUNT IS WRONG");
+        ALOGV("\tLVM_ERROR : Effect_process() ERROR NULL INPUT POINTER OR FRAME COUNT IS WRONG");
         return -EINVAL;
     }
     if ((pContext->pBundledContext->bBassEnabled == LVM_FALSE)&&
         (pContext->EffectType == LVM_BASS_BOOST)){
-        //LOGV("\tEffect_process() LVM_BASS_BOOST Effect is not enabled");
+        //ALOGV("\tEffect_process() LVM_BASS_BOOST Effect is not enabled");
         if(pContext->pBundledContext->SamplesToExitCountBb > 0){
             pContext->pBundledContext->SamplesToExitCountBb -= outBuffer->frameCount * 2; // STEREO
-            //LOGV("\tEffect_process: Waiting to turn off BASS_BOOST, %d samples left",
+            //ALOGV("\tEffect_process: Waiting to turn off BASS_BOOST, %d samples left",
             //    pContext->pBundledContext->SamplesToExitCountBb);
         }
         if(pContext->pBundledContext->SamplesToExitCountBb <= 0) {
             status = -ENODATA;
             pContext->pBundledContext->NumberEffectsEnabled--;
-            LOGV("\tEffect_process() this is the last frame for LVM_BASS_BOOST");
+            ALOGV("\tEffect_process() this is the last frame for LVM_BASS_BOOST");
         }
     }
     if ((pContext->pBundledContext->bVolumeEnabled == LVM_FALSE)&&
         (pContext->EffectType == LVM_VOLUME)){
-        //LOGV("\tEffect_process() LVM_VOLUME Effect is not enabled");
+        //ALOGV("\tEffect_process() LVM_VOLUME Effect is not enabled");
         status = -ENODATA;
         pContext->pBundledContext->NumberEffectsEnabled--;
     }
     if ((pContext->pBundledContext->bEqualizerEnabled == LVM_FALSE)&&
         (pContext->EffectType == LVM_EQUALIZER)){
-        //LOGV("\tEffect_process() LVM_EQUALIZER Effect is not enabled");
+        //ALOGV("\tEffect_process() LVM_EQUALIZER Effect is not enabled");
         if(pContext->pBundledContext->SamplesToExitCountEq > 0){
             pContext->pBundledContext->SamplesToExitCountEq -= outBuffer->frameCount * 2; // STEREO
-            //LOGV("\tEffect_process: Waiting to turn off EQUALIZER, %d samples left",
+            //ALOGV("\tEffect_process: Waiting to turn off EQUALIZER, %d samples left",
             //    pContext->pBundledContext->SamplesToExitCountEq);
         }
         if(pContext->pBundledContext->SamplesToExitCountEq <= 0) {
             status = -ENODATA;
             pContext->pBundledContext->NumberEffectsEnabled--;
-            LOGV("\tEffect_process() this is the last frame for LVM_EQUALIZER");
+            ALOGV("\tEffect_process() this is the last frame for LVM_EQUALIZER");
         }
     }
     if ((pContext->pBundledContext->bVirtualizerEnabled == LVM_FALSE)&&
         (pContext->EffectType == LVM_VIRTUALIZER)){
-        //LOGV("\tEffect_process() LVM_VIRTUALIZER Effect is not enabled");
+        //ALOGV("\tEffect_process() LVM_VIRTUALIZER Effect is not enabled");
         if(pContext->pBundledContext->SamplesToExitCountVirt > 0){
             pContext->pBundledContext->SamplesToExitCountVirt -= outBuffer->frameCount * 2;// STEREO
-            //LOGV("\tEffect_process: Waiting for to turn off VIRTUALIZER, %d samples left",
+            //ALOGV("\tEffect_process: Waiting for to turn off VIRTUALIZER, %d samples left",
             //    pContext->pBundledContext->SamplesToExitCountVirt);
         }
         if(pContext->pBundledContext->SamplesToExitCountVirt <= 0) {
             status = -ENODATA;
             pContext->pBundledContext->NumberEffectsEnabled--;
-            LOGV("\tEffect_process() this is the last frame for LVM_VIRTUALIZER");
+            ALOGV("\tEffect_process() this is the last frame for LVM_VIRTUALIZER");
         }
     }
 
@@ -2675,12 +2675,12 @@
 
     if(pContext->pBundledContext->NumberEffectsCalled ==
        pContext->pBundledContext->NumberEffectsEnabled){
-        //LOGV("\tEffect_process     Calling process with %d effects enabled, %d called: Effect %d",
+        //ALOGV("\tEffect_process     Calling process with %d effects enabled, %d called: Effect %d",
         //pContext->pBundledContext->NumberEffectsEnabled,
         //pContext->pBundledContext->NumberEffectsCalled, pContext->EffectType);
 
         if(status == -ENODATA){
-            LOGV("\tEffect_process() processing last frame");
+            ALOGV("\tEffect_process() processing last frame");
         }
         pContext->pBundledContext->NumberEffectsCalled = 0;
         /* Process all the available frames, block processing is
@@ -2690,11 +2690,11 @@
                                                 outBuffer->frameCount,
                                                 pContext);
         if(lvmStatus != LVM_SUCCESS){
-            LOGV("\tLVM_ERROR : LvmBundle_process returned error %d", lvmStatus);
+            ALOGV("\tLVM_ERROR : LvmBundle_process returned error %d", lvmStatus);
             return lvmStatus;
         }
     } else {
-        //LOGV("\tEffect_process Not Calling process with %d effects enabled, %d called: Effect %d",
+        //ALOGV("\tEffect_process Not Calling process with %d effects enabled, %d called: Effect %d",
         //pContext->pBundledContext->NumberEffectsEnabled,
         //pContext->pBundledContext->NumberEffectsCalled, pContext->EffectType);
         // 2 is for stereo input
@@ -2721,92 +2721,92 @@
     EffectContext * pContext = (EffectContext *) self;
     int retsize;
 
-    //LOGV("\t\nEffect_command start");
+    //ALOGV("\t\nEffect_command start");
 
     if(pContext->EffectType == LVM_BASS_BOOST){
-        //LOGV("\tEffect_command setting command for LVM_BASS_BOOST");
+        //ALOGV("\tEffect_command setting command for LVM_BASS_BOOST");
     }
     if(pContext->EffectType == LVM_VIRTUALIZER){
-        //LOGV("\tEffect_command setting command for LVM_VIRTUALIZER");
+        //ALOGV("\tEffect_command setting command for LVM_VIRTUALIZER");
     }
     if(pContext->EffectType == LVM_EQUALIZER){
-        //LOGV("\tEffect_command setting command for LVM_EQUALIZER");
+        //ALOGV("\tEffect_command setting command for LVM_EQUALIZER");
     }
     if(pContext->EffectType == LVM_VOLUME){
-        //LOGV("\tEffect_command setting command for LVM_VOLUME");
+        //ALOGV("\tEffect_command setting command for LVM_VOLUME");
     }
 
     if (pContext == NULL){
-        LOGV("\tLVM_ERROR : Effect_command ERROR pContext == NULL");
+        ALOGV("\tLVM_ERROR : Effect_command ERROR pContext == NULL");
         return -EINVAL;
     }
 
-    //LOGV("\tEffect_command INPUTS are: command %d cmdSize %d",cmdCode, cmdSize);
+    //ALOGV("\tEffect_command INPUTS are: command %d cmdSize %d",cmdCode, cmdSize);
 
     // Incase we disable an effect, next time process is
     // called the number of effect called could be greater
     // pContext->pBundledContext->NumberEffectsCalled = 0;
 
-    //LOGV("\tEffect_command NumberEffectsCalled = %d, NumberEffectsEnabled = %d",
+    //ALOGV("\tEffect_command NumberEffectsCalled = %d, NumberEffectsEnabled = %d",
     //        pContext->pBundledContext->NumberEffectsCalled,
     //        pContext->pBundledContext->NumberEffectsEnabled);
 
     switch (cmdCode){
         case EFFECT_CMD_INIT:
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("\tLVM_ERROR, EFFECT_CMD_INIT: ERROR for effect type %d",
+                ALOGV("\tLVM_ERROR, EFFECT_CMD_INIT: ERROR for effect type %d",
                         pContext->EffectType);
                 return -EINVAL;
             }
             *(int *) pReplyData = 0;
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT start");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT start");
             if(pContext->EffectType == LVM_BASS_BOOST){
-                //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_BASS_BOOST");
+                //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_BASS_BOOST");
                 android::BassSetStrength(pContext, 0);
             }
             if(pContext->EffectType == LVM_VIRTUALIZER){
-                //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_VIRTUALIZER");
+                //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_VIRTUALIZER");
                 android::VirtualizerSetStrength(pContext, 0);
             }
             if(pContext->EffectType == LVM_EQUALIZER){
-                //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_EQUALIZER");
+                //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_EQUALIZER");
                 android::EqualizerSetPreset(pContext, 0);
             }
             if(pContext->EffectType == LVM_VOLUME){
-                //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_VOLUME");
+                //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_VOLUME");
                 *(int *) pReplyData = android::VolumeSetVolumeLevel(pContext, 0);
             }
             break;
 
         case EFFECT_CMD_CONFIGURE:
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_CONFIGURE start");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_CONFIGURE start");
             if (pCmdData    == NULL||
                 cmdSize     != sizeof(effect_config_t)||
                 pReplyData  == NULL||
                 *replySize  != sizeof(int)){
-                LOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
                         "EFFECT_CMD_CONFIGURE: ERROR");
                 return -EINVAL;
             }
             *(int *) pReplyData = android::Effect_configure(pContext, (effect_config_t *) pCmdData);
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_CONFIGURE end");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_CONFIGURE end");
             break;
 
         case EFFECT_CMD_RESET:
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_RESET start");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_RESET start");
             android::Effect_configure(pContext, &pContext->config);
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_RESET end");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_RESET end");
             break;
 
         case EFFECT_CMD_GET_PARAM:{
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
 
             if(pContext->EffectType == LVM_BASS_BOOST){
                 if (pCmdData == NULL ||
                         cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
                         pReplyData == NULL ||
                         *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
-                    LOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
                             "EFFECT_CMD_GET_PARAM: ERROR");
                     return -EINVAL;
                 }
@@ -2825,7 +2825,7 @@
 
                 *replySize = sizeof(effect_param_t) + voffset + p->vsize;
 
-                //LOGV("\tBassBoost_command EFFECT_CMD_GET_PARAM "
+                //ALOGV("\tBassBoost_command EFFECT_CMD_GET_PARAM "
                 //        "*pCmdData %d, *replySize %d, *pReplyData %d ",
                 //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
                 //        *replySize,
@@ -2837,7 +2837,7 @@
                         cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
                         pReplyData == NULL ||
                         *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
-                    LOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
                             "EFFECT_CMD_GET_PARAM: ERROR");
                     return -EINVAL;
                 }
@@ -2856,20 +2856,20 @@
 
                 *replySize = sizeof(effect_param_t) + voffset + p->vsize;
 
-                //LOGV("\tVirtualizer_command EFFECT_CMD_GET_PARAM "
+                //ALOGV("\tVirtualizer_command EFFECT_CMD_GET_PARAM "
                 //        "*pCmdData %d, *replySize %d, *pReplyData %d ",
                 //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
                 //        *replySize,
                 //        *(int16_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset));
             }
             if(pContext->EffectType == LVM_EQUALIZER){
-                //LOGV("\tEqualizer_command cmdCode Case: "
+                //ALOGV("\tEqualizer_command cmdCode Case: "
                 //        "EFFECT_CMD_GET_PARAM start");
                 if (pCmdData == NULL ||
                     cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
                     pReplyData == NULL ||
                     *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))) {
-                    LOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
                             "EFFECT_CMD_GET_PARAM");
                     return -EINVAL;
                 }
@@ -2888,7 +2888,7 @@
 
                 *replySize = sizeof(effect_param_t) + voffset + p->vsize;
 
-                //LOGV("\tEqualizer_command EFFECT_CMD_GET_PARAM *pCmdData %d, *replySize %d, "
+                //ALOGV("\tEqualizer_command EFFECT_CMD_GET_PARAM *pCmdData %d, *replySize %d, "
                 //       "*pReplyData %08x %08x",
                 //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)), *replySize,
                 //        *(int32_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset),
@@ -2896,12 +2896,12 @@
                 //        sizeof(int32_t)));
             }
             if(pContext->EffectType == LVM_VOLUME){
-                //LOGV("\tVolume_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
+                //ALOGV("\tVolume_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
                 if (pCmdData == NULL ||
                         cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
                         pReplyData == NULL ||
                         *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
-                    LOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
                             "EFFECT_CMD_GET_PARAM: ERROR");
                     return -EINVAL;
                 }
@@ -2920,18 +2920,18 @@
 
                 *replySize = sizeof(effect_param_t) + voffset + p->vsize;
 
-                //LOGV("\tVolume_command EFFECT_CMD_GET_PARAM "
+                //ALOGV("\tVolume_command EFFECT_CMD_GET_PARAM "
                 //        "*pCmdData %d, *replySize %d, *pReplyData %d ",
                 //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
                 //        *replySize,
                 //        *(int16_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset));
             }
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM end");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM end");
         } break;
         case EFFECT_CMD_SET_PARAM:{
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_PARAM start");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_PARAM start");
             if(pContext->EffectType == LVM_BASS_BOOST){
-                //LOGV("\tBassBoost_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d",
+                //ALOGV("\tBassBoost_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d",
                 //       *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
                 //       *replySize,
                 //       *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
@@ -2940,19 +2940,19 @@
                     cmdSize    != (int)(sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t))||
                     pReplyData == NULL||
                     *replySize != sizeof(int32_t)){
-                    LOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
                             "EFFECT_CMD_SET_PARAM: ERROR");
                     return -EINVAL;
                 }
                 effect_param_t *p = (effect_param_t *) pCmdData;
 
                 if (p->psize != sizeof(int32_t)){
-                    LOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
                             "EFFECT_CMD_SET_PARAM: ERROR, psize is not sizeof(int32_t)");
                     return -EINVAL;
                 }
 
-                //LOGV("\tnBassBoost_command cmdSize is %d\n"
+                //ALOGV("\tnBassBoost_command cmdSize is %d\n"
                 //        "\tsizeof(effect_param_t) is  %d\n"
                 //        "\tp->psize is %d\n"
                 //        "\tp->vsize is %d"
@@ -2964,7 +2964,7 @@
                                                                     p->data + p->psize);
             }
             if(pContext->EffectType == LVM_VIRTUALIZER){
-              //LOGV("\tVirtualizer_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d",
+              //ALOGV("\tVirtualizer_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d",
               //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
               //        *replySize,
               //        *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
@@ -2973,19 +2973,19 @@
                     cmdSize    != (int)(sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t))||
                     pReplyData == NULL||
                     *replySize != sizeof(int32_t)){
-                    LOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
                             "EFFECT_CMD_SET_PARAM: ERROR");
                     return -EINVAL;
                 }
                 effect_param_t *p = (effect_param_t *) pCmdData;
 
                 if (p->psize != sizeof(int32_t)){
-                    LOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
                             "EFFECT_CMD_SET_PARAM: ERROR, psize is not sizeof(int32_t)");
                     return -EINVAL;
                 }
 
-                //LOGV("\tnVirtualizer_command cmdSize is %d\n"
+                //ALOGV("\tnVirtualizer_command cmdSize is %d\n"
                 //        "\tsizeof(effect_param_t) is  %d\n"
                 //        "\tp->psize is %d\n"
                 //        "\tp->vsize is %d"
@@ -2997,16 +2997,16 @@
                                                                        p->data + p->psize);
             }
             if(pContext->EffectType == LVM_EQUALIZER){
-               //LOGV("\tEqualizer_command cmdCode Case: "
+               //ALOGV("\tEqualizer_command cmdCode Case: "
                //        "EFFECT_CMD_SET_PARAM start");
-               //LOGV("\tEqualizer_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
+               //ALOGV("\tEqualizer_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
                //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
                //        *replySize,
                //        *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
 
                 if (pCmdData == NULL || cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
                     pReplyData == NULL || *replySize != sizeof(int32_t)) {
-                    LOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
                             "EFFECT_CMD_SET_PARAM: ERROR");
                     return -EINVAL;
                 }
@@ -3017,8 +3017,8 @@
                                                                      p->data + p->psize);
             }
             if(pContext->EffectType == LVM_VOLUME){
-                //LOGV("\tVolume_command cmdCode Case: EFFECT_CMD_SET_PARAM start");
-                //LOGV("\tVolume_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
+                //ALOGV("\tVolume_command cmdCode Case: EFFECT_CMD_SET_PARAM start");
+                //ALOGV("\tVolume_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
                 //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
                 //        *replySize,
                 //        *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) +sizeof(int32_t)));
@@ -3027,7 +3027,7 @@
                         cmdSize    < (int)(sizeof(effect_param_t) + sizeof(int32_t))||
                         pReplyData == NULL||
                         *replySize != sizeof(int32_t)){
-                    LOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
+                    ALOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
                             "EFFECT_CMD_SET_PARAM: ERROR");
                     return -EINVAL;
                 }
@@ -3037,13 +3037,13 @@
                                                                  (void *)p->data,
                                                                  p->data + p->psize);
             }
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_PARAM end");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_PARAM end");
         } break;
 
         case EFFECT_CMD_ENABLE:
-            LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_ENABLE start");
+            ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_ENABLE start");
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_ENABLE: ERROR");
+                ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_ENABLE: ERROR");
                 return -EINVAL;
             }
 
@@ -3051,9 +3051,9 @@
             break;
 
         case EFFECT_CMD_DISABLE:
-            //LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_DISABLE start");
+            //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_DISABLE start");
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_DISABLE: ERROR");
+                ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_DISABLE: ERROR");
                 return -EINVAL;
             }
             *(int *)pReplyData = android::Effect_setEnabled(pContext, LVM_FALSE);
@@ -3061,36 +3061,36 @@
 
         case EFFECT_CMD_SET_DEVICE:
         {
-            LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE start");
+            ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE start");
             uint32_t device = *(uint32_t *)pCmdData;
 
             if (pContext->EffectType == LVM_BASS_BOOST) {
                 if((device == AUDIO_DEVICE_OUT_SPEAKER) ||
                         (device == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT) ||
                         (device == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER)){
-                    LOGV("\tEFFECT_CMD_SET_DEVICE device is invalid for LVM_BASS_BOOST %d",
+                    ALOGV("\tEFFECT_CMD_SET_DEVICE device is invalid for LVM_BASS_BOOST %d",
                           *(int32_t *)pCmdData);
-                    LOGV("\tEFFECT_CMD_SET_DEVICE temporary disable LVM_BAS_BOOST");
+                    ALOGV("\tEFFECT_CMD_SET_DEVICE temporary disable LVM_BAS_BOOST");
 
                     // If a device doesnt support bassboost the effect must be temporarily disabled
                     // the effect must still report its original state as this can only be changed
                     // by the ENABLE/DISABLE command
 
                     if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
-                        LOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_BASS_BOOST %d",
+                        ALOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_BASS_BOOST %d",
                              *(int32_t *)pCmdData);
                         android::LvmEffect_disable(pContext);
                     }
                     pContext->pBundledContext->bBassTempDisabled = LVM_TRUE;
                 } else {
-                    LOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_BASS_BOOST %d",
+                    ALOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_BASS_BOOST %d",
                          *(int32_t *)pCmdData);
 
                     // If a device supports bassboost and the effect has been temporarily disabled
                     // previously then re-enable it
 
                     if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
-                        LOGV("\tEFFECT_CMD_SET_DEVICE re-enable LVM_BASS_BOOST %d",
+                        ALOGV("\tEFFECT_CMD_SET_DEVICE re-enable LVM_BASS_BOOST %d",
                              *(int32_t *)pCmdData);
                         android::LvmEffect_enable(pContext);
                     }
@@ -3101,36 +3101,36 @@
                 if((device == AUDIO_DEVICE_OUT_SPEAKER)||
                         (device == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT)||
                         (device == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER)){
-                    LOGV("\tEFFECT_CMD_SET_DEVICE device is invalid for LVM_VIRTUALIZER %d",
+                    ALOGV("\tEFFECT_CMD_SET_DEVICE device is invalid for LVM_VIRTUALIZER %d",
                           *(int32_t *)pCmdData);
-                    LOGV("\tEFFECT_CMD_SET_DEVICE temporary disable LVM_VIRTUALIZER");
+                    ALOGV("\tEFFECT_CMD_SET_DEVICE temporary disable LVM_VIRTUALIZER");
 
                     //If a device doesnt support virtualizer the effect must be temporarily disabled
                     // the effect must still report its original state as this can only be changed
                     // by the ENABLE/DISABLE command
 
                     if (pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE) {
-                        LOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_VIRTUALIZER %d",
+                        ALOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_VIRTUALIZER %d",
                               *(int32_t *)pCmdData);
                         android::LvmEffect_disable(pContext);
                     }
                     pContext->pBundledContext->bVirtualizerTempDisabled = LVM_TRUE;
                 } else {
-                    LOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_VIRTUALIZER %d",
+                    ALOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_VIRTUALIZER %d",
                           *(int32_t *)pCmdData);
 
                     // If a device supports virtualizer and the effect has been temporarily disabled
                     // previously then re-enable it
 
                     if(pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE){
-                        LOGV("\tEFFECT_CMD_SET_DEVICE re-enable LVM_VIRTUALIZER %d",
+                        ALOGV("\tEFFECT_CMD_SET_DEVICE re-enable LVM_VIRTUALIZER %d",
                               *(int32_t *)pCmdData);
                         android::LvmEffect_enable(pContext);
                     }
                     pContext->pBundledContext->bVirtualizerTempDisabled = LVM_FALSE;
                 }
             }
-            LOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE end");
+            ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE end");
             break;
         }
         case EFFECT_CMD_SET_VOLUME:
@@ -3150,7 +3150,7 @@
 
             if (pCmdData == NULL ||
                 cmdSize != 2 * sizeof(uint32_t)) {
-                LOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
                         "EFFECT_CMD_SET_VOLUME: ERROR");
                 return -EINVAL;
             }
@@ -3176,12 +3176,12 @@
             if(rightdB > maxdB){
                 maxdB = rightdB;
             }
-            //LOGV("\tEFFECT_CMD_SET_VOLUME Session: %d, SessionID: %d VOLUME is %d dB (%d), "
+            //ALOGV("\tEFFECT_CMD_SET_VOLUME Session: %d, SessionID: %d VOLUME is %d dB (%d), "
             //      "effect is %d",
             //pContext->pBundledContext->SessionNo, pContext->pBundledContext->SessionId,
             //(int32_t)maxdB, maxVol<<7, pContext->EffectType);
-            //LOGV("\tEFFECT_CMD_SET_VOLUME: Left is %d, Right is %d", leftVolume, rightVolume);
-            //LOGV("\tEFFECT_CMD_SET_VOLUME: Left %ddB, Right %ddB, Position %ddB",
+            //ALOGV("\tEFFECT_CMD_SET_VOLUME: Left is %d, Right is %d", leftVolume, rightVolume);
+            //ALOGV("\tEFFECT_CMD_SET_VOLUME: Left %ddB, Right %ddB, Position %ddB",
             //        leftdB, rightdB, pandB);
 
             memcpy(pReplyData, vol_ret, sizeof(int32_t)*2);
@@ -3194,7 +3194,7 @@
 
             /* Volume parameters */
             ActiveParams.VC_Balance  = pandB;
-            LOGV("\t\tVolumeSetStereoPosition() (-96dB -> +96dB)-> %d\n", ActiveParams.VC_Balance );
+            ALOGV("\t\tVolumeSetStereoPosition() (-96dB -> +96dB)-> %d\n", ActiveParams.VC_Balance );
 
             /* Activate the initial settings */
             LvmStatus =LVM_SetControlParameters(pContext->pBundledContext->hInstance,&ActiveParams);
@@ -3208,7 +3208,7 @@
             return -EINVAL;
     }
 
-    //LOGV("\tEffect_command end...\n\n");
+    //ALOGV("\tEffect_command end...\n\n");
     return 0;
 }    /* end Effect_command */
 
@@ -3220,7 +3220,7 @@
     const effect_descriptor_t *desc;
 
     if (pContext == NULL || pDescriptor == NULL) {
-        LOGV("Effect_getDescriptor() invalid param");
+        ALOGV("Effect_getDescriptor() invalid param");
         return -EINVAL;
     }
 
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 663f8ff..1825aab 100755
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -32,15 +32,15 @@
 
 #define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc){\
         if (LvmStatus == LVREV_NULLADDRESS){\
-            LOGV("\tLVREV_ERROR : Parameter error - "\
+            ALOGV("\tLVREV_ERROR : Parameter error - "\
                     "null pointer returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
         if (LvmStatus == LVREV_INVALIDNUMSAMPLES){\
-            LOGV("\tLVREV_ERROR : Parameter error - "\
+            ALOGV("\tLVREV_ERROR : Parameter error - "\
                     "bad number of samples returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
         if (LvmStatus == LVREV_OUTOFRANGE){\
-            LOGV("\tLVREV_ERROR : Parameter error - "\
+            ALOGV("\tLVREV_ERROR : Parameter error - "\
                     "out of range returned by %s in %s\n", callingFunc, calledFunc);\
         }\
     }
@@ -185,27 +185,27 @@
 
 /* Effect Library Interface Implementation */
 extern "C" int EffectQueryNumberEffects(uint32_t *pNumEffects){
-    LOGV("\n\tEffectQueryNumberEffects start");
+    ALOGV("\n\tEffectQueryNumberEffects start");
     *pNumEffects = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
-    LOGV("\tEffectQueryNumberEffects creating %d effects", *pNumEffects);
-    LOGV("\tEffectQueryNumberEffects end\n");
+    ALOGV("\tEffectQueryNumberEffects creating %d effects", *pNumEffects);
+    ALOGV("\tEffectQueryNumberEffects end\n");
     return 0;
 }     /* end EffectQueryNumberEffects */
 
 extern "C" int EffectQueryEffect(uint32_t index,
                                  effect_descriptor_t *pDescriptor){
-    LOGV("\n\tEffectQueryEffect start");
-    LOGV("\tEffectQueryEffect processing index %d", index);
+    ALOGV("\n\tEffectQueryEffect start");
+    ALOGV("\tEffectQueryEffect processing index %d", index);
     if (pDescriptor == NULL){
-        LOGV("\tLVM_ERROR : EffectQueryEffect was passed NULL pointer");
+        ALOGV("\tLVM_ERROR : EffectQueryEffect was passed NULL pointer");
         return -EINVAL;
     }
     if (index >= sizeof(gDescriptors) / sizeof(const effect_descriptor_t *)) {
-        LOGV("\tLVM_ERROR : EffectQueryEffect index out of range %d", index);
+        ALOGV("\tLVM_ERROR : EffectQueryEffect index out of range %d", index);
         return -ENOENT;
     }
     memcpy(pDescriptor, gDescriptors[index], sizeof(effect_descriptor_t));
-    LOGV("\tEffectQueryEffect end\n");
+    ALOGV("\tEffectQueryEffect end\n");
     return 0;
 }     /* end EffectQueryEffect */
 
@@ -218,10 +218,10 @@
     int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
     const effect_descriptor_t *desc;
 
-    LOGV("\t\nEffectCreate start");
+    ALOGV("\t\nEffectCreate start");
 
     if (pHandle == NULL || uuid == NULL){
-        LOGV("\tLVM_ERROR : EffectCreate() called with NULL pointer");
+        ALOGV("\tLVM_ERROR : EffectCreate() called with NULL pointer");
         return -EINVAL;
     }
 
@@ -229,7 +229,7 @@
         desc = gDescriptors[i];
         if (memcmp(uuid, &desc->uuid, sizeof(effect_uuid_t))
                 == 0) {
-            LOGV("\tEffectCreate - UUID matched Reverb type %d, UUID = %x", i, desc->uuid.timeLow);
+            ALOGV("\tEffectCreate - UUID matched Reverb type %d, UUID = %x", i, desc->uuid.timeLow);
             break;
         }
     }
@@ -246,9 +246,9 @@
     pContext->auxiliary = false;
     if ((desc->flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_AUXILIARY){
         pContext->auxiliary = true;
-        LOGV("\tEffectCreate - AUX");
+        ALOGV("\tEffectCreate - AUX");
     }else{
-        LOGV("\tEffectCreate - INS");
+        ALOGV("\tEffectCreate - INS");
     }
 
     pContext->preset = false;
@@ -257,16 +257,16 @@
         // force reloading preset at first call to process()
         pContext->curPreset = REVERB_PRESET_LAST + 1;
         pContext->nextPreset = REVERB_DEFAULT_PRESET;
-        LOGV("\tEffectCreate - PRESET");
+        ALOGV("\tEffectCreate - PRESET");
     }else{
-        LOGV("\tEffectCreate - ENVIRONMENTAL");
+        ALOGV("\tEffectCreate - ENVIRONMENTAL");
     }
 
-    LOGV("\tEffectCreate - Calling Reverb_init");
+    ALOGV("\tEffectCreate - Calling Reverb_init");
     ret = Reverb_init(pContext);
 
     if (ret < 0){
-        LOGV("\tLVM_ERROR : EffectCreate() init failed");
+        ALOGV("\tLVM_ERROR : EffectCreate() init failed");
         delete pContext;
         return ret;
     }
@@ -291,17 +291,17 @@
     pContext->InFrames32  = (LVM_INT32 *)malloc(LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2);
     pContext->OutFrames32 = (LVM_INT32 *)malloc(LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2);
 
-    LOGV("\tEffectCreate %p, size %d", pContext, sizeof(ReverbContext));
-    LOGV("\tEffectCreate end\n");
+    ALOGV("\tEffectCreate %p, size %d", pContext, sizeof(ReverbContext));
+    ALOGV("\tEffectCreate end\n");
     return 0;
 } /* end EffectCreate */
 
 extern "C" int EffectRelease(effect_handle_t handle){
     ReverbContext * pContext = (ReverbContext *)handle;
 
-    LOGV("\tEffectRelease %p", handle);
+    ALOGV("\tEffectRelease %p", handle);
     if (pContext == NULL){
-        LOGV("\tLVM_ERROR : EffectRelease called with NULL pointer");
+        ALOGV("\tLVM_ERROR : EffectRelease called with NULL pointer");
         return -EINVAL;
     }
 
@@ -322,14 +322,14 @@
     int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
 
     if (pDescriptor == NULL || uuid == NULL){
-        LOGV("EffectGetDescriptor() called with NULL pointer");
+        ALOGV("EffectGetDescriptor() called with NULL pointer");
         return -EINVAL;
     }
 
     for (i = 0; i < length; i++) {
         if (memcmp(uuid, &gDescriptors[i]->uuid, sizeof(effect_uuid_t)) == 0) {
             memcpy(pDescriptor, gDescriptors[i], sizeof(effect_descriptor_t));
-            LOGV("EffectGetDescriptor - UUID matched Reverb type %d, UUID = %x",
+            ALOGV("EffectGetDescriptor - UUID matched Reverb type %d, UUID = %x",
                  i, gDescriptors[i]->uuid.timeLow);
             return 0;
         }
@@ -341,7 +341,7 @@
 /* local functions */
 #define CHECK_ARG(cond) {                     \
     if (!(cond)) {                            \
-        LOGV("\tLVM_ERROR : Invalid argument: "#cond);      \
+        ALOGV("\tLVM_ERROR : Invalid argument: "#cond);      \
         return -EINVAL;                       \
     }                                         \
 }
@@ -444,7 +444,7 @@
     if (pContext->config.inputCfg.channels == AUDIO_CHANNEL_OUT_STEREO) {
         samplesPerFrame = 2;
     } else if (pContext->config.inputCfg.channels != AUDIO_CHANNEL_OUT_MONO) {
-        LOGV("\tLVREV_ERROR : process invalid PCM format");
+        ALOGV("\tLVREV_ERROR : process invalid PCM format");
         return -EINVAL;
     }
 
@@ -452,7 +452,7 @@
 
     // Check for NULL pointers
     if((pContext->InFrames32 == NULL)||(pContext->OutFrames32 == NULL)){
-        LOGV("\tLVREV_ERROR : process failed to allocate memory for temporary buffers ");
+        ALOGV("\tLVREV_ERROR : process failed to allocate memory for temporary buffers ");
         return -EINVAL;
     }
 
@@ -485,7 +485,7 @@
     } else {
         if(pContext->bEnabled == LVM_FALSE && pContext->SamplesToExitCount > 0) {
             memset(pContext->InFrames32,0,frameCount * sizeof(LVM_INT32) * samplesPerFrame);
-            LOGV("\tZeroing %d samples per frame at the end of call", samplesPerFrame);
+            ALOGV("\tZeroing %d samples per frame at the end of call", samplesPerFrame);
         }
 
         /* Process the samples, producing a stereo output */
@@ -552,12 +552,12 @@
 
     // Accumulate if required
     if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
-        //LOGV("\tBuffer access is ACCUMULATE");
+        //ALOGV("\tBuffer access is ACCUMULATE");
         for (int i=0; i<frameCount*2; i++){ //always stereo here
             pOut[i] = clamp16((int32_t)pOut[i] + (int32_t)OutFrames16[i]);
         }
     }else{
-        //LOGV("\tBuffer access is WRITE");
+        //ALOGV("\tBuffer access is WRITE");
         memcpy(pOut, OutFrames16, frameCount*sizeof(LVM_INT16)*2);
     }
 
@@ -592,15 +592,15 @@
     for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
         if (MemTab.Region[i].Size != 0){
             if (MemTab.Region[i].pBaseAddress != NULL){
-                LOGV("\tfree() - START freeing %ld bytes for region %u at %p\n",
+                ALOGV("\tfree() - START freeing %ld bytes for region %u at %p\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
 
                 free(MemTab.Region[i].pBaseAddress);
 
-                LOGV("\tfree() - END   freeing %ld bytes for region %u at %p\n",
+                ALOGV("\tfree() - END   freeing %ld bytes for region %u at %p\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
             }else{
-                LOGV("\tLVM_ERROR : free() - trying to free with NULL pointer %ld bytes "
+                ALOGV("\tLVM_ERROR : free() - trying to free with NULL pointer %ld bytes "
                         "for region %u at %p ERROR\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
             }
@@ -624,7 +624,7 @@
 
 int Reverb_configure(ReverbContext *pContext, effect_config_t *pConfig){
     LVM_Fs_en   SampleRate;
-    //LOGV("\tReverb_configure start");
+    //ALOGV("\tReverb_configure start");
 
     CHECK_ARG(pContext != NULL);
     CHECK_ARG(pConfig != NULL);
@@ -642,7 +642,7 @@
         return -EINVAL;
     }
 
-    //LOGV("\tReverb_configure calling memcpy");
+    //ALOGV("\tReverb_configure calling memcpy");
     memcpy(&pContext->config, pConfig, sizeof(effect_config_t));
 
 
@@ -666,7 +666,7 @@
         SampleRate = LVM_FS_48000;
         break;
     default:
-        LOGV("\rReverb_Configure invalid sampling rate %d", pConfig->inputCfg.samplingRate);
+        ALOGV("\rReverb_Configure invalid sampling rate %d", pConfig->inputCfg.samplingRate);
         return -EINVAL;
     }
 
@@ -675,7 +675,7 @@
         LVREV_ControlParams_st    ActiveParams;
         LVREV_ReturnStatus_en     LvmStatus = LVREV_SUCCESS;
 
-        //LOGV("\tReverb_configure change sampling rate to %d", SampleRate);
+        //ALOGV("\tReverb_configure change sampling rate to %d", SampleRate);
 
         /* Get the current settings */
         LvmStatus = LVREV_GetControlParameters(pContext->hInstance,
@@ -687,13 +687,13 @@
         LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
 
         LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "Reverb_configure")
-        //LOGV("\tReverb_configure Succesfully called LVREV_SetControlParameters\n");
+        //ALOGV("\tReverb_configure Succesfully called LVREV_SetControlParameters\n");
 
     }else{
-        //LOGV("\tReverb_configure keep sampling rate at %d", SampleRate);
+        //ALOGV("\tReverb_configure keep sampling rate at %d", SampleRate);
     }
 
-    //LOGV("\tReverb_configure End");
+    //ALOGV("\tReverb_configure End");
     return 0;
 }   /* end Reverb_configure */
 
@@ -713,7 +713,7 @@
 int Reverb_init(ReverbContext *pContext){
     int status;
 
-    LOGV("\tReverb_init start");
+    ALOGV("\tReverb_init start");
 
     CHECK_ARG(pContext != NULL);
 
@@ -768,7 +768,7 @@
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetMemoryTable", "Reverb_init")
     if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
 
-    LOGV("\tCreateInstance Succesfully called LVM_GetMemoryTable\n");
+    ALOGV("\tCreateInstance Succesfully called LVM_GetMemoryTable\n");
 
     /* Allocate memory */
     for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
@@ -776,11 +776,11 @@
             MemTab.Region[i].pBaseAddress = malloc(MemTab.Region[i].Size);
 
             if (MemTab.Region[i].pBaseAddress == LVM_NULL){
-                LOGV("\tLVREV_ERROR :Reverb_init CreateInstance Failed to allocate %ld "
+                ALOGV("\tLVREV_ERROR :Reverb_init CreateInstance Failed to allocate %ld "
                         "bytes for region %u\n", MemTab.Region[i].Size, i );
                 bMallocFailure = LVM_TRUE;
             }else{
-                LOGV("\tReverb_init CreateInstance allocate %ld bytes for region %u at %p\n",
+                ALOGV("\tReverb_init CreateInstance allocate %ld bytes for region %u at %p\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
             }
         }
@@ -792,10 +792,10 @@
     if(bMallocFailure == LVM_TRUE){
         for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
             if (MemTab.Region[i].pBaseAddress == LVM_NULL){
-                LOGV("\tLVM_ERROR :Reverb_init CreateInstance Failed to allocate %ld bytes "
+                ALOGV("\tLVM_ERROR :Reverb_init CreateInstance Failed to allocate %ld bytes "
                         "for region %u - Not freeing\n", MemTab.Region[i].Size, i );
             }else{
-                LOGV("\tLVM_ERROR :Reverb_init CreateInstance Failed: but allocated %ld bytes "
+                ALOGV("\tLVM_ERROR :Reverb_init CreateInstance Failed: but allocated %ld bytes "
                         "for region %u at %p- free\n",
                         MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
                 free(MemTab.Region[i].pBaseAddress);
@@ -803,7 +803,7 @@
         }
         return -EINVAL;
     }
-    LOGV("\tReverb_init CreateInstance Succesfully malloc'd memory\n");
+    ALOGV("\tReverb_init CreateInstance Succesfully malloc'd memory\n");
 
     /* Initialise */
     pContext->hInstance = LVM_NULL;
@@ -816,7 +816,7 @@
     LVM_ERROR_CHECK(LvmStatus, "LVM_GetInstanceHandle", "Reverb_init")
     if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
 
-    LOGV("\tReverb_init CreateInstance Succesfully called LVM_GetInstanceHandle\n");
+    ALOGV("\tReverb_init CreateInstance Succesfully called LVM_GetInstanceHandle\n");
 
     /* Set the initial process parameters */
     /* General parameters */
@@ -860,8 +860,8 @@
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "Reverb_init")
     if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
 
-    LOGV("\tReverb_init CreateInstance Succesfully called LVREV_SetControlParameters\n");
-    LOGV("\tReverb_init End");
+    ALOGV("\tReverb_init CreateInstance Succesfully called LVREV_SetControlParameters\n");
+    ALOGV("\tReverb_init End");
     return 0;
 }   /* end Reverb_init */
 
@@ -960,7 +960,7 @@
 //----------------------------------------------------------------------------
 
 void ReverbSetRoomHfLevel(ReverbContext *pContext, int16_t level){
-    //LOGV("\tReverbSetRoomHfLevel start (%d)", level);
+    //ALOGV("\tReverbSetRoomHfLevel start (%d)", level);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -968,17 +968,17 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetRoomHfLevel")
-    //LOGV("\tReverbSetRoomHfLevel Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbSetRoomHfLevel() just Got -> %d\n", ActiveParams.LPF);
+    //ALOGV("\tReverbSetRoomHfLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbSetRoomHfLevel() just Got -> %d\n", ActiveParams.LPF);
 
     ActiveParams.LPF = ReverbConvertHfLevel(level);
 
     /* Activate the initial settings */
     LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetRoomHfLevel")
-    //LOGV("\tReverbSetRoomhfLevel() just Set -> %d\n", ActiveParams.LPF);
+    //ALOGV("\tReverbSetRoomhfLevel() just Set -> %d\n", ActiveParams.LPF);
     pContext->SavedHfLevel = level;
-    //LOGV("\tReverbSetHfRoomLevel end.. saving %d", pContext->SavedHfLevel);
+    //ALOGV("\tReverbSetHfRoomLevel end.. saving %d", pContext->SavedHfLevel);
     return;
 }
 
@@ -995,7 +995,7 @@
 
 int16_t ReverbGetRoomHfLevel(ReverbContext *pContext){
     int16_t level;
-    //LOGV("\tReverbGetRoomHfLevel start, saved level is %d", pContext->SavedHfLevel);
+    //ALOGV("\tReverbGetRoomHfLevel start, saved level is %d", pContext->SavedHfLevel);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1003,20 +1003,20 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetRoomHfLevel")
-    //LOGV("\tReverbGetRoomHfLevel Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbGetRoomHfLevel() just Got -> %d\n", ActiveParams.LPF);
+    //ALOGV("\tReverbGetRoomHfLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbGetRoomHfLevel() just Got -> %d\n", ActiveParams.LPF);
 
     level = ReverbConvertHfLevel(pContext->SavedHfLevel);
 
-    //LOGV("\tReverbGetRoomHfLevel() ActiveParams.LPFL %d, pContext->SavedHfLevel: %d, "
+    //ALOGV("\tReverbGetRoomHfLevel() ActiveParams.LPFL %d, pContext->SavedHfLevel: %d, "
     //     "converted level: %d\n", ActiveParams.LPF, pContext->SavedHfLevel, level);
 
     if(ActiveParams.LPF != level){
-        LOGV("\tLVM_ERROR : (ignore at start up) ReverbGetRoomHfLevel() has wrong level -> %d %d\n",
+        ALOGV("\tLVM_ERROR : (ignore at start up) ReverbGetRoomHfLevel() has wrong level -> %d %d\n",
                ActiveParams.Level, level);
     }
 
-    //LOGV("\tReverbGetRoomHfLevel end");
+    //ALOGV("\tReverbGetRoomHfLevel end");
     return pContext->SavedHfLevel;
 }
 
@@ -1033,7 +1033,7 @@
 //----------------------------------------------------------------------------
 
 void ReverbSetReverbLevel(ReverbContext *pContext, int16_t level){
-    //LOGV("\n\tReverbSetReverbLevel start (%d)", level);
+    //ALOGV("\n\tReverbSetReverbLevel start (%d)", level);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1042,25 +1042,25 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetReverbLevel")
-    //LOGV("\tReverbSetReverbLevel Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbSetReverbLevel just Got -> %d\n", ActiveParams.Level);
+    //ALOGV("\tReverbSetReverbLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbSetReverbLevel just Got -> %d\n", ActiveParams.Level);
 
     // needs to subtract max levels for both RoomLevel and ReverbLevel
     CombinedLevel = (level + pContext->SavedRoomLevel)-LVREV_MAX_REVERB_LEVEL;
-    //LOGV("\tReverbSetReverbLevel() CombinedLevel is %d = %d + %d\n",
+    //ALOGV("\tReverbSetReverbLevel() CombinedLevel is %d = %d + %d\n",
     //      CombinedLevel, level, pContext->SavedRoomLevel);
 
     ActiveParams.Level = ReverbConvertLevel(CombinedLevel);
 
-    //LOGV("\tReverbSetReverbLevel() Trying to set -> %d\n", ActiveParams.Level);
+    //ALOGV("\tReverbSetReverbLevel() Trying to set -> %d\n", ActiveParams.Level);
 
     /* Activate the initial settings */
     LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetReverbLevel")
-    //LOGV("\tReverbSetReverbLevel() just Set -> %d\n", ActiveParams.Level);
+    //ALOGV("\tReverbSetReverbLevel() just Set -> %d\n", ActiveParams.Level);
 
     pContext->SavedReverbLevel = level;
-    //LOGV("\tReverbSetReverbLevel end pContext->SavedReverbLevel is %d\n\n",
+    //ALOGV("\tReverbSetReverbLevel end pContext->SavedReverbLevel is %d\n\n",
     //     pContext->SavedReverbLevel);
     return;
 }
@@ -1078,7 +1078,7 @@
 
 int16_t ReverbGetReverbLevel(ReverbContext *pContext){
     int16_t level;
-    //LOGV("\tReverbGetReverbLevel start");
+    //ALOGV("\tReverbGetReverbLevel start");
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1087,26 +1087,26 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetReverbLevel")
-    //LOGV("\tReverbGetReverbLevel Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbGetReverbLevel() just Got -> %d\n", ActiveParams.Level);
+    //ALOGV("\tReverbGetReverbLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbGetReverbLevel() just Got -> %d\n", ActiveParams.Level);
 
     // needs to subtract max levels for both RoomLevel and ReverbLevel
     CombinedLevel = (pContext->SavedReverbLevel + pContext->SavedRoomLevel)-LVREV_MAX_REVERB_LEVEL;
 
-    //LOGV("\tReverbGetReverbLevel() CombinedLevel is %d = %d + %d\n",
+    //ALOGV("\tReverbGetReverbLevel() CombinedLevel is %d = %d + %d\n",
     //CombinedLevel, pContext->SavedReverbLevel, pContext->SavedRoomLevel);
     level = ReverbConvertLevel(CombinedLevel);
 
-    //LOGV("\tReverbGetReverbLevel(): ActiveParams.Level: %d, pContext->SavedReverbLevel: %d, "
+    //ALOGV("\tReverbGetReverbLevel(): ActiveParams.Level: %d, pContext->SavedReverbLevel: %d, "
     //"pContext->SavedRoomLevel: %d, CombinedLevel: %d, converted level: %d\n",
     //ActiveParams.Level, pContext->SavedReverbLevel,pContext->SavedRoomLevel, CombinedLevel,level);
 
     if(ActiveParams.Level != level){
-        LOGV("\tLVM_ERROR : (ignore at start up) ReverbGetReverbLevel() has wrong level -> %d %d\n",
+        ALOGV("\tLVM_ERROR : (ignore at start up) ReverbGetReverbLevel() has wrong level -> %d %d\n",
                 ActiveParams.Level, level);
     }
 
-    //LOGV("\tReverbGetReverbLevel end\n");
+    //ALOGV("\tReverbGetReverbLevel end\n");
 
     return pContext->SavedReverbLevel;
 }
@@ -1124,7 +1124,7 @@
 //----------------------------------------------------------------------------
 
 void ReverbSetRoomLevel(ReverbContext *pContext, int16_t level){
-    //LOGV("\tReverbSetRoomLevel start (%d)", level);
+    //ALOGV("\tReverbSetRoomLevel start (%d)", level);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1133,8 +1133,8 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetRoomLevel")
-    //LOGV("\tReverbSetRoomLevel Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbSetRoomLevel() just Got -> %d\n", ActiveParams.Level);
+    //ALOGV("\tReverbSetRoomLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbSetRoomLevel() just Got -> %d\n", ActiveParams.Level);
 
     // needs to subtract max levels for both RoomLevel and ReverbLevel
     CombinedLevel = (level + pContext->SavedReverbLevel)-LVREV_MAX_REVERB_LEVEL;
@@ -1143,10 +1143,10 @@
     /* Activate the initial settings */
     LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetRoomLevel")
-    //LOGV("\tReverbSetRoomLevel() just Set -> %d\n", ActiveParams.Level);
+    //ALOGV("\tReverbSetRoomLevel() just Set -> %d\n", ActiveParams.Level);
 
     pContext->SavedRoomLevel = level;
-    //LOGV("\tReverbSetRoomLevel end");
+    //ALOGV("\tReverbSetRoomLevel end");
     return;
 }
 
@@ -1163,7 +1163,7 @@
 
 int16_t ReverbGetRoomLevel(ReverbContext *pContext){
     int16_t level;
-    //LOGV("\tReverbGetRoomLevel start");
+    //ALOGV("\tReverbGetRoomLevel start");
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1172,24 +1172,24 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetRoomLevel")
-    //LOGV("\tReverbGetRoomLevel Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbGetRoomLevel() just Got -> %d\n", ActiveParams.Level);
+    //ALOGV("\tReverbGetRoomLevel Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbGetRoomLevel() just Got -> %d\n", ActiveParams.Level);
 
     // needs to subtract max levels for both RoomLevel and ReverbLevel
     CombinedLevel = (pContext->SavedRoomLevel + pContext->SavedReverbLevel-LVREV_MAX_REVERB_LEVEL);
     level = ReverbConvertLevel(CombinedLevel);
 
-    //LOGV("\tReverbGetRoomLevel, Level = %d, pContext->SavedRoomLevel = %d, "
+    //ALOGV("\tReverbGetRoomLevel, Level = %d, pContext->SavedRoomLevel = %d, "
     //     "pContext->SavedReverbLevel = %d, CombinedLevel = %d, level = %d",
     //     ActiveParams.Level, pContext->SavedRoomLevel,
     //     pContext->SavedReverbLevel, CombinedLevel, level);
 
     if(ActiveParams.Level != level){
-        LOGV("\tLVM_ERROR : (ignore at start up) ReverbGetRoomLevel() has wrong level -> %d %d\n",
+        ALOGV("\tLVM_ERROR : (ignore at start up) ReverbGetRoomLevel() has wrong level -> %d %d\n",
               ActiveParams.Level, level);
     }
 
-    //LOGV("\tReverbGetRoomLevel end");
+    //ALOGV("\tReverbGetRoomLevel end");
     return pContext->SavedRoomLevel;
 }
 
@@ -1206,7 +1206,7 @@
 //----------------------------------------------------------------------------
 
 void ReverbSetDecayTime(ReverbContext *pContext, uint32_t time){
-    //LOGV("\tReverbSetDecayTime start (%d)", time);
+    //ALOGV("\tReverbSetDecayTime start (%d)", time);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1214,8 +1214,8 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetDecayTime")
-    //LOGV("\tReverbSetDecayTime Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbSetDecayTime() just Got -> %d\n", ActiveParams.T60);
+    //ALOGV("\tReverbSetDecayTime Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbSetDecayTime() just Got -> %d\n", ActiveParams.T60);
 
     if (time <= LVREV_MAX_T60) {
         ActiveParams.T60 = (LVM_UINT16)time;
@@ -1227,12 +1227,12 @@
     /* Activate the initial settings */
     LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetDecayTime")
-    //LOGV("\tReverbSetDecayTime() just Set -> %d\n", ActiveParams.T60);
+    //ALOGV("\tReverbSetDecayTime() just Set -> %d\n", ActiveParams.T60);
 
     pContext->SamplesToExitCount = (ActiveParams.T60 * pContext->config.inputCfg.samplingRate)/1000;
-    //LOGV("\tReverbSetDecayTime() just Set SamplesToExitCount-> %d\n",pContext->SamplesToExitCount);
+    //ALOGV("\tReverbSetDecayTime() just Set SamplesToExitCount-> %d\n",pContext->SamplesToExitCount);
     pContext->SavedDecayTime = (int16_t)time;
-    //LOGV("\tReverbSetDecayTime end");
+    //ALOGV("\tReverbSetDecayTime end");
     return;
 }
 
@@ -1248,7 +1248,7 @@
 //----------------------------------------------------------------------------
 
 uint32_t ReverbGetDecayTime(ReverbContext *pContext){
-    //LOGV("\tReverbGetDecayTime start");
+    //ALOGV("\tReverbGetDecayTime start");
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1256,16 +1256,16 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetDecayTime")
-    //LOGV("\tReverbGetDecayTime Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbGetDecayTime() just Got -> %d\n", ActiveParams.T60);
+    //ALOGV("\tReverbGetDecayTime Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbGetDecayTime() just Got -> %d\n", ActiveParams.T60);
 
     if(ActiveParams.T60 != pContext->SavedDecayTime){
         // This will fail if the decay time is set to more than 7000
-        LOGV("\tLVM_ERROR : ReverbGetDecayTime() has wrong level -> %d %d\n",
+        ALOGV("\tLVM_ERROR : ReverbGetDecayTime() has wrong level -> %d %d\n",
          ActiveParams.T60, pContext->SavedDecayTime);
     }
 
-    //LOGV("\tReverbGetDecayTime end");
+    //ALOGV("\tReverbGetDecayTime end");
     return (uint32_t)ActiveParams.T60;
 }
 
@@ -1282,7 +1282,7 @@
 //----------------------------------------------------------------------------
 
 void ReverbSetDecayHfRatio(ReverbContext *pContext, int16_t ratio){
-    //LOGV("\tReverbSetDecayHfRatioe start (%d)", ratio);
+    //ALOGV("\tReverbSetDecayHfRatioe start (%d)", ratio);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;   /* Function call status */
@@ -1290,18 +1290,18 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetDecayHfRatio")
-    //LOGV("\tReverbSetDecayHfRatio Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbSetDecayHfRatio() just Got -> %d\n", ActiveParams.Damping);
+    //ALOGV("\tReverbSetDecayHfRatio Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbSetDecayHfRatio() just Got -> %d\n", ActiveParams.Damping);
 
     ActiveParams.Damping = (LVM_INT16)(ratio/20);
 
     /* Activate the initial settings */
     LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetDecayHfRatio")
-    //LOGV("\tReverbSetDecayHfRatio() just Set -> %d\n", ActiveParams.Damping);
+    //ALOGV("\tReverbSetDecayHfRatio() just Set -> %d\n", ActiveParams.Damping);
 
     pContext->SavedDecayHfRatio = ratio;
-    //LOGV("\tReverbSetDecayHfRatio end");
+    //ALOGV("\tReverbSetDecayHfRatio end");
     return;
 }
 
@@ -1317,7 +1317,7 @@
 //----------------------------------------------------------------------------
 
 int32_t ReverbGetDecayHfRatio(ReverbContext *pContext){
-    //LOGV("\tReverbGetDecayHfRatio start");
+    //ALOGV("\tReverbGetDecayHfRatio start");
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;   /* Function call status */
@@ -1325,15 +1325,15 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetDecayHfRatio")
-    //LOGV("\tReverbGetDecayHfRatio Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbGetDecayHfRatio() just Got -> %d\n", ActiveParams.Damping);
+    //ALOGV("\tReverbGetDecayHfRatio Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbGetDecayHfRatio() just Got -> %d\n", ActiveParams.Damping);
 
     if(ActiveParams.Damping != (LVM_INT16)(pContext->SavedDecayHfRatio / 20)){
-        LOGV("\tLVM_ERROR : ReverbGetDecayHfRatio() has wrong level -> %d %d\n",
+        ALOGV("\tLVM_ERROR : ReverbGetDecayHfRatio() has wrong level -> %d %d\n",
          ActiveParams.Damping, pContext->SavedDecayHfRatio);
     }
 
-    //LOGV("\tReverbGetDecayHfRatio end");
+    //ALOGV("\tReverbGetDecayHfRatio end");
     return pContext->SavedDecayHfRatio;
 }
 
@@ -1350,7 +1350,7 @@
 //----------------------------------------------------------------------------
 
 void ReverbSetDiffusion(ReverbContext *pContext, int16_t level){
-    //LOGV("\tReverbSetDiffusion start (%d)", level);
+    //ALOGV("\tReverbSetDiffusion start (%d)", level);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1358,18 +1358,18 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetDiffusion")
-    //LOGV("\tReverbSetDiffusion Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbSetDiffusion() just Got -> %d\n", ActiveParams.Density);
+    //ALOGV("\tReverbSetDiffusion Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbSetDiffusion() just Got -> %d\n", ActiveParams.Density);
 
     ActiveParams.Density = (LVM_INT16)(level/10);
 
     /* Activate the initial settings */
     LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetDiffusion")
-    //LOGV("\tReverbSetDiffusion() just Set -> %d\n", ActiveParams.Density);
+    //ALOGV("\tReverbSetDiffusion() just Set -> %d\n", ActiveParams.Density);
 
     pContext->SavedDiffusion = level;
-    //LOGV("\tReverbSetDiffusion end");
+    //ALOGV("\tReverbSetDiffusion end");
     return;
 }
 
@@ -1385,7 +1385,7 @@
 //----------------------------------------------------------------------------
 
 int32_t ReverbGetDiffusion(ReverbContext *pContext){
-    //LOGV("\tReverbGetDiffusion start");
+    //ALOGV("\tReverbGetDiffusion start");
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1394,16 +1394,16 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetDiffusion")
-    //LOGV("\tReverbGetDiffusion Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbGetDiffusion just Got -> %d\n", ActiveParams.Density);
+    //ALOGV("\tReverbGetDiffusion Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbGetDiffusion just Got -> %d\n", ActiveParams.Density);
 
     Temp = (LVM_INT16)(pContext->SavedDiffusion/10);
 
     if(ActiveParams.Density != Temp){
-        LOGV("\tLVM_ERROR : ReverbGetDiffusion invalid value %d %d", Temp, ActiveParams.Density);
+        ALOGV("\tLVM_ERROR : ReverbGetDiffusion invalid value %d %d", Temp, ActiveParams.Density);
     }
 
-    //LOGV("\tReverbGetDiffusion end");
+    //ALOGV("\tReverbGetDiffusion end");
     return pContext->SavedDiffusion;
 }
 
@@ -1420,7 +1420,7 @@
 //----------------------------------------------------------------------------
 
 void ReverbSetDensity(ReverbContext *pContext, int16_t level){
-    //LOGV("\tReverbSetDensity start (%d)", level);
+    //ALOGV("\tReverbSetDensity start (%d)", level);
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1428,18 +1428,18 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetDensity")
-    //LOGV("\tReverbSetDensity Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbSetDensity just Got -> %d\n", ActiveParams.RoomSize);
+    //ALOGV("\tReverbSetDensity Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbSetDensity just Got -> %d\n", ActiveParams.RoomSize);
 
     ActiveParams.RoomSize = (LVM_INT16)(((level * 99) / 1000) + 1);
 
     /* Activate the initial settings */
     LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetDensity")
-    //LOGV("\tReverbSetDensity just Set -> %d\n", ActiveParams.RoomSize);
+    //ALOGV("\tReverbSetDensity just Set -> %d\n", ActiveParams.RoomSize);
 
     pContext->SavedDensity = level;
-    //LOGV("\tReverbSetDensity end");
+    //ALOGV("\tReverbSetDensity end");
     return;
 }
 
@@ -1455,7 +1455,7 @@
 //----------------------------------------------------------------------------
 
 int32_t ReverbGetDensity(ReverbContext *pContext){
-    //LOGV("\tReverbGetDensity start");
+    //ALOGV("\tReverbGetDensity start");
 
     LVREV_ControlParams_st    ActiveParams;              /* Current control Parameters */
     LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS;     /* Function call status */
@@ -1463,17 +1463,17 @@
     /* Get the current settings */
     LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
     LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetDensity")
-    //LOGV("\tReverbGetDensity Succesfully returned from LVM_GetControlParameters\n");
-    //LOGV("\tReverbGetDensity() just Got -> %d\n", ActiveParams.RoomSize);
+    //ALOGV("\tReverbGetDensity Succesfully returned from LVM_GetControlParameters\n");
+    //ALOGV("\tReverbGetDensity() just Got -> %d\n", ActiveParams.RoomSize);
 
 
     Temp = (LVM_INT16)(((pContext->SavedDensity * 99) / 1000) + 1);
 
     if(Temp != ActiveParams.RoomSize){
-        LOGV("\tLVM_ERROR : ReverbGetDensity invalid value %d %d", Temp, ActiveParams.RoomSize);
+        ALOGV("\tLVM_ERROR : ReverbGetDensity invalid value %d %d", Temp, ActiveParams.RoomSize);
     }
 
-    //LOGV("\tReverbGetDensity end");
+    //ALOGV("\tReverbGetDensity end");
     return pContext->SavedDensity;
 }
 
@@ -1546,98 +1546,98 @@
     char *name;
     t_reverb_settings *pProperties;
 
-    //LOGV("\tReverb_getParameter start");
+    //ALOGV("\tReverb_getParameter start");
     if (pContext->preset) {
         if (param != REVERB_PARAM_PRESET || *pValueSize < sizeof(uint16_t)) {
             return -EINVAL;
         }
 
         *(uint16_t *)pValue = pContext->nextPreset;
-        LOGV("get REVERB_PARAM_PRESET, preset %d", pContext->nextPreset);
+        ALOGV("get REVERB_PARAM_PRESET, preset %d", pContext->nextPreset);
         return 0;
     }
 
     switch (param){
         case REVERB_PARAM_ROOM_LEVEL:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize1 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize1 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
         case REVERB_PARAM_ROOM_HF_LEVEL:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize12 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize12 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
         case REVERB_PARAM_DECAY_TIME:
             if (*pValueSize != sizeof(uint32_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize3 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize3 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(uint32_t);
             break;
         case REVERB_PARAM_DECAY_HF_RATIO:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize4 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize4 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
         case REVERB_PARAM_REFLECTIONS_LEVEL:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize5 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize5 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
         case REVERB_PARAM_REFLECTIONS_DELAY:
             if (*pValueSize != sizeof(uint32_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize6 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize6 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(uint32_t);
             break;
         case REVERB_PARAM_REVERB_LEVEL:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize7 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize7 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
         case REVERB_PARAM_REVERB_DELAY:
             if (*pValueSize != sizeof(uint32_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize8 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize8 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(uint32_t);
             break;
         case REVERB_PARAM_DIFFUSION:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize9 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize9 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
         case REVERB_PARAM_DENSITY:
             if (*pValueSize != sizeof(int16_t)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize10 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize10 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(int16_t);
             break;
         case REVERB_PARAM_PROPERTIES:
             if (*pValueSize != sizeof(t_reverb_settings)){
-                LOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize11 %d", *pValueSize);
+                ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize11 %d", *pValueSize);
                 return -EINVAL;
             }
             *pValueSize = sizeof(t_reverb_settings);
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Reverb_getParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid param %d", param);
             return -EINVAL;
     }
 
@@ -1656,68 +1656,68 @@
             pProperties->diffusion = ReverbGetDiffusion(pContext);
             pProperties->density = ReverbGetDensity(pContext);
 
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is roomLevel        %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is roomLevel        %d",
                 pProperties->roomLevel);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is roomHFLevel      %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is roomHFLevel      %d",
                 pProperties->roomHFLevel);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is decayTime        %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is decayTime        %d",
                 pProperties->decayTime);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is decayHFRatio     %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is decayHFRatio     %d",
                 pProperties->decayHFRatio);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reflectionsLevel %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reflectionsLevel %d",
                 pProperties->reflectionsLevel);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reflectionsDelay %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reflectionsDelay %d",
                 pProperties->reflectionsDelay);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reverbDelay      %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reverbDelay      %d",
                 pProperties->reverbDelay);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reverbLevel      %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reverbLevel      %d",
                 pProperties->reverbLevel);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is diffusion        %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is diffusion        %d",
                 pProperties->diffusion);
-            LOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is density          %d",
+            ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is density          %d",
                 pProperties->density);
             break;
 
         case REVERB_PARAM_ROOM_LEVEL:
             *(int16_t *)pValue = ReverbGetRoomLevel(pContext);
 
-            //LOGV("\tReverb_getParameter() REVERB_PARAM_ROOM_LEVEL Value is %d",
+            //ALOGV("\tReverb_getParameter() REVERB_PARAM_ROOM_LEVEL Value is %d",
             //        *(int16_t *)pValue);
             break;
         case REVERB_PARAM_ROOM_HF_LEVEL:
             *(int16_t *)pValue = ReverbGetRoomHfLevel(pContext);
 
-            //LOGV("\tReverb_getParameter() REVERB_PARAM_ROOM_HF_LEVEL Value is %d",
+            //ALOGV("\tReverb_getParameter() REVERB_PARAM_ROOM_HF_LEVEL Value is %d",
             //        *(int16_t *)pValue);
             break;
         case REVERB_PARAM_DECAY_TIME:
             *(uint32_t *)pValue = ReverbGetDecayTime(pContext);
 
-            //LOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_TIME Value is %d",
+            //ALOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_TIME Value is %d",
             //        *(int32_t *)pValue);
             break;
         case REVERB_PARAM_DECAY_HF_RATIO:
             *(int16_t *)pValue = ReverbGetDecayHfRatio(pContext);
 
-            //LOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_HF_RATION Value is %d",
+            //ALOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_HF_RATION Value is %d",
             //        *(int16_t *)pValue);
             break;
         case REVERB_PARAM_REVERB_LEVEL:
              *(int16_t *)pValue = ReverbGetReverbLevel(pContext);
 
-            //LOGV("\tReverb_getParameter() REVERB_PARAM_REVERB_LEVEL Value is %d",
+            //ALOGV("\tReverb_getParameter() REVERB_PARAM_REVERB_LEVEL Value is %d",
             //        *(int16_t *)pValue);
             break;
         case REVERB_PARAM_DIFFUSION:
             *(int16_t *)pValue = ReverbGetDiffusion(pContext);
 
-            //LOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_DIFFUSION Value is %d",
+            //ALOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_DIFFUSION Value is %d",
             //        *(int16_t *)pValue);
             break;
         case REVERB_PARAM_DENSITY:
             *(uint16_t *)pValue = 0;
             *(int16_t *)pValue = ReverbGetDensity(pContext);
-            //LOGV("\tReverb_getParameter() REVERB_PARAM_DENSITY Value is %d",
+            //ALOGV("\tReverb_getParameter() REVERB_PARAM_DENSITY Value is %d",
             //        *(uint32_t *)pValue);
             break;
         case REVERB_PARAM_REFLECTIONS_LEVEL:
@@ -1729,12 +1729,12 @@
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Reverb_getParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid param %d", param);
             status = -EINVAL;
             break;
     }
 
-    //LOGV("\tReverb_getParameter end");
+    //ALOGV("\tReverb_getParameter end");
     return status;
 } /* end Reverb_getParameter */
 
@@ -1762,14 +1762,14 @@
     int32_t *pParamTemp = (int32_t *)pParam;
     int32_t param = *pParamTemp++;
 
-    //LOGV("\tReverb_setParameter start");
+    //ALOGV("\tReverb_setParameter start");
     if (pContext->preset) {
         if (param != REVERB_PARAM_PRESET) {
             return -EINVAL;
         }
 
         uint16_t preset = *(uint16_t *)pValue;
-        LOGV("set REVERB_PARAM_PRESET, preset %d", preset);
+        ALOGV("set REVERB_PARAM_PRESET, preset %d", preset);
         if (preset > REVERB_PRESET_LAST) {
             return -EINVAL;
         }
@@ -1779,7 +1779,7 @@
 
     switch (param){
         case REVERB_PARAM_PROPERTIES:
-            LOGV("\tReverb_setParameter() REVERB_PARAM_PROPERTIES");
+            ALOGV("\tReverb_setParameter() REVERB_PARAM_PROPERTIES");
             pProperties = (t_reverb_settings *) pValue;
             ReverbSetRoomLevel(pContext, pProperties->roomLevel);
             ReverbSetRoomHfLevel(pContext, pProperties->roomHFLevel);
@@ -1791,52 +1791,52 @@
             break;
         case REVERB_PARAM_ROOM_LEVEL:
             level = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_ROOM_LEVEL value is %d", level);
-            //LOGV("\tReverb_setParameter() Calling ReverbSetRoomLevel");
+            //ALOGV("\tReverb_setParameter() REVERB_PARAM_ROOM_LEVEL value is %d", level);
+            //ALOGV("\tReverb_setParameter() Calling ReverbSetRoomLevel");
             ReverbSetRoomLevel(pContext, level);
-            //LOGV("\tReverb_setParameter() Called ReverbSetRoomLevel");
+            //ALOGV("\tReverb_setParameter() Called ReverbSetRoomLevel");
            break;
         case REVERB_PARAM_ROOM_HF_LEVEL:
             level = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_ROOM_HF_LEVEL value is %d", level);
-            //LOGV("\tReverb_setParameter() Calling ReverbSetRoomHfLevel");
+            //ALOGV("\tReverb_setParameter() REVERB_PARAM_ROOM_HF_LEVEL value is %d", level);
+            //ALOGV("\tReverb_setParameter() Calling ReverbSetRoomHfLevel");
             ReverbSetRoomHfLevel(pContext, level);
-            //LOGV("\tReverb_setParameter() Called ReverbSetRoomHfLevel");
+            //ALOGV("\tReverb_setParameter() Called ReverbSetRoomHfLevel");
            break;
         case REVERB_PARAM_DECAY_TIME:
             time = *(uint32_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_TIME value is %d", time);
-            //LOGV("\tReverb_setParameter() Calling ReverbSetDecayTime");
+            //ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_TIME value is %d", time);
+            //ALOGV("\tReverb_setParameter() Calling ReverbSetDecayTime");
             ReverbSetDecayTime(pContext, time);
-            //LOGV("\tReverb_setParameter() Called ReverbSetDecayTime");
+            //ALOGV("\tReverb_setParameter() Called ReverbSetDecayTime");
            break;
         case REVERB_PARAM_DECAY_HF_RATIO:
             ratio = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_HF_RATIO value is %d", ratio);
-            //LOGV("\tReverb_setParameter() Calling ReverbSetDecayHfRatio");
+            //ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_HF_RATIO value is %d", ratio);
+            //ALOGV("\tReverb_setParameter() Calling ReverbSetDecayHfRatio");
             ReverbSetDecayHfRatio(pContext, ratio);
-            //LOGV("\tReverb_setParameter() Called ReverbSetDecayHfRatio");
+            //ALOGV("\tReverb_setParameter() Called ReverbSetDecayHfRatio");
             break;
          case REVERB_PARAM_REVERB_LEVEL:
             level = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_REVERB_LEVEL value is %d", level);
-            //LOGV("\tReverb_setParameter() Calling ReverbSetReverbLevel");
+            //ALOGV("\tReverb_setParameter() REVERB_PARAM_REVERB_LEVEL value is %d", level);
+            //ALOGV("\tReverb_setParameter() Calling ReverbSetReverbLevel");
             ReverbSetReverbLevel(pContext, level);
-            //LOGV("\tReverb_setParameter() Called ReverbSetReverbLevel");
+            //ALOGV("\tReverb_setParameter() Called ReverbSetReverbLevel");
            break;
         case REVERB_PARAM_DIFFUSION:
             ratio = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DIFFUSION value is %d", ratio);
-            //LOGV("\tReverb_setParameter() Calling ReverbSetDiffusion");
+            //ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DIFFUSION value is %d", ratio);
+            //ALOGV("\tReverb_setParameter() Calling ReverbSetDiffusion");
             ReverbSetDiffusion(pContext, ratio);
-            //LOGV("\tReverb_setParameter() Called ReverbSetDiffusion");
+            //ALOGV("\tReverb_setParameter() Called ReverbSetDiffusion");
             break;
         case REVERB_PARAM_DENSITY:
             ratio = *(int16_t *)pValue;
-            //LOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DENSITY value is %d", ratio);
-            //LOGV("\tReverb_setParameter() Calling ReverbSetDensity");
+            //ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DENSITY value is %d", ratio);
+            //ALOGV("\tReverb_setParameter() Calling ReverbSetDensity");
             ReverbSetDensity(pContext, ratio);
-            //LOGV("\tReverb_setParameter() Called ReverbSetDensity");
+            //ALOGV("\tReverb_setParameter() Called ReverbSetDensity");
             break;
            break;
         case REVERB_PARAM_REFLECTIONS_LEVEL:
@@ -1844,11 +1844,11 @@
         case REVERB_PARAM_REVERB_DELAY:
             break;
         default:
-            LOGV("\tLVM_ERROR : Reverb_setParameter() invalid param %d", param);
+            ALOGV("\tLVM_ERROR : Reverb_setParameter() invalid param %d", param);
             break;
     }
 
-    //LOGV("\tReverb_setParameter end");
+    //ALOGV("\tReverb_setParameter end");
     return status;
 } /* end Reverb_setParameter */
 
@@ -1864,16 +1864,16 @@
     int    status = 0;
 
     if (pContext == NULL){
-        LOGV("\tLVM_ERROR : Reverb_process() ERROR pContext == NULL");
+        ALOGV("\tLVM_ERROR : Reverb_process() ERROR pContext == NULL");
         return -EINVAL;
     }
     if (inBuffer == NULL  || inBuffer->raw == NULL  ||
             outBuffer == NULL || outBuffer->raw == NULL ||
             inBuffer->frameCount != outBuffer->frameCount){
-        LOGV("\tLVM_ERROR : Reverb_process() ERROR NULL INPUT POINTER OR FRAME COUNT IS WRONG");
+        ALOGV("\tLVM_ERROR : Reverb_process() ERROR NULL INPUT POINTER OR FRAME COUNT IS WRONG");
         return -EINVAL;
     }
-    //LOGV("\tReverb_process() Calling process with %d frames", outBuffer->frameCount);
+    //ALOGV("\tReverb_process() Calling process with %d frames", outBuffer->frameCount);
     /* Process all the available frames, block processing is handled internalLY by the LVM bundle */
     status = process(    (LVM_INT16 *)inBuffer->raw,
                          (LVM_INT16 *)outBuffer->raw,
@@ -1905,19 +1905,19 @@
 
 
     if (pContext == NULL){
-        LOGV("\tLVM_ERROR : Reverb_command ERROR pContext == NULL");
+        ALOGV("\tLVM_ERROR : Reverb_command ERROR pContext == NULL");
         return -EINVAL;
     }
 
-    //LOGV("\tReverb_command INPUTS are: command %d cmdSize %d",cmdCode, cmdSize);
+    //ALOGV("\tReverb_command INPUTS are: command %d cmdSize %d",cmdCode, cmdSize);
 
     switch (cmdCode){
         case EFFECT_CMD_INIT:
-            //LOGV("\tReverb_command cmdCode Case: "
+            //ALOGV("\tReverb_command cmdCode Case: "
             //        "EFFECT_CMD_INIT start");
 
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_INIT: ERROR");
                 return -EINVAL;
             }
@@ -1925,13 +1925,13 @@
             break;
 
         case EFFECT_CMD_CONFIGURE:
-            //LOGV("\tReverb_command cmdCode Case: "
+            //ALOGV("\tReverb_command cmdCode Case: "
             //        "EFFECT_CMD_CONFIGURE start");
             if (pCmdData    == NULL||
                 cmdSize     != sizeof(effect_config_t)||
                 pReplyData  == NULL||
                 *replySize  != sizeof(int)){
-                LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_CONFIGURE: ERROR");
                 return -EINVAL;
             }
@@ -1939,19 +1939,19 @@
             break;
 
         case EFFECT_CMD_RESET:
-            //LOGV("\tReverb_command cmdCode Case: "
+            //ALOGV("\tReverb_command cmdCode Case: "
             //        "EFFECT_CMD_RESET start");
             Reverb_configure(pContext, &pContext->config);
             break;
 
         case EFFECT_CMD_GET_PARAM:{
-            //LOGV("\tReverb_command cmdCode Case: "
+            //ALOGV("\tReverb_command cmdCode Case: "
             //        "EFFECT_CMD_GET_PARAM start");
             if (pCmdData == NULL ||
                     cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
                     pReplyData == NULL ||
                     *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
-                LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_GET_PARAM: ERROR");
                 return -EINVAL;
             }
@@ -1970,7 +1970,7 @@
 
             *replySize = sizeof(effect_param_t) + voffset + p->vsize;
 
-            //LOGV("\tReverb_command EFFECT_CMD_GET_PARAM "
+            //ALOGV("\tReverb_command EFFECT_CMD_GET_PARAM "
             //        "*pCmdData %d, *replySize %d, *pReplyData %d ",
             //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
             //        *replySize,
@@ -1979,16 +1979,16 @@
         } break;
         case EFFECT_CMD_SET_PARAM:{
 
-            //LOGV("\tReverb_command cmdCode Case: "
+            //ALOGV("\tReverb_command cmdCode Case: "
             //        "EFFECT_CMD_SET_PARAM start");
-            //LOGV("\tReverb_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
+            //ALOGV("\tReverb_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
             //        *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
             //        *replySize,
             //        *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
 
             if (pCmdData == NULL || (cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)))
                     || pReplyData == NULL || *replySize != (int)sizeof(int32_t)) {
-                LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_SET_PARAM: ERROR");
                 return -EINVAL;
             }
@@ -1996,12 +1996,12 @@
             effect_param_t *p = (effect_param_t *) pCmdData;
 
             if (p->psize != sizeof(int32_t)){
-                LOGV("\t4LVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\t4LVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_SET_PARAM: ERROR, psize is not sizeof(int32_t)");
                 return -EINVAL;
             }
 
-            //LOGV("\tn5Reverb_command cmdSize is %d\n"
+            //ALOGV("\tn5Reverb_command cmdSize is %d\n"
             //        "\tsizeof(effect_param_t) is  %d\n"
             //        "\tp->psize is %d\n"
             //        "\tp->vsize is %d"
@@ -2014,16 +2014,16 @@
         } break;
 
         case EFFECT_CMD_ENABLE:
-            //LOGV("\tReverb_command cmdCode Case: "
+            //ALOGV("\tReverb_command cmdCode Case: "
             //        "EFFECT_CMD_ENABLE start");
 
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_ENABLE: ERROR");
                 return -EINVAL;
             }
             if(pContext->bEnabled == LVM_TRUE){
-                 LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                 ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                          "EFFECT_CMD_ENABLE: ERROR-Effect is already enabled");
                  return -EINVAL;
              }
@@ -2036,19 +2036,19 @@
                     (ActiveParams.T60 * pContext->config.inputCfg.samplingRate)/1000;
             // force no volume ramp for first buffer processed after enabling the effect
             pContext->volumeMode = android::REVERB_VOLUME_FLAT;
-            //LOGV("\tEFFECT_CMD_ENABLE SamplesToExitCount = %d", pContext->SamplesToExitCount);
+            //ALOGV("\tEFFECT_CMD_ENABLE SamplesToExitCount = %d", pContext->SamplesToExitCount);
             break;
         case EFFECT_CMD_DISABLE:
-            //LOGV("\tReverb_command cmdCode Case: "
+            //ALOGV("\tReverb_command cmdCode Case: "
             //        "EFFECT_CMD_DISABLE start");
 
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_DISABLE: ERROR");
                 return -EINVAL;
             }
             if(pContext->bEnabled == LVM_FALSE){
-                 LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                 ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                          "EFFECT_CMD_DISABLE: ERROR-Effect is not yet enabled");
                  return -EINVAL;
              }
@@ -2059,7 +2059,7 @@
         case EFFECT_CMD_SET_VOLUME:
             if (pCmdData == NULL ||
                 cmdSize != 2 * sizeof(uint32_t)) {
-                LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                         "EFFECT_CMD_SET_VOLUME: ERROR");
                 return -EINVAL;
             }
@@ -2079,23 +2079,23 @@
                 pContext->rightVolume = REVERB_UNIT_VOLUME;
                 pContext->volumeMode = android::REVERB_VOLUME_OFF;
             }
-            LOGV("EFFECT_CMD_SET_VOLUME left %d, right %d mode %d",
+            ALOGV("EFFECT_CMD_SET_VOLUME left %d, right %d mode %d",
                     pContext->leftVolume, pContext->rightVolume,  pContext->volumeMode);
             break;
 
         case EFFECT_CMD_SET_DEVICE:
         case EFFECT_CMD_SET_AUDIO_MODE:
-        //LOGV("\tReverb_command cmdCode Case: "
+        //ALOGV("\tReverb_command cmdCode Case: "
         //        "EFFECT_CMD_SET_DEVICE/EFFECT_CMD_SET_VOLUME/EFFECT_CMD_SET_AUDIO_MODE start");
             break;
 
         default:
-            LOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+            ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
                     "DEFAULT start %d ERROR",cmdCode);
             return -EINVAL;
     }
 
-    //LOGV("\tReverb_command end\n\n");
+    //ALOGV("\tReverb_command end\n\n");
     return 0;
 }    /* end Reverb_command */
 
@@ -2107,7 +2107,7 @@
     const effect_descriptor_t *desc;
 
     if (pContext == NULL || pDescriptor == NULL) {
-        LOGV("Reverb_getDescriptor() invalid param");
+        ALOGV("Reverb_getDescriptor() invalid param");
         return -EINVAL;
     }
 
diff --git a/media/libeffects/preprocessing/PreProcessing.cpp b/media/libeffects/preprocessing/PreProcessing.cpp
index ba286a1..b15614a 100755
--- a/media/libeffects/preprocessing/PreProcessing.cpp
+++ b/media/libeffects/preprocessing/PreProcessing.cpp
@@ -226,7 +226,7 @@
 
 int  AgcInit (preproc_effect_t *effect)
 {
-    LOGV("AgcInit");
+    ALOGV("AgcInit");
     webrtc::GainControl *agc = static_cast<webrtc::GainControl *>(effect->engine);
     agc->set_mode(webrtc::GainControl::kFixedDigital);
     agc->set_target_level_dbfs(kAgcDefaultTargetLevel);
@@ -238,7 +238,7 @@
 int  AgcCreate(preproc_effect_t *effect)
 {
     webrtc::GainControl *agc = effect->session->apm->gain_control();
-    LOGV("AgcCreate got agc %p", agc);
+    ALOGV("AgcCreate got agc %p", agc);
     if (agc == NULL) {
         LOGW("AgcCreate Error");
         return -ENOMEM;
@@ -288,15 +288,15 @@
     switch (param) {
     case AGC_PARAM_TARGET_LEVEL:
         *(int16_t *) pValue = (int16_t)(agc->target_level_dbfs() * -100);
-        LOGV("AgcGetParameter() target level %d milliBels", *(int16_t *) pValue);
+        ALOGV("AgcGetParameter() target level %d milliBels", *(int16_t *) pValue);
         break;
     case AGC_PARAM_COMP_GAIN:
         *(int16_t *) pValue = (int16_t)(agc->compression_gain_db() * 100);
-        LOGV("AgcGetParameter() comp gain %d milliBels", *(int16_t *) pValue);
+        ALOGV("AgcGetParameter() comp gain %d milliBels", *(int16_t *) pValue);
         break;
     case AGC_PARAM_LIMITER_ENA:
         *(bool *) pValue = (bool)agc->is_limiter_enabled();
-        LOGV("AgcGetParameter() limiter enabled %s",
+        ALOGV("AgcGetParameter() limiter enabled %s",
              (*(int16_t *) pValue != 0) ? "true" : "false");
         break;
     case AGC_PARAM_PROPERTIES:
@@ -321,19 +321,19 @@
 
     switch (param) {
     case AGC_PARAM_TARGET_LEVEL:
-        LOGV("AgcSetParameter() target level %d milliBels", *(int16_t *)pValue);
+        ALOGV("AgcSetParameter() target level %d milliBels", *(int16_t *)pValue);
         status = agc->set_target_level_dbfs(-(*(int16_t *)pValue / 100));
         break;
     case AGC_PARAM_COMP_GAIN:
-        LOGV("AgcSetParameter() comp gain %d milliBels", *(int16_t *)pValue);
+        ALOGV("AgcSetParameter() comp gain %d milliBels", *(int16_t *)pValue);
         status = agc->set_compression_gain_db(*(int16_t *)pValue / 100);
         break;
     case AGC_PARAM_LIMITER_ENA:
-        LOGV("AgcSetParameter() limiter enabled %s", *(bool *)pValue ? "true" : "false");
+        ALOGV("AgcSetParameter() limiter enabled %s", *(bool *)pValue ? "true" : "false");
         status = agc->enable_limiter(*(bool *)pValue);
         break;
     case AGC_PARAM_PROPERTIES:
-        LOGV("AgcSetParameter() properties level %d, gain %d limiter %d",
+        ALOGV("AgcSetParameter() properties level %d, gain %d limiter %d",
              pProperties->targetLevel,
              pProperties->compGain,
              pProperties->limiterEnabled);
@@ -349,7 +349,7 @@
         break;
     }
 
-    LOGV("AgcSetParameter() done status %d", status);
+    ALOGV("AgcSetParameter() done status %d", status);
 
     return status;
 }
@@ -357,13 +357,13 @@
 void AgcEnable(preproc_effect_t *effect)
 {
     webrtc::GainControl *agc = static_cast<webrtc::GainControl *>(effect->engine);
-    LOGV("AgcEnable agc %p", agc);
+    ALOGV("AgcEnable agc %p", agc);
     agc->Enable(true);
 }
 
 void AgcDisable(preproc_effect_t *effect)
 {
-    LOGV("AgcDisable");
+    ALOGV("AgcDisable");
     webrtc::GainControl *agc = static_cast<webrtc::GainControl *>(effect->engine);
     agc->Enable(false);
 }
@@ -391,7 +391,7 @@
 
 int  AecInit (preproc_effect_t *effect)
 {
-    LOGV("AecInit");
+    ALOGV("AecInit");
     webrtc::EchoControlMobile *aec = static_cast<webrtc::EchoControlMobile *>(effect->engine);
     aec->set_routing_mode(kAecDefaultMode);
     aec->enable_comfort_noise(kAecDefaultComfortNoise);
@@ -401,7 +401,7 @@
 int  AecCreate(preproc_effect_t *effect)
 {
     webrtc::EchoControlMobile *aec = effect->session->apm->echo_control_mobile();
-    LOGV("AecCreate got aec %p", aec);
+    ALOGV("AecCreate got aec %p", aec);
     if (aec == NULL) {
         LOGW("AgcCreate Error");
         return -ENOMEM;
@@ -426,7 +426,7 @@
     case AEC_PARAM_ECHO_DELAY:
     case AEC_PARAM_PROPERTIES:
         *(uint32_t *)pValue = 1000 * effect->session->apm->stream_delay_ms();
-        LOGV("AecGetParameter() echo delay %d us", *(uint32_t *)pValue);
+        ALOGV("AecGetParameter() echo delay %d us", *(uint32_t *)pValue);
         break;
     default:
         LOGW("AecGetParameter() unknown param %08x value %08x", param, *(uint32_t *)pValue);
@@ -446,7 +446,7 @@
     case AEC_PARAM_ECHO_DELAY:
     case AEC_PARAM_PROPERTIES:
         status = effect->session->apm->set_stream_delay_ms(value/1000);
-        LOGV("AecSetParameter() echo delay %d us, status %d", value, status);
+        ALOGV("AecSetParameter() echo delay %d us, status %d", value, status);
         break;
     default:
         LOGW("AecSetParameter() unknown param %08x value %08x", param, *(uint32_t *)pValue);
@@ -459,20 +459,20 @@
 void AecEnable(preproc_effect_t *effect)
 {
     webrtc::EchoControlMobile *aec = static_cast<webrtc::EchoControlMobile *>(effect->engine);
-    LOGV("AecEnable aec %p", aec);
+    ALOGV("AecEnable aec %p", aec);
     aec->Enable(true);
 }
 
 void AecDisable(preproc_effect_t *effect)
 {
-    LOGV("AecDisable");
+    ALOGV("AecDisable");
     webrtc::EchoControlMobile *aec = static_cast<webrtc::EchoControlMobile *>(effect->engine);
     aec->Enable(false);
 }
 
 int AecSetDevice(preproc_effect_t *effect, uint32_t device)
 {
-    LOGV("AecSetDevice %08x", device);
+    ALOGV("AecSetDevice %08x", device);
     webrtc::EchoControlMobile *aec = static_cast<webrtc::EchoControlMobile *>(effect->engine);
     webrtc::EchoControlMobile::RoutingMode mode = webrtc::EchoControlMobile::kQuietEarpieceOrHeadset;
 
@@ -511,7 +511,7 @@
 
 int  NsInit (preproc_effect_t *effect)
 {
-    LOGV("NsInit");
+    ALOGV("NsInit");
     webrtc::NoiseSuppression *ns = static_cast<webrtc::NoiseSuppression *>(effect->engine);
     ns->set_level(kNsDefaultLevel);
     return 0;
@@ -520,7 +520,7 @@
 int  NsCreate(preproc_effect_t *effect)
 {
     webrtc::NoiseSuppression *ns = effect->session->apm->noise_suppression();
-    LOGV("NsCreate got ns %p", ns);
+    ALOGV("NsCreate got ns %p", ns);
     if (ns == NULL) {
         LOGW("AgcCreate Error");
         return -ENOMEM;
@@ -548,13 +548,13 @@
 void NsEnable(preproc_effect_t *effect)
 {
     webrtc::NoiseSuppression *ns = static_cast<webrtc::NoiseSuppression *>(effect->engine);
-    LOGV("NsEnable ns %p", ns);
+    ALOGV("NsEnable ns %p", ns);
     ns->Enable(true);
 }
 
 void NsDisable(preproc_effect_t *effect)
 {
-    LOGV("NsDisable");
+    ALOGV("NsDisable");
     webrtc::NoiseSuppression *ns = static_cast<webrtc::NoiseSuppression *>(effect->engine);
     ns->Enable(false);
 }
@@ -593,7 +593,7 @@
 int Effect_SetState(preproc_effect_t *effect, uint32_t state)
 {
     int status = 0;
-    LOGV("Effect_SetState proc %d, new %d old %d", effect->procId, state, effect->state);
+    ALOGV("Effect_SetState proc %d, new %d old %d", effect->procId, state, effect->state);
     switch(state) {
     case PREPROC_EFFECT_STATE_INIT:
         switch(effect->state) {
@@ -725,7 +725,7 @@
 {
     int status = -ENOMEM;
 
-    LOGV("Session_CreateEffect procId %d, createdMsk %08x", procId, session->createdMsk);
+    ALOGV("Session_CreateEffect procId %d, createdMsk %08x", procId, session->createdMsk);
 
     if (session->createdMsk == 0) {
         session->apm = webrtc::AudioProcessing::Create(session->io);
@@ -775,7 +775,7 @@
     if (status < 0) {
         goto error;
     }
-    LOGV("Session_CreateEffect OK");
+    ALOGV("Session_CreateEffect OK");
     session->createdMsk |= (1<<procId);
     return status;
 
@@ -841,7 +841,7 @@
         return -EINVAL;
     }
 
-    LOGV("Session_SetConfig sr %d cnl %08x",
+    ALOGV("Session_SetConfig sr %d cnl %08x",
          config->inputCfg.samplingRate, config->inputCfg.channels);
     int status;
 
@@ -948,7 +948,7 @@
         return -EINVAL;
     }
 
-    LOGV("Session_SetReverseConfig sr %d cnl %08x",
+    ALOGV("Session_SetReverseConfig sr %d cnl %08x",
          config->inputCfg.samplingRate, config->inputCfg.channels);
 
     if (session->state < PREPROC_SESSION_STATE_CONFIG) {
@@ -996,7 +996,7 @@
             session->revEnabledMsk &= ~(1 << procId);
         }
     }
-    LOGV("Session_SetProcEnabled proc %d, enabled %d enabledMsk %08x revEnabledMsk %08x",
+    ALOGV("Session_SetProcEnabled proc %d, enabled %d enabledMsk %08x revEnabledMsk %08x",
          procId, enabled, session->enabledMsk, session->revEnabledMsk);
     session->processedMsk = 0;
     if (HasReverseStream(procId)) {
@@ -1074,7 +1074,7 @@
     int    status = 0;
 
     if (effect == NULL){
-        LOGV("PreProcessingFx_Process() ERROR effect == NULL");
+        ALOGV("PreProcessingFx_Process() ERROR effect == NULL");
         return -EINVAL;
     }
     preproc_session_t * session = (preproc_session_t *)effect->session;
@@ -1087,7 +1087,7 @@
 
     session->processedMsk |= (1<<effect->procId);
 
-//    LOGV("PreProcessingFx_Process In %d frames enabledMsk %08x processedMsk %08x",
+//    ALOGV("PreProcessingFx_Process In %d frames enabledMsk %08x processedMsk %08x",
 //         inBuffer->frameCount, session->enabledMsk, session->processedMsk);
 
     if ((session->processedMsk & session->enabledMsk) == session->enabledMsk) {
@@ -1237,7 +1237,7 @@
         return -EINVAL;
     }
 
-    //LOGV("PreProcessingFx_Command: command %d cmdSize %d",cmdCode, cmdSize);
+    //ALOGV("PreProcessingFx_Command: command %d cmdSize %d",cmdCode, cmdSize);
 
     switch (cmdCode){
         case EFFECT_CMD_INIT:
@@ -1255,7 +1255,7 @@
                 cmdSize     != sizeof(effect_config_t)||
                 pReplyData  == NULL||
                 *replySize  != sizeof(int)){
-                LOGV("PreProcessingFx_Command cmdCode Case: "
+                ALOGV("PreProcessingFx_Command cmdCode Case: "
                         "EFFECT_CMD_CONFIGURE: ERROR");
                 return -EINVAL;
             }
@@ -1271,7 +1271,7 @@
                 cmdSize     != sizeof(effect_config_t)||
                 pReplyData  == NULL||
                 *replySize  != sizeof(int)){
-                LOGV("PreProcessingFx_Command cmdCode Case: "
+                ALOGV("PreProcessingFx_Command cmdCode Case: "
                         "EFFECT_CMD_CONFIGURE_REVERSE: ERROR");
                 return -EINVAL;
             }
@@ -1293,7 +1293,7 @@
                     cmdSize < (int)sizeof(effect_param_t) ||
                     pReplyData == NULL ||
                     *replySize < (int)sizeof(effect_param_t)){
-                LOGV("PreProcessingFx_Command cmdCode Case: "
+                ALOGV("PreProcessingFx_Command cmdCode Case: "
                         "EFFECT_CMD_GET_PARAM: ERROR");
                 return -EINVAL;
             }
@@ -1318,14 +1318,14 @@
                     cmdSize < (int)sizeof(effect_param_t) ||
                     pReplyData == NULL ||
                     *replySize != sizeof(int32_t)){
-                LOGV("PreProcessingFx_Command cmdCode Case: "
+                ALOGV("PreProcessingFx_Command cmdCode Case: "
                         "EFFECT_CMD_SET_PARAM: ERROR");
                 return -EINVAL;
             }
             effect_param_t *p = (effect_param_t *) pCmdData;
 
             if (p->psize != sizeof(int32_t)){
-                LOGV("PreProcessingFx_Command cmdCode Case: "
+                ALOGV("PreProcessingFx_Command cmdCode Case: "
                         "EFFECT_CMD_SET_PARAM: ERROR, psize is not sizeof(int32_t)");
                 return -EINVAL;
             }
@@ -1338,7 +1338,7 @@
 
         case EFFECT_CMD_ENABLE:
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("PreProcessingFx_Command cmdCode Case: EFFECT_CMD_ENABLE: ERROR");
+                ALOGV("PreProcessingFx_Command cmdCode Case: EFFECT_CMD_ENABLE: ERROR");
                 return -EINVAL;
             }
             *(int *)pReplyData = Effect_SetState(effect, PREPROC_EFFECT_STATE_ACTIVE);
@@ -1346,7 +1346,7 @@
 
         case EFFECT_CMD_DISABLE:
             if (pReplyData == NULL || *replySize != sizeof(int)){
-                LOGV("PreProcessingFx_Command cmdCode Case: EFFECT_CMD_DISABLE: ERROR");
+                ALOGV("PreProcessingFx_Command cmdCode Case: EFFECT_CMD_DISABLE: ERROR");
                 return -EINVAL;
             }
             *(int *)pReplyData  = Effect_SetState(effect, PREPROC_EFFECT_STATE_CONFIG);
@@ -1356,7 +1356,7 @@
         case EFFECT_CMD_SET_INPUT_DEVICE:
             if (pCmdData == NULL ||
                 cmdSize != sizeof(uint32_t)) {
-                LOGV("PreProcessingFx_Command cmdCode Case: EFFECT_CMD_SET_DEVICE: ERROR");
+                ALOGV("PreProcessingFx_Command cmdCode Case: EFFECT_CMD_SET_DEVICE: ERROR");
                 return -EINVAL;
             }
 
@@ -1410,7 +1410,7 @@
 
     session->revProcessedMsk |= (1<<effect->procId);
 
-//    LOGV("PreProcessingFx_ProcessReverse In %d frames revEnabledMsk %08x revProcessedMsk %08x",
+//    ALOGV("PreProcessingFx_ProcessReverse In %d frames revEnabledMsk %08x revProcessedMsk %08x",
 //         inBuffer->frameCount, session->revEnabledMsk, session->revProcessedMsk);
 
 
@@ -1528,7 +1528,7 @@
                             int32_t             ioId,
                             effect_handle_t  *pInterface)
 {
-    LOGV("EffectCreate: uuid: %08x session %d IO: %d", uuid->timeLow, sessionId, ioId);
+    ALOGV("EffectCreate: uuid: %08x session %d IO: %d", uuid->timeLow, sessionId, ioId);
 
     int status;
     const effect_descriptor_t *desc;
@@ -1562,7 +1562,7 @@
 int PreProcessingLib_Release(effect_handle_t interface)
 {
     int status;
-    LOGV("EffectRelease start %p", interface);
+    ALOGV("EffectRelease start %p", interface);
     if (PreProc_Init() != 0) {
         return sInitStatus;
     }
@@ -1584,11 +1584,11 @@
 
     const effect_descriptor_t *desc = PreProc_GetDescriptor(uuid);
     if (desc == NULL) {
-        LOGV("PreProcessingLib_GetDescriptor() not found");
+        ALOGV("PreProcessingLib_GetDescriptor() not found");
         return  -EINVAL;
     }
 
-    LOGV("PreProcessingLib_GetDescriptor() got fx %s", desc->name);
+    ALOGV("PreProcessingLib_GetDescriptor() got fx %s", desc->name);
 
     memcpy(pDescriptor, desc, sizeof(effect_descriptor_t));
     return 0;
diff --git a/media/libeffects/testlibs/AudioEqualizer.cpp b/media/libeffects/testlibs/AudioEqualizer.cpp
index 44c9476..4f3a308 100644
--- a/media/libeffects/testlibs/AudioEqualizer.cpp
+++ b/media/libeffects/testlibs/AudioEqualizer.cpp
@@ -39,7 +39,7 @@
                                                 int nChannels, int sampleRate,
                                                 const PresetConfig * presets,
                                                 int nPresets) {
-    LOGV("AudioEqualizer::CreateInstance(pMem=%p, nBands=%d, nChannels=%d, "
+    ALOGV("AudioEqualizer::CreateInstance(pMem=%p, nBands=%d, nChannels=%d, "
          "sampleRate=%d, nPresets=%d)",
          pMem, nBands, nChannels, sampleRate, nPresets);
     assert(nBands >= 2);
@@ -56,7 +56,7 @@
 }
 
 void AudioEqualizer::configure(int nChannels, int sampleRate) {
-    LOGV("AudioEqualizer::configure(nChannels=%d, sampleRate=%d)", nChannels,
+    ALOGV("AudioEqualizer::configure(nChannels=%d, sampleRate=%d)", nChannels,
          sampleRate);
     mpLowShelf->configure(nChannels, sampleRate);
     for (int i = 0; i < mNumPeaking; ++i) {
@@ -66,7 +66,7 @@
 }
 
 void AudioEqualizer::clear() {
-    LOGV("AudioEqualizer::clear()");
+    ALOGV("AudioEqualizer::clear()");
     mpLowShelf->clear();
     for (int i = 0; i < mNumPeaking; ++i) {
         mpPeakingFilters[i].clear();
@@ -75,14 +75,14 @@
 }
 
 void AudioEqualizer::free() {
-    LOGV("AudioEqualizer::free()");
+    ALOGV("AudioEqualizer::free()");
     if (mpMem != NULL) {
         ::free(mpMem);
     }
 }
 
 void AudioEqualizer::reset() {
-    LOGV("AudioEqualizer::reset()");
+    ALOGV("AudioEqualizer::reset()");
     const int32_t bottom = Effects_log2(kMinFreq);
     const int32_t top = Effects_log2(mSampleRate * 500);
     const int32_t jump = (top - bottom) / (mNumPeaking + 2);
@@ -103,7 +103,7 @@
 }
 
 void AudioEqualizer::setGain(int band, int32_t millibel) {
-    LOGV("AudioEqualizer::setGain(band=%d, millibel=%d)", band, millibel);
+    ALOGV("AudioEqualizer::setGain(band=%d, millibel=%d)", band, millibel);
     assert(band >= 0 && band < mNumPeaking + 2);
     if (band == 0) {
         mpLowShelf->setGain(millibel);
@@ -116,7 +116,7 @@
 }
 
 void AudioEqualizer::setFrequency(int band, uint32_t millihertz) {
-    LOGV("AudioEqualizer::setFrequency(band=%d, millihertz=%d)", band,
+    ALOGV("AudioEqualizer::setFrequency(band=%d, millihertz=%d)", band,
          millihertz);
     assert(band >= 0 && band < mNumPeaking + 2);
     if (band == 0) {
@@ -130,7 +130,7 @@
 }
 
 void AudioEqualizer::setBandwidth(int band, uint32_t cents) {
-    LOGV("AudioEqualizer::setBandwidth(band=%d, cents=%d)", band, cents);
+    ALOGV("AudioEqualizer::setBandwidth(band=%d, cents=%d)", band, cents);
     assert(band >= 0 && band < mNumPeaking + 2);
     if (band > 0 && band < mNumPeaking + 1) {
         mpPeakingFilters[band - 1].setBandwidth(cents);
@@ -201,7 +201,7 @@
 }
 
 void AudioEqualizer::setPreset(int preset) {
-    LOGV("AudioEqualizer::setPreset(preset=%d)", preset);
+    ALOGV("AudioEqualizer::setPreset(preset=%d)", preset);
     assert(preset < mNumPresets && preset >= 0);
     const PresetConfig &presetCfg = mpPresets[preset];
     for (int band = 0; band < (mNumPeaking + 2); ++band) {
@@ -214,7 +214,7 @@
 }
 
 void AudioEqualizer::commit(bool immediate) {
-    LOGV("AudioEqualizer::commit(immediate=%d)", immediate);
+    ALOGV("AudioEqualizer::commit(immediate=%d)", immediate);
     mpLowShelf->commit(immediate);
     for (int i = 0; i < mNumPeaking; ++i) {
         mpPeakingFilters[i].commit(immediate);
@@ -225,7 +225,7 @@
 void AudioEqualizer::process(const audio_sample_t * pIn,
                              audio_sample_t * pOut,
                              int frameCount) {
-//    LOGV("AudioEqualizer::process(frameCount=%d)", frameCount);
+//    ALOGV("AudioEqualizer::process(frameCount=%d)", frameCount);
     mpLowShelf->process(pIn, pOut, frameCount);
     for (int i = 0; i < mNumPeaking; ++i) {
         mpPeakingFilters[i].process(pIn, pOut, frameCount);
@@ -234,7 +234,7 @@
 }
 
 void AudioEqualizer::enable(bool immediate) {
-    LOGV("AudioEqualizer::enable(immediate=%d)", immediate);
+    ALOGV("AudioEqualizer::enable(immediate=%d)", immediate);
     mpLowShelf->enable(immediate);
     for (int i = 0; i < mNumPeaking; ++i) {
         mpPeakingFilters[i].enable(immediate);
@@ -243,7 +243,7 @@
 }
 
 void AudioEqualizer::disable(bool immediate) {
-    LOGV("AudioEqualizer::disable(immediate=%d)", immediate);
+    ALOGV("AudioEqualizer::disable(immediate=%d)", immediate);
     mpLowShelf->disable(immediate);
     for (int i = 0; i < mNumPeaking; ++i) {
         mpPeakingFilters[i].disable(immediate);
diff --git a/media/libeffects/testlibs/EffectEqualizer.cpp b/media/libeffects/testlibs/EffectEqualizer.cpp
index b22ebec..79a296c 100644
--- a/media/libeffects/testlibs/EffectEqualizer.cpp
+++ b/media/libeffects/testlibs/EffectEqualizer.cpp
@@ -147,7 +147,7 @@
     int ret;
     int i;
 
-    LOGV("EffectLibCreateEffect start");
+    ALOGV("EffectLibCreateEffect start");
 
     if (pHandle == NULL || uuid == NULL) {
         return -EINVAL;
@@ -173,7 +173,7 @@
     *pHandle = (effect_handle_t)pContext;
     pContext->state = EQUALIZER_STATE_INITIALIZED;
 
-    LOGV("EffectLibCreateEffect %p, size %d",
+    ALOGV("EffectLibCreateEffect %p, size %d",
          pContext, AudioEqualizer::GetInstanceSize(kNumBands)+sizeof(EqualizerContext));
 
     return 0;
@@ -183,7 +183,7 @@
 extern "C" int EffectRelease(effect_handle_t handle) {
     EqualizerContext * pContext = (EqualizerContext *)handle;
 
-    LOGV("EffectLibReleaseEffect %p", handle);
+    ALOGV("EffectLibReleaseEffect %p", handle);
     if (pContext == NULL) {
         return -EINVAL;
     }
@@ -199,7 +199,7 @@
                                    effect_descriptor_t *pDescriptor) {
 
     if (pDescriptor == NULL || uuid == NULL){
-        LOGV("EffectGetDescriptor() called with NULL pointer");
+        ALOGV("EffectGetDescriptor() called with NULL pointer");
         return -EINVAL;
     }
 
@@ -218,7 +218,7 @@
 
 #define CHECK_ARG(cond) {                     \
     if (!(cond)) {                            \
-        LOGV("Invalid argument: "#cond);      \
+        ALOGV("Invalid argument: "#cond);      \
         return -EINVAL;                       \
     }                                         \
 }
@@ -239,7 +239,7 @@
 
 int Equalizer_configure(EqualizerContext *pContext, effect_config_t *pConfig)
 {
-    LOGV("Equalizer_configure start");
+    ALOGV("Equalizer_configure start");
 
     CHECK_ARG(pContext != NULL);
     CHECK_ARG(pConfig != NULL);
@@ -292,7 +292,7 @@
 {
     int status;
 
-    LOGV("Equalizer_init start");
+    ALOGV("Equalizer_init start");
 
     CHECK_ARG(pContext != NULL);
 
@@ -416,13 +416,13 @@
     switch (param) {
     case EQ_PARAM_NUM_BANDS:
         *(uint16_t *)pValue = (uint16_t)kNumBands;
-        LOGV("Equalizer_getParameter() EQ_PARAM_NUM_BANDS %d", *(int16_t *)pValue);
+        ALOGV("Equalizer_getParameter() EQ_PARAM_NUM_BANDS %d", *(int16_t *)pValue);
         break;
 
     case EQ_PARAM_LEVEL_RANGE:
         *(int16_t *)pValue = -9600;
         *((int16_t *)pValue + 1) = 4800;
-        LOGV("Equalizer_getParameter() EQ_PARAM_LEVEL_RANGE min %d, max %d",
+        ALOGV("Equalizer_getParameter() EQ_PARAM_LEVEL_RANGE min %d, max %d",
              *(int32_t *)pValue, *((int32_t *)pValue + 1));
         break;
 
@@ -433,7 +433,7 @@
             break;
         }
         *(int16_t *)pValue = (int16_t)pEqualizer->getGain(param2);
-        LOGV("Equalizer_getParameter() EQ_PARAM_BAND_LEVEL band %d, level %d",
+        ALOGV("Equalizer_getParameter() EQ_PARAM_BAND_LEVEL band %d, level %d",
              param2, *(int32_t *)pValue);
         break;
 
@@ -444,7 +444,7 @@
             break;
         }
         *(int32_t *)pValue = pEqualizer->getFrequency(param2);
-        LOGV("Equalizer_getParameter() EQ_PARAM_CENTER_FREQ band %d, frequency %d",
+        ALOGV("Equalizer_getParameter() EQ_PARAM_CENTER_FREQ band %d, frequency %d",
              param2, *(int32_t *)pValue);
         break;
 
@@ -455,25 +455,25 @@
             break;
         }
         pEqualizer->getBandRange(param2, *(uint32_t *)pValue, *((uint32_t *)pValue + 1));
-        LOGV("Equalizer_getParameter() EQ_PARAM_BAND_FREQ_RANGE band %d, min %d, max %d",
+        ALOGV("Equalizer_getParameter() EQ_PARAM_BAND_FREQ_RANGE band %d, min %d, max %d",
              param2, *(int32_t *)pValue, *((int32_t *)pValue + 1));
         break;
 
     case EQ_PARAM_GET_BAND:
         param2 = *pParam;
         *(uint16_t *)pValue = (uint16_t)pEqualizer->getMostRelevantBand(param2);
-        LOGV("Equalizer_getParameter() EQ_PARAM_GET_BAND frequency %d, band %d",
+        ALOGV("Equalizer_getParameter() EQ_PARAM_GET_BAND frequency %d, band %d",
              param2, *(int32_t *)pValue);
         break;
 
     case EQ_PARAM_CUR_PRESET:
         *(uint16_t *)pValue = (uint16_t)pEqualizer->getPreset();
-        LOGV("Equalizer_getParameter() EQ_PARAM_CUR_PRESET %d", *(int32_t *)pValue);
+        ALOGV("Equalizer_getParameter() EQ_PARAM_CUR_PRESET %d", *(int32_t *)pValue);
         break;
 
     case EQ_PARAM_GET_NUM_OF_PRESETS:
         *(uint16_t *)pValue = (uint16_t)pEqualizer->getNumPresets();
-        LOGV("Equalizer_getParameter() EQ_PARAM_GET_NUM_OF_PRESETS %d", *(int16_t *)pValue);
+        ALOGV("Equalizer_getParameter() EQ_PARAM_GET_NUM_OF_PRESETS %d", *(int16_t *)pValue);
         break;
 
     case EQ_PARAM_GET_PRESET_NAME:
@@ -486,13 +486,13 @@
         strncpy(name, pEqualizer->getPresetName(param2), *pValueSize - 1);
         name[*pValueSize - 1] = 0;
         *pValueSize = strlen(name) + 1;
-        LOGV("Equalizer_getParameter() EQ_PARAM_GET_PRESET_NAME preset %d, name %s len %d",
+        ALOGV("Equalizer_getParameter() EQ_PARAM_GET_PRESET_NAME preset %d, name %s len %d",
              param2, gEqualizerPresets[param2].name, *pValueSize);
         break;
 
     case EQ_PARAM_PROPERTIES: {
         int16_t *p = (int16_t *)pValue;
-        LOGV("Equalizer_getParameter() EQ_PARAM_PROPERTIES");
+        ALOGV("Equalizer_getParameter() EQ_PARAM_PROPERTIES");
         p[0] = (int16_t)pEqualizer->getPreset();
         p[1] = (int16_t)kNumBands;
         for (int i = 0; i < kNumBands; i++) {
@@ -501,7 +501,7 @@
     } break;
 
     default:
-        LOGV("Equalizer_getParameter() invalid param %d", param);
+        ALOGV("Equalizer_getParameter() invalid param %d", param);
         status = -EINVAL;
         break;
     }
@@ -541,7 +541,7 @@
     case EQ_PARAM_CUR_PRESET:
         preset = (int32_t)(*(uint16_t *)pValue);
 
-        LOGV("setParameter() EQ_PARAM_CUR_PRESET %d", preset);
+        ALOGV("setParameter() EQ_PARAM_CUR_PRESET %d", preset);
         if (preset < 0 || preset >= pEqualizer->getNumPresets()) {
             status = -EINVAL;
             break;
@@ -552,7 +552,7 @@
     case EQ_PARAM_BAND_LEVEL:
         band =  *pParam;
         level = (int32_t)(*(int16_t *)pValue);
-        LOGV("setParameter() EQ_PARAM_BAND_LEVEL band %d, level %d", band, level);
+        ALOGV("setParameter() EQ_PARAM_BAND_LEVEL band %d, level %d", band, level);
         if (band >= kNumBands) {
             status = -EINVAL;
             break;
@@ -561,7 +561,7 @@
         pEqualizer->commit(true);
        break;
     case EQ_PARAM_PROPERTIES: {
-        LOGV("setParameter() EQ_PARAM_PROPERTIES");
+        ALOGV("setParameter() EQ_PARAM_PROPERTIES");
         int16_t *p = (int16_t *)pValue;
         if ((int)p[0] >= pEqualizer->getNumPresets()) {
             status = -EINVAL;
@@ -581,7 +581,7 @@
         pEqualizer->commit(true);
     } break;
     default:
-        LOGV("setParameter() invalid param %d", param);
+        ALOGV("setParameter() invalid param %d", param);
         status = -EINVAL;
         break;
     }
@@ -634,7 +634,7 @@
 
     android::AudioEqualizer * pEqualizer = pContext->pEqualizer;
 
-    LOGV("Equalizer_command command %d cmdSize %d",cmdCode, cmdSize);
+    ALOGV("Equalizer_command command %d cmdSize %d",cmdCode, cmdSize);
 
     switch (cmdCode) {
     case EFFECT_CMD_INIT:
@@ -666,14 +666,14 @@
         p->status = android::Equalizer_getParameter(pEqualizer, (int32_t *)p->data, &p->vsize,
                 p->data + voffset);
         *replySize = sizeof(effect_param_t) + voffset + p->vsize;
-        LOGV("Equalizer_command EFFECT_CMD_GET_PARAM *pCmdData %d, *replySize %d, *pReplyData %08x %08x",
+        ALOGV("Equalizer_command EFFECT_CMD_GET_PARAM *pCmdData %d, *replySize %d, *pReplyData %08x %08x",
                 *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)), *replySize,
                 *(int32_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset),
                 *(int32_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset + sizeof(int32_t)));
 
         } break;
     case EFFECT_CMD_SET_PARAM: {
-        LOGV("Equalizer_command EFFECT_CMD_SET_PARAM cmdSize %d pCmdData %p, *replySize %d, pReplyData %p",
+        ALOGV("Equalizer_command EFFECT_CMD_SET_PARAM cmdSize %d pCmdData %p, *replySize %d, pReplyData %p",
              cmdSize, pCmdData, *replySize, pReplyData);
         if (pCmdData == NULL || cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
             pReplyData == NULL || *replySize != sizeof(int32_t)) {
@@ -691,7 +691,7 @@
             return -ENOSYS;
         }
         pContext->state = EQUALIZER_STATE_ACTIVE;
-        LOGV("EFFECT_CMD_ENABLE() OK");
+        ALOGV("EFFECT_CMD_ENABLE() OK");
         *(int *)pReplyData = 0;
         break;
     case EFFECT_CMD_DISABLE:
@@ -702,7 +702,7 @@
             return -ENOSYS;
         }
         pContext->state = EQUALIZER_STATE_INITIALIZED;
-        LOGV("EFFECT_CMD_DISABLE() OK");
+        ALOGV("EFFECT_CMD_DISABLE() OK");
         *(int *)pReplyData = 0;
         break;
     case EFFECT_CMD_SET_DEVICE:
@@ -723,7 +723,7 @@
     android::EqualizerContext * pContext = (android::EqualizerContext *) self;
 
     if (pContext == NULL || pDescriptor == NULL) {
-        LOGV("Equalizer_getDescriptor() invalid param");
+        ALOGV("Equalizer_getDescriptor() invalid param");
         return -EINVAL;
     }
 
diff --git a/media/libeffects/testlibs/EffectReverb.c b/media/libeffects/testlibs/EffectReverb.c
index 405f908..1da8d32 100644
--- a/media/libeffects/testlibs/EffectReverb.c
+++ b/media/libeffects/testlibs/EffectReverb.c
@@ -122,7 +122,7 @@
     int aux = 0;
     int preset = 0;
 
-    LOGV("EffectLibCreateEffect start");
+    ALOGV("EffectLibCreateEffect start");
 
     if (pHandle == NULL || uuid == NULL) {
         return -EINVAL;
@@ -163,7 +163,7 @@
 
     module->context.mState = REVERB_STATE_INITIALIZED;
 
-    LOGV("EffectLibCreateEffect %p ,size %d", module, sizeof(reverb_module_t));
+    ALOGV("EffectLibCreateEffect %p ,size %d", module, sizeof(reverb_module_t));
 
     return 0;
 }
@@ -171,7 +171,7 @@
 int EffectRelease(effect_handle_t handle) {
     reverb_module_t *pRvbModule = (reverb_module_t *)handle;
 
-    LOGV("EffectLibReleaseEffect %p", handle);
+    ALOGV("EffectLibReleaseEffect %p", handle);
     if (handle == NULL) {
         return -EINVAL;
     }
@@ -188,14 +188,14 @@
     int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
 
     if (pDescriptor == NULL || uuid == NULL){
-        LOGV("EffectGetDescriptor() called with NULL pointer");
+        ALOGV("EffectGetDescriptor() called with NULL pointer");
         return -EINVAL;
     }
 
     for (i = 0; i < length; i++) {
         if (memcmp(uuid, &gDescriptors[i]->uuid, sizeof(effect_uuid_t)) == 0) {
             memcpy(pDescriptor, gDescriptors[i], sizeof(effect_descriptor_t));
-            LOGV("EffectGetDescriptor - UUID matched Reverb type %d, UUID = %x",
+            ALOGV("EffectGetDescriptor - UUID matched Reverb type %d, UUID = %x",
                  i, gDescriptors[i]->uuid.timeLow);
             return 0;
         }
@@ -306,7 +306,7 @@
 
     pReverb = (reverb_object_t*) &pRvbModule->context;
 
-    LOGV("Reverb_Command command %d cmdSize %d",cmdCode, cmdSize);
+    ALOGV("Reverb_Command command %d cmdSize %d",cmdCode, cmdSize);
 
     switch (cmdCode) {
     case EFFECT_CMD_INIT:
@@ -330,7 +330,7 @@
         Reverb_Reset(pReverb, false);
         break;
     case EFFECT_CMD_GET_PARAM:
-        LOGV("Reverb_Command EFFECT_CMD_GET_PARAM pCmdData %p, *replySize %d, pReplyData: %p",pCmdData, *replySize, pReplyData);
+        ALOGV("Reverb_Command EFFECT_CMD_GET_PARAM pCmdData %p, *replySize %d, pReplyData: %p",pCmdData, *replySize, pReplyData);
 
         if (pCmdData == NULL || cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
             pReplyData == NULL || *replySize < (int) sizeof(effect_param_t)) {
@@ -338,13 +338,13 @@
         }
         effect_param_t *rep = (effect_param_t *) pReplyData;
         memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + sizeof(int32_t));
-        LOGV("Reverb_Command EFFECT_CMD_GET_PARAM param %d, replySize %d",*(int32_t *)rep->data, rep->vsize);
+        ALOGV("Reverb_Command EFFECT_CMD_GET_PARAM param %d, replySize %d",*(int32_t *)rep->data, rep->vsize);
         rep->status = Reverb_getParameter(pReverb, *(int32_t *)rep->data, &rep->vsize,
                 rep->data + sizeof(int32_t));
         *replySize = sizeof(effect_param_t) + sizeof(int32_t) + rep->vsize;
         break;
     case EFFECT_CMD_SET_PARAM:
-        LOGV("Reverb_Command EFFECT_CMD_SET_PARAM cmdSize %d pCmdData %p, *replySize %d, pReplyData %p",
+        ALOGV("Reverb_Command EFFECT_CMD_SET_PARAM cmdSize %d pCmdData %p, *replySize %d, pReplyData %p",
                 cmdSize, pCmdData, *replySize, pReplyData);
         if (pCmdData == NULL || (cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)))
                 || pReplyData == NULL || *replySize != (int)sizeof(int32_t)) {
@@ -362,7 +362,7 @@
             return -ENOSYS;
         }
         pReverb->mState = REVERB_STATE_ACTIVE;
-        LOGV("EFFECT_CMD_ENABLE() OK");
+        ALOGV("EFFECT_CMD_ENABLE() OK");
         *(int *)pReplyData = 0;
         break;
     case EFFECT_CMD_DISABLE:
@@ -373,14 +373,14 @@
             return -ENOSYS;
         }
         pReverb->mState = REVERB_STATE_INITIALIZED;
-        LOGV("EFFECT_CMD_DISABLE() OK");
+        ALOGV("EFFECT_CMD_DISABLE() OK");
         *(int *)pReplyData = 0;
         break;
     case EFFECT_CMD_SET_DEVICE:
         if (pCmdData == NULL || cmdSize != (int)sizeof(uint32_t)) {
             return -EINVAL;
         }
-        LOGV("Reverb_Command EFFECT_CMD_SET_DEVICE: 0x%08x", *(uint32_t *)pCmdData);
+        ALOGV("Reverb_Command EFFECT_CMD_SET_DEVICE: 0x%08x", *(uint32_t *)pCmdData);
         break;
     case EFFECT_CMD_SET_VOLUME: {
         // audio output is always stereo => 2 channel volumes
@@ -389,14 +389,14 @@
         }
         float left = (float)(*(uint32_t *)pCmdData) / (1 << 24);
         float right = (float)(*((uint32_t *)pCmdData + 1)) / (1 << 24);
-        LOGV("Reverb_Command EFFECT_CMD_SET_VOLUME: left %f, right %f ", left, right);
+        ALOGV("Reverb_Command EFFECT_CMD_SET_VOLUME: left %f, right %f ", left, right);
         break;
         }
     case EFFECT_CMD_SET_AUDIO_MODE:
         if (pCmdData == NULL || cmdSize != (int)sizeof(uint32_t)) {
             return -EINVAL;
         }
-        LOGV("Reverb_Command EFFECT_CMD_SET_AUDIO_MODE: %d", *(uint32_t *)pCmdData);
+        ALOGV("Reverb_Command EFFECT_CMD_SET_AUDIO_MODE: %d", *(uint32_t *)pCmdData);
         break;
     default:
         LOGW("Reverb_Command invalid command %d",cmdCode);
@@ -464,7 +464,7 @@
 int Reverb_Init(reverb_module_t *pRvbModule, int aux, int preset) {
     int ret;
 
-    LOGV("Reverb_Init module %p, aux: %d, preset: %d", pRvbModule,aux, preset);
+    ALOGV("Reverb_Init module %p, aux: %d, preset: %d", pRvbModule,aux, preset);
 
     memset(&pRvbModule->context, 0, sizeof(reverb_object_t));
 
@@ -494,7 +494,7 @@
 
     ret = Reverb_Configure(pRvbModule, &pRvbModule->config, true);
     if (ret < 0) {
-        LOGV("Reverb_Init error %d on module %p", ret, pRvbModule);
+        ALOGV("Reverb_Init error %d on module %p", ret, pRvbModule);
     }
 
     return ret;
@@ -531,12 +531,12 @@
         || pConfig->outputCfg.channels != OUTPUT_CHANNELS
         || pConfig->inputCfg.format != AUDIO_FORMAT_PCM_16_BIT
         || pConfig->outputCfg.format != AUDIO_FORMAT_PCM_16_BIT) {
-        LOGV("Reverb_Configure invalid config");
+        ALOGV("Reverb_Configure invalid config");
         return -EINVAL;
     }
     if ((pReverb->m_Aux && (pConfig->inputCfg.channels != AUDIO_CHANNEL_OUT_MONO)) ||
         (!pReverb->m_Aux && (pConfig->inputCfg.channels != AUDIO_CHANNEL_OUT_STEREO))) {
-        LOGV("Reverb_Configure invalid config");
+        ALOGV("Reverb_Configure invalid config");
         return -EINVAL;
     }
 
@@ -576,7 +576,7 @@
         pReverb->m_nCosWT_5KHz = 25997;
         break;
     default:
-        LOGV("Reverb_Configure invalid sampling rate %d", pReverb->m_nSamplingRate);
+        ALOGV("Reverb_Configure invalid sampling rate %d", pReverb->m_nSamplingRate);
         return -EINVAL;
     }
 
@@ -761,7 +761,7 @@
         } else {
             *pValue16 = (int16_t)(pReverb->m_nNextRoom + 1);
         }
-        LOGV("get REVERB_PARAM_PRESET, preset %d", *pValue16);
+        ALOGV("get REVERB_PARAM_PRESET, preset %d", *pValue16);
     } else {
         switch (param) {
         case REVERB_PARAM_ROOM_LEVEL:
@@ -812,7 +812,7 @@
                     / (32767 - pReverb->m_nRoomLpfFbk);
             *pValue16 = Effects_Linear16ToMillibels(temp);
 
-            LOGV("get REVERB_PARAM_ROOM_LEVEL %d, gain %d, m_nRoomLpfFwd %d, m_nRoomLpfFbk %d", *pValue16, temp, pReverb->m_nRoomLpfFwd, pReverb->m_nRoomLpfFbk);
+            ALOGV("get REVERB_PARAM_ROOM_LEVEL %d, gain %d, m_nRoomLpfFwd %d, m_nRoomLpfFbk %d", *pValue16, temp, pReverb->m_nRoomLpfFwd, pReverb->m_nRoomLpfFbk);
 
             if (param == REVERB_PARAM_ROOM_LEVEL) {
                 break;
@@ -827,17 +827,17 @@
             // - C is cos(2piWT) @ 5000Hz: pReverb->m_nCosWT_5KHz
 
             temp = MULT_EG1_EG1(pReverb->m_nRoomLpfFbk, pReverb->m_nRoomLpfFbk);
-            LOGV("get REVERB_PARAM_ROOM_HF_LEVEL, a1^2 %d", temp);
+            ALOGV("get REVERB_PARAM_ROOM_HF_LEVEL, a1^2 %d", temp);
             temp2 = MULT_EG1_EG1(pReverb->m_nRoomLpfFbk, pReverb->m_nCosWT_5KHz)
                     << 1;
-            LOGV("get REVERB_PARAM_ROOM_HF_LEVEL, 2 Cos a1 %d", temp2);
+            ALOGV("get REVERB_PARAM_ROOM_HF_LEVEL, 2 Cos a1 %d", temp2);
             temp = 32767 + temp - temp2;
-            LOGV("get REVERB_PARAM_ROOM_HF_LEVEL, a1^2 + 2 Cos a1 + 1 %d", temp);
+            ALOGV("get REVERB_PARAM_ROOM_HF_LEVEL, a1^2 + 2 Cos a1 + 1 %d", temp);
             temp = Effects_Sqrt(temp) * 181;
-            LOGV("get REVERB_PARAM_ROOM_HF_LEVEL, SQRT(a1^2 + 2 Cos a1 + 1) %d", temp);
+            ALOGV("get REVERB_PARAM_ROOM_HF_LEVEL, SQRT(a1^2 + 2 Cos a1 + 1) %d", temp);
             temp = ((32767 - pReverb->m_nRoomLpfFbk) << 15) / temp;
 
-            LOGV("get REVERB_PARAM_ROOM_HF_LEVEL, gain %d, m_nRoomLpfFwd %d, m_nRoomLpfFbk %d", temp, pReverb->m_nRoomLpfFwd, pReverb->m_nRoomLpfFbk);
+            ALOGV("get REVERB_PARAM_ROOM_HF_LEVEL, gain %d, m_nRoomLpfFwd %d, m_nRoomLpfFbk %d", temp, pReverb->m_nRoomLpfFwd, pReverb->m_nRoomLpfFbk);
 
             *pValue16 = Effects_Linear16ToMillibels(temp);
 
@@ -858,7 +858,7 @@
             // Convert samples to ms
             *pValue32 = (temp * 1000) / pReverb->m_nSamplingRate;
 
-            LOGV("get REVERB_PARAM_DECAY_TIME, samples %d, ms %d", temp, *pValue32);
+            ALOGV("get REVERB_PARAM_DECAY_TIME, samples %d, ms %d", temp, *pValue32);
 
             if (param == REVERB_PARAM_DECAY_TIME) {
                 break;
@@ -877,7 +877,7 @@
             // - C is cos(2piWT) @ 5000Hz: pReverb->m_nCosWT_5KHz
             if (pReverb->m_nRvbLpfFbk == 0) {
                 *pValue16 = 1000;
-                LOGV("get REVERB_PARAM_DECAY_HF_RATIO, pReverb->m_nRvbLpfFbk == 0, ratio %d", *pValue16);
+                ALOGV("get REVERB_PARAM_DECAY_HF_RATIO, pReverb->m_nRvbLpfFbk == 0, ratio %d", *pValue16);
             } else {
                 temp = MULT_EG1_EG1(pReverb->m_nRvbLpfFbk, pReverb->m_nRvbLpfFbk);
                 temp2 = MULT_EG1_EG1(pReverb->m_nRvbLpfFbk, pReverb->m_nCosWT_5KHz)
@@ -891,7 +891,7 @@
 
                 temp = Effects_Linear16ToMillibels(temp);
                 temp2 = Effects_Linear16ToMillibels(temp2);
-                LOGV("get REVERB_PARAM_DECAY_HF_RATIO, gain 5KHz %d mB, gain DC %d mB", temp, temp2);
+                ALOGV("get REVERB_PARAM_DECAY_HF_RATIO, gain 5KHz %d mB, gain DC %d mB", temp, temp2);
 
                 if (temp == 0)
                     temp = 1;
@@ -900,7 +900,7 @@
                     temp = 1000;
 
                 *pValue16 = temp;
-                LOGV("get REVERB_PARAM_DECAY_HF_RATIO, ratio %d", *pValue16);
+                ALOGV("get REVERB_PARAM_DECAY_HF_RATIO, ratio %d", *pValue16);
             }
 
             if (param == REVERB_PARAM_DECAY_HF_RATIO) {
@@ -912,7 +912,7 @@
         case REVERB_PARAM_REFLECTIONS_LEVEL:
             *pValue16 = Effects_Linear16ToMillibels(pReverb->m_nEarlyGain);
 
-            LOGV("get REVERB_PARAM_REFLECTIONS_LEVEL, %d", *pValue16);
+            ALOGV("get REVERB_PARAM_REFLECTIONS_LEVEL, %d", *pValue16);
             if (param == REVERB_PARAM_REFLECTIONS_LEVEL) {
                 break;
             }
@@ -923,7 +923,7 @@
             // convert samples to ms
             *pValue32 = (pReverb->m_nEarlyDelay * 1000) / pReverb->m_nSamplingRate;
 
-            LOGV("get REVERB_PARAM_REFLECTIONS_DELAY, samples %d, ms %d", pReverb->m_nEarlyDelay, *pValue32);
+            ALOGV("get REVERB_PARAM_REFLECTIONS_DELAY, samples %d, ms %d", pReverb->m_nEarlyDelay, *pValue32);
 
             if (param == REVERB_PARAM_REFLECTIONS_DELAY) {
                 break;
@@ -935,7 +935,7 @@
             // Convert linear gain to millibels
             *pValue16 = Effects_Linear16ToMillibels(pReverb->m_nLateGain << 2);
 
-            LOGV("get REVERB_PARAM_REVERB_LEVEL %d", *pValue16);
+            ALOGV("get REVERB_PARAM_REVERB_LEVEL %d", *pValue16);
 
             if (param == REVERB_PARAM_REVERB_LEVEL) {
                 break;
@@ -947,7 +947,7 @@
             // convert samples to ms
             *pValue32 = (pReverb->m_nLateDelay * 1000) / pReverb->m_nSamplingRate;
 
-            LOGV("get REVERB_PARAM_REVERB_DELAY, samples %d, ms %d", pReverb->m_nLateDelay, *pValue32);
+            ALOGV("get REVERB_PARAM_REVERB_DELAY, samples %d, ms %d", pReverb->m_nLateDelay, *pValue32);
 
             if (param == REVERB_PARAM_REVERB_DELAY) {
                 break;
@@ -965,7 +965,7 @@
                 temp = 1000;
 
             *pValue16 = temp;
-            LOGV("get REVERB_PARAM_DIFFUSION, %d, AP0 gain %d", *pValue16, pReverb->m_sAp0.m_nApGain);
+            ALOGV("get REVERB_PARAM_DIFFUSION, %d, AP0 gain %d", *pValue16, pReverb->m_sAp0.m_nApGain);
 
             if (param == REVERB_PARAM_DIFFUSION) {
                 break;
@@ -987,7 +987,7 @@
 
             *pValue16 = temp;
 
-            LOGV("get REVERB_PARAM_DENSITY, %d, AP0 delay smps %d", *pValue16, pReverb->m_sAp0.m_zApOut - pReverb->m_sAp0.m_zApIn);
+            ALOGV("get REVERB_PARAM_DENSITY, %d, AP0 delay smps %d", *pValue16, pReverb->m_sAp0.m_zApOut - pReverb->m_sAp0.m_zApIn);
             break;
 
         default:
@@ -997,7 +997,7 @@
 
     *pSize = size;
 
-    LOGV("Reverb_getParameter, context %p, param %d, value %d",
+    ALOGV("Reverb_getParameter, context %p, param %d, value %d",
             pReverb, param, *(int *)pValue);
 
     return 0;
@@ -1035,7 +1035,7 @@
     int32_t averageDelay;
     size_t paramSize;
 
-    LOGV("Reverb_setParameter, context %p, param %d, value16 %d, value32 %d",
+    ALOGV("Reverb_setParameter, context %p, param %d, value16 %d, value32 %d",
             pReverb, param, *(int16_t *)pValue, *(int32_t *)pValue);
 
     if (pReverb->m_Preset) {
@@ -1043,7 +1043,7 @@
             return -EINVAL;
         }
         value16 = *(int16_t *)pValue;
-        LOGV("set REVERB_PARAM_PRESET, preset %d", value16);
+        ALOGV("set REVERB_PARAM_PRESET, preset %d", value16);
         if (value16 < REVERB_PRESET_NONE || value16 > REVERB_PRESET_PLATE) {
             return -EINVAL;
         }
@@ -1114,7 +1114,7 @@
             pReverb->m_nRoomLpfFwd
                     = MULT_EG1_EG1(temp, (32767 - pReverb->m_nRoomLpfFbk));
 
-            LOGV("REVERB_PARAM_ROOM_LEVEL, gain %d, new m_nRoomLpfFwd %d, m_nRoomLpfFbk %d", temp, pReverb->m_nRoomLpfFwd, pReverb->m_nRoomLpfFbk);
+            ALOGV("REVERB_PARAM_ROOM_LEVEL, gain %d, new m_nRoomLpfFwd %d, m_nRoomLpfFbk %d", temp, pReverb->m_nRoomLpfFwd, pReverb->m_nRoomLpfFbk);
             if (param == REVERB_PARAM_ROOM_LEVEL)
                 break;
             value16 = pProperties->roomHFLevel;
@@ -1142,11 +1142,11 @@
 
                 // dG^2
                 temp = Effects_MillibelsToLinear16(value16);
-                LOGV("REVERB_PARAM_ROOM_HF_LEVEL, HF gain %d", temp);
+                ALOGV("REVERB_PARAM_ROOM_HF_LEVEL, HF gain %d", temp);
                 temp = (1 << 30) / temp;
-                LOGV("REVERB_PARAM_ROOM_HF_LEVEL, 1/ HF gain %d", temp);
+                ALOGV("REVERB_PARAM_ROOM_HF_LEVEL, 1/ HF gain %d", temp);
                 dG2 = (int32_t) (((int64_t) temp * (int64_t) temp) >> 15);
-                LOGV("REVERB_PARAM_ROOM_HF_LEVEL, 1/ HF gain ^ 2 %d", dG2);
+                ALOGV("REVERB_PARAM_ROOM_HF_LEVEL, 1/ HF gain ^ 2 %d", dG2);
                 // b = 2*(C-dG^2)/(1-dG^2)
                 b = (int32_t) ((((int64_t) 1 << (15 + 1))
                         * ((int64_t) pReverb->m_nCosWT_5KHz - (int64_t) dG2))
@@ -1156,18 +1156,18 @@
                 delta = (int32_t) ((((int64_t) b * (int64_t) b) >> 15) - (1 << (15
                         + 2)));
 
-                LOGV_IF(delta > (1<<30), " delta overflow %d", delta);
+                ALOGV_IF(delta > (1<<30), " delta overflow %d", delta);
 
-                LOGV("REVERB_PARAM_ROOM_HF_LEVEL, dG2 %d, b %d, delta %d, m_nCosWT_5KHz %d", dG2, b, delta, pReverb->m_nCosWT_5KHz);
+                ALOGV("REVERB_PARAM_ROOM_HF_LEVEL, dG2 %d, b %d, delta %d, m_nCosWT_5KHz %d", dG2, b, delta, pReverb->m_nCosWT_5KHz);
                 // m_nRoomLpfFbk = -a1 = - (- b + sqrt(delta)) / 2
                 pReverb->m_nRoomLpfFbk = (b - Effects_Sqrt(delta) * 181) >> 1;
             }
-            LOGV("REVERB_PARAM_ROOM_HF_LEVEL, olg DC gain %d new m_nRoomLpfFbk %d, old m_nRoomLpfFwd %d",
+            ALOGV("REVERB_PARAM_ROOM_HF_LEVEL, olg DC gain %d new m_nRoomLpfFbk %d, old m_nRoomLpfFwd %d",
                     temp2, pReverb->m_nRoomLpfFbk, pReverb->m_nRoomLpfFwd);
 
             pReverb->m_nRoomLpfFwd
                     = MULT_EG1_EG1(temp2, (32767 - pReverb->m_nRoomLpfFbk));
-            LOGV("REVERB_PARAM_ROOM_HF_LEVEL, new m_nRoomLpfFwd %d", pReverb->m_nRoomLpfFwd);
+            ALOGV("REVERB_PARAM_ROOM_HF_LEVEL, new m_nRoomLpfFwd %d", pReverb->m_nRoomLpfFwd);
 
             if (param == REVERB_PARAM_ROOM_HF_LEVEL)
                 break;
@@ -1189,7 +1189,7 @@
                     + (pReverb->m_sAp1.m_zApOut - pReverb->m_sAp1.m_zApIn)) >> 1;
 
             temp = (-6000 * averageDelay) / value32;
-            LOGV("REVERB_PARAM_DECAY_TIME, delay smps %d, DT smps %d, gain mB %d",averageDelay, value32, temp);
+            ALOGV("REVERB_PARAM_DECAY_TIME, delay smps %d, DT smps %d, gain mB %d",averageDelay, value32, temp);
             if (temp < -4000 || temp > -100)
                 return -EINVAL;
 
@@ -1202,7 +1202,7 @@
             pReverb->m_nRvbLpfFwd
                     = MULT_EG1_EG1(temp, (32767 - pReverb->m_nRvbLpfFbk));
 
-            LOGV("REVERB_PARAM_DECAY_TIME, gain %d, new m_nRvbLpfFwd %d, old m_nRvbLpfFbk %d, reverb gain %d", temp, pReverb->m_nRvbLpfFwd, pReverb->m_nRvbLpfFbk, Effects_Linear16ToMillibels(pReverb->m_nLateGain));
+            ALOGV("REVERB_PARAM_DECAY_TIME, gain %d, new m_nRvbLpfFwd %d, old m_nRvbLpfFbk %d, reverb gain %d", temp, pReverb->m_nRvbLpfFwd, pReverb->m_nRvbLpfFbk, Effects_Linear16ToMillibels(pReverb->m_nLateGain));
 
             if (param == REVERB_PARAM_DECAY_TIME)
                 break;
@@ -1229,17 +1229,17 @@
                 // G_5000Hz = G_DC * (1000/REVERB_PARAM_DECAY_HF_RATIO) in millibels
 
                 value32 = ((int32_t) 1000 << 15) / (int32_t) value16;
-                LOGV("REVERB_PARAM_DECAY_HF_RATIO, DC gain %d, DC gain mB %d, 1000/R %d", temp2, temp, value32);
+                ALOGV("REVERB_PARAM_DECAY_HF_RATIO, DC gain %d, DC gain mB %d, 1000/R %d", temp2, temp, value32);
 
                 temp = (int32_t) (((int64_t) temp * (int64_t) value32) >> 15);
 
                 if (temp < -4000) {
-                    LOGV("REVERB_PARAM_DECAY_HF_RATIO HF gain overflow %d mB", temp);
+                    ALOGV("REVERB_PARAM_DECAY_HF_RATIO HF gain overflow %d mB", temp);
                     temp = -4000;
                 }
 
                 temp = Effects_MillibelsToLinear16(temp);
-                LOGV("REVERB_PARAM_DECAY_HF_RATIO, HF gain %d", temp);
+                ALOGV("REVERB_PARAM_DECAY_HF_RATIO, HF gain %d", temp);
                 // dG^2
                 temp = (temp2 << 15) / temp;
                 dG2 = (int32_t) (((int64_t) temp * (int64_t) temp) >> 15);
@@ -1256,11 +1256,11 @@
                 // m_nRoomLpfFbk = -a1 = - (- b + sqrt(delta)) / 2
                 pReverb->m_nRvbLpfFbk = (b - Effects_Sqrt(delta) * 181) >> 1;
 
-                LOGV("REVERB_PARAM_DECAY_HF_RATIO, dG2 %d, b %d, delta %d", dG2, b, delta);
+                ALOGV("REVERB_PARAM_DECAY_HF_RATIO, dG2 %d, b %d, delta %d", dG2, b, delta);
 
             }
 
-            LOGV("REVERB_PARAM_DECAY_HF_RATIO, gain %d, m_nRvbLpfFbk %d, m_nRvbLpfFwd %d", temp2, pReverb->m_nRvbLpfFbk, pReverb->m_nRvbLpfFwd);
+            ALOGV("REVERB_PARAM_DECAY_HF_RATIO, gain %d, m_nRvbLpfFbk %d, m_nRvbLpfFwd %d", temp2, pReverb->m_nRvbLpfFbk, pReverb->m_nRvbLpfFwd);
 
             pReverb->m_nRvbLpfFwd
                     = MULT_EG1_EG1(temp2, (32767 - pReverb->m_nRvbLpfFbk));
@@ -1284,7 +1284,7 @@
                         = MULT_EG1_EG1(pPreset->m_sEarlyR.m_nGain[i],value16);
             }
             pReverb->m_nEarlyGain = value16;
-            LOGV("REVERB_PARAM_REFLECTIONS_LEVEL, m_nEarlyGain %d", pReverb->m_nEarlyGain);
+            ALOGV("REVERB_PARAM_REFLECTIONS_LEVEL, m_nEarlyGain %d", pReverb->m_nEarlyGain);
 
             if (param == REVERB_PARAM_REFLECTIONS_LEVEL)
                 break;
@@ -1315,7 +1315,7 @@
             }
             pReverb->m_nEarlyDelay = temp;
 
-            LOGV("REVERB_PARAM_REFLECTIONS_DELAY, m_nEarlyDelay smps %d max smp delay %d", pReverb->m_nEarlyDelay, maxSamples);
+            ALOGV("REVERB_PARAM_REFLECTIONS_DELAY, m_nEarlyDelay smps %d max smp delay %d", pReverb->m_nEarlyDelay, maxSamples);
 
             // Convert milliseconds to sample count => m_nEarlyDelay
             if (param == REVERB_PARAM_REFLECTIONS_DELAY)
@@ -1330,7 +1330,7 @@
             // Convert millibels to linear 16 bits (gange 0 - 8191) => m_nLateGain.
             pReverb->m_nLateGain = Effects_MillibelsToLinear16(value16) >> 2;
 
-            LOGV("REVERB_PARAM_REVERB_LEVEL, m_nLateGain %d", pReverb->m_nLateGain);
+            ALOGV("REVERB_PARAM_REVERB_LEVEL, m_nLateGain %d", pReverb->m_nLateGain);
 
             if (param == REVERB_PARAM_REVERB_LEVEL)
                 break;
@@ -1359,7 +1359,7 @@
             pReverb->m_nDelay1Out += temp;
             pReverb->m_nLateDelay += temp;
 
-            LOGV("REVERB_PARAM_REVERB_DELAY, m_nLateDelay smps %d max smp delay %d", pReverb->m_nLateDelay, maxSamples);
+            ALOGV("REVERB_PARAM_REVERB_DELAY, m_nLateDelay smps %d max smp delay %d", pReverb->m_nLateDelay, maxSamples);
 
             // Convert milliseconds to sample count => m_nDelay1Out + m_nMaxExcursion
             if (param == REVERB_PARAM_REVERB_DELAY)
@@ -1378,7 +1378,7 @@
             pReverb->m_sAp1.m_nApGain = AP1_GAIN_BASE + ((int32_t) value16
                     * AP1_GAIN_RANGE) / 1000;
 
-            LOGV("REVERB_PARAM_DIFFUSION, m_sAp0.m_nApGain %d m_sAp1.m_nApGain %d", pReverb->m_sAp0.m_nApGain, pReverb->m_sAp1.m_nApGain);
+            ALOGV("REVERB_PARAM_DIFFUSION, m_sAp0.m_nApGain %d m_sAp1.m_nApGain %d", pReverb->m_sAp0.m_nApGain, pReverb->m_sAp1.m_nApGain);
 
             if (param == REVERB_PARAM_DIFFUSION)
                 break;
@@ -1400,7 +1400,7 @@
                 temp = maxSamples;
             pReverb->m_sAp0.m_zApOut = (uint16_t) (pReverb->m_sAp0.m_zApIn + temp);
 
-            LOGV("REVERB_PARAM_DENSITY, Ap0 delay smps %d", temp);
+            ALOGV("REVERB_PARAM_DENSITY, Ap0 delay smps %d", temp);
 
             temp = AP1_TIME_BASE + ((int32_t) value16 * AP1_TIME_RANGE) / 1000;
             /*lint -e{702} shift for performance */
@@ -1409,7 +1409,7 @@
                 temp = maxSamples;
             pReverb->m_sAp1.m_zApOut = (uint16_t) (pReverb->m_sAp1.m_zApIn + temp);
 
-            LOGV("Ap1 delay smps %d", temp);
+            ALOGV("Ap1 delay smps %d", temp);
 
             break;
 
diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp
index 1a06cc6..e9b8042 100644
--- a/media/libeffects/visualizer/EffectVisualizer.cpp
+++ b/media/libeffects/visualizer/EffectVisualizer.cpp
@@ -93,7 +93,7 @@
 
 int Visualizer_configure(VisualizerContext *pContext, effect_config_t *pConfig)
 {
-    LOGV("Visualizer_configure start");
+    ALOGV("Visualizer_configure start");
 
     if (pConfig->inputCfg.samplingRate != pConfig->outputCfg.samplingRate) return -EINVAL;
     if (pConfig->inputCfg.channels != pConfig->outputCfg.channels) return -EINVAL;
@@ -201,7 +201,7 @@
 
     pContext->mState = VISUALIZER_STATE_INITIALIZED;
 
-    LOGV("VisualizerLib_Create %p", pContext);
+    ALOGV("VisualizerLib_Create %p", pContext);
 
     return 0;
 
@@ -210,7 +210,7 @@
 int VisualizerLib_Release(effect_handle_t handle) {
     VisualizerContext * pContext = (VisualizerContext *)handle;
 
-    LOGV("VisualizerLib_Release %p", handle);
+    ALOGV("VisualizerLib_Release %p", handle);
     if (pContext == NULL) {
         return -EINVAL;
     }
@@ -224,7 +224,7 @@
                                 effect_descriptor_t *pDescriptor) {
 
     if (pDescriptor == NULL || uuid == NULL){
-        LOGV("VisualizerLib_GetDescriptor() called with NULL pointer");
+        ALOGV("VisualizerLib_GetDescriptor() called with NULL pointer");
         return -EINVAL;
     }
 
@@ -328,7 +328,7 @@
         return -EINVAL;
     }
 
-//    LOGV("Visualizer_command command %d cmdSize %d",cmdCode, cmdSize);
+//    ALOGV("Visualizer_command command %d cmdSize %d",cmdCode, cmdSize);
 
     switch (cmdCode) {
     case EFFECT_CMD_INIT:
@@ -356,7 +356,7 @@
             return -ENOSYS;
         }
         pContext->mState = VISUALIZER_STATE_ACTIVE;
-        LOGV("EFFECT_CMD_ENABLE() OK");
+        ALOGV("EFFECT_CMD_ENABLE() OK");
         *(int *)pReplyData = 0;
         break;
     case EFFECT_CMD_DISABLE:
@@ -367,7 +367,7 @@
             return -ENOSYS;
         }
         pContext->mState = VISUALIZER_STATE_INITIALIZED;
-        LOGV("EFFECT_CMD_DISABLE() OK");
+        ALOGV("EFFECT_CMD_DISABLE() OK");
         *(int *)pReplyData = 0;
         break;
     case EFFECT_CMD_GET_PARAM: {
@@ -386,7 +386,7 @@
             p->status = -EINVAL;
             break;
         }
-        LOGV("get mCaptureSize = %d", pContext->mCaptureSize);
+        ALOGV("get mCaptureSize = %d", pContext->mCaptureSize);
         *((uint32_t *)p->data + 1) = pContext->mCaptureSize;
         p->vsize = sizeof(uint32_t);
         *replySize += sizeof(uint32_t);
@@ -406,7 +406,7 @@
             break;;
         }
         pContext->mCaptureSize = *((uint32_t *)p->data + 1);
-        LOGV("set mCaptureSize = %d", pContext->mCaptureSize);
+        ALOGV("set mCaptureSize = %d", pContext->mCaptureSize);
         } break;
     case EFFECT_CMD_SET_DEVICE:
     case EFFECT_CMD_SET_VOLUME:
@@ -416,7 +416,7 @@
 
     case VISUALIZER_CMD_CAPTURE:
         if (pReplyData == NULL || *replySize != pContext->mCaptureSize) {
-            LOGV("VISUALIZER_CMD_CAPTURE() error *replySize %d pContext->mCaptureSize %d",
+            ALOGV("VISUALIZER_CMD_CAPTURE() error *replySize %d pContext->mCaptureSize %d",
                     *replySize, pContext->mCaptureSize);
             return -EINVAL;
         }
@@ -459,7 +459,7 @@
     VisualizerContext * pContext = (VisualizerContext *) self;
 
     if (pContext == NULL || pDescriptor == NULL) {
-        LOGV("Visualizer_getDescriptor() invalid param");
+        ALOGV("Visualizer_getDescriptor() invalid param");
         return -EINVAL;
     }
 
diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp
index 0633744..6e53a15 100644
--- a/media/libmedia/AudioEffect.cpp
+++ b/media/libmedia/AudioEffect.cpp
@@ -69,7 +69,7 @@
     effect_uuid_t uuid;
     effect_uuid_t *pUuid = NULL;
 
-    LOGV("Constructor string\n - type: %s\n - uuid: %s", typeStr, uuidStr);
+    ALOGV("Constructor string\n - type: %s\n - uuid: %s", typeStr, uuidStr);
 
     if (typeStr != NULL) {
         if (stringToGuid(typeStr, &type) == NO_ERROR) {
@@ -98,7 +98,7 @@
     sp<IMemory> cblk;
     int enabled;
 
-    LOGV("set %p mUserData: %p uuid: %p timeLow %08x", this, user, type, type ? type->timeLow : 0);
+    ALOGV("set %p mUserData: %p uuid: %p timeLow %08x", this, user, type, type ? type->timeLow : 0);
 
     if (mIEffect != 0) {
         LOGW("Effect already in use");
@@ -159,7 +159,7 @@
     mCblk->buffer = (uint8_t *)mCblk + bufOffset;
 
     iEffect->asBinder()->linkToDeath(mIEffectClient);
-    LOGV("set() %p OK effect: %s id: %d status %d enabled %d, ", this, mDescriptor.name, mId, mStatus, mEnabled);
+    ALOGV("set() %p OK effect: %s id: %d status %d enabled %d, ", this, mDescriptor.name, mId, mStatus, mEnabled);
 
     return mStatus;
 }
@@ -167,7 +167,7 @@
 
 AudioEffect::~AudioEffect()
 {
-    LOGV("Destructor %p", this);
+    ALOGV("Destructor %p", this);
 
     if (mStatus == NO_ERROR || mStatus == ALREADY_EXISTS) {
         if (mIEffect != NULL) {
@@ -210,10 +210,10 @@
     AutoMutex lock(mLock);
     if (enabled != mEnabled) {
         if (enabled) {
-            LOGV("enable %p", this);
+            ALOGV("enable %p", this);
             status = mIEffect->enable();
         } else {
-            LOGV("disable %p", this);
+            ALOGV("disable %p", this);
             status = mIEffect->disable();
         }
         if (status == NO_ERROR) {
@@ -230,7 +230,7 @@
                               void *replyData)
 {
     if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) {
-        LOGV("command() bad status %d", mStatus);
+        ALOGV("command() bad status %d", mStatus);
         return INVALID_OPERATION;
     }
 
@@ -273,7 +273,7 @@
     uint32_t size = sizeof(int);
     uint32_t psize = ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize;
 
-    LOGV("setParameter: param: %d, param2: %d", *(int *)param->data, (param->psize == 8) ? *((int *)param->data + 1): -1);
+    ALOGV("setParameter: param: %d, param2: %d", *(int *)param->data, (param->psize == 8) ? *((int *)param->data + 1): -1);
 
     return mIEffect->command(EFFECT_CMD_SET_PARAM, sizeof (effect_param_t) + psize, param, &size, &param->status);
 }
@@ -328,7 +328,7 @@
         return BAD_VALUE;
     }
 
-    LOGV("getParameter: param: %d, param2: %d", *(int *)param->data, (param->psize == 8) ? *((int *)param->data + 1): -1);
+    ALOGV("getParameter: param: %d, param2: %d", *(int *)param->data, (param->psize == 8) ? *((int *)param->data + 1): -1);
 
     uint32_t psize = sizeof(effect_param_t) + ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize;
 
@@ -353,7 +353,7 @@
 
 void AudioEffect::controlStatusChanged(bool controlGranted)
 {
-    LOGV("controlStatusChanged %p control %d callback %p mUserData %p", this, controlGranted, mCbf, mUserData);
+    ALOGV("controlStatusChanged %p control %d callback %p mUserData %p", this, controlGranted, mCbf, mUserData);
     if (controlGranted) {
         if (mStatus == ALREADY_EXISTS) {
             mStatus = NO_ERROR;
@@ -370,7 +370,7 @@
 
 void AudioEffect::enableStatusChanged(bool enabled)
 {
-    LOGV("enableStatusChanged %p enabled %d mCbf %p", this, enabled, mCbf);
+    ALOGV("enableStatusChanged %p enabled %d mCbf %p", this, enabled, mCbf);
     if (mStatus == ALREADY_EXISTS) {
         mEnabled = enabled;
         if (mCbf) {
diff --git a/media/libmedia/AudioParameter.cpp b/media/libmedia/AudioParameter.cpp
index 59ccfd0..abc7b3f 100644
--- a/media/libmedia/AudioParameter.cpp
+++ b/media/libmedia/AudioParameter.cpp
@@ -53,7 +53,7 @@
                 mParameters.replaceValueFor(key, value);
             }
         } else {
-            LOGV("AudioParameter() cstor empty key value pair");
+            ALOGV("AudioParameter() cstor empty key value pair");
         }
         pair = strtok(NULL, ";");
     }
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index e5062ab..1d8e15b 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -80,7 +80,8 @@
 // ---------------------------------------------------------------------------
 
 AudioRecord::AudioRecord()
-    : mStatus(NO_INIT), mSessionId(0)
+    : mStatus(NO_INIT), mSessionId(0),
+      mPreviousPriority(ANDROID_PRIORITY_NORMAL), mPreviousSchedulingGroup(ANDROID_TGROUP_DEFAULT)
 {
 }
 
@@ -95,7 +96,8 @@
         void* user,
         int notificationFrames,
         int sessionId)
-    : mStatus(NO_INIT), mSessionId(0)
+    : mStatus(NO_INIT), mSessionId(0),
+      mPreviousPriority(ANDROID_PRIORITY_NORMAL), mPreviousSchedulingGroup(ANDROID_TGROUP_DEFAULT)
 {
     mStatus = set(inputSource, sampleRate, format, channelMask,
             frameCount, flags, cbf, user, notificationFrames, sessionId);
@@ -132,7 +134,7 @@
         int sessionId)
 {
 
-    LOGV("set(): sampleRate %d, channelMask %d, frameCount %d",sampleRate, channelMask, frameCount);
+    ALOGV("set(): sampleRate %d, channelMask %d, frameCount %d",sampleRate, channelMask, frameCount);
 
     AutoMutex lock(mLock);
 
@@ -168,7 +170,7 @@
     } else {
         mSessionId = sessionId;
     }
-    LOGV("set(): mSessionId %d", mSessionId);
+    ALOGV("set(): mSessionId %d", mSessionId);
 
     audio_io_handle_t input = AudioSystem::getInput(inputSource,
                                                     sampleRate,
@@ -187,7 +189,7 @@
     if (status != NO_ERROR) {
         return status;
     }
-    LOGV("AudioRecord::set() minFrameCount = %d", minFrameCount);
+    ALOGV("AudioRecord::set() minFrameCount = %d", minFrameCount);
 
     if (frameCount == 0) {
         frameCount = minFrameCount;
@@ -287,7 +289,7 @@
     status_t ret = NO_ERROR;
     sp<ClientRecordThread> t = mClientRecordThread;
 
-    LOGV("start");
+    ALOGV("start");
 
     if (t != 0) {
         if (t->exitPending()) {
@@ -326,9 +328,11 @@
             cblk->bufferTimeoutMs = MAX_RUN_TIMEOUT_MS;
             cblk->waitTimeMs = 0;
             if (t != 0) {
-               t->run("ClientRecordThread", ANDROID_PRIORITY_AUDIO);
+                t->run("ClientRecordThread", ANDROID_PRIORITY_AUDIO);
             } else {
-                setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_AUDIO);
+                mPreviousPriority = getpriority(PRIO_PROCESS, 0);
+                mPreviousSchedulingGroup = androidGetThreadSchedulingGroup(0);
+                androidSetThreadPriority(0, ANDROID_PRIORITY_AUDIO);
             }
         } else {
             mActive = 0;
@@ -346,7 +350,7 @@
 {
     sp<ClientRecordThread> t = mClientRecordThread;
 
-    LOGV("stop");
+    ALOGV("stop");
 
     if (t != 0) {
         t->mLock.lock();
@@ -363,7 +367,8 @@
         if (t != 0) {
             t->requestExit();
         } else {
-            setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_NORMAL);
+            setpriority(PRIO_PROCESS, 0, mPreviousPriority);
+            androidSetThreadSchedulingGroup(0, mPreviousSchedulingGroup);
         }
     }
 
@@ -739,7 +744,7 @@
 
     // Manage overrun callback
     if (mActive && (cblk->framesAvailable() == 0)) {
-        LOGV("Overrun user: %x, server: %x, flags %04x", cblk->user, cblk->server, cblk->flags);
+        ALOGV("Overrun user: %x, server: %x, flags %04x", cblk->user, cblk->server, cblk->flags);
         if (!(android_atomic_or(CBLK_UNDERRUN_ON, &cblk->flags) & CBLK_UNDERRUN_MSK)) {
             mCbf(EVENT_OVERRUN, mUserData, 0);
         }
@@ -798,7 +803,7 @@
             result = status_t(STOPPED);
         }
     }
-    LOGV("restoreRecord_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x",
+    ALOGV("restoreRecord_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x",
          result, mActive, mCblk, cblk, mCblk->flags, cblk->flags);
 
     if (result == NO_ERROR) {
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index 7b14c18..b9a5bc5 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -220,18 +220,18 @@
     gLock.lock();
     outputDesc = AudioSystem::gOutputs.valueFor(output);
     if (outputDesc == 0) {
-        LOGV("getOutputSamplingRate() no output descriptor for output %d in gOutputs", output);
+        ALOGV("getOutputSamplingRate() no output descriptor for output %d in gOutputs", output);
         gLock.unlock();
         const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
         if (af == 0) return PERMISSION_DENIED;
         *samplingRate = af->sampleRate(output);
     } else {
-        LOGV("getOutputSamplingRate() reading from output desc");
+        ALOGV("getOutputSamplingRate() reading from output desc");
         *samplingRate = outputDesc->samplingRate;
         gLock.unlock();
     }
 
-    LOGV("getOutputSamplingRate() streamType %d, output %d, sampling rate %d", streamType, output, *samplingRate);
+    ALOGV("getOutputSamplingRate() streamType %d, output %d, sampling rate %d", streamType, output, *samplingRate);
 
     return NO_ERROR;
 }
@@ -262,7 +262,7 @@
         gLock.unlock();
     }
 
-    LOGV("getOutputFrameCount() streamType %d, output %d, frameCount %d", streamType, output, *frameCount);
+    ALOGV("getOutputFrameCount() streamType %d, output %d, frameCount %d", streamType, output, *frameCount);
 
     return NO_ERROR;
 }
@@ -293,7 +293,7 @@
         gLock.unlock();
     }
 
-    LOGV("getOutputLatency() streamType %d, output %d, latency %d", streamType, output, *latency);
+    ALOGV("getOutputLatency() streamType %d, output %d, latency %d", streamType, output, *latency);
 
     return NO_ERROR;
 }
@@ -387,7 +387,7 @@
 }
 
 void AudioSystem::AudioFlingerClient::ioConfigChanged(int event, int ioHandle, void *param2) {
-    LOGV("ioConfigChanged() event %d", event);
+    ALOGV("ioConfigChanged() event %d", event);
     OutputDescriptor *desc;
     uint32_t stream;
 
@@ -399,14 +399,14 @@
     case STREAM_CONFIG_CHANGED:
         if (param2 == 0) break;
         stream = *(uint32_t *)param2;
-        LOGV("ioConfigChanged() STREAM_CONFIG_CHANGED stream %d, output %d", stream, ioHandle);
+        ALOGV("ioConfigChanged() STREAM_CONFIG_CHANGED stream %d, output %d", stream, ioHandle);
         if (gStreamOutputMap.indexOfKey(stream) >= 0) {
             gStreamOutputMap.replaceValueFor(stream, ioHandle);
         }
         break;
     case OUTPUT_OPENED: {
         if (gOutputs.indexOfKey(ioHandle) >= 0) {
-            LOGV("ioConfigChanged() opening already existing output! %d", ioHandle);
+            ALOGV("ioConfigChanged() opening already existing output! %d", ioHandle);
             break;
         }
         if (param2 == 0) break;
@@ -414,7 +414,7 @@
 
         OutputDescriptor *outputDesc =  new OutputDescriptor(*desc);
         gOutputs.add(ioHandle, outputDesc);
-        LOGV("ioConfigChanged() new output samplingRate %d, format %d channels %d frameCount %d latency %d",
+        ALOGV("ioConfigChanged() new output samplingRate %d, format %d channels %d frameCount %d latency %d",
                 outputDesc->samplingRate, outputDesc->format, outputDesc->channels, outputDesc->frameCount, outputDesc->latency);
         } break;
     case OUTPUT_CLOSED: {
@@ -422,7 +422,7 @@
             LOGW("ioConfigChanged() closing unknow output! %d", ioHandle);
             break;
         }
-        LOGV("ioConfigChanged() output %d closed", ioHandle);
+        ALOGV("ioConfigChanged() output %d closed", ioHandle);
 
         gOutputs.removeItem(ioHandle);
         for (int i = gStreamOutputMap.size() - 1; i >= 0 ; i--) {
@@ -441,7 +441,7 @@
         if (param2 == 0) break;
         desc = (OutputDescriptor *)param2;
 
-        LOGV("ioConfigChanged() new config for output %d samplingRate %d, format %d channels %d frameCount %d latency %d",
+        ALOGV("ioConfigChanged() new config for output %d samplingRate %d, format %d channels %d frameCount %d latency %d",
                 ioHandle, desc->samplingRate, desc->format,
                 desc->channels, desc->frameCount, desc->latency);
         OutputDescriptor *outputDesc = gOutputs.valueAt(index);
@@ -582,7 +582,7 @@
          (samplingRate != 8000 && samplingRate != 16000))) {
         Mutex::Autolock _l(gLock);
         output = AudioSystem::gStreamOutputMap.valueFor(stream);
-        LOGV_IF((output != 0), "getOutput() read %d from cache for stream %d", output, stream);
+        ALOGV_IF((output != 0), "getOutput() read %d from cache for stream %d", output, stream);
     }
     if (output == 0) {
         const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
@@ -736,7 +736,7 @@
 void AudioSystem::clearAudioConfigCache()
 {
     Mutex::Autolock _l(gLock);
-    LOGV("clearAudioConfigCache()");
+    ALOGV("clearAudioConfigCache()");
     gStreamOutputMap.clear();
     gOutputs.clear();
 }
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 8ebb652..7e55fbd 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -79,7 +79,8 @@
 // ---------------------------------------------------------------------------
 
 AudioTrack::AudioTrack()
-    : mStatus(NO_INIT)
+    : mStatus(NO_INIT),
+      mPreviousPriority(ANDROID_PRIORITY_NORMAL), mPreviousSchedulingGroup(ANDROID_TGROUP_DEFAULT)
 {
 }
 
@@ -94,7 +95,8 @@
         void* user,
         int notificationFrames,
         int sessionId)
-    : mStatus(NO_INIT)
+    : mStatus(NO_INIT),
+      mPreviousPriority(ANDROID_PRIORITY_NORMAL), mPreviousSchedulingGroup(ANDROID_TGROUP_DEFAULT)
 {
     mStatus = set(streamType, sampleRate, format, channelMask,
             frameCount, flags, cbf, user, notificationFrames,
@@ -112,7 +114,8 @@
         void* user,
         int notificationFrames,
         int sessionId)
-    : mStatus(NO_INIT)
+    : mStatus(NO_INIT),
+      mPreviousPriority(ANDROID_PRIORITY_NORMAL), mPreviousSchedulingGroup(ANDROID_TGROUP_DEFAULT)
 {
     mStatus = set(streamType, sampleRate, format, channelMask,
             0, flags, cbf, user, notificationFrames,
@@ -121,7 +124,7 @@
 
 AudioTrack::~AudioTrack()
 {
-    LOGV_IF(mSharedBuffer != 0, "Destructor sharedBuffer: %p", mSharedBuffer->pointer());
+    ALOGV_IF(mSharedBuffer != 0, "Destructor sharedBuffer: %p", mSharedBuffer->pointer());
 
     if (mStatus == NO_ERROR) {
         // Make sure that callback function exits in the case where
@@ -153,7 +156,7 @@
         int sessionId)
 {
 
-    LOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size());
+    ALOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size());
 
     AutoMutex lock(mLock);
     if (mAudioTrack != 0) {
@@ -319,7 +322,7 @@
     sp<AudioTrackThread> t = mAudioTrackThread;
     status_t status = NO_ERROR;
 
-    LOGV("start %p", this);
+    ALOGV("start %p", this);
     if (t != 0) {
         if (t->exitPending()) {
             if (t->requestExitAndWait() == WOULD_BLOCK) {
@@ -346,12 +349,14 @@
         cblk->waitTimeMs = 0;
         android_atomic_and(~CBLK_DISABLED_ON, &cblk->flags);
         if (t != 0) {
-           t->run("AudioTrackThread", ANDROID_PRIORITY_AUDIO);
+            t->run("AudioTrackThread", ANDROID_PRIORITY_AUDIO);
         } else {
-            setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_AUDIO);
+            mPreviousPriority = getpriority(PRIO_PROCESS, 0);
+            mPreviousSchedulingGroup = androidGetThreadSchedulingGroup(0);
+            androidSetThreadPriority(0, ANDROID_PRIORITY_AUDIO);
         }
 
-        LOGV("start %p before lock cblk %p", this, mCblk);
+        ALOGV("start %p before lock cblk %p", this, mCblk);
         if (!(cblk->flags & CBLK_INVALID_MSK)) {
             cblk->lock.unlock();
             status = mAudioTrack->start();
@@ -365,12 +370,13 @@
         }
         cblk->lock.unlock();
         if (status != NO_ERROR) {
-            LOGV("start() failed");
+            ALOGV("start() failed");
             mActive = 0;
             if (t != 0) {
                 t->requestExit();
             } else {
-                setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_NORMAL);
+                setpriority(PRIO_PROCESS, 0, mPreviousPriority);
+                androidSetThreadSchedulingGroup(0, mPreviousSchedulingGroup);
             }
         }
     }
@@ -384,7 +390,7 @@
 {
     sp<AudioTrackThread> t = mAudioTrackThread;
 
-    LOGV("stop %p", this);
+    ALOGV("stop %p", this);
     if (t != 0) {
         t->mLock.lock();
     }
@@ -408,7 +414,8 @@
         if (t != 0) {
             t->requestExit();
         } else {
-            setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_NORMAL);
+            setpriority(PRIO_PROCESS, 0, mPreviousPriority);
+            androidSetThreadSchedulingGroup(0, mPreviousSchedulingGroup);
         }
     }
 
@@ -431,7 +438,7 @@
 // must be called with mLock held
 void AudioTrack::flush_l()
 {
-    LOGV("flush");
+    ALOGV("flush");
 
     // clear playback marker and periodic update counter
     mMarkerPosition = 0;
@@ -449,7 +456,7 @@
 
 void AudioTrack::pause()
 {
-    LOGV("pause");
+    ALOGV("pause");
     AutoMutex lock(mLock);
     if (mActive == 1) {
         mActive = 0;
@@ -496,7 +503,7 @@
 
 status_t AudioTrack::setAuxEffectSendLevel(float level)
 {
-    LOGV("setAuxEffectSendLevel(%f)", level);
+    ALOGV("setAuxEffectSendLevel(%f)", level);
     if (level > 1.0f) {
         return BAD_VALUE;
     }
@@ -696,7 +703,7 @@
 
 status_t AudioTrack::attachAuxEffect(int effectId)
 {
-    LOGV("attachAuxEffect(%d)", effectId);
+    ALOGV("attachAuxEffect(%d)", effectId);
     status_t status = mAudioTrack->attachAuxEffect(effectId);
     if (status == NO_ERROR) {
         mAuxEffectId = effectId;
@@ -852,7 +859,7 @@
         while (framesAvail == 0) {
             active = mActive;
             if (UNLIKELY(!active)) {
-                LOGV("Not active and NO_MORE_BUFFERS");
+                ALOGV("Not active and NO_MORE_BUFFERS");
                 cblk->lock.unlock();
                 return NO_MORE_BUFFERS;
             }
@@ -966,7 +973,7 @@
         return BAD_VALUE;
     }
 
-    LOGV("write %p: %d bytes, mActive=%d", this, userSize, mActive);
+    ALOGV("write %p: %d bytes, mActive=%d", this, userSize, mActive);
 
     // acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed
     // while we are accessing the cblk
@@ -1036,7 +1043,7 @@
 
     // Manage underrun callback
     if (mActive && (cblk->framesAvailable() == cblk->frameCount)) {
-        LOGV("Underrun user: %x, server: %x, flags %04x", cblk->user, cblk->server, cblk->flags);
+        ALOGV("Underrun user: %x, server: %x, flags %04x", cblk->user, cblk->server, cblk->flags);
         if (!(android_atomic_or(CBLK_UNDERRUN_ON, &cblk->flags) & CBLK_UNDERRUN_MSK)) {
             mCbf(EVENT_UNDERRUN, mUserData, 0);
             if (cblk->server == cblk->frameCount) {
@@ -1247,7 +1254,7 @@
             cblk->lock.unlock();
         }
     }
-    LOGV("restoreTrack_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x",
+    ALOGV("restoreTrack_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x",
          result, mActive, mCblk, cblk, mCblk->flags, cblk->flags);
 
     if (result == NO_ERROR) {
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index d58834b..bedf8d3 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -377,7 +377,7 @@
         data.writeInt32(flags);
         remote()->transact(OPEN_OUTPUT, data, &reply);
         int  output = reply.readInt32();
-        LOGV("openOutput() returned output, %p", output);
+        ALOGV("openOutput() returned output, %p", output);
         devices = reply.readInt32();
         if (pDevices) *pDevices = devices;
         samplingRate = reply.readInt32();
@@ -844,7 +844,7 @@
                                      &channels,
                                      &latency,
                                      flags);
-            LOGV("OPEN_OUTPUT output, %p", output);
+            ALOGV("OPEN_OUTPUT output, %p", output);
             reply->writeInt32(output);
             reply->writeInt32(devices);
             reply->writeInt32(samplingRate);
diff --git a/media/libmedia/IAudioFlingerClient.cpp b/media/libmedia/IAudioFlingerClient.cpp
index 3900de4..5a3f250 100644
--- a/media/libmedia/IAudioFlingerClient.cpp
+++ b/media/libmedia/IAudioFlingerClient.cpp
@@ -47,7 +47,7 @@
         data.writeInt32(ioHandle);
         if (event == AudioSystem::STREAM_CONFIG_CHANGED) {
             uint32_t stream = *(uint32_t *)param2;
-            LOGV("ioConfigChanged stream %d", stream);
+            ALOGV("ioConfigChanged stream %d", stream);
             data.writeInt32(stream);
         } else if (event != AudioSystem::OUTPUT_CLOSED && event != AudioSystem::INPUT_CLOSED) {
             AudioSystem::OutputDescriptor *desc = (AudioSystem::OutputDescriptor *)param2;
@@ -79,7 +79,7 @@
             if (event == AudioSystem::STREAM_CONFIG_CHANGED) {
                 stream = data.readInt32();
                 param2 = &stream;
-                LOGV("STREAM_CONFIG_CHANGED stream %d", stream);
+                ALOGV("STREAM_CONFIG_CHANGED stream %d", stream);
             } else if (event != AudioSystem::OUTPUT_CLOSED && event != AudioSystem::INPUT_CLOSED) {
                 desc.samplingRate = data.readInt32();
                 desc.format = data.readInt32();
diff --git a/media/libmedia/IEffect.cpp b/media/libmedia/IEffect.cpp
index a945b97..d469e28 100644
--- a/media/libmedia/IEffect.cpp
+++ b/media/libmedia/IEffect.cpp
@@ -43,7 +43,7 @@
 
     status_t enable()
     {
-        LOGV("enable");
+        ALOGV("enable");
         Parcel data, reply;
         data.writeInterfaceToken(IEffect::getInterfaceDescriptor());
         remote()->transact(ENABLE, data, &reply);
@@ -52,7 +52,7 @@
 
     status_t disable()
     {
-        LOGV("disable");
+        ALOGV("disable");
         Parcel data, reply;
         data.writeInterfaceToken(IEffect::getInterfaceDescriptor());
         remote()->transact(DISABLE, data, &reply);
@@ -65,7 +65,7 @@
                      uint32_t *pReplySize,
                      void *pReplyData)
     {
-        LOGV("command");
+        ALOGV("command");
         Parcel data, reply;
         data.writeInterfaceToken(IEffect::getInterfaceDescriptor());
         data.writeInt32(cmdCode);
@@ -95,7 +95,7 @@
 
     void disconnect()
     {
-        LOGV("disconnect");
+        ALOGV("disconnect");
         Parcel data, reply;
         data.writeInterfaceToken(IEffect::getInterfaceDescriptor());
         remote()->transact(DISCONNECT, data, &reply);
@@ -124,21 +124,21 @@
 {
     switch(code) {
         case ENABLE: {
-            LOGV("ENABLE");
+            ALOGV("ENABLE");
             CHECK_INTERFACE(IEffect, data, reply);
             reply->writeInt32(enable());
             return NO_ERROR;
         } break;
 
         case DISABLE: {
-            LOGV("DISABLE");
+            ALOGV("DISABLE");
             CHECK_INTERFACE(IEffect, data, reply);
             reply->writeInt32(disable());
             return NO_ERROR;
         } break;
 
         case COMMAND: {
-            LOGV("COMMAND");
+            ALOGV("COMMAND");
             CHECK_INTERFACE(IEffect, data, reply);
             uint32_t cmdCode = data.readInt32();
             uint32_t cmdSize = data.readInt32();
@@ -172,7 +172,7 @@
         } break;
 
         case DISCONNECT: {
-            LOGV("DISCONNECT");
+            ALOGV("DISCONNECT");
             CHECK_INTERFACE(IEffect, data, reply);
             disconnect();
             return NO_ERROR;
diff --git a/media/libmedia/IEffectClient.cpp b/media/libmedia/IEffectClient.cpp
index 1fa9cbe..4693b45 100644
--- a/media/libmedia/IEffectClient.cpp
+++ b/media/libmedia/IEffectClient.cpp
@@ -40,7 +40,7 @@
 
     void controlStatusChanged(bool controlGranted)
     {
-        LOGV("controlStatusChanged");
+        ALOGV("controlStatusChanged");
         Parcel data, reply;
         data.writeInterfaceToken(IEffectClient::getInterfaceDescriptor());
         data.writeInt32((uint32_t)controlGranted);
@@ -49,7 +49,7 @@
 
     void enableStatusChanged(bool enabled)
     {
-        LOGV("enableStatusChanged");
+        ALOGV("enableStatusChanged");
         Parcel data, reply;
         data.writeInterfaceToken(IEffectClient::getInterfaceDescriptor());
         data.writeInt32((uint32_t)enabled);
@@ -62,7 +62,7 @@
                          uint32_t replySize,
                          void *pReplyData)
     {
-        LOGV("commandExecuted");
+        ALOGV("commandExecuted");
         Parcel data, reply;
         data.writeInterfaceToken(IEffectClient::getInterfaceDescriptor());
         data.writeInt32(cmdCode);
@@ -96,21 +96,21 @@
 {
     switch(code) {
         case CONTROL_STATUS_CHANGED: {
-            LOGV("CONTROL_STATUS_CHANGED");
+            ALOGV("CONTROL_STATUS_CHANGED");
             CHECK_INTERFACE(IEffectClient, data, reply);
             bool hasControl = (bool)data.readInt32();
             controlStatusChanged(hasControl);
             return NO_ERROR;
         } break;
         case ENABLE_STATUS_CHANGED: {
-            LOGV("ENABLE_STATUS_CHANGED");
+            ALOGV("ENABLE_STATUS_CHANGED");
             CHECK_INTERFACE(IEffectClient, data, reply);
             bool enabled = (bool)data.readInt32();
             enableStatusChanged(enabled);
             return NO_ERROR;
         } break;
         case COMMAND_EXECUTED: {
-            LOGV("COMMAND_EXECUTED");
+            ALOGV("COMMAND_EXECUTED");
             CHECK_INTERFACE(IEffectClient, data, reply);
             uint32_t cmdCode = data.readInt32();
             uint32_t cmdSize = data.readInt32();
diff --git a/media/libmedia/IMediaDeathNotifier.cpp b/media/libmedia/IMediaDeathNotifier.cpp
index 39ac076..da33edb 100644
--- a/media/libmedia/IMediaDeathNotifier.cpp
+++ b/media/libmedia/IMediaDeathNotifier.cpp
@@ -34,7 +34,7 @@
 /*static*/const sp<IMediaPlayerService>&
 IMediaDeathNotifier::getMediaPlayerService()
 {
-    LOGV("getMediaPlayerService");
+    ALOGV("getMediaPlayerService");
     Mutex::Autolock _l(sServiceLock);
     if (sMediaPlayerService.get() == 0) {
         sp<IServiceManager> sm = defaultServiceManager();
@@ -61,7 +61,7 @@
 /*static*/ void
 IMediaDeathNotifier::addObitRecipient(const wp<IMediaDeathNotifier>& recipient)
 {
-    LOGV("addObitRecipient");
+    ALOGV("addObitRecipient");
     Mutex::Autolock _l(sServiceLock);
     sObitRecipients.add(recipient);
 }
@@ -69,7 +69,7 @@
 /*static*/ void
 IMediaDeathNotifier::removeObitRecipient(const wp<IMediaDeathNotifier>& recipient)
 {
-    LOGV("removeObitRecipient");
+    ALOGV("removeObitRecipient");
     Mutex::Autolock _l(sServiceLock);
     sObitRecipients.remove(recipient);
 }
@@ -100,7 +100,7 @@
 
 IMediaDeathNotifier::DeathNotifier::~DeathNotifier()
 {
-    LOGV("DeathNotifier::~DeathNotifier");
+    ALOGV("DeathNotifier::~DeathNotifier");
     Mutex::Autolock _l(sServiceLock);
     sObitRecipients.clear();
     if (sMediaPlayerService != 0) {
diff --git a/media/libmedia/IMediaMetadataRetriever.cpp b/media/libmedia/IMediaMetadataRetriever.cpp
index 07152d8..9b8d7c3 100644
--- a/media/libmedia/IMediaMetadataRetriever.cpp
+++ b/media/libmedia/IMediaMetadataRetriever.cpp
@@ -118,7 +118,7 @@
 
     sp<IMemory> getFrameAtTime(int64_t timeUs, int option)
     {
-        LOGV("getTimeAtTime: time(%lld us) and option(%d)", timeUs, option);
+        ALOGV("getTimeAtTime: time(%lld us) and option(%d)", timeUs, option);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaMetadataRetriever::getInterfaceDescriptor());
         data.writeInt64(timeUs);
@@ -208,7 +208,7 @@
             CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
             int64_t timeUs = data.readInt64();
             int option = data.readInt32();
-            LOGV("getTimeAtTime: time(%lld us) and option(%d)", timeUs, option);
+            ALOGV("getTimeAtTime: time(%lld us) and option(%d)", timeUs, option);
 #ifndef DISABLE_GROUP_SCHEDULE_HACK
             setSchedPolicy(data);
 #endif
diff --git a/media/libmedia/IMediaRecorder.cpp b/media/libmedia/IMediaRecorder.cpp
index 38e111e..42f55c2 100644
--- a/media/libmedia/IMediaRecorder.cpp
+++ b/media/libmedia/IMediaRecorder.cpp
@@ -64,7 +64,7 @@
 
     status_t setCamera(const sp<ICamera>& camera, const sp<ICameraRecordingProxy>& proxy)
     {
-        LOGV("setCamera(%p,%p)", camera.get(), proxy.get());
+        ALOGV("setCamera(%p,%p)", camera.get(), proxy.get());
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeStrongBinder(camera->asBinder());
@@ -75,7 +75,7 @@
 
     sp<ISurfaceTexture> querySurfaceMediaSource()
     {
-        LOGV("Query SurfaceMediaSource");
+        ALOGV("Query SurfaceMediaSource");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(QUERY_SURFACE_MEDIASOURCE, data, &reply);
@@ -88,7 +88,7 @@
 
     status_t setPreviewSurface(const sp<Surface>& surface)
     {
-        LOGV("setPreviewSurface(%p)", surface.get());
+        ALOGV("setPreviewSurface(%p)", surface.get());
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         Surface::writeToParcel(surface, &data);
@@ -98,7 +98,7 @@
 
     status_t init()
     {
-        LOGV("init");
+        ALOGV("init");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(INIT, data, &reply);
@@ -107,7 +107,7 @@
 
     status_t setVideoSource(int vs)
     {
-        LOGV("setVideoSource(%d)", vs);
+        ALOGV("setVideoSource(%d)", vs);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeInt32(vs);
@@ -117,7 +117,7 @@
 
     status_t setAudioSource(int as)
     {
-        LOGV("setAudioSource(%d)", as);
+        ALOGV("setAudioSource(%d)", as);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeInt32(as);
@@ -127,7 +127,7 @@
 
     status_t setOutputFormat(int of)
     {
-        LOGV("setOutputFormat(%d)", of);
+        ALOGV("setOutputFormat(%d)", of);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeInt32(of);
@@ -137,7 +137,7 @@
 
     status_t setVideoEncoder(int ve)
     {
-        LOGV("setVideoEncoder(%d)", ve);
+        ALOGV("setVideoEncoder(%d)", ve);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeInt32(ve);
@@ -147,7 +147,7 @@
 
     status_t setAudioEncoder(int ae)
     {
-        LOGV("setAudioEncoder(%d)", ae);
+        ALOGV("setAudioEncoder(%d)", ae);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeInt32(ae);
@@ -157,7 +157,7 @@
 
     status_t setOutputFile(const char* path)
     {
-        LOGV("setOutputFile(%s)", path);
+        ALOGV("setOutputFile(%s)", path);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeCString(path);
@@ -166,7 +166,7 @@
     }
 
     status_t setOutputFile(int fd, int64_t offset, int64_t length) {
-        LOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
+        ALOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeFileDescriptor(fd);
@@ -178,7 +178,7 @@
 
     status_t setVideoSize(int width, int height)
     {
-        LOGV("setVideoSize(%dx%d)", width, height);
+        ALOGV("setVideoSize(%dx%d)", width, height);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeInt32(width);
@@ -189,7 +189,7 @@
 
     status_t setVideoFrameRate(int frames_per_second)
     {
-        LOGV("setVideoFrameRate(%d)", frames_per_second);
+        ALOGV("setVideoFrameRate(%d)", frames_per_second);
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeInt32(frames_per_second);
@@ -199,7 +199,7 @@
 
     status_t setParameters(const String8& params)
     {
-        LOGV("setParameter(%s)", params.string());
+        ALOGV("setParameter(%s)", params.string());
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeString8(params);
@@ -209,7 +209,7 @@
 
     status_t setListener(const sp<IMediaRecorderClient>& listener)
     {
-        LOGV("setListener(%p)", listener.get());
+        ALOGV("setListener(%p)", listener.get());
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         data.writeStrongBinder(listener->asBinder());
@@ -219,7 +219,7 @@
 
     status_t prepare()
     {
-        LOGV("prepare");
+        ALOGV("prepare");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(PREPARE, data, &reply);
@@ -228,7 +228,7 @@
 
     status_t getMaxAmplitude(int* max)
     {
-        LOGV("getMaxAmplitude");
+        ALOGV("getMaxAmplitude");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(GET_MAX_AMPLITUDE, data, &reply);
@@ -238,7 +238,7 @@
 
     status_t start()
     {
-        LOGV("start");
+        ALOGV("start");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(START, data, &reply);
@@ -247,7 +247,7 @@
 
     status_t stop()
     {
-        LOGV("stop");
+        ALOGV("stop");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(STOP, data, &reply);
@@ -256,7 +256,7 @@
 
     status_t reset()
     {
-        LOGV("reset");
+        ALOGV("reset");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(RESET, data, &reply);
@@ -265,7 +265,7 @@
 
     status_t close()
     {
-        LOGV("close");
+        ALOGV("close");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(CLOSE, data, &reply);
@@ -274,7 +274,7 @@
 
     status_t release()
     {
-        LOGV("release");
+        ALOGV("release");
         Parcel data, reply;
         data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
         remote()->transact(RELEASE, data, &reply);
@@ -291,49 +291,49 @@
 {
     switch(code) {
         case RELEASE: {
-            LOGV("RELEASE");
+            ALOGV("RELEASE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(release());
             return NO_ERROR;
         } break;
         case INIT: {
-            LOGV("INIT");
+            ALOGV("INIT");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(init());
             return NO_ERROR;
         } break;
         case CLOSE: {
-            LOGV("CLOSE");
+            ALOGV("CLOSE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(close());
             return NO_ERROR;
         } break;
         case RESET: {
-            LOGV("RESET");
+            ALOGV("RESET");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(reset());
             return NO_ERROR;
         } break;
         case STOP: {
-            LOGV("STOP");
+            ALOGV("STOP");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(stop());
             return NO_ERROR;
         } break;
         case START: {
-            LOGV("START");
+            ALOGV("START");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(start());
             return NO_ERROR;
         } break;
         case PREPARE: {
-            LOGV("PREPARE");
+            ALOGV("PREPARE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(prepare());
             return NO_ERROR;
         } break;
         case GET_MAX_AMPLITUDE: {
-            LOGV("GET_MAX_AMPLITUDE");
+            ALOGV("GET_MAX_AMPLITUDE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int max = 0;
             status_t ret = getMaxAmplitude(&max);
@@ -342,35 +342,35 @@
             return NO_ERROR;
         } break;
         case SET_VIDEO_SOURCE: {
-            LOGV("SET_VIDEO_SOURCE");
+            ALOGV("SET_VIDEO_SOURCE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int vs = data.readInt32();
             reply->writeInt32(setVideoSource(vs));
             return NO_ERROR;
         } break;
         case SET_AUDIO_SOURCE: {
-            LOGV("SET_AUDIO_SOURCE");
+            ALOGV("SET_AUDIO_SOURCE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int as = data.readInt32();
             reply->writeInt32(setAudioSource(as));
             return NO_ERROR;
         } break;
         case SET_OUTPUT_FORMAT: {
-            LOGV("SET_OUTPUT_FORMAT");
+            ALOGV("SET_OUTPUT_FORMAT");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int of = data.readInt32();
             reply->writeInt32(setOutputFormat(of));
             return NO_ERROR;
         } break;
         case SET_VIDEO_ENCODER: {
-            LOGV("SET_VIDEO_ENCODER");
+            ALOGV("SET_VIDEO_ENCODER");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int ve = data.readInt32();
             reply->writeInt32(setVideoEncoder(ve));
             return NO_ERROR;
         } break;
         case SET_AUDIO_ENCODER: {
-            LOGV("SET_AUDIO_ENCODER");
+            ALOGV("SET_AUDIO_ENCODER");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int ae = data.readInt32();
             reply->writeInt32(setAudioEncoder(ae));
@@ -378,14 +378,14 @@
 
         } break;
         case SET_OUTPUT_FILE_PATH: {
-            LOGV("SET_OUTPUT_FILE_PATH");
+            ALOGV("SET_OUTPUT_FILE_PATH");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             const char* path = data.readCString();
             reply->writeInt32(setOutputFile(path));
             return NO_ERROR;
         } break;
         case SET_OUTPUT_FILE_FD: {
-            LOGV("SET_OUTPUT_FILE_FD");
+            ALOGV("SET_OUTPUT_FILE_FD");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int fd = dup(data.readFileDescriptor());
             int64_t offset = data.readInt64();
@@ -395,7 +395,7 @@
             return NO_ERROR;
         } break;
         case SET_VIDEO_SIZE: {
-            LOGV("SET_VIDEO_SIZE");
+            ALOGV("SET_VIDEO_SIZE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int width = data.readInt32();
             int height = data.readInt32();
@@ -403,20 +403,20 @@
             return NO_ERROR;
         } break;
         case SET_VIDEO_FRAMERATE: {
-            LOGV("SET_VIDEO_FRAMERATE");
+            ALOGV("SET_VIDEO_FRAMERATE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             int frames_per_second = data.readInt32();
             reply->writeInt32(setVideoFrameRate(frames_per_second));
             return NO_ERROR;
         } break;
         case SET_PARAMETERS: {
-            LOGV("SET_PARAMETER");
+            ALOGV("SET_PARAMETER");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             reply->writeInt32(setParameters(data.readString8()));
             return NO_ERROR;
         } break;
         case SET_LISTENER: {
-            LOGV("SET_LISTENER");
+            ALOGV("SET_LISTENER");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             sp<IMediaRecorderClient> listener =
                 interface_cast<IMediaRecorderClient>(data.readStrongBinder());
@@ -424,14 +424,14 @@
             return NO_ERROR;
         } break;
         case SET_PREVIEW_SURFACE: {
-            LOGV("SET_PREVIEW_SURFACE");
+            ALOGV("SET_PREVIEW_SURFACE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             sp<Surface> surface = Surface::readFromParcel(data);
             reply->writeInt32(setPreviewSurface(surface));
             return NO_ERROR;
         } break;
         case SET_CAMERA: {
-            LOGV("SET_CAMERA");
+            ALOGV("SET_CAMERA");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             sp<ICamera> camera = interface_cast<ICamera>(data.readStrongBinder());
             sp<ICameraRecordingProxy> proxy =
@@ -440,7 +440,7 @@
             return NO_ERROR;
         } break;
         case QUERY_SURFACE_MEDIASOURCE: {
-            LOGV("QUERY_SURFACE_MEDIASOURCE");
+            ALOGV("QUERY_SURFACE_MEDIASOURCE");
             CHECK_INTERFACE(IMediaRecorder, data, reply);
             // call the mediaserver side to create
             // a surfacemediasource
diff --git a/media/libmedia/JetPlayer.cpp b/media/libmedia/JetPlayer.cpp
index 8b953e0..afa84b7 100644
--- a/media/libmedia/JetPlayer.cpp
+++ b/media/libmedia/JetPlayer.cpp
@@ -42,7 +42,7 @@
         mAudioTrack(NULL),
         mTrackBufferSize(trackBufferSize)
 {
-    LOGV("JetPlayer constructor");
+    ALOGV("JetPlayer constructor");
     mPreviousJetStatus.currentUserID = -1;
     mPreviousJetStatus.segmentRepeatCount = -1;
     mPreviousJetStatus.numQueuedSegments = -1;
@@ -52,7 +52,7 @@
 //-------------------------------------------------------------------------------------------------
 JetPlayer::~JetPlayer()
 {
-    LOGV("~JetPlayer");
+    ALOGV("~JetPlayer");
     release();
 
 }
@@ -99,13 +99,14 @@
     // create render and playback thread
     {
         Mutex::Autolock l(mMutex);
-        LOGV("JetPlayer::init(): trying to start render thread");
-        createThreadEtc(renderThread, this, "jetRenderThread", ANDROID_PRIORITY_AUDIO);
+        ALOGV("JetPlayer::init(): trying to start render thread");
+        mThread = new JetPlayerThread(this);
+        mThread->run("jetRenderThread", ANDROID_PRIORITY_AUDIO);
         mCondition.wait(mMutex);
     }
     if (mTid > 0) {
         // render thread started, we're ready
-        LOGV("JetPlayer::init(): render thread(%d) successfully started.", mTid);
+        ALOGV("JetPlayer::init(): render thread(%d) successfully started.", mTid);
         mState = EAS_STATE_READY;
     } else {
         LOGE("JetPlayer::init(): failed to start render thread.");
@@ -125,7 +126,7 @@
 //-------------------------------------------------------------------------------------------------
 int JetPlayer::release()
 {
-    LOGV("JetPlayer::release()");
+    ALOGV("JetPlayer::release()");
     Mutex::Autolock lock(mMutex);
     mPaused = true;
     mRender = false;
@@ -156,19 +157,13 @@
 
 
 //-------------------------------------------------------------------------------------------------
-int JetPlayer::renderThread(void* p) {
-
-    return ((JetPlayer*)p)->render();
-}
-
-//-------------------------------------------------------------------------------------------------
 int JetPlayer::render() {
     EAS_RESULT result = EAS_FAILURE;
     EAS_I32 count;
     int temp;
     bool audioStarted = false;
 
-    LOGV("JetPlayer::render(): entering");
+    ALOGV("JetPlayer::render(): entering");
 
     // allocate render buffer
     mAudioBuffer = 
@@ -182,7 +177,7 @@
     {
         Mutex::Autolock l(mMutex);
         mTid = gettid();
-        LOGV("JetPlayer::render(): render thread(%d) signal", mTid);
+        ALOGV("JetPlayer::render(): render thread(%d) signal", mTid);
         mCondition.signal();
     }
 
@@ -192,21 +187,21 @@
 
         if (mEasData == NULL) {
             mMutex.unlock();
-            LOGV("JetPlayer::render(): NULL EAS data, exiting render.");
+            ALOGV("JetPlayer::render(): NULL EAS data, exiting render.");
             goto threadExit;
         }
             
         // nothing to render, wait for client thread to wake us up
         while (!mRender)
         {
-            LOGV("JetPlayer::render(): signal wait");
+            ALOGV("JetPlayer::render(): signal wait");
             if (audioStarted) { 
                 mAudioTrack->pause(); 
                 // we have to restart the playback once we start rendering again
                 audioStarted = false;
             }
             mCondition.wait(mMutex);
-            LOGV("JetPlayer::render(): signal rx'd");
+            ALOGV("JetPlayer::render(): signal rx'd");
         }
         
         // render midi data into the input buffer
@@ -225,7 +220,7 @@
         }
 
         // update playback state
-        //LOGV("JetPlayer::render(): updating state");
+        //ALOGV("JetPlayer::render(): updating state");
         JET_Status(mEasData, &mJetStatus);
         fireUpdateOnStatusChange();
         mPaused = mJetStatus.paused;
@@ -239,7 +234,7 @@
         }
 
         // Write data to the audio hardware
-        //LOGV("JetPlayer::render(): writing to audio output");
+        //ALOGV("JetPlayer::render(): writing to audio output");
         if ((temp = mAudioTrack->write(mAudioBuffer, num_output)) < 0) {
             LOGE("JetPlayer::render(): Error in writing:%d",temp);
             return temp;
@@ -247,7 +242,7 @@
 
         // start audio output if necessary
         if (!audioStarted) {
-            LOGV("JetPlayer::render(): starting audio playback");
+            ALOGV("JetPlayer::render(): starting audio playback");
             mAudioTrack->start();
             audioStarted = true;
         }
@@ -338,7 +333,7 @@
 //-------------------------------------------------------------------------------------------------
 int JetPlayer::loadFromFile(const char* path)
 {
-    LOGV("JetPlayer::loadFromFile(): path=%s", path);
+    ALOGV("JetPlayer::loadFromFile(): path=%s", path);
 
     Mutex::Autolock lock(mMutex);
 
@@ -363,7 +358,7 @@
 //-------------------------------------------------------------------------------------------------
 int JetPlayer::loadFromFD(const int fd, const long long offset, const long long length)
 {
-    LOGV("JetPlayer::loadFromFD(): fd=%d offset=%lld length=%lld", fd, offset, length);
+    ALOGV("JetPlayer::loadFromFD(): fd=%d offset=%lld length=%lld", fd, offset, length);
     
     Mutex::Autolock lock(mMutex);
 
@@ -393,7 +388,7 @@
 //-------------------------------------------------------------------------------------------------
 int JetPlayer::play()
 {
-    LOGV("JetPlayer::play(): entering");
+    ALOGV("JetPlayer::play(): entering");
     Mutex::Autolock lock(mMutex);
 
     EAS_RESULT result = JET_Play(mEasData);
@@ -407,7 +402,7 @@
     fireUpdateOnStatusChange();
 
     // wake up render thread
-    LOGV("JetPlayer::play(): wakeup render thread");
+    ALOGV("JetPlayer::play(): wakeup render thread");
     mCondition.signal();
 
     return result;
@@ -435,7 +430,7 @@
 int JetPlayer::queueSegment(int segmentNum, int libNum, int repeatCount, int transpose,
         EAS_U32 muteFlags, EAS_U8 userID)
 {
-    LOGV("JetPlayer::queueSegment segmentNum=%d, libNum=%d, repeatCount=%d, transpose=%d",
+    ALOGV("JetPlayer::queueSegment segmentNum=%d, libNum=%d, repeatCount=%d, transpose=%d",
         segmentNum, libNum, repeatCount, transpose);
     Mutex::Autolock lock(mMutex);
     return JET_QueueSegment(mEasData, segmentNum, libNum, repeatCount, transpose, muteFlags, userID);
@@ -458,7 +453,7 @@
 //-------------------------------------------------------------------------------------------------
 int JetPlayer::triggerClip(int clipId)
 {
-    LOGV("JetPlayer::triggerClip clipId=%d", clipId);
+    ALOGV("JetPlayer::triggerClip clipId=%d", clipId);
     Mutex::Autolock lock(mMutex);
     return JET_TriggerClip(mEasData, clipId);
 }
@@ -466,7 +461,7 @@
 //-------------------------------------------------------------------------------------------------
 int JetPlayer::clearQueue()
 {
-    LOGV("JetPlayer::clearQueue");
+    ALOGV("JetPlayer::clearQueue");
     Mutex::Autolock lock(mMutex);
     return JET_Clear_Queue(mEasData);
 }
@@ -480,7 +475,7 @@
 void JetPlayer::dumpJetStatus(S_JET_STATUS* pJetStatus)
 {
     if(pJetStatus!=NULL)
-        LOGV(">> current JET player status: userID=%d segmentRepeatCount=%d numQueuedSegments=%d paused=%d",
+        ALOGV(">> current JET player status: userID=%d segmentRepeatCount=%d numQueuedSegments=%d paused=%d",
                 pJetStatus->currentUserID, pJetStatus->segmentRepeatCount,
                 pJetStatus->numQueuedSegments, pJetStatus->paused);
     else
diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp
index 6096b72..109f294 100644
--- a/media/libmedia/MediaProfiles.cpp
+++ b/media/libmedia/MediaProfiles.cpp
@@ -82,67 +82,67 @@
 /*static*/ void
 MediaProfiles::logVideoCodec(const MediaProfiles::VideoCodec& codec)
 {
-    LOGV("video codec:");
-    LOGV("codec = %d", codec.mCodec);
-    LOGV("bit rate: %d", codec.mBitRate);
-    LOGV("frame width: %d", codec.mFrameWidth);
-    LOGV("frame height: %d", codec.mFrameHeight);
-    LOGV("frame rate: %d", codec.mFrameRate);
+    ALOGV("video codec:");
+    ALOGV("codec = %d", codec.mCodec);
+    ALOGV("bit rate: %d", codec.mBitRate);
+    ALOGV("frame width: %d", codec.mFrameWidth);
+    ALOGV("frame height: %d", codec.mFrameHeight);
+    ALOGV("frame rate: %d", codec.mFrameRate);
 }
 
 /*static*/ void
 MediaProfiles::logAudioCodec(const MediaProfiles::AudioCodec& codec)
 {
-    LOGV("audio codec:");
-    LOGV("codec = %d", codec.mCodec);
-    LOGV("bit rate: %d", codec.mBitRate);
-    LOGV("sample rate: %d", codec.mSampleRate);
-    LOGV("number of channels: %d", codec.mChannels);
+    ALOGV("audio codec:");
+    ALOGV("codec = %d", codec.mCodec);
+    ALOGV("bit rate: %d", codec.mBitRate);
+    ALOGV("sample rate: %d", codec.mSampleRate);
+    ALOGV("number of channels: %d", codec.mChannels);
 }
 
 /*static*/ void
 MediaProfiles::logVideoEncoderCap(const MediaProfiles::VideoEncoderCap& cap)
 {
-    LOGV("video encoder cap:");
-    LOGV("codec = %d", cap.mCodec);
-    LOGV("bit rate: min = %d and max = %d", cap.mMinBitRate, cap.mMaxBitRate);
-    LOGV("frame width: min = %d and max = %d", cap.mMinFrameWidth, cap.mMaxFrameWidth);
-    LOGV("frame height: min = %d and max = %d", cap.mMinFrameHeight, cap.mMaxFrameHeight);
-    LOGV("frame rate: min = %d and max = %d", cap.mMinFrameRate, cap.mMaxFrameRate);
+    ALOGV("video encoder cap:");
+    ALOGV("codec = %d", cap.mCodec);
+    ALOGV("bit rate: min = %d and max = %d", cap.mMinBitRate, cap.mMaxBitRate);
+    ALOGV("frame width: min = %d and max = %d", cap.mMinFrameWidth, cap.mMaxFrameWidth);
+    ALOGV("frame height: min = %d and max = %d", cap.mMinFrameHeight, cap.mMaxFrameHeight);
+    ALOGV("frame rate: min = %d and max = %d", cap.mMinFrameRate, cap.mMaxFrameRate);
 }
 
 /*static*/ void
 MediaProfiles::logAudioEncoderCap(const MediaProfiles::AudioEncoderCap& cap)
 {
-    LOGV("audio encoder cap:");
-    LOGV("codec = %d", cap.mCodec);
-    LOGV("bit rate: min = %d and max = %d", cap.mMinBitRate, cap.mMaxBitRate);
-    LOGV("sample rate: min = %d and max = %d", cap.mMinSampleRate, cap.mMaxSampleRate);
-    LOGV("number of channels: min = %d and max = %d", cap.mMinChannels, cap.mMaxChannels);
+    ALOGV("audio encoder cap:");
+    ALOGV("codec = %d", cap.mCodec);
+    ALOGV("bit rate: min = %d and max = %d", cap.mMinBitRate, cap.mMaxBitRate);
+    ALOGV("sample rate: min = %d and max = %d", cap.mMinSampleRate, cap.mMaxSampleRate);
+    ALOGV("number of channels: min = %d and max = %d", cap.mMinChannels, cap.mMaxChannels);
 }
 
 /*static*/ void
 MediaProfiles::logVideoDecoderCap(const MediaProfiles::VideoDecoderCap& cap)
 {
-    LOGV("video decoder cap:");
-    LOGV("codec = %d", cap.mCodec);
+    ALOGV("video decoder cap:");
+    ALOGV("codec = %d", cap.mCodec);
 }
 
 /*static*/ void
 MediaProfiles::logAudioDecoderCap(const MediaProfiles::AudioDecoderCap& cap)
 {
-    LOGV("audio codec cap:");
-    LOGV("codec = %d", cap.mCodec);
+    ALOGV("audio codec cap:");
+    ALOGV("codec = %d", cap.mCodec);
 }
 
 /*static*/ void
 MediaProfiles::logVideoEditorCap(const MediaProfiles::VideoEditorCap& cap)
 {
-    LOGV("videoeditor cap:");
-    LOGV("mMaxInputFrameWidth = %d", cap.mMaxInputFrameWidth);
-    LOGV("mMaxInputFrameHeight = %d", cap.mMaxInputFrameHeight);
-    LOGV("mMaxOutputFrameWidth = %d", cap.mMaxOutputFrameWidth);
-    LOGV("mMaxOutputFrameHeight = %d", cap.mMaxOutputFrameHeight);
+    ALOGV("videoeditor cap:");
+    ALOGV("mMaxInputFrameWidth = %d", cap.mMaxInputFrameWidth);
+    ALOGV("mMaxInputFrameHeight = %d", cap.mMaxInputFrameHeight);
+    ALOGV("mMaxOutputFrameWidth = %d", cap.mMaxOutputFrameWidth);
+    ALOGV("mMaxOutputFrameHeight = %d", cap.mMaxOutputFrameHeight);
 }
 
 /*static*/ int
@@ -349,7 +349,7 @@
 {
     CHECK(!strcmp("quality", atts[0]));
     int quality = atoi(atts[1]);
-    LOGV("%s: cameraId=%d, quality=%d\n", __func__, cameraId, quality);
+    ALOGV("%s: cameraId=%d, quality=%d\n", __func__, cameraId, quality);
     ImageEncodingQualityLevels *levels = findImageEncodingQualityLevels(cameraId);
 
     if (levels == NULL) {
@@ -377,7 +377,7 @@
         offsetTimeMs = atoi(atts[3]);
     }
 
-    LOGV("%s: cameraId=%d, offset=%d ms", __func__, cameraId, offsetTimeMs);
+    ALOGV("%s: cameraId=%d, offset=%d ms", __func__, cameraId, offsetTimeMs);
     mStartTimeOffsets.replaceValueFor(cameraId, offsetTimeMs);
 }
 /*static*/ MediaProfiles::ExportVideoProfile*
@@ -465,7 +465,7 @@
 }
 
 void MediaProfiles::initRequiredProfileRefs(const Vector<int>& cameraIds) {
-    LOGV("Number of camera ids: %d", cameraIds.size());
+    ALOGV("Number of camera ids: %d", cameraIds.size());
     CHECK(cameraIds.size() > 0);
     mRequiredProfileRefs = new RequiredProfiles[cameraIds.size()];
     for (size_t i = 0, n = cameraIds.size(); i < n; ++i) {
@@ -592,14 +592,14 @@
 
                 int index = getCamcorderProfileIndex(cameraId, profile->mQuality);
                 if (index != -1) {
-                    LOGV("Profile quality %d for camera %d already exists",
+                    ALOGV("Profile quality %d for camera %d already exists",
                         profile->mQuality, cameraId);
                     CHECK(index == refIndex);
                     continue;
                 }
 
                 // Insert the new profile
-                LOGV("Add a profile: quality %d=>%d for camera %d",
+                ALOGV("Add a profile: quality %d=>%d for camera %d",
                         mCamcorderProfiles[info->mRefProfileIndex]->mQuality,
                         profile->mQuality, cameraId);
 
@@ -612,7 +612,7 @@
 /*static*/ MediaProfiles*
 MediaProfiles::getInstance()
 {
-    LOGV("getInstance");
+    ALOGV("getInstance");
     Mutex::Autolock lock(sLock);
     if (!sIsInitialized) {
         char value[PROPERTY_VALUE_MAX];
@@ -954,7 +954,7 @@
 
 int MediaProfiles::getVideoEncoderParamByName(const char *name, video_encoder codec) const
 {
-    LOGV("getVideoEncoderParamByName: %s for codec %d", name, codec);
+    ALOGV("getVideoEncoderParamByName: %s for codec %d", name, codec);
     int index = -1;
     for (size_t i = 0, n = mVideoEncoders.size(); i < n; ++i) {
         if (mVideoEncoders[i]->mCodec == codec) {
@@ -982,7 +982,7 @@
 int MediaProfiles::getVideoEditorExportParamByName(
     const char *name, int codec) const
 {
-    LOGV("getVideoEditorExportParamByName: name %s codec %d", name, codec);
+    ALOGV("getVideoEditorExportParamByName: name %s codec %d", name, codec);
     ExportVideoProfile *exportProfile = NULL;
     int index = -1;
     for (size_t i =0; i < mVideoEditorExportProfiles.size(); i++) {
@@ -1006,7 +1006,7 @@
 }
 int MediaProfiles::getVideoEditorCapParamByName(const char *name) const
 {
-    LOGV("getVideoEditorCapParamByName: %s", name);
+    ALOGV("getVideoEditorCapParamByName: %s", name);
 
     if (mVideoEditorCap == NULL) {
         LOGE("The mVideoEditorCap is not created, then create default cap.");
@@ -1039,7 +1039,7 @@
 
 int MediaProfiles::getAudioEncoderParamByName(const char *name, audio_encoder codec) const
 {
-    LOGV("getAudioEncoderParamByName: %s for codec %d", name, codec);
+    ALOGV("getAudioEncoderParamByName: %s for codec %d", name, codec);
     int index = -1;
     for (size_t i = 0, n = mAudioEncoders.size(); i < n; ++i) {
         if (mAudioEncoders[i]->mCodec == codec) {
@@ -1098,7 +1098,7 @@
                                                   int cameraId,
                                                   camcorder_quality quality) const
 {
-    LOGV("getCamcorderProfileParamByName: %s for camera %d, quality %d",
+    ALOGV("getCamcorderProfileParamByName: %s for camera %d, quality %d",
          name, cameraId, quality);
 
     int index = getCamcorderProfileIndex(cameraId, quality);
@@ -1145,7 +1145,7 @@
     if (index >= 0) {
         offsetTimeMs = mStartTimeOffsets.valueFor(cameraId);
     }
-    LOGV("offsetTime=%d ms and cameraId=%d", offsetTimeMs, cameraId);
+    ALOGV("offsetTime=%d ms and cameraId=%d", offsetTimeMs, cameraId);
     return offsetTimeMs;
 }
 
diff --git a/media/libmedia/MediaScanner.cpp b/media/libmedia/MediaScanner.cpp
index 19dedfc..b304f8c 100644
--- a/media/libmedia/MediaScanner.cpp
+++ b/media/libmedia/MediaScanner.cpp
@@ -143,7 +143,7 @@
     if (pathRemaining >= 8 /* strlen(".nomedia") */ ) {
         strcpy(fileSpot, ".nomedia");
         if (access(path, F_OK) == 0) {
-            LOGV("found .nomedia, setting noMedia flag\n");
+            ALOGV("found .nomedia, setting noMedia flag\n");
             noMedia = true;
         }
 
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp
index 7c2200e..28b54b5 100644
--- a/media/libmedia/ToneGenerator.cpp
+++ b/media/libmedia/ToneGenerator.cpp
@@ -800,7 +800,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 ToneGenerator::ToneGenerator(int streamType, float volume, bool threadCanCallJava) {
 
-    LOGV("ToneGenerator constructor: streamType=%d, volume=%f\n", streamType, volume);
+    ALOGV("ToneGenerator constructor: streamType=%d, volume=%f\n", streamType, volume);
 
     mState = TONE_IDLE;
 
@@ -829,9 +829,9 @@
     }
 
     if (initAudioTrack()) {
-        LOGV("ToneGenerator INIT OK, time: %d\n", (unsigned int)(systemTime()/1000000));
+        ALOGV("ToneGenerator INIT OK, time: %d\n", (unsigned int)(systemTime()/1000000));
     } else {
-        LOGV("!!!ToneGenerator INIT FAILED!!!\n");
+        ALOGV("!!!ToneGenerator INIT FAILED!!!\n");
     }
 }
 
@@ -853,11 +853,11 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 ToneGenerator::~ToneGenerator() {
-    LOGV("ToneGenerator destructor\n");
+    ALOGV("ToneGenerator destructor\n");
 
     if (mpAudioTrack) {
         stopTone();
-        LOGV("Delete Track: %p\n", mpAudioTrack);
+        ALOGV("Delete Track: %p\n", mpAudioTrack);
         delete mpAudioTrack;
     }
 }
@@ -886,13 +886,13 @@
         return lResult;
 
     if (mState == TONE_IDLE) {
-        LOGV("startTone: try to re-init AudioTrack");
+        ALOGV("startTone: try to re-init AudioTrack");
         if (!initAudioTrack()) {
             return lResult;
         }
     }
 
-    LOGV("startTone\n");
+    ALOGV("startTone\n");
 
     mLock.lock();
 
@@ -903,7 +903,7 @@
     mDurationMs = durationMs;
 
     if (mState == TONE_STOPPED) {
-        LOGV("Start waiting for previous tone to stop");
+        ALOGV("Start waiting for previous tone to stop");
         lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
         if (lStatus != NO_ERROR) {
             LOGE("--- start wait for stop timed out, status %d", lStatus);
@@ -915,14 +915,14 @@
 
     if (mState == TONE_INIT) {
         if (prepareWave()) {
-            LOGV("Immediate start, time %d\n", (unsigned int)(systemTime()/1000000));
+            ALOGV("Immediate start, time %d\n", (unsigned int)(systemTime()/1000000));
             lResult = true;
             mState = TONE_STARTING;
             mLock.unlock();
             mpAudioTrack->start();
             mLock.lock();
             if (mState == TONE_STARTING) {
-                LOGV("Wait for start callback");
+                ALOGV("Wait for start callback");
                 lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
                 if (lStatus != NO_ERROR) {
                     LOGE("--- Immediate start timed out, status %d", lStatus);
@@ -934,14 +934,14 @@
             mState = TONE_IDLE;
         }
     } else {
-        LOGV("Delayed start\n");
+        ALOGV("Delayed start\n");
         mState = TONE_RESTARTING;
         lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
         if (lStatus == NO_ERROR) {
             if (mState != TONE_IDLE) {
                 lResult = true;
             }
-            LOGV("cond received");
+            ALOGV("cond received");
         } else {
             LOGE("--- Delayed start timed out, status %d", lStatus);
             mState = TONE_IDLE;
@@ -949,7 +949,7 @@
     }
     mLock.unlock();
 
-    LOGV_IF(lResult, "Tone started, time %d\n", (unsigned int)(systemTime()/1000000));
+    ALOGV_IF(lResult, "Tone started, time %d\n", (unsigned int)(systemTime()/1000000));
     LOGW_IF(!lResult, "Tone start failed!!!, time %d\n", (unsigned int)(systemTime()/1000000));
 
     return lResult;
@@ -969,15 +969,15 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 void ToneGenerator::stopTone() {
-    LOGV("stopTone");
+    ALOGV("stopTone");
 
     mLock.lock();
     if (mState == TONE_PLAYING || mState == TONE_STARTING || mState == TONE_RESTARTING) {
         mState = TONE_STOPPING;
-        LOGV("waiting cond");
+        ALOGV("waiting cond");
         status_t lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
         if (lStatus == NO_ERROR) {
-            LOGV("track stop complete, time %d", (unsigned int)(systemTime()/1000000));
+            ALOGV("track stop complete, time %d", (unsigned int)(systemTime()/1000000));
         } else {
             LOGE("--- Stop timed out");
             mState = TONE_IDLE;
@@ -1021,7 +1021,7 @@
         LOGE("AudioTrack allocation failed");
         goto initAudioTrack_exit;
     }
-    LOGV("Create Track: %p\n", mpAudioTrack);
+    ALOGV("Create Track: %p\n", mpAudioTrack);
 
     mpAudioTrack->set(mStreamType,
                       0,
@@ -1050,7 +1050,7 @@
 
     // Cleanup
     if (mpAudioTrack) {
-        LOGV("Delete Track I: %p\n", mpAudioTrack);
+        ALOGV("Delete Track I: %p\n", mpAudioTrack);
         delete mpAudioTrack;
         mpAudioTrack = 0;
     }
@@ -1109,22 +1109,22 @@
             lWaveCmd = WaveGenerator::WAVEGEN_CONT;
             break;
         case TONE_STARTING:
-            LOGV("Starting Cbk");
+            ALOGV("Starting Cbk");
 
             lWaveCmd = WaveGenerator::WAVEGEN_START;
             break;
         case TONE_STOPPING:
         case TONE_RESTARTING:
-            LOGV("Stop/restart Cbk");
+            ALOGV("Stop/restart Cbk");
 
             lWaveCmd = WaveGenerator::WAVEGEN_STOP;
             lpToneGen->mNextSegSmp = TONEGEN_INF; // forced to skip state machine management below
             break;
         case TONE_STOPPED:
-            LOGV("Stopped Cbk");
+            ALOGV("Stopped Cbk");
             goto audioCallback_EndLoop;
         default:
-            LOGV("Extra Cbk");
+            ALOGV("Extra Cbk");
             goto audioCallback_EndLoop;
         }
 
@@ -1145,7 +1145,7 @@
         if (lpToneGen->mTotalSmp > lpToneGen->mNextSegSmp) {
             // Time to go to next sequence segment
 
-            LOGV("End Segment, time: %d\n", (unsigned int)(systemTime()/1000000));
+            ALOGV("End Segment, time: %d\n", (unsigned int)(systemTime()/1000000));
 
             lGenSmp = lReqSmp;
 
@@ -1160,13 +1160,13 @@
                     lpWaveGen->getSamples(lpOut, lGenSmp, lWaveCmd);
                     lFrequency = lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[++lFreqIdx];
                 }
-                LOGV("ON->OFF, lGenSmp: %d, lReqSmp: %d\n", lGenSmp, lReqSmp);
+                ALOGV("ON->OFF, lGenSmp: %d, lReqSmp: %d\n", lGenSmp, lReqSmp);
             }
 
             // check if we need to loop and loop for the reqd times
             if (lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt) {
                 if (lpToneGen->mLoopCounter < lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt) {
-                    LOGV ("in if loop loopCnt(%d) loopctr(%d), CurSeg(%d) \n",
+                    ALOGV ("in if loop loopCnt(%d) loopctr(%d), CurSeg(%d) \n",
                           lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt,
                           lpToneGen->mLoopCounter,
                           lpToneGen->mCurSegment);
@@ -1176,14 +1176,14 @@
                     // completed loop. go to next segment
                     lpToneGen->mLoopCounter = 0;
                     lpToneGen->mCurSegment++;
-                    LOGV ("in else loop loopCnt(%d) loopctr(%d), CurSeg(%d) \n",
+                    ALOGV ("in else loop loopCnt(%d) loopctr(%d), CurSeg(%d) \n",
                           lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt,
                           lpToneGen->mLoopCounter,
                           lpToneGen->mCurSegment);
                 }
             } else {
                 lpToneGen->mCurSegment++;
-                LOGV ("Goto next seg loopCnt(%d) loopctr(%d), CurSeg(%d) \n",
+                ALOGV ("Goto next seg loopCnt(%d) loopctr(%d), CurSeg(%d) \n",
                       lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt,
                       lpToneGen->mLoopCounter,
                       lpToneGen->mCurSegment);
@@ -1192,32 +1192,32 @@
 
             // Handle loop if last segment reached
             if (lpToneDesc->segments[lpToneGen->mCurSegment].duration == 0) {
-                LOGV("Last Seg: %d\n", lpToneGen->mCurSegment);
+                ALOGV("Last Seg: %d\n", lpToneGen->mCurSegment);
 
                 // Pre increment loop count and restart if total count not reached. Stop sequence otherwise
                 if (++lpToneGen->mCurCount <= lpToneDesc->repeatCnt) {
-                    LOGV("Repeating Count: %d\n", lpToneGen->mCurCount);
+                    ALOGV("Repeating Count: %d\n", lpToneGen->mCurCount);
 
                     lpToneGen->mCurSegment = lpToneDesc->repeatSegment;
                     if (lpToneDesc->segments[lpToneDesc->repeatSegment].waveFreq[0] != 0) {
                         lWaveCmd = WaveGenerator::WAVEGEN_START;
                     }
 
-                    LOGV("New segment %d, Next Time: %d\n", lpToneGen->mCurSegment,
+                    ALOGV("New segment %d, Next Time: %d\n", lpToneGen->mCurSegment,
                             (lpToneGen->mNextSegSmp*1000)/lpToneGen->mSamplingRate);
 
                 } else {
                     lGenSmp = 0;
-                    LOGV("End repeat, time: %d\n", (unsigned int)(systemTime()/1000000));
+                    ALOGV("End repeat, time: %d\n", (unsigned int)(systemTime()/1000000));
                 }
             } else {
-                LOGV("New segment %d, Next Time: %d\n", lpToneGen->mCurSegment,
+                ALOGV("New segment %d, Next Time: %d\n", lpToneGen->mCurSegment,
                         (lpToneGen->mNextSegSmp*1000)/lpToneGen->mSamplingRate);
                 if (lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[0] != 0) {
                     // If next segment is not silent,  OFF -> ON transition : reset wave generator
                     lWaveCmd = WaveGenerator::WAVEGEN_START;
 
-                    LOGV("OFF->ON, lGenSmp: %d, lReqSmp: %d\n", lGenSmp, lReqSmp);
+                    ALOGV("OFF->ON, lGenSmp: %d, lReqSmp: %d\n", lGenSmp, lReqSmp);
                 } else {
                     lGenSmp = 0;
                 }
@@ -1255,7 +1255,7 @@
 
         switch (lpToneGen->mState) {
         case TONE_RESTARTING:
-            LOGV("Cbk restarting track\n");
+            ALOGV("Cbk restarting track\n");
             if (lpToneGen->prepareWave()) {
                 lpToneGen->mState = TONE_STARTING;
                 // must reload lpToneDesc as prepareWave() may change mpToneDesc
@@ -1270,14 +1270,14 @@
             lSignal = true;
             break;
         case TONE_STOPPING:
-            LOGV("Cbk Stopping\n");
+            ALOGV("Cbk Stopping\n");
             lpToneGen->mState = TONE_STOPPED;
             // Force loop exit
             lNumSmp = 0;
             break;
         case TONE_STOPPED:
             lpToneGen->mState = TONE_INIT;
-            LOGV("Cbk Stopped track\n");
+            ALOGV("Cbk Stopped track\n");
             lpToneGen->mpAudioTrack->stop();
             // Force loop exit
             lNumSmp = 0;
@@ -1285,7 +1285,7 @@
             lSignal = true;
             break;
         case TONE_STARTING:
-            LOGV("Cbk starting track\n");
+            ALOGV("Cbk starting track\n");
             lpToneGen->mState = TONE_PLAYING;
             lSignal = true;
            break;
@@ -1338,7 +1338,7 @@
         } else {
             mMaxSmp = (mDurationMs * mSamplingRate) / 1000;
         }
-        LOGV("prepareWave, duration limited to %d ms", mDurationMs);
+        ALOGV("prepareWave, duration limited to %d ms", mDurationMs);
     }
 
     while (mpToneDesc->segments[segmentIdx].duration) {
@@ -1425,7 +1425,7 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 void ToneGenerator::clearWaveGens() {
-    LOGV("Clearing mWaveGens:");
+    ALOGV("Clearing mWaveGens:");
 
     for (size_t lIdx = 0; lIdx < mWaveGens.size(); lIdx++) {
         delete mWaveGens.valueAt(lIdx);
@@ -1456,7 +1456,7 @@
         regionTone = sToneMappingTable[mRegion][toneType - FIRST_SUP_TONE];
     }
 
-    LOGV("getToneForRegion, tone %d, region %d, regionTone %d", toneType, mRegion, regionTone);
+    ALOGV("getToneForRegion, tone %d, region %d, regionTone %d", toneType, mRegion, regionTone);
 
     return regionTone;
 }
@@ -1504,7 +1504,7 @@
         d0 = 32767;
     mA1_Q14 = (short) d0;
 
-    LOGV("WaveGenerator init, mA1_Q14: %d, mS2_0: %d, mAmplitude_Q15: %d\n",
+    ALOGV("WaveGenerator init, mA1_Q14: %d, mS2_0: %d, mAmplitude_Q15: %d\n",
             mA1_Q14, mS2_0, mAmplitude_Q15);
 }
 
diff --git a/media/libmedia/Visualizer.cpp b/media/libmedia/Visualizer.cpp
index bf40481..de40f98 100644
--- a/media/libmedia/Visualizer.cpp
+++ b/media/libmedia/Visualizer.cpp
@@ -120,7 +120,7 @@
             return NO_INIT;
         }
     }
-    LOGV("setCaptureCallBack() rate: %d thread %p flags 0x%08x",
+    ALOGV("setCaptureCallBack() rate: %d thread %p flags 0x%08x",
             rate, mCaptureThread.get(), mCaptureFlags);
     return NO_ERROR;
 }
@@ -147,7 +147,7 @@
     *((int32_t *)p->data + 1)= size;
     status_t status = setParameter(p);
 
-    LOGV("setCaptureSize size %d  status %d p->status %d", size, status, p->status);
+    ALOGV("setCaptureSize size %d  status %d p->status %d", size, status, p->status);
 
     if (status == NO_ERROR) {
         status = p->status;
@@ -172,12 +172,12 @@
     if (mEnabled) {
         uint32_t replySize = mCaptureSize;
         status = command(VISUALIZER_CMD_CAPTURE, 0, NULL, &replySize, waveform);
-        LOGV("getWaveForm() command returned %d", status);
+        ALOGV("getWaveForm() command returned %d", status);
         if (replySize == 0) {
             status = NOT_ENOUGH_DATA;
         }
     } else {
-        LOGV("getWaveForm() disabled");
+        ALOGV("getWaveForm() disabled");
         memset(waveform, 0x80, mCaptureSize);
     }
     return status;
@@ -236,7 +236,7 @@
 void Visualizer::periodicCapture()
 {
     Mutex::Autolock _l(mLock);
-    LOGV("periodicCapture() %p mCaptureCallBack %p mCaptureFlags 0x%08x",
+    ALOGV("periodicCapture() %p mCaptureCallBack %p mCaptureFlags 0x%08x",
             this, mCaptureCallBack, mCaptureFlags);
     if (mCaptureCallBack != NULL &&
         (mCaptureFlags & (CAPTURE_WAVEFORM|CAPTURE_FFT)) &&
@@ -289,7 +289,7 @@
     }
     mCaptureSize = size;
 
-    LOGV("initCaptureSize size %d status %d", mCaptureSize, status);
+    ALOGV("initCaptureSize size %d status %d", mCaptureSize, status);
 
     return size;
 }
@@ -300,18 +300,18 @@
     : Thread(bCanCallJava), mReceiver(receiver)
 {
     mSleepTimeUs = 1000000000 / captureRate;
-    LOGV("CaptureThread cstor %p captureRate %d mSleepTimeUs %d", this, captureRate, mSleepTimeUs);
+    ALOGV("CaptureThread cstor %p captureRate %d mSleepTimeUs %d", this, captureRate, mSleepTimeUs);
 }
 
 bool Visualizer::CaptureThread::threadLoop()
 {
-    LOGV("CaptureThread %p enter", this);
+    ALOGV("CaptureThread %p enter", this);
     while (!exitPending())
     {
         usleep(mSleepTimeUs);
         mReceiver.periodicCapture();
     }
-    LOGV("CaptureThread %p exiting", this);
+    ALOGV("CaptureThread %p exiting", this);
     return false;
 }
 
diff --git a/media/libmedia/mediametadataretriever.cpp b/media/libmedia/mediametadataretriever.cpp
index cee06ab..fd8c065 100644
--- a/media/libmedia/mediametadataretriever.cpp
+++ b/media/libmedia/mediametadataretriever.cpp
@@ -58,7 +58,7 @@
 
 MediaMetadataRetriever::MediaMetadataRetriever()
 {
-    LOGV("constructor");
+    ALOGV("constructor");
     const sp<IMediaPlayerService>& service(getService());
     if (service == 0) {
         LOGE("failed to obtain MediaMetadataRetrieverService");
@@ -73,14 +73,14 @@
 
 MediaMetadataRetriever::~MediaMetadataRetriever()
 {
-    LOGV("destructor");
+    ALOGV("destructor");
     disconnect();
     IPCThreadState::self()->flushCommands();
 }
 
 void MediaMetadataRetriever::disconnect()
 {
-    LOGV("disconnect");
+    ALOGV("disconnect");
     sp<IMediaMetadataRetriever> retriever;
     {
         Mutex::Autolock _l(mLock);
@@ -95,7 +95,7 @@
 status_t MediaMetadataRetriever::setDataSource(
         const char *srcUrl, const KeyedVector<String8, String8> *headers)
 {
-    LOGV("setDataSource");
+    ALOGV("setDataSource");
     Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
         LOGE("retriever is not initialized");
@@ -105,13 +105,13 @@
         LOGE("data source is a null pointer");
         return UNKNOWN_ERROR;
     }
-    LOGV("data source (%s)", srcUrl);
+    ALOGV("data source (%s)", srcUrl);
     return mRetriever->setDataSource(srcUrl, headers);
 }
 
 status_t MediaMetadataRetriever::setDataSource(int fd, int64_t offset, int64_t length)
 {
-    LOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
     Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
         LOGE("retriever is not initialized");
@@ -126,7 +126,7 @@
 
 sp<IMemory> MediaMetadataRetriever::getFrameAtTime(int64_t timeUs, int option)
 {
-    LOGV("getFrameAtTime: time(%lld us) option(%d)", timeUs, option);
+    ALOGV("getFrameAtTime: time(%lld us) option(%d)", timeUs, option);
     Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
         LOGE("retriever is not initialized");
@@ -137,7 +137,7 @@
 
 const char* MediaMetadataRetriever::extractMetadata(int keyCode)
 {
-    LOGV("extractMetadata(%d)", keyCode);
+    ALOGV("extractMetadata(%d)", keyCode);
     Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
         LOGE("retriever is not initialized");
@@ -148,7 +148,7 @@
 
 sp<IMemory> MediaMetadataRetriever::extractAlbumArt()
 {
-    LOGV("extractAlbumArt");
+    ALOGV("extractAlbumArt");
     Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
         LOGE("retriever is not initialized");
diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp
index c2e1ddf..5853144 100644
--- a/media/libmedia/mediaplayer.cpp
+++ b/media/libmedia/mediaplayer.cpp
@@ -46,7 +46,7 @@
 
 MediaPlayer::MediaPlayer()
 {
-    LOGV("constructor");
+    ALOGV("constructor");
     mListener = NULL;
     mCookie = NULL;
     mDuration = -1;
@@ -67,7 +67,7 @@
 
 MediaPlayer::~MediaPlayer()
 {
-    LOGV("destructor");
+    ALOGV("destructor");
     AudioSystem::releaseAudioSessionId(mAudioSessionId);
     disconnect();
     IPCThreadState::self()->flushCommands();
@@ -75,7 +75,7 @@
 
 void MediaPlayer::disconnect()
 {
-    LOGV("disconnect");
+    ALOGV("disconnect");
     sp<IMediaPlayer> p;
     {
         Mutex::Autolock _l(mLock);
@@ -99,7 +99,7 @@
 
 status_t MediaPlayer::setListener(const sp<MediaPlayerListener>& listener)
 {
-    LOGV("setListener");
+    ALOGV("setListener");
     Mutex::Autolock _l(mLock);
     mListener = listener;
     return NO_ERROR;
@@ -140,7 +140,7 @@
 status_t MediaPlayer::setDataSource(
         const char *url, const KeyedVector<String8, String8> *headers)
 {
-    LOGV("setDataSource(%s)", url);
+    ALOGV("setDataSource(%s)", url);
     status_t err = BAD_VALUE;
     if (url != NULL) {
         const sp<IMediaPlayerService>& service(getMediaPlayerService());
@@ -157,7 +157,7 @@
 
 status_t MediaPlayer::setDataSource(int fd, int64_t offset, int64_t length)
 {
-    LOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
     status_t err = UNKNOWN_ERROR;
     const sp<IMediaPlayerService>& service(getMediaPlayerService());
     if (service != 0) {
@@ -172,7 +172,7 @@
 
 status_t MediaPlayer::setDataSource(const sp<IStreamSource> &source)
 {
-    LOGV("setDataSource");
+    ALOGV("setDataSource");
     status_t err = UNKNOWN_ERROR;
     const sp<IMediaPlayerService>& service(getMediaPlayerService());
     if (service != 0) {
@@ -192,7 +192,7 @@
             (mCurrentState != MEDIA_PLAYER_STATE_ERROR) &&
             ((mCurrentState & MEDIA_PLAYER_IDLE) != MEDIA_PLAYER_IDLE);
     if ((mPlayer != NULL) && hasBeenInitialized) {
-         LOGV("invoke %d", request.dataSize());
+         ALOGV("invoke %d", request.dataSize());
          return  mPlayer->invoke(request, reply);
     }
     LOGE("invoke failed: wrong state %X", mCurrentState);
@@ -222,7 +222,7 @@
 status_t MediaPlayer::setVideoSurfaceTexture(
         const sp<ISurfaceTexture>& surfaceTexture)
 {
-    LOGV("setVideoSurfaceTexture");
+    ALOGV("setVideoSurfaceTexture");
     Mutex::Autolock _l(mLock);
     if (mPlayer == 0) return NO_INIT;
     return mPlayer->setVideoSurfaceTexture(surfaceTexture);
@@ -246,7 +246,7 @@
 // code.
 status_t MediaPlayer::prepare()
 {
-    LOGV("prepare");
+    ALOGV("prepare");
     Mutex::Autolock _l(mLock);
     mLockThreadId = getThreadId();
     if (mPrepareSync) {
@@ -264,21 +264,21 @@
         mSignal.wait(mLock);  // wait for prepare done
         mPrepareSync = false;
     }
-    LOGV("prepare complete - status=%d", mPrepareStatus);
+    ALOGV("prepare complete - status=%d", mPrepareStatus);
     mLockThreadId = 0;
     return mPrepareStatus;
 }
 
 status_t MediaPlayer::prepareAsync()
 {
-    LOGV("prepareAsync");
+    ALOGV("prepareAsync");
     Mutex::Autolock _l(mLock);
     return prepareAsync_l();
 }
 
 status_t MediaPlayer::start()
 {
-    LOGV("start");
+    ALOGV("start");
     Mutex::Autolock _l(mLock);
     if (mCurrentState & MEDIA_PLAYER_STARTED)
         return NO_ERROR;
@@ -293,7 +293,7 @@
             mCurrentState = MEDIA_PLAYER_STATE_ERROR;
         } else {
             if (mCurrentState == MEDIA_PLAYER_PLAYBACK_COMPLETE) {
-                LOGV("playback completed immediately following start()");
+                ALOGV("playback completed immediately following start()");
             }
         }
         return ret;
@@ -304,7 +304,7 @@
 
 status_t MediaPlayer::stop()
 {
-    LOGV("stop");
+    ALOGV("stop");
     Mutex::Autolock _l(mLock);
     if (mCurrentState & MEDIA_PLAYER_STOPPED) return NO_ERROR;
     if ( (mPlayer != 0) && ( mCurrentState & ( MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PREPARED |
@@ -323,7 +323,7 @@
 
 status_t MediaPlayer::pause()
 {
-    LOGV("pause");
+    ALOGV("pause");
     Mutex::Autolock _l(mLock);
     if (mCurrentState & (MEDIA_PLAYER_PAUSED|MEDIA_PLAYER_PLAYBACK_COMPLETE))
         return NO_ERROR;
@@ -346,20 +346,20 @@
     if (mPlayer != 0) {
         bool temp = false;
         mPlayer->isPlaying(&temp);
-        LOGV("isPlaying: %d", temp);
+        ALOGV("isPlaying: %d", temp);
         if ((mCurrentState & MEDIA_PLAYER_STARTED) && ! temp) {
             LOGE("internal/external state mismatch corrected");
             mCurrentState = MEDIA_PLAYER_PAUSED;
         }
         return temp;
     }
-    LOGV("isPlaying: no active player");
+    ALOGV("isPlaying: no active player");
     return false;
 }
 
 status_t MediaPlayer::getVideoWidth(int *w)
 {
-    LOGV("getVideoWidth");
+    ALOGV("getVideoWidth");
     Mutex::Autolock _l(mLock);
     if (mPlayer == 0) return INVALID_OPERATION;
     *w = mVideoWidth;
@@ -368,7 +368,7 @@
 
 status_t MediaPlayer::getVideoHeight(int *h)
 {
-    LOGV("getVideoHeight");
+    ALOGV("getVideoHeight");
     Mutex::Autolock _l(mLock);
     if (mPlayer == 0) return INVALID_OPERATION;
     *h = mVideoHeight;
@@ -377,11 +377,11 @@
 
 status_t MediaPlayer::getCurrentPosition(int *msec)
 {
-    LOGV("getCurrentPosition");
+    ALOGV("getCurrentPosition");
     Mutex::Autolock _l(mLock);
     if (mPlayer != 0) {
         if (mCurrentPosition >= 0) {
-            LOGV("Using cached seek position: %d", mCurrentPosition);
+            ALOGV("Using cached seek position: %d", mCurrentPosition);
             *msec = mCurrentPosition;
             return NO_ERROR;
         }
@@ -392,7 +392,7 @@
 
 status_t MediaPlayer::getDuration_l(int *msec)
 {
-    LOGV("getDuration");
+    ALOGV("getDuration");
     bool isValidState = (mCurrentState & (MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PAUSED | MEDIA_PLAYER_STOPPED | MEDIA_PLAYER_PLAYBACK_COMPLETE));
     if (mPlayer != 0 && isValidState) {
         status_t ret = NO_ERROR;
@@ -414,7 +414,7 @@
 
 status_t MediaPlayer::seekTo_l(int msec)
 {
-    LOGV("seekTo %d", msec);
+    ALOGV("seekTo %d", msec);
     if ((mPlayer != 0) && ( mCurrentState & ( MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_PAUSED |  MEDIA_PLAYER_PLAYBACK_COMPLETE) ) ) {
         if ( msec < 0 ) {
             LOGW("Attempt to seek to invalid position: %d", msec);
@@ -431,7 +431,7 @@
             return mPlayer->seekTo(msec);
         }
         else {
-            LOGV("Seek in progress - queue up seekTo[%d]", msec);
+            ALOGV("Seek in progress - queue up seekTo[%d]", msec);
             return NO_ERROR;
         }
     }
@@ -473,14 +473,14 @@
 
 status_t MediaPlayer::reset()
 {
-    LOGV("reset");
+    ALOGV("reset");
     Mutex::Autolock _l(mLock);
     return reset_l();
 }
 
 status_t MediaPlayer::setAudioStreamType(int type)
 {
-    LOGV("MediaPlayer::setAudioStreamType");
+    ALOGV("MediaPlayer::setAudioStreamType");
     Mutex::Autolock _l(mLock);
     if (mStreamType == type) return NO_ERROR;
     if (mCurrentState & ( MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_STARTED |
@@ -496,7 +496,7 @@
 
 status_t MediaPlayer::setLooping(int loop)
 {
-    LOGV("MediaPlayer::setLooping");
+    ALOGV("MediaPlayer::setLooping");
     Mutex::Autolock _l(mLock);
     mLoop = (loop != 0);
     if (mPlayer != 0) {
@@ -506,18 +506,18 @@
 }
 
 bool MediaPlayer::isLooping() {
-    LOGV("isLooping");
+    ALOGV("isLooping");
     Mutex::Autolock _l(mLock);
     if (mPlayer != 0) {
         return mLoop;
     }
-    LOGV("isLooping: no active player");
+    ALOGV("isLooping: no active player");
     return false;
 }
 
 status_t MediaPlayer::setVolume(float leftVolume, float rightVolume)
 {
-    LOGV("MediaPlayer::setVolume(%f, %f)", leftVolume, rightVolume);
+    ALOGV("MediaPlayer::setVolume(%f, %f)", leftVolume, rightVolume);
     Mutex::Autolock _l(mLock);
     mLeftVolume = leftVolume;
     mRightVolume = rightVolume;
@@ -529,7 +529,7 @@
 
 status_t MediaPlayer::setAudioSessionId(int sessionId)
 {
-    LOGV("MediaPlayer::setAudioSessionId(%d)", sessionId);
+    ALOGV("MediaPlayer::setAudioSessionId(%d)", sessionId);
     Mutex::Autolock _l(mLock);
     if (!(mCurrentState & MEDIA_PLAYER_IDLE)) {
         LOGE("setAudioSessionId called in state %d", mCurrentState);
@@ -554,7 +554,7 @@
 
 status_t MediaPlayer::setAuxEffectSendLevel(float level)
 {
-    LOGV("MediaPlayer::setAuxEffectSendLevel(%f)", level);
+    ALOGV("MediaPlayer::setAuxEffectSendLevel(%f)", level);
     Mutex::Autolock _l(mLock);
     mSendLevel = level;
     if (mPlayer != 0) {
@@ -565,7 +565,7 @@
 
 status_t MediaPlayer::attachAuxEffect(int effectId)
 {
-    LOGV("MediaPlayer::attachAuxEffect(%d)", effectId);
+    ALOGV("MediaPlayer::attachAuxEffect(%d)", effectId);
     Mutex::Autolock _l(mLock);
     if (mPlayer == 0 ||
         (mCurrentState & MEDIA_PLAYER_IDLE) ||
@@ -579,29 +579,29 @@
 
 status_t MediaPlayer::setParameter(int key, const Parcel& request)
 {
-    LOGV("MediaPlayer::setParameter(%d)", key);
+    ALOGV("MediaPlayer::setParameter(%d)", key);
     Mutex::Autolock _l(mLock);
     if (mPlayer != NULL) {
         return  mPlayer->setParameter(key, request);
     }
-    LOGV("setParameter: no active player");
+    ALOGV("setParameter: no active player");
     return INVALID_OPERATION;
 }
 
 status_t MediaPlayer::getParameter(int key, Parcel *reply)
 {
-    LOGV("MediaPlayer::getParameter(%d)", key);
+    ALOGV("MediaPlayer::getParameter(%d)", key);
     Mutex::Autolock _l(mLock);
     if (mPlayer != NULL) {
          return  mPlayer->getParameter(key, reply);
     }
-    LOGV("getParameter: no active player");
+    ALOGV("getParameter: no active player");
     return INVALID_OPERATION;
 }
 
 void MediaPlayer::notify(int msg, int ext1, int ext2, const Parcel *obj)
 {
-    LOGV("message received msg=%d, ext1=%d, ext2=%d", msg, ext1, ext2);
+    ALOGV("message received msg=%d, ext1=%d, ext2=%d", msg, ext1, ext2);
     bool send = true;
     bool locked = false;
 
@@ -620,7 +620,7 @@
 
     // Allows calls from JNI in idle state to notify errors
     if (!(msg == MEDIA_ERROR && mCurrentState == MEDIA_PLAYER_IDLE) && mPlayer == 0) {
-        LOGV("notify(%d, %d, %d) callback on disconnected mediaplayer", msg, ext1, ext2);
+        ALOGV("notify(%d, %d, %d) callback on disconnected mediaplayer", msg, ext1, ext2);
         if (locked) mLock.unlock();   // release the lock when done.
         return;
     }
@@ -629,17 +629,17 @@
     case MEDIA_NOP: // interface test message
         break;
     case MEDIA_PREPARED:
-        LOGV("prepared");
+        ALOGV("prepared");
         mCurrentState = MEDIA_PLAYER_PREPARED;
         if (mPrepareSync) {
-            LOGV("signal application thread");
+            ALOGV("signal application thread");
             mPrepareSync = false;
             mPrepareStatus = NO_ERROR;
             mSignal.signal();
         }
         break;
     case MEDIA_PLAYBACK_COMPLETE:
-        LOGV("playback complete");
+        ALOGV("playback complete");
         if (mCurrentState == MEDIA_PLAYER_IDLE) {
             LOGE("playback complete in idle state");
         }
@@ -655,7 +655,7 @@
         mCurrentState = MEDIA_PLAYER_STATE_ERROR;
         if (mPrepareSync)
         {
-            LOGV("signal application thread");
+            ALOGV("signal application thread");
             mPrepareSync = false;
             mPrepareStatus = ext1;
             mSignal.signal();
@@ -670,30 +670,30 @@
         }
         break;
     case MEDIA_SEEK_COMPLETE:
-        LOGV("Received seek complete");
+        ALOGV("Received seek complete");
         if (mSeekPosition != mCurrentPosition) {
-            LOGV("Executing queued seekTo(%d)", mSeekPosition);
+            ALOGV("Executing queued seekTo(%d)", mSeekPosition);
             mSeekPosition = -1;
             seekTo_l(mCurrentPosition);
         }
         else {
-            LOGV("All seeks complete - return to regularly scheduled program");
+            ALOGV("All seeks complete - return to regularly scheduled program");
             mCurrentPosition = mSeekPosition = -1;
         }
         break;
     case MEDIA_BUFFERING_UPDATE:
-        LOGV("buffering %d", ext1);
+        ALOGV("buffering %d", ext1);
         break;
     case MEDIA_SET_VIDEO_SIZE:
-        LOGV("New video size %d x %d", ext1, ext2);
+        ALOGV("New video size %d x %d", ext1, ext2);
         mVideoWidth = ext1;
         mVideoHeight = ext2;
         break;
     case MEDIA_TIMED_TEXT:
-        LOGV("Received timed text message");
+        ALOGV("Received timed text message");
         break;
     default:
-        LOGV("unrecognized message: (%d, %d, %d)", msg, ext1, ext2);
+        ALOGV("unrecognized message: (%d, %d, %d)", msg, ext1, ext2);
         break;
     }
 
@@ -703,15 +703,15 @@
     // this prevents re-entrant calls into client code
     if ((listener != 0) && send) {
         Mutex::Autolock _l(mNotifyLock);
-        LOGV("callback application");
+        ALOGV("callback application");
         listener->notify(msg, ext1, ext2, obj);
-        LOGV("back from callback");
+        ALOGV("back from callback");
     }
 }
 
 /*static*/ sp<IMemory> MediaPlayer::decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, int* pFormat)
 {
-    LOGV("decode(%s)", url);
+    ALOGV("decode(%s)", url);
     sp<IMemory> p;
     const sp<IMediaPlayerService>& service = getMediaPlayerService();
     if (service != 0) {
@@ -725,13 +725,13 @@
 
 void MediaPlayer::died()
 {
-    LOGV("died");
+    ALOGV("died");
     notify(MEDIA_ERROR, MEDIA_ERROR_SERVER_DIED, 0);
 }
 
 /*static*/ sp<IMemory> MediaPlayer::decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, int* pFormat)
 {
-    LOGV("decode(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("decode(%d, %lld, %lld)", fd, offset, length);
     sp<IMemory> p;
     const sp<IMediaPlayerService>& service = getMediaPlayerService();
     if (service != 0) {
diff --git a/media/libmedia/mediarecorder.cpp b/media/libmedia/mediarecorder.cpp
index 11d281f..ec62978 100644
--- a/media/libmedia/mediarecorder.cpp
+++ b/media/libmedia/mediarecorder.cpp
@@ -31,7 +31,7 @@
 
 status_t MediaRecorder::setCamera(const sp<ICamera>& camera, const sp<ICameraRecordingProxy>& proxy)
 {
-    LOGV("setCamera(%p,%p)", camera.get(), proxy.get());
+    ALOGV("setCamera(%p,%p)", camera.get(), proxy.get());
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -43,7 +43,7 @@
 
     status_t ret = mMediaRecorder->setCamera(camera, proxy);
     if (OK != ret) {
-        LOGV("setCamera failed: %d", ret);
+        ALOGV("setCamera failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -52,7 +52,7 @@
 
 status_t MediaRecorder::setPreviewSurface(const sp<Surface>& surface)
 {
-    LOGV("setPreviewSurface(%p)", surface.get());
+    ALOGV("setPreviewSurface(%p)", surface.get());
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -68,7 +68,7 @@
 
     status_t ret = mMediaRecorder->setPreviewSurface(surface);
     if (OK != ret) {
-        LOGV("setPreviewSurface failed: %d", ret);
+        ALOGV("setPreviewSurface failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -77,7 +77,7 @@
 
 status_t MediaRecorder::init()
 {
-    LOGV("init");
+    ALOGV("init");
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -89,14 +89,14 @@
 
     status_t ret = mMediaRecorder->init();
     if (OK != ret) {
-        LOGV("init failed: %d", ret);
+        ALOGV("init failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
 
     ret = mMediaRecorder->setListener(this);
     if (OK != ret) {
-        LOGV("setListener failed: %d", ret);
+        ALOGV("setListener failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -107,7 +107,7 @@
 
 status_t MediaRecorder::setVideoSource(int vs)
 {
-    LOGV("setVideoSource(%d)", vs);
+    ALOGV("setVideoSource(%d)", vs);
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -117,7 +117,7 @@
         return INVALID_OPERATION;
     }
     if (mCurrentState & MEDIA_RECORDER_IDLE) {
-        LOGV("Call init() since the media recorder is not initialized yet");
+        ALOGV("Call init() since the media recorder is not initialized yet");
         status_t ret = init();
         if (OK != ret) {
             return ret;
@@ -132,7 +132,7 @@
     status_t ret = mMediaRecorder->setVideoSource(vs);
 
     if (OK != ret) {
-        LOGV("setVideoSource failed: %d", ret);
+        ALOGV("setVideoSource failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -142,13 +142,13 @@
 
 status_t MediaRecorder::setAudioSource(int as)
 {
-    LOGV("setAudioSource(%d)", as);
+    ALOGV("setAudioSource(%d)", as);
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
     if (mCurrentState & MEDIA_RECORDER_IDLE) {
-        LOGV("Call init() since the media recorder is not initialized yet");
+        ALOGV("Call init() since the media recorder is not initialized yet");
         status_t ret = init();
         if (OK != ret) {
             return ret;
@@ -165,7 +165,7 @@
 
     status_t ret = mMediaRecorder->setAudioSource(as);
     if (OK != ret) {
-        LOGV("setAudioSource failed: %d", ret);
+        ALOGV("setAudioSource failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -175,7 +175,7 @@
 
 status_t MediaRecorder::setOutputFormat(int of)
 {
-    LOGV("setOutputFormat(%d)", of);
+    ALOGV("setOutputFormat(%d)", of);
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -201,7 +201,7 @@
 
 status_t MediaRecorder::setVideoEncoder(int ve)
 {
-    LOGV("setVideoEncoder(%d)", ve);
+    ALOGV("setVideoEncoder(%d)", ve);
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -221,7 +221,7 @@
 
     status_t ret = mMediaRecorder->setVideoEncoder(ve);
     if (OK != ret) {
-        LOGV("setVideoEncoder failed: %d", ret);
+        ALOGV("setVideoEncoder failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -231,7 +231,7 @@
 
 status_t MediaRecorder::setAudioEncoder(int ae)
 {
-    LOGV("setAudioEncoder(%d)", ae);
+    ALOGV("setAudioEncoder(%d)", ae);
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -251,7 +251,7 @@
 
     status_t ret = mMediaRecorder->setAudioEncoder(ae);
     if (OK != ret) {
-        LOGV("setAudioEncoder failed: %d", ret);
+        ALOGV("setAudioEncoder failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -261,7 +261,7 @@
 
 status_t MediaRecorder::setOutputFile(const char* path)
 {
-    LOGV("setOutputFile(%s)", path);
+    ALOGV("setOutputFile(%s)", path);
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -277,7 +277,7 @@
 
     status_t ret = mMediaRecorder->setOutputFile(path);
     if (OK != ret) {
-        LOGV("setOutputFile failed: %d", ret);
+        ALOGV("setOutputFile failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -287,7 +287,7 @@
 
 status_t MediaRecorder::setOutputFile(int fd, int64_t offset, int64_t length)
 {
-    LOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -314,7 +314,7 @@
 
     status_t ret = mMediaRecorder->setOutputFile(fd, offset, length);
     if (OK != ret) {
-        LOGV("setOutputFile failed: %d", ret);
+        ALOGV("setOutputFile failed: %d", ret);
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
@@ -324,7 +324,7 @@
 
 status_t MediaRecorder::setVideoSize(int width, int height)
 {
-    LOGV("setVideoSize(%d, %d)", width, height);
+    ALOGV("setVideoSize(%d, %d)", width, height);
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -367,7 +367,7 @@
 
 status_t MediaRecorder::setVideoFrameRate(int frames_per_second)
 {
-    LOGV("setVideoFrameRate(%d)", frames_per_second);
+    ALOGV("setVideoFrameRate(%d)", frames_per_second);
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -391,7 +391,7 @@
 }
 
 status_t MediaRecorder::setParameters(const String8& params) {
-    LOGV("setParameters(%s)", params.string());
+    ALOGV("setParameters(%s)", params.string());
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -419,7 +419,7 @@
 
 status_t MediaRecorder::prepare()
 {
-    LOGV("prepare");
+    ALOGV("prepare");
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -458,7 +458,7 @@
 
 status_t MediaRecorder::getMaxAmplitude(int* max)
 {
-    LOGV("getMaxAmplitude");
+    ALOGV("getMaxAmplitude");
     if(mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -479,7 +479,7 @@
 
 status_t MediaRecorder::start()
 {
-    LOGV("start");
+    ALOGV("start");
     if (mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -501,7 +501,7 @@
 
 status_t MediaRecorder::stop()
 {
-    LOGV("stop");
+    ALOGV("stop");
     if (mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -529,7 +529,7 @@
 // Reset should be OK in any state
 status_t MediaRecorder::reset()
 {
-    LOGV("reset");
+    ALOGV("reset");
     if (mMediaRecorder == NULL) {
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
@@ -565,7 +565,7 @@
 
 status_t MediaRecorder::close()
 {
-    LOGV("close");
+    ALOGV("close");
     if (!(mCurrentState & MEDIA_RECORDER_INITIALIZED)) {
         LOGE("close called in an invalid state: %d", mCurrentState);
         return INVALID_OPERATION;
@@ -583,7 +583,7 @@
 
 status_t MediaRecorder::doReset()
 {
-    LOGV("doReset");
+    ALOGV("doReset");
     status_t ret = mMediaRecorder->reset();
     if (OK != ret) {
         LOGE("doReset failed: %d", ret);
@@ -597,7 +597,7 @@
 
 void MediaRecorder::doCleanUp()
 {
-    LOGV("doCleanUp");
+    ALOGV("doCleanUp");
     mIsAudioSourceSet  = false;
     mIsVideoSourceSet  = false;
     mIsAudioEncoderSet = false;
@@ -608,7 +608,7 @@
 // Release should be OK in any state
 status_t MediaRecorder::release()
 {
-    LOGV("release");
+    ALOGV("release");
     if (mMediaRecorder != NULL) {
         return mMediaRecorder->release();
     }
@@ -617,7 +617,7 @@
 
 MediaRecorder::MediaRecorder() : mSurfaceMediaSource(NULL)
 {
-    LOGV("constructor");
+    ALOGV("constructor");
 
     const sp<IMediaPlayerService>& service(getMediaPlayerService());
     if (service != NULL) {
@@ -638,7 +638,7 @@
 
 MediaRecorder::~MediaRecorder()
 {
-    LOGV("destructor");
+    ALOGV("destructor");
     if (mMediaRecorder != NULL) {
         mMediaRecorder.clear();
     }
@@ -650,7 +650,7 @@
 
 status_t MediaRecorder::setListener(const sp<MediaRecorderListener>& listener)
 {
-    LOGV("setListener");
+    ALOGV("setListener");
     Mutex::Autolock _l(mLock);
     mListener = listener;
 
@@ -659,7 +659,7 @@
 
 void MediaRecorder::notify(int msg, int ext1, int ext2)
 {
-    LOGV("message received msg=%d, ext1=%d, ext2=%d", msg, ext1, ext2);
+    ALOGV("message received msg=%d, ext1=%d, ext2=%d", msg, ext1, ext2);
 
     sp<MediaRecorderListener> listener;
     mLock.lock();
@@ -668,15 +668,15 @@
 
     if (listener != NULL) {
         Mutex::Autolock _l(mNotifyLock);
-        LOGV("callback application");
+        ALOGV("callback application");
         listener->notify(msg, ext1, ext2);
-        LOGV("back from callback");
+        ALOGV("back from callback");
     }
 }
 
 void MediaRecorder::died()
 {
-    LOGV("died");
+    ALOGV("died");
     notify(MEDIA_RECORDER_EVENT_ERROR, MEDIA_ERROR_SERVER_DIED, 0);
 }
 
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index e8d0f0c..27d8c03 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -215,7 +215,7 @@
 
 MediaPlayerService::MediaPlayerService()
 {
-    LOGV("MediaPlayerService created");
+    ALOGV("MediaPlayerService created");
     mNextConnId = 1;
 
     mBatteryAudio.refCount = 0;
@@ -230,7 +230,7 @@
 
 MediaPlayerService::~MediaPlayerService()
 {
-    LOGV("MediaPlayerService destroyed");
+    ALOGV("MediaPlayerService destroyed");
 }
 
 sp<IMediaRecorder> MediaPlayerService::createMediaRecorder(pid_t pid)
@@ -239,7 +239,7 @@
     wp<MediaRecorderClient> w = recorder;
     Mutex::Autolock lock(mLock);
     mMediaRecorderClients.add(w);
-    LOGV("Create new media recorder client from pid %d", pid);
+    ALOGV("Create new media recorder client from pid %d", pid);
     return recorder;
 }
 
@@ -247,13 +247,13 @@
 {
     Mutex::Autolock lock(mLock);
     mMediaRecorderClients.remove(client);
-    LOGV("Delete media recorder client");
+    ALOGV("Delete media recorder client");
 }
 
 sp<IMediaMetadataRetriever> MediaPlayerService::createMetadataRetriever(pid_t pid)
 {
     sp<MetadataRetrieverClient> retriever = new MetadataRetrieverClient(pid);
-    LOGV("Create new media retriever from pid %d", pid);
+    ALOGV("Create new media retriever from pid %d", pid);
     return retriever;
 }
 
@@ -266,7 +266,7 @@
             this, pid, connId, client, audioSessionId,
             IPCThreadState::self()->getCallingUid());
 
-    LOGV("Create new client(%d) from pid %d, uid %d, ", connId, pid,
+    ALOGV("Create new client(%d) from pid %d, uid %d, ", connId, pid,
          IPCThreadState::self()->getCallingUid());
 
     wp<Client> w = c;
@@ -478,7 +478,7 @@
         int32_t connId, const sp<IMediaPlayerClient>& client,
         int audioSessionId, uid_t uid)
 {
-    LOGV("Client(%d) constructor", connId);
+    ALOGV("Client(%d) constructor", connId);
     mPid = pid;
     mConnId = connId;
     mService = service;
@@ -496,7 +496,7 @@
 
 MediaPlayerService::Client::~Client()
 {
-    LOGV("Client(%d) destructor pid = %d", mConnId, mPid);
+    ALOGV("Client(%d) destructor pid = %d", mConnId, mPid);
     mAudioOutput.clear();
     wp<Client> client(this);
     disconnect();
@@ -505,7 +505,7 @@
 
 void MediaPlayerService::Client::disconnect()
 {
-    LOGV("disconnect(%d) from pid %d", mConnId, mPid);
+    ALOGV("disconnect(%d) from pid %d", mConnId, mPid);
     // grab local reference and clear main reference to prevent future
     // access to object
     sp<MediaPlayerBase> p;
@@ -614,19 +614,19 @@
     sp<MediaPlayerBase> p;
     switch (playerType) {
         case SONIVOX_PLAYER:
-            LOGV(" create MidiFile");
+            ALOGV(" create MidiFile");
             p = new MidiFile();
             break;
         case STAGEFRIGHT_PLAYER:
-            LOGV(" create StagefrightPlayer");
+            ALOGV(" create StagefrightPlayer");
             p = new StagefrightPlayer;
             break;
         case NU_PLAYER:
-            LOGV(" create NuPlayer");
+            ALOGV(" create NuPlayer");
             p = new NuPlayerDriver;
             break;
         case TEST_PLAYER:
-            LOGV("Create Test Player stub");
+            ALOGV("Create Test Player stub");
             p = new TestPlayerStub();
             break;
         default:
@@ -651,7 +651,7 @@
     // determine if we have the right player type
     sp<MediaPlayerBase> p = mPlayer;
     if ((p != NULL) && (p->playerType() != playerType)) {
-        LOGV("delete player");
+        ALOGV("delete player");
         p.clear();
     }
     if (p == NULL) {
@@ -668,7 +668,7 @@
 status_t MediaPlayerService::Client::setDataSource(
         const char *url, const KeyedVector<String8, String8> *headers)
 {
-    LOGV("setDataSource(%s)", url);
+    ALOGV("setDataSource(%s)", url);
     if (url == NULL)
         return UNKNOWN_ERROR;
 
@@ -696,7 +696,7 @@
         return mStatus;
     } else {
         player_type playerType = getPlayerType(url);
-        LOGV("player type = %d", playerType);
+        ALOGV("player type = %d", playerType);
 
         // create the right type of player
         sp<MediaPlayerBase> p = createPlayer(playerType);
@@ -708,7 +708,7 @@
         }
 
         // now set data source
-        LOGV(" setDataSource");
+        ALOGV(" setDataSource");
         mStatus = p->setDataSource(url, headers);
         if (mStatus == NO_ERROR) {
             mPlayer = p;
@@ -721,7 +721,7 @@
 
 status_t MediaPlayerService::Client::setDataSource(int fd, int64_t offset, int64_t length)
 {
-    LOGV("setDataSource fd=%d, offset=%lld, length=%lld", fd, offset, length);
+    ALOGV("setDataSource fd=%d, offset=%lld, length=%lld", fd, offset, length);
     struct stat sb;
     int ret = fstat(fd, &sb);
     if (ret != 0) {
@@ -729,11 +729,11 @@
         return UNKNOWN_ERROR;
     }
 
-    LOGV("st_dev  = %llu", sb.st_dev);
-    LOGV("st_mode = %u", sb.st_mode);
-    LOGV("st_uid  = %lu", sb.st_uid);
-    LOGV("st_gid  = %lu", sb.st_gid);
-    LOGV("st_size = %llu", sb.st_size);
+    ALOGV("st_dev  = %llu", sb.st_dev);
+    ALOGV("st_mode = %u", sb.st_mode);
+    ALOGV("st_uid  = %lu", sb.st_uid);
+    ALOGV("st_gid  = %lu", sb.st_gid);
+    ALOGV("st_size = %llu", sb.st_size);
 
     if (offset >= sb.st_size) {
         LOGE("offset error");
@@ -742,11 +742,11 @@
     }
     if (offset + length > sb.st_size) {
         length = sb.st_size - offset;
-        LOGV("calculated length = %lld", length);
+        ALOGV("calculated length = %lld", length);
     }
 
     player_type playerType = getPlayerType(fd, offset, length);
-    LOGV("player type = %d", playerType);
+    ALOGV("player type = %d", playerType);
 
     // create the right type of player
     sp<MediaPlayerBase> p = createPlayer(playerType);
@@ -804,7 +804,7 @@
 status_t MediaPlayerService::Client::setVideoSurfaceTexture(
         const sp<ISurfaceTexture>& surfaceTexture)
 {
-    LOGV("[%d] setVideoSurfaceTexture(%p)", mConnId, surfaceTexture.get());
+    ALOGV("[%d] setVideoSurfaceTexture(%p)", mConnId, surfaceTexture.get());
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
 
@@ -920,7 +920,7 @@
 
 status_t MediaPlayerService::Client::prepareAsync()
 {
-    LOGV("[%d] prepareAsync", mConnId);
+    ALOGV("[%d] prepareAsync", mConnId);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     status_t ret = p->prepareAsync();
@@ -933,7 +933,7 @@
 
 status_t MediaPlayerService::Client::start()
 {
-    LOGV("[%d] start", mConnId);
+    ALOGV("[%d] start", mConnId);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     p->setLooping(mLoop);
@@ -942,7 +942,7 @@
 
 status_t MediaPlayerService::Client::stop()
 {
-    LOGV("[%d] stop", mConnId);
+    ALOGV("[%d] stop", mConnId);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     return p->stop();
@@ -950,7 +950,7 @@
 
 status_t MediaPlayerService::Client::pause()
 {
-    LOGV("[%d] pause", mConnId);
+    ALOGV("[%d] pause", mConnId);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     return p->pause();
@@ -962,18 +962,18 @@
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     *state = p->isPlaying();
-    LOGV("[%d] isPlaying: %d", mConnId, *state);
+    ALOGV("[%d] isPlaying: %d", mConnId, *state);
     return NO_ERROR;
 }
 
 status_t MediaPlayerService::Client::getCurrentPosition(int *msec)
 {
-    LOGV("getCurrentPosition");
+    ALOGV("getCurrentPosition");
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     status_t ret = p->getCurrentPosition(msec);
     if (ret == NO_ERROR) {
-        LOGV("[%d] getCurrentPosition = %d", mConnId, *msec);
+        ALOGV("[%d] getCurrentPosition = %d", mConnId, *msec);
     } else {
         LOGE("getCurrentPosition returned %d", ret);
     }
@@ -982,12 +982,12 @@
 
 status_t MediaPlayerService::Client::getDuration(int *msec)
 {
-    LOGV("getDuration");
+    ALOGV("getDuration");
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     status_t ret = p->getDuration(msec);
     if (ret == NO_ERROR) {
-        LOGV("[%d] getDuration = %d", mConnId, *msec);
+        ALOGV("[%d] getDuration = %d", mConnId, *msec);
     } else {
         LOGE("getDuration returned %d", ret);
     }
@@ -996,7 +996,7 @@
 
 status_t MediaPlayerService::Client::seekTo(int msec)
 {
-    LOGV("[%d] seekTo(%d)", mConnId, msec);
+    ALOGV("[%d] seekTo(%d)", mConnId, msec);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     return p->seekTo(msec);
@@ -1004,7 +1004,7 @@
 
 status_t MediaPlayerService::Client::reset()
 {
-    LOGV("[%d] reset", mConnId);
+    ALOGV("[%d] reset", mConnId);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     return p->reset();
@@ -1012,7 +1012,7 @@
 
 status_t MediaPlayerService::Client::setAudioStreamType(int type)
 {
-    LOGV("[%d] setAudioStreamType(%d)", mConnId, type);
+    ALOGV("[%d] setAudioStreamType(%d)", mConnId, type);
     // TODO: for hardware output, call player instead
     Mutex::Autolock l(mLock);
     if (mAudioOutput != 0) mAudioOutput->setAudioStreamType(type);
@@ -1021,7 +1021,7 @@
 
 status_t MediaPlayerService::Client::setLooping(int loop)
 {
-    LOGV("[%d] setLooping(%d)", mConnId, loop);
+    ALOGV("[%d] setLooping(%d)", mConnId, loop);
     mLoop = loop;
     sp<MediaPlayerBase> p = getPlayer();
     if (p != 0) return p->setLooping(loop);
@@ -1030,7 +1030,7 @@
 
 status_t MediaPlayerService::Client::setVolume(float leftVolume, float rightVolume)
 {
-    LOGV("[%d] setVolume(%f, %f)", mConnId, leftVolume, rightVolume);
+    ALOGV("[%d] setVolume(%f, %f)", mConnId, leftVolume, rightVolume);
     // TODO: for hardware output, call player instead
     Mutex::Autolock l(mLock);
     if (mAudioOutput != 0) mAudioOutput->setVolume(leftVolume, rightVolume);
@@ -1039,7 +1039,7 @@
 
 status_t MediaPlayerService::Client::setAuxEffectSendLevel(float level)
 {
-    LOGV("[%d] setAuxEffectSendLevel(%f)", mConnId, level);
+    ALOGV("[%d] setAuxEffectSendLevel(%f)", mConnId, level);
     Mutex::Autolock l(mLock);
     if (mAudioOutput != 0) return mAudioOutput->setAuxEffectSendLevel(level);
     return NO_ERROR;
@@ -1047,21 +1047,21 @@
 
 status_t MediaPlayerService::Client::attachAuxEffect(int effectId)
 {
-    LOGV("[%d] attachAuxEffect(%d)", mConnId, effectId);
+    ALOGV("[%d] attachAuxEffect(%d)", mConnId, effectId);
     Mutex::Autolock l(mLock);
     if (mAudioOutput != 0) return mAudioOutput->attachAuxEffect(effectId);
     return NO_ERROR;
 }
 
 status_t MediaPlayerService::Client::setParameter(int key, const Parcel &request) {
-    LOGV("[%d] setParameter(%d)", mConnId, key);
+    ALOGV("[%d] setParameter(%d)", mConnId, key);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     return p->setParameter(key, request);
 }
 
 status_t MediaPlayerService::Client::getParameter(int key, Parcel *reply) {
-    LOGV("[%d] getParameter(%d)", mConnId, key);
+    ALOGV("[%d] getParameter(%d)", mConnId, key);
     sp<MediaPlayerBase> p = getPlayer();
     if (p == 0) return UNKNOWN_ERROR;
     return p->getParameter(key, reply);
@@ -1084,7 +1084,7 @@
         // also access mMetadataUpdated and clears it.
         client->addNewMetadataUpdate(metadata_type);
     }
-    LOGV("[%d] notify (%p, %d, %d, %d)", client->mConnId, cookie, msg, ext1, ext2);
+    ALOGV("[%d] notify (%p, %d, %d, %d)", client->mConnId, cookie, msg, ext1, ext2);
     client->mClient->notify(msg, ext1, ext2, obj);
 }
 
@@ -1135,7 +1135,7 @@
     Antagonizer* p = reinterpret_cast<Antagonizer*>(user);
     while (!p->mExit) {
         if (p->mActive) {
-            LOGV("send event");
+            ALOGV("send event");
             p->mCb(p->mClient, 0, 0, 0);
         }
         usleep(interval);
@@ -1151,7 +1151,7 @@
 
 sp<IMemory> MediaPlayerService::decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, int* pFormat)
 {
-    LOGV("decode(%s)", url);
+    ALOGV("decode(%s)", url);
     sp<MemoryBase> mem;
     sp<MediaPlayerBase> player;
 
@@ -1165,7 +1165,7 @@
     }
 
     player_type playerType = getPlayerType(url);
-    LOGV("player type = %d", playerType);
+    ALOGV("player type = %d", playerType);
 
     // create the right type of player
     sp<AudioCache> cache = new AudioCache(url);
@@ -1178,16 +1178,16 @@
     // set data source
     if (player->setDataSource(url) != NO_ERROR) goto Exit;
 
-    LOGV("prepare");
+    ALOGV("prepare");
     player->prepareAsync();
 
-    LOGV("wait for prepare");
+    ALOGV("wait for prepare");
     if (cache->wait() != NO_ERROR) goto Exit;
 
-    LOGV("start");
+    ALOGV("start");
     player->start();
 
-    LOGV("wait for playback complete");
+    ALOGV("wait for playback complete");
     cache->wait();
     // in case of error, return what was successfully decoded.
     if (cache->size() == 0) {
@@ -1198,7 +1198,7 @@
     *pSampleRate = cache->sampleRate();
     *pNumChannels = cache->channelCount();
     *pFormat = (int)cache->format();
-    LOGV("return memory @ %p, sampleRate=%u, channelCount = %d, format = %d", mem->pointer(), *pSampleRate, *pNumChannels, *pFormat);
+    ALOGV("return memory @ %p, sampleRate=%u, channelCount = %d, format = %d", mem->pointer(), *pSampleRate, *pNumChannels, *pFormat);
 
 Exit:
     if (player != 0) player->reset();
@@ -1207,12 +1207,12 @@
 
 sp<IMemory> MediaPlayerService::decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, int* pFormat)
 {
-    LOGV("decode(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("decode(%d, %lld, %lld)", fd, offset, length);
     sp<MemoryBase> mem;
     sp<MediaPlayerBase> player;
 
     player_type playerType = getPlayerType(fd, offset, length);
-    LOGV("player type = %d", playerType);
+    ALOGV("player type = %d", playerType);
 
     // create the right type of player
     sp<AudioCache> cache = new AudioCache("decode_fd");
@@ -1225,16 +1225,16 @@
     // set data source
     if (player->setDataSource(fd, offset, length) != NO_ERROR) goto Exit;
 
-    LOGV("prepare");
+    ALOGV("prepare");
     player->prepareAsync();
 
-    LOGV("wait for prepare");
+    ALOGV("wait for prepare");
     if (cache->wait() != NO_ERROR) goto Exit;
 
-    LOGV("start");
+    ALOGV("start");
     player->start();
 
-    LOGV("wait for playback complete");
+    ALOGV("wait for playback complete");
     cache->wait();
     // in case of error, return what was successfully decoded.
     if (cache->size() == 0) {
@@ -1245,7 +1245,7 @@
     *pSampleRate = cache->sampleRate();
     *pNumChannels = cache->channelCount();
     *pFormat = cache->format();
-    LOGV("return memory @ %p, sampleRate=%u, channelCount = %d, format = %d", mem->pointer(), *pSampleRate, *pNumChannels, *pFormat);
+    ALOGV("return memory @ %p, sampleRate=%u, channelCount = %d, format = %d", mem->pointer(), *pSampleRate, *pNumChannels, *pFormat);
 
 Exit:
     if (player != 0) player->reset();
@@ -1260,7 +1260,7 @@
     : mCallback(NULL),
       mCallbackCookie(NULL),
       mSessionId(sessionId) {
-    LOGV("AudioOutput(%d)", sessionId);
+    ALOGV("AudioOutput(%d)", sessionId);
     mTrack = 0;
     mStreamType = AUDIO_STREAM_MUSIC;
     mLeftVolume = 1.0;
@@ -1351,7 +1351,7 @@
         bufferCount = mMinBufferCount;
 
     }
-    LOGV("open(%u, %d, %d, %d, %d)", sampleRate, channelCount, format, bufferCount,mSessionId);
+    ALOGV("open(%u, %d, %d, %d, %d)", sampleRate, channelCount, format, bufferCount,mSessionId);
     if (mTrack) close();
     int afSampleRate;
     int afFrameCount;
@@ -1399,7 +1399,7 @@
         return NO_INIT;
     }
 
-    LOGV("setVolume");
+    ALOGV("setVolume");
     t->setVolume(mLeftVolume, mRightVolume);
 
     mMsecsPerFrame = 1.e3 / (float) sampleRate;
@@ -1412,7 +1412,7 @@
 
 void MediaPlayerService::AudioOutput::start()
 {
-    LOGV("start");
+    ALOGV("start");
     if (mTrack) {
         mTrack->setVolume(mLeftVolume, mRightVolume);
         mTrack->setAuxEffectSendLevel(mSendLevel);
@@ -1426,7 +1426,7 @@
 {
     LOG_FATAL_IF(mCallback != NULL, "Don't call write if supplying a callback.");
 
-    //LOGV("write(%p, %u)", buffer, size);
+    //ALOGV("write(%p, %u)", buffer, size);
     if (mTrack) {
         ssize_t ret = mTrack->write(buffer, size);
         return ret;
@@ -1436,32 +1436,32 @@
 
 void MediaPlayerService::AudioOutput::stop()
 {
-    LOGV("stop");
+    ALOGV("stop");
     if (mTrack) mTrack->stop();
 }
 
 void MediaPlayerService::AudioOutput::flush()
 {
-    LOGV("flush");
+    ALOGV("flush");
     if (mTrack) mTrack->flush();
 }
 
 void MediaPlayerService::AudioOutput::pause()
 {
-    LOGV("pause");
+    ALOGV("pause");
     if (mTrack) mTrack->pause();
 }
 
 void MediaPlayerService::AudioOutput::close()
 {
-    LOGV("close");
+    ALOGV("close");
     delete mTrack;
     mTrack = 0;
 }
 
 void MediaPlayerService::AudioOutput::setVolume(float left, float right)
 {
-    LOGV("setVolume(%f, %f)", left, right);
+    ALOGV("setVolume(%f, %f)", left, right);
     mLeftVolume = left;
     mRightVolume = right;
     if (mTrack) {
@@ -1471,7 +1471,7 @@
 
 status_t MediaPlayerService::AudioOutput::setAuxEffectSendLevel(float level)
 {
-    LOGV("setAuxEffectSendLevel(%f)", level);
+    ALOGV("setAuxEffectSendLevel(%f)", level);
     mSendLevel = level;
     if (mTrack) {
         return mTrack->setAuxEffectSendLevel(level);
@@ -1481,7 +1481,7 @@
 
 status_t MediaPlayerService::AudioOutput::attachAuxEffect(int effectId)
 {
-    LOGV("attachAuxEffect(%d)", effectId);
+    ALOGV("attachAuxEffect(%d)", effectId);
     mAuxEffectId = effectId;
     if (mTrack) {
         return mTrack->attachAuxEffect(effectId);
@@ -1492,7 +1492,7 @@
 // static
 void MediaPlayerService::AudioOutput::CallbackWrapper(
         int event, void *cookie, void *info) {
-    //LOGV("callbackwrapper");
+    //ALOGV("callbackwrapper");
     if (event != AudioTrack::EVENT_MORE_DATA) {
         return;
     }
@@ -1614,7 +1614,7 @@
         uint32_t sampleRate, int channelCount, int format, int bufferCount,
         AudioCallback cb, void *cookie)
 {
-    LOGV("open(%u, %d, %d, %d)", sampleRate, channelCount, format, bufferCount);
+    ALOGV("open(%u, %d, %d, %d)", sampleRate, channelCount, format, bufferCount);
     if (mHeap->getHeapID() < 0) {
         return NO_INIT;
     }
@@ -1644,13 +1644,13 @@
 
 ssize_t MediaPlayerService::AudioCache::write(const void* buffer, size_t size)
 {
-    LOGV("write(%p, %u)", buffer, size);
+    ALOGV("write(%p, %u)", buffer, size);
     if ((buffer == 0) || (size == 0)) return size;
 
     uint8_t* p = static_cast<uint8_t*>(mHeap->getBase());
     if (p == NULL) return NO_INIT;
     p += mSize;
-    LOGV("memcpy(%p, %p, %u)", p, buffer, size);
+    ALOGV("memcpy(%p, %p, %u)", p, buffer, size);
     if (mSize + size > mHeap->getSize()) {
         LOGE("Heap size overflow! req size: %d, max size: %d", (mSize + size), mHeap->getSize());
         size = mHeap->getSize() - mSize;
@@ -1670,9 +1670,9 @@
     mCommandComplete = false;
 
     if (mError == NO_ERROR) {
-        LOGV("wait - success");
+        ALOGV("wait - success");
     } else {
-        LOGV("wait - error");
+        ALOGV("wait - error");
     }
     return mError;
 }
@@ -1680,7 +1680,7 @@
 void MediaPlayerService::AudioCache::notify(
         void* cookie, int msg, int ext1, int ext2, const Parcel *obj)
 {
-    LOGV("notify(%p, %d, %d, %d)", cookie, msg, ext1, ext2);
+    ALOGV("notify(%p, %d, %d, %d)", cookie, msg, ext1, ext2);
     AudioCache* p = static_cast<AudioCache*>(cookie);
 
     // ignore buffering messages
@@ -1691,13 +1691,13 @@
         p->mError = ext1;
         break;
     case MEDIA_PREPARED:
-        LOGV("prepared");
+        ALOGV("prepared");
         break;
     case MEDIA_PLAYBACK_COMPLETE:
-        LOGV("playback complete");
+        ALOGV("playback complete");
         break;
     default:
-        LOGV("ignored");
+        ALOGV("ignored");
         return;
     }
 
diff --git a/media/libmediaplayerservice/MediaRecorderClient.cpp b/media/libmediaplayerservice/MediaRecorderClient.cpp
index 6f80b35..ca92c77 100644
--- a/media/libmediaplayerservice/MediaRecorderClient.cpp
+++ b/media/libmediaplayerservice/MediaRecorderClient.cpp
@@ -61,7 +61,7 @@
 
 sp<ISurfaceTexture> MediaRecorderClient::querySurfaceMediaSource()
 {
-    LOGV("Query SurfaceMediaSource");
+    ALOGV("Query SurfaceMediaSource");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -75,7 +75,7 @@
 status_t MediaRecorderClient::setCamera(const sp<ICamera>& camera,
                                         const sp<ICameraRecordingProxy>& proxy)
 {
-    LOGV("setCamera");
+    ALOGV("setCamera");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -86,7 +86,7 @@
 
 status_t MediaRecorderClient::setPreviewSurface(const sp<Surface>& surface)
 {
-    LOGV("setPreviewSurface");
+    ALOGV("setPreviewSurface");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -97,7 +97,7 @@
 
 status_t MediaRecorderClient::setVideoSource(int vs)
 {
-    LOGV("setVideoSource(%d)", vs);
+    ALOGV("setVideoSource(%d)", vs);
     if (!checkPermission(cameraPermission)) {
         return PERMISSION_DENIED;
     }
@@ -111,7 +111,7 @@
 
 status_t MediaRecorderClient::setAudioSource(int as)
 {
-    LOGV("setAudioSource(%d)", as);
+    ALOGV("setAudioSource(%d)", as);
     if (!checkPermission(recordAudioPermission)) {
         return PERMISSION_DENIED;
     }
@@ -125,7 +125,7 @@
 
 status_t MediaRecorderClient::setOutputFormat(int of)
 {
-    LOGV("setOutputFormat(%d)", of);
+    ALOGV("setOutputFormat(%d)", of);
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -136,7 +136,7 @@
 
 status_t MediaRecorderClient::setVideoEncoder(int ve)
 {
-    LOGV("setVideoEncoder(%d)", ve);
+    ALOGV("setVideoEncoder(%d)", ve);
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -147,7 +147,7 @@
 
 status_t MediaRecorderClient::setAudioEncoder(int ae)
 {
-    LOGV("setAudioEncoder(%d)", ae);
+    ALOGV("setAudioEncoder(%d)", ae);
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -158,7 +158,7 @@
 
 status_t MediaRecorderClient::setOutputFile(const char* path)
 {
-    LOGV("setOutputFile(%s)", path);
+    ALOGV("setOutputFile(%s)", path);
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -169,7 +169,7 @@
 
 status_t MediaRecorderClient::setOutputFile(int fd, int64_t offset, int64_t length)
 {
-    LOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -180,7 +180,7 @@
 
 status_t MediaRecorderClient::setVideoSize(int width, int height)
 {
-    LOGV("setVideoSize(%dx%d)", width, height);
+    ALOGV("setVideoSize(%dx%d)", width, height);
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -191,7 +191,7 @@
 
 status_t MediaRecorderClient::setVideoFrameRate(int frames_per_second)
 {
-    LOGV("setVideoFrameRate(%d)", frames_per_second);
+    ALOGV("setVideoFrameRate(%d)", frames_per_second);
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -201,7 +201,7 @@
 }
 
 status_t MediaRecorderClient::setParameters(const String8& params) {
-    LOGV("setParameters(%s)", params.string());
+    ALOGV("setParameters(%s)", params.string());
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -212,7 +212,7 @@
 
 status_t MediaRecorderClient::prepare()
 {
-    LOGV("prepare");
+    ALOGV("prepare");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -224,7 +224,7 @@
 
 status_t MediaRecorderClient::getMaxAmplitude(int* max)
 {
-    LOGV("getMaxAmplitude");
+    ALOGV("getMaxAmplitude");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -235,7 +235,7 @@
 
 status_t MediaRecorderClient::start()
 {
-    LOGV("start");
+    ALOGV("start");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -247,7 +247,7 @@
 
 status_t MediaRecorderClient::stop()
 {
-    LOGV("stop");
+    ALOGV("stop");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -258,7 +258,7 @@
 
 status_t MediaRecorderClient::init()
 {
-    LOGV("init");
+    ALOGV("init");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -269,7 +269,7 @@
 
 status_t MediaRecorderClient::close()
 {
-    LOGV("close");
+    ALOGV("close");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -281,7 +281,7 @@
 
 status_t MediaRecorderClient::reset()
 {
-    LOGV("reset");
+    ALOGV("reset");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
@@ -292,7 +292,7 @@
 
 status_t MediaRecorderClient::release()
 {
-    LOGV("release");
+    ALOGV("release");
     Mutex::Autolock lock(mLock);
     if (mRecorder != NULL) {
         delete mRecorder;
@@ -305,7 +305,7 @@
 
 MediaRecorderClient::MediaRecorderClient(const sp<MediaPlayerService>& service, pid_t pid)
 {
-    LOGV("Client constructor");
+    ALOGV("Client constructor");
     mPid = pid;
     mRecorder = new StagefrightRecorder;
     mMediaPlayerService = service;
@@ -313,13 +313,13 @@
 
 MediaRecorderClient::~MediaRecorderClient()
 {
-    LOGV("Client destructor");
+    ALOGV("Client destructor");
     release();
 }
 
 status_t MediaRecorderClient::setListener(const sp<IMediaRecorderClient>& listener)
 {
-    LOGV("setListener");
+    ALOGV("setListener");
     Mutex::Autolock lock(mLock);
     if (mRecorder == NULL) {
         LOGE("recorder is not initialized");
diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.cpp b/media/libmediaplayerservice/MetadataRetrieverClient.cpp
index d574ea3..f945c6a 100644
--- a/media/libmediaplayerservice/MetadataRetrieverClient.cpp
+++ b/media/libmediaplayerservice/MetadataRetrieverClient.cpp
@@ -46,7 +46,7 @@
 
 MetadataRetrieverClient::MetadataRetrieverClient(pid_t pid)
 {
-    LOGV("MetadataRetrieverClient constructor pid(%d)", pid);
+    ALOGV("MetadataRetrieverClient constructor pid(%d)", pid);
     mPid = pid;
     mThumbnail = NULL;
     mAlbumArt = NULL;
@@ -55,7 +55,7 @@
 
 MetadataRetrieverClient::~MetadataRetrieverClient()
 {
-    LOGV("MetadataRetrieverClient destructor");
+    ALOGV("MetadataRetrieverClient destructor");
     disconnect();
 }
 
@@ -74,7 +74,7 @@
 
 void MetadataRetrieverClient::disconnect()
 {
-    LOGV("disconnect from pid %d", mPid);
+    ALOGV("disconnect from pid %d", mPid);
     Mutex::Autolock lock(mLock);
     mRetriever.clear();
     mThumbnail.clear();
@@ -92,7 +92,7 @@
             break;
         }
         case SONIVOX_PLAYER:
-            LOGV("create midi metadata retriever");
+            ALOGV("create midi metadata retriever");
             p = new MidiMetadataRetriever();
             break;
         default:
@@ -110,13 +110,13 @@
 status_t MetadataRetrieverClient::setDataSource(
         const char *url, const KeyedVector<String8, String8> *headers)
 {
-    LOGV("setDataSource(%s)", url);
+    ALOGV("setDataSource(%s)", url);
     Mutex::Autolock lock(mLock);
     if (url == NULL) {
         return UNKNOWN_ERROR;
     }
     player_type playerType = getPlayerType(url);
-    LOGV("player type = %d", playerType);
+    ALOGV("player type = %d", playerType);
     sp<MediaMetadataRetrieverBase> p = createRetriever(playerType);
     if (p == NULL) return NO_INIT;
     status_t ret = p->setDataSource(url, headers);
@@ -126,7 +126,7 @@
 
 status_t MetadataRetrieverClient::setDataSource(int fd, int64_t offset, int64_t length)
 {
-    LOGV("setDataSource fd=%d, offset=%lld, length=%lld", fd, offset, length);
+    ALOGV("setDataSource fd=%d, offset=%lld, length=%lld", fd, offset, length);
     Mutex::Autolock lock(mLock);
     struct stat sb;
     int ret = fstat(fd, &sb);
@@ -134,11 +134,11 @@
         LOGE("fstat(%d) failed: %d, %s", fd, ret, strerror(errno));
         return BAD_VALUE;
     }
-    LOGV("st_dev  = %llu", sb.st_dev);
-    LOGV("st_mode = %u", sb.st_mode);
-    LOGV("st_uid  = %lu", sb.st_uid);
-    LOGV("st_gid  = %lu", sb.st_gid);
-    LOGV("st_size = %llu", sb.st_size);
+    ALOGV("st_dev  = %llu", sb.st_dev);
+    ALOGV("st_mode = %u", sb.st_mode);
+    ALOGV("st_uid  = %lu", sb.st_uid);
+    ALOGV("st_gid  = %lu", sb.st_gid);
+    ALOGV("st_size = %llu", sb.st_size);
 
     if (offset >= sb.st_size) {
         LOGE("offset (%lld) bigger than file size (%llu)", offset, sb.st_size);
@@ -147,11 +147,11 @@
     }
     if (offset + length > sb.st_size) {
         length = sb.st_size - offset;
-        LOGV("calculated length = %lld", length);
+        ALOGV("calculated length = %lld", length);
     }
 
     player_type playerType = getPlayerType(fd, offset, length);
-    LOGV("player type = %d", playerType);
+    ALOGV("player type = %d", playerType);
     sp<MediaMetadataRetrieverBase> p = createRetriever(playerType);
     if (p == NULL) {
         ::close(fd);
@@ -165,7 +165,7 @@
 
 sp<IMemory> MetadataRetrieverClient::getFrameAtTime(int64_t timeUs, int option)
 {
-    LOGV("getFrameAtTime: time(%lld us) option(%d)", timeUs, option);
+    ALOGV("getFrameAtTime: time(%lld us) option(%d)", timeUs, option);
     Mutex::Autolock lock(mLock);
     mThumbnail.clear();
     if (mRetriever == NULL) {
@@ -197,7 +197,7 @@
     frameCopy->mDisplayHeight = frame->mDisplayHeight;
     frameCopy->mSize = frame->mSize;
     frameCopy->mRotationAngle = frame->mRotationAngle;
-    LOGV("rotation: %d", frameCopy->mRotationAngle);
+    ALOGV("rotation: %d", frameCopy->mRotationAngle);
     frameCopy->mData = (uint8_t *)frameCopy + sizeof(VideoFrame);
     memcpy(frameCopy->mData, frame->mData, frame->mSize);
     delete frame;  // Fix memory leakage
@@ -206,7 +206,7 @@
 
 sp<IMemory> MetadataRetrieverClient::extractAlbumArt()
 {
-    LOGV("extractAlbumArt");
+    ALOGV("extractAlbumArt");
     Mutex::Autolock lock(mLock);
     mAlbumArt.clear();
     if (mRetriever == NULL) {
@@ -241,7 +241,7 @@
 
 const char* MetadataRetrieverClient::extractMetadata(int keyCode)
 {
-    LOGV("extractMetadata");
+    ALOGV("extractMetadata");
     Mutex::Autolock lock(mLock);
     if (mRetriever == NULL) {
         LOGE("retriever is not initialized");
diff --git a/media/libmediaplayerservice/MidiFile.cpp b/media/libmediaplayerservice/MidiFile.cpp
index 7e04523..4946956 100644
--- a/media/libmediaplayerservice/MidiFile.cpp
+++ b/media/libmediaplayerservice/MidiFile.cpp
@@ -58,7 +58,7 @@
     mStreamType(AUDIO_STREAM_MUSIC), mLoop(false), mExit(false),
     mPaused(false), mRender(false), mTid(-1)
 {
-    LOGV("constructor");
+    ALOGV("constructor");
 
     mFileLocator.path = NULL;
     mFileLocator.fd = -1;
@@ -86,14 +86,15 @@
     // create playback thread
     {
         Mutex::Autolock l(mMutex);
-        createThreadEtc(renderThread, this, "midithread", ANDROID_PRIORITY_AUDIO);
+        mThread = new MidiFileThread(this);
+        mThread->run("midithread", ANDROID_PRIORITY_AUDIO);
         mCondition.wait(mMutex);
-        LOGV("thread started");
+        ALOGV("thread started");
     }
 
     // indicate success
     if (mTid > 0) {
-        LOGV(" render thread(%d) started", mTid);
+        ALOGV(" render thread(%d) started", mTid);
         mState = EAS_STATE_READY;
     }
 
@@ -108,13 +109,13 @@
 }
 
 MidiFile::~MidiFile() {
-    LOGV("MidiFile destructor");
+    ALOGV("MidiFile destructor");
     release();
 }
 
 status_t MidiFile::setDataSource(
         const char* path, const KeyedVector<String8, String8> *) {
-    LOGV("MidiFile::setDataSource url=%s", path);
+    ALOGV("MidiFile::setDataSource url=%s", path);
     Mutex::Autolock lock(mMutex);
 
     // file still open?
@@ -145,7 +146,7 @@
 
 status_t MidiFile::setDataSource(int fd, int64_t offset, int64_t length)
 {
-    LOGV("MidiFile::setDataSource fd=%d", fd);
+    ALOGV("MidiFile::setDataSource fd=%d", fd);
     Mutex::Autolock lock(mMutex);
 
     // file still open?
@@ -173,7 +174,7 @@
 
 status_t MidiFile::prepare()
 {
-    LOGV("MidiFile::prepare");
+    ALOGV("MidiFile::prepare");
     Mutex::Autolock lock(mMutex);
     if (!mEasHandle) {
         return ERROR_NOT_OPEN;
@@ -189,7 +190,7 @@
 
 status_t MidiFile::prepareAsync()
 {
-    LOGV("MidiFile::prepareAsync");
+    ALOGV("MidiFile::prepareAsync");
     status_t ret = prepare();
 
     // don't hold lock during callback
@@ -203,7 +204,7 @@
 
 status_t MidiFile::start()
 {
-    LOGV("MidiFile::start");
+    ALOGV("MidiFile::start");
     Mutex::Autolock lock(mMutex);
     if (!mEasHandle) {
         return ERROR_NOT_OPEN;
@@ -221,14 +222,14 @@
     mRender = true;
 
     // wake up render thread
-    LOGV("  wakeup render thread");
+    ALOGV("  wakeup render thread");
     mCondition.signal();
     return NO_ERROR;
 }
 
 status_t MidiFile::stop()
 {
-    LOGV("MidiFile::stop");
+    ALOGV("MidiFile::stop");
     Mutex::Autolock lock(mMutex);
     if (!mEasHandle) {
         return ERROR_NOT_OPEN;
@@ -246,7 +247,7 @@
 
 status_t MidiFile::seekTo(int position)
 {
-    LOGV("MidiFile::seekTo %d", position);
+    ALOGV("MidiFile::seekTo %d", position);
     // hold lock during EAS calls
     {
         Mutex::Autolock lock(mMutex);
@@ -268,7 +269,7 @@
 
 status_t MidiFile::pause()
 {
-    LOGV("MidiFile::pause");
+    ALOGV("MidiFile::pause");
     Mutex::Autolock lock(mMutex);
     if (!mEasHandle) {
         return ERROR_NOT_OPEN;
@@ -283,14 +284,14 @@
 
 bool MidiFile::isPlaying()
 {
-    LOGV("MidiFile::isPlaying, mState=%d", int(mState));
+    ALOGV("MidiFile::isPlaying, mState=%d", int(mState));
     if (!mEasHandle || mPaused) return false;
     return (mState == EAS_STATE_PLAY);
 }
 
 status_t MidiFile::getCurrentPosition(int* position)
 {
-    LOGV("MidiFile::getCurrentPosition");
+    ALOGV("MidiFile::getCurrentPosition");
     if (!mEasHandle) {
         LOGE("getCurrentPosition(): file not open");
         return ERROR_NOT_OPEN;
@@ -306,7 +307,7 @@
 status_t MidiFile::getDuration(int* duration)
 {
 
-    LOGV("MidiFile::getDuration");
+    ALOGV("MidiFile::getDuration");
     {
         Mutex::Autolock lock(mMutex);
         if (!mEasHandle) return ERROR_NOT_OPEN;
@@ -349,7 +350,7 @@
 
 status_t MidiFile::release()
 {
-    LOGV("MidiFile::release");
+    ALOGV("MidiFile::release");
     Mutex::Autolock l(mMutex);
     reset_nosync();
 
@@ -372,7 +373,7 @@
 
 status_t MidiFile::reset()
 {
-    LOGV("MidiFile::reset");
+    ALOGV("MidiFile::reset");
     Mutex::Autolock lock(mMutex);
     return reset_nosync();
 }
@@ -380,7 +381,7 @@
 // call only with mutex held
 status_t MidiFile::reset_nosync()
 {
-    LOGV("MidiFile::reset_nosync");
+    ALOGV("MidiFile::reset_nosync");
     // close file
     if (mEasHandle) {
         EAS_CloseFile(mEasData, mEasHandle);
@@ -407,7 +408,7 @@
 
 status_t MidiFile::setLooping(int loop)
 {
-    LOGV("MidiFile::setLooping");
+    ALOGV("MidiFile::setLooping");
     Mutex::Autolock lock(mMutex);
     if (!mEasHandle) {
         return ERROR_NOT_OPEN;
@@ -427,18 +428,13 @@
     return NO_ERROR;
 }
 
-int MidiFile::renderThread(void* p) {
-
-    return ((MidiFile*)p)->render();
-}
-
 int MidiFile::render() {
     EAS_RESULT result = EAS_FAILURE;
     EAS_I32 count;
     int temp;
     bool audioStarted = false;
 
-    LOGV("MidiFile::render");
+    ALOGV("MidiFile::render");
 
     // allocate render buffer
     mAudioBuffer = new EAS_PCM[pLibConfig->mixBufferSize * pLibConfig->numChannels * NUM_BUFFERS];
@@ -451,7 +447,7 @@
     {
         Mutex::Autolock l(mMutex);
         mTid = gettid();
-        LOGV("render thread(%d) signal", mTid);
+        ALOGV("render thread(%d) signal", mTid);
         mCondition.signal();
     }
 
@@ -461,9 +457,9 @@
         // nothing to render, wait for client thread to wake us up
         while (!mRender && !mExit)
         {
-            LOGV("MidiFile::render - signal wait");
+            ALOGV("MidiFile::render - signal wait");
             mCondition.wait(mMutex);
-            LOGV("MidiFile::render - signal rx'd");
+            ALOGV("MidiFile::render - signal rx'd");
         }
         if (mExit) {
             mMutex.unlock();
@@ -471,7 +467,7 @@
         }
 
         // render midi data into the input buffer
-        //LOGV("MidiFile::render - rendering audio");
+        //ALOGV("MidiFile::render - rendering audio");
         int num_output = 0;
         EAS_PCM* p = mAudioBuffer;
         for (int i = 0; i < NUM_BUFFERS; i++) {
@@ -484,20 +480,20 @@
         }
 
         // update playback state and position
-        // LOGV("MidiFile::render - updating state");
+        // ALOGV("MidiFile::render - updating state");
         EAS_GetLocation(mEasData, mEasHandle, &mPlayTime);
         EAS_State(mEasData, mEasHandle, &mState);
         mMutex.unlock();
 
         // create audio output track if necessary
         if (!mAudioSink->ready()) {
-            LOGV("MidiFile::render - create output track");
+            ALOGV("MidiFile::render - create output track");
             if (createOutputTrack() != NO_ERROR)
                 goto threadExit;
         }
 
         // Write data to the audio hardware
-        // LOGV("MidiFile::render - writing to audio output");
+        // ALOGV("MidiFile::render - writing to audio output");
         if ((temp = mAudioSink->write(mAudioBuffer, num_output)) < 0) {
             LOGE("Error in writing:%d",temp);
             return temp;
@@ -505,7 +501,7 @@
 
         // start audio output if necessary
         if (!audioStarted) {
-            //LOGV("MidiFile::render - starting audio");
+            //ALOGV("MidiFile::render - starting audio");
             mAudioSink->start();
             audioStarted = true;
         }
@@ -517,7 +513,7 @@
             switch(mState) {
             case EAS_STATE_STOPPED:
             {
-                LOGV("MidiFile::render - stopped");
+                ALOGV("MidiFile::render - stopped");
                 sendEvent(MEDIA_PLAYBACK_COMPLETE);
                 break;
             }
@@ -528,7 +524,7 @@
                 break;
             }
             case EAS_STATE_PAUSED:
-                LOGV("MidiFile::render - paused");
+                ALOGV("MidiFile::render - paused");
                 break;
             default:
                 break;
diff --git a/media/libmediaplayerservice/MidiFile.h b/media/libmediaplayerservice/MidiFile.h
index 3469389..2a0dcf9 100644
--- a/media/libmediaplayerservice/MidiFile.h
+++ b/media/libmediaplayerservice/MidiFile.h
@@ -24,6 +24,7 @@
 
 namespace android {
 
+// Note that the name MidiFile is misleading; this actually represents a MIDI file player
 class MidiFile : public MediaPlayerInterface {
 public:
                         MidiFile();
@@ -65,7 +66,6 @@
 private:
             status_t    createOutputTrack();
             status_t    reset_nosync();
-    static  int         renderThread(void*);
             int         render();
             void        updateState(){ EAS_State(mEasData, mEasHandle, &mState); }
 
@@ -84,6 +84,29 @@
     bool                mPaused;
     volatile bool       mRender;
     pid_t               mTid;
+
+    class MidiFileThread : public Thread {
+    public:
+        MidiFileThread(MidiFile *midiPlayer) : mMidiFile(midiPlayer) {
+        }
+
+    protected:
+        virtual ~MidiFileThread() {}
+
+    private:
+        MidiFile *mMidiFile;
+
+        bool threadLoop() {
+            int result;
+            result = mMidiFile->render();
+            return false;
+        }
+
+        MidiFileThread(const MidiFileThread &);
+        MidiFileThread &operator=(const MidiFileThread &);
+    };
+
+    sp<MidiFileThread> mThread;
 };
 
 }; // namespace android
diff --git a/media/libmediaplayerservice/MidiMetadataRetriever.cpp b/media/libmediaplayerservice/MidiMetadataRetriever.cpp
index aaf2d18..bb65ed4 100644
--- a/media/libmediaplayerservice/MidiMetadataRetriever.cpp
+++ b/media/libmediaplayerservice/MidiMetadataRetriever.cpp
@@ -31,14 +31,14 @@
 
 void MidiMetadataRetriever::clearMetadataValues()
 {
-    LOGV("clearMetadataValues");
+    ALOGV("clearMetadataValues");
     mMetadataValues[0][0] = '\0';
 }
 
 status_t MidiMetadataRetriever::setDataSource(
         const char *url, const KeyedVector<String8, String8> *headers)
 {
-    LOGV("setDataSource: %s", url? url: "NULL pointer");
+    ALOGV("setDataSource: %s", url? url: "NULL pointer");
     Mutex::Autolock lock(mLock);
     clearMetadataValues();
     if (mMidiPlayer == 0) {
@@ -49,7 +49,7 @@
 
 status_t MidiMetadataRetriever::setDataSource(int fd, int64_t offset, int64_t length)
 {
-    LOGV("setDataSource: fd(%d), offset(%lld), and length(%lld)", fd, offset, length);
+    ALOGV("setDataSource: fd(%d), offset(%lld), and length(%lld)", fd, offset, length);
     Mutex::Autolock lock(mLock);
     clearMetadataValues();
     if (mMidiPlayer == 0) {
@@ -60,7 +60,7 @@
 
 const char* MidiMetadataRetriever::extractMetadata(int keyCode)
 {
-    LOGV("extractMetdata: key(%d)", keyCode);
+    ALOGV("extractMetdata: key(%d)", keyCode);
     Mutex::Autolock lock(mLock);
     if (mMidiPlayer == 0 || mMidiPlayer->initCheck() != NO_ERROR) {
         LOGE("Midi player is not initialized yet");
@@ -78,7 +78,7 @@
                 snprintf(mMetadataValues[0], MAX_METADATA_STRING_LENGTH, "%d", duration);
             }
 
-            LOGV("duration: %s ms", mMetadataValues[0]);
+            ALOGV("duration: %s ms", mMetadataValues[0]);
             return mMetadataValues[0];
         }
     default:
diff --git a/media/libmediaplayerservice/StagefrightPlayer.cpp b/media/libmediaplayerservice/StagefrightPlayer.cpp
index 598d573..6d7771a 100644
--- a/media/libmediaplayerservice/StagefrightPlayer.cpp
+++ b/media/libmediaplayerservice/StagefrightPlayer.cpp
@@ -29,13 +29,13 @@
 
 StagefrightPlayer::StagefrightPlayer()
     : mPlayer(new AwesomePlayer) {
-    LOGV("StagefrightPlayer");
+    ALOGV("StagefrightPlayer");
 
     mPlayer->setListener(this);
 }
 
 StagefrightPlayer::~StagefrightPlayer() {
-    LOGV("~StagefrightPlayer");
+    ALOGV("~StagefrightPlayer");
     reset();
 
     delete mPlayer;
@@ -43,7 +43,7 @@
 }
 
 status_t StagefrightPlayer::initCheck() {
-    LOGV("initCheck");
+    ALOGV("initCheck");
     return OK;
 }
 
@@ -61,7 +61,7 @@
 // Warning: The filedescriptor passed into this method will only be valid until
 // the method returns, if you want to keep it, dup it!
 status_t StagefrightPlayer::setDataSource(int fd, int64_t offset, int64_t length) {
-    LOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
     return mPlayer->setDataSource(dup(fd), offset, length);
 }
 
@@ -71,7 +71,7 @@
 
 status_t StagefrightPlayer::setVideoSurfaceTexture(
         const sp<ISurfaceTexture> &surfaceTexture) {
-    LOGV("setVideoSurfaceTexture");
+    ALOGV("setVideoSurfaceTexture");
 
     return mPlayer->setSurfaceTexture(surfaceTexture);
 }
@@ -85,30 +85,30 @@
 }
 
 status_t StagefrightPlayer::start() {
-    LOGV("start");
+    ALOGV("start");
 
     return mPlayer->play();
 }
 
 status_t StagefrightPlayer::stop() {
-    LOGV("stop");
+    ALOGV("stop");
 
     return pause();  // what's the difference?
 }
 
 status_t StagefrightPlayer::pause() {
-    LOGV("pause");
+    ALOGV("pause");
 
     return mPlayer->pause();
 }
 
 bool StagefrightPlayer::isPlaying() {
-    LOGV("isPlaying");
+    ALOGV("isPlaying");
     return mPlayer->isPlaying();
 }
 
 status_t StagefrightPlayer::seekTo(int msec) {
-    LOGV("seekTo %.2f secs", msec / 1E3);
+    ALOGV("seekTo %.2f secs", msec / 1E3);
 
     status_t err = mPlayer->seekTo((int64_t)msec * 1000);
 
@@ -116,7 +116,7 @@
 }
 
 status_t StagefrightPlayer::getCurrentPosition(int *msec) {
-    LOGV("getCurrentPosition");
+    ALOGV("getCurrentPosition");
 
     int64_t positionUs;
     status_t err = mPlayer->getPosition(&positionUs);
@@ -131,7 +131,7 @@
 }
 
 status_t StagefrightPlayer::getDuration(int *msec) {
-    LOGV("getDuration");
+    ALOGV("getDuration");
 
     int64_t durationUs;
     status_t err = mPlayer->getDuration(&durationUs);
@@ -147,7 +147,7 @@
 }
 
 status_t StagefrightPlayer::reset() {
-    LOGV("reset");
+    ALOGV("reset");
 
     mPlayer->reset();
 
@@ -155,13 +155,13 @@
 }
 
 status_t StagefrightPlayer::setLooping(int loop) {
-    LOGV("setLooping");
+    ALOGV("setLooping");
 
     return mPlayer->setLooping(loop);
 }
 
 player_type StagefrightPlayer::playerType() {
-    LOGV("playerType");
+    ALOGV("playerType");
     return STAGEFRIGHT_PLAYER;
 }
 
@@ -176,12 +176,12 @@
 }
 
 status_t StagefrightPlayer::setParameter(int key, const Parcel &request) {
-    LOGV("setParameter");
+    ALOGV("setParameter");
     return mPlayer->setParameter(key, request);
 }
 
 status_t StagefrightPlayer::getParameter(int key, Parcel *reply) {
-    LOGV("getParameter");
+    ALOGV("getParameter");
     return mPlayer->getParameter(key, reply);
 }
 
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index 6981668..c0ba091 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -71,17 +71,17 @@
       mVideoSource(VIDEO_SOURCE_LIST_END),
       mStarted(false), mSurfaceMediaSource(NULL) {
 
-    LOGV("Constructor");
+    ALOGV("Constructor");
     reset();
 }
 
 StagefrightRecorder::~StagefrightRecorder() {
-    LOGV("Destructor");
+    ALOGV("Destructor");
     stop();
 }
 
 status_t StagefrightRecorder::init() {
-    LOGV("init");
+    ALOGV("init");
     return OK;
 }
 
@@ -89,12 +89,12 @@
 // and return a interface reference. The client side will use that
 // while encoding GL Frames
 sp<ISurfaceTexture> StagefrightRecorder::querySurfaceMediaSource() const {
-    LOGV("Get SurfaceMediaSource");
+    ALOGV("Get SurfaceMediaSource");
     return mSurfaceMediaSource;
 }
 
 status_t StagefrightRecorder::setAudioSource(audio_source_t as) {
-    LOGV("setAudioSource: %d", as);
+    ALOGV("setAudioSource: %d", as);
     if (as < AUDIO_SOURCE_DEFAULT ||
         as >= AUDIO_SOURCE_CNT) {
         LOGE("Invalid audio source: %d", as);
@@ -111,7 +111,7 @@
 }
 
 status_t StagefrightRecorder::setVideoSource(video_source vs) {
-    LOGV("setVideoSource: %d", vs);
+    ALOGV("setVideoSource: %d", vs);
     if (vs < VIDEO_SOURCE_DEFAULT ||
         vs >= VIDEO_SOURCE_LIST_END) {
         LOGE("Invalid video source: %d", vs);
@@ -128,7 +128,7 @@
 }
 
 status_t StagefrightRecorder::setOutputFormat(output_format of) {
-    LOGV("setOutputFormat: %d", of);
+    ALOGV("setOutputFormat: %d", of);
     if (of < OUTPUT_FORMAT_DEFAULT ||
         of >= OUTPUT_FORMAT_LIST_END) {
         LOGE("Invalid output format: %d", of);
@@ -145,7 +145,7 @@
 }
 
 status_t StagefrightRecorder::setAudioEncoder(audio_encoder ae) {
-    LOGV("setAudioEncoder: %d", ae);
+    ALOGV("setAudioEncoder: %d", ae);
     if (ae < AUDIO_ENCODER_DEFAULT ||
         ae >= AUDIO_ENCODER_LIST_END) {
         LOGE("Invalid audio encoder: %d", ae);
@@ -162,7 +162,7 @@
 }
 
 status_t StagefrightRecorder::setVideoEncoder(video_encoder ve) {
-    LOGV("setVideoEncoder: %d", ve);
+    ALOGV("setVideoEncoder: %d", ve);
     if (ve < VIDEO_ENCODER_DEFAULT ||
         ve >= VIDEO_ENCODER_LIST_END) {
         LOGE("Invalid video encoder: %d", ve);
@@ -179,7 +179,7 @@
 }
 
 status_t StagefrightRecorder::setVideoSize(int width, int height) {
-    LOGV("setVideoSize: %dx%d", width, height);
+    ALOGV("setVideoSize: %dx%d", width, height);
     if (width <= 0 || height <= 0) {
         LOGE("Invalid video size: %dx%d", width, height);
         return BAD_VALUE;
@@ -193,7 +193,7 @@
 }
 
 status_t StagefrightRecorder::setVideoFrameRate(int frames_per_second) {
-    LOGV("setVideoFrameRate: %d", frames_per_second);
+    ALOGV("setVideoFrameRate: %d", frames_per_second);
     if ((frames_per_second <= 0 && frames_per_second != -1) ||
         frames_per_second > 120) {
         LOGE("Invalid video frame rate: %d", frames_per_second);
@@ -208,7 +208,7 @@
 
 status_t StagefrightRecorder::setCamera(const sp<ICamera> &camera,
                                         const sp<ICameraRecordingProxy> &proxy) {
-    LOGV("setCamera");
+    ALOGV("setCamera");
     if (camera == 0) {
         LOGE("camera is NULL");
         return BAD_VALUE;
@@ -224,7 +224,7 @@
 }
 
 status_t StagefrightRecorder::setPreviewSurface(const sp<Surface> &surface) {
-    LOGV("setPreviewSurface: %p", surface.get());
+    ALOGV("setPreviewSurface: %p", surface.get());
     mPreviewSurface = surface;
 
     return OK;
@@ -239,7 +239,7 @@
 }
 
 status_t StagefrightRecorder::setOutputFile(int fd, int64_t offset, int64_t length) {
-    LOGV("setOutputFile: %d, %lld, %lld", fd, offset, length);
+    ALOGV("setOutputFile: %d, %lld, %lld", fd, offset, length);
     // These don't make any sense, do they?
     CHECK_EQ(offset, 0);
     CHECK_EQ(length, 0);
@@ -313,7 +313,7 @@
 }
 
 status_t StagefrightRecorder::setParamAudioSamplingRate(int32_t sampleRate) {
-    LOGV("setParamAudioSamplingRate: %d", sampleRate);
+    ALOGV("setParamAudioSamplingRate: %d", sampleRate);
     if (sampleRate <= 0) {
         LOGE("Invalid audio sampling rate: %d", sampleRate);
         return BAD_VALUE;
@@ -325,7 +325,7 @@
 }
 
 status_t StagefrightRecorder::setParamAudioNumberOfChannels(int32_t channels) {
-    LOGV("setParamAudioNumberOfChannels: %d", channels);
+    ALOGV("setParamAudioNumberOfChannels: %d", channels);
     if (channels <= 0 || channels >= 3) {
         LOGE("Invalid number of audio channels: %d", channels);
         return BAD_VALUE;
@@ -337,7 +337,7 @@
 }
 
 status_t StagefrightRecorder::setParamAudioEncodingBitRate(int32_t bitRate) {
-    LOGV("setParamAudioEncodingBitRate: %d", bitRate);
+    ALOGV("setParamAudioEncodingBitRate: %d", bitRate);
     if (bitRate <= 0) {
         LOGE("Invalid audio encoding bit rate: %d", bitRate);
         return BAD_VALUE;
@@ -352,7 +352,7 @@
 }
 
 status_t StagefrightRecorder::setParamVideoEncodingBitRate(int32_t bitRate) {
-    LOGV("setParamVideoEncodingBitRate: %d", bitRate);
+    ALOGV("setParamVideoEncodingBitRate: %d", bitRate);
     if (bitRate <= 0) {
         LOGE("Invalid video encoding bit rate: %d", bitRate);
         return BAD_VALUE;
@@ -368,7 +368,7 @@
 
 // Always rotate clockwise, and only support 0, 90, 180 and 270 for now.
 status_t StagefrightRecorder::setParamVideoRotation(int32_t degrees) {
-    LOGV("setParamVideoRotation: %d", degrees);
+    ALOGV("setParamVideoRotation: %d", degrees);
     if (degrees < 0 || degrees % 90 != 0) {
         LOGE("Unsupported video rotation angle: %d", degrees);
         return BAD_VALUE;
@@ -378,7 +378,7 @@
 }
 
 status_t StagefrightRecorder::setParamMaxFileDurationUs(int64_t timeUs) {
-    LOGV("setParamMaxFileDurationUs: %lld us", timeUs);
+    ALOGV("setParamMaxFileDurationUs: %lld us", timeUs);
 
     // This is meant for backward compatibility for MediaRecorder.java
     if (timeUs <= 0) {
@@ -397,7 +397,7 @@
 }
 
 status_t StagefrightRecorder::setParamMaxFileSizeBytes(int64_t bytes) {
-    LOGV("setParamMaxFileSizeBytes: %lld bytes", bytes);
+    ALOGV("setParamMaxFileSizeBytes: %lld bytes", bytes);
 
     // This is meant for backward compatibility for MediaRecorder.java
     if (bytes <= 0) {
@@ -418,7 +418,7 @@
 }
 
 status_t StagefrightRecorder::setParamInterleaveDuration(int32_t durationUs) {
-    LOGV("setParamInterleaveDuration: %d", durationUs);
+    ALOGV("setParamInterleaveDuration: %d", durationUs);
     if (durationUs <= 500000) {           //  500 ms
         // If interleave duration is too small, it is very inefficient to do
         // interleaving since the metadata overhead will count for a significant
@@ -440,20 +440,20 @@
 // If seconds == 0, all frames are encoded as I frames. No P frames
 // If seconds >  0, it is the time spacing (seconds) between 2 neighboring I frames
 status_t StagefrightRecorder::setParamVideoIFramesInterval(int32_t seconds) {
-    LOGV("setParamVideoIFramesInterval: %d seconds", seconds);
+    ALOGV("setParamVideoIFramesInterval: %d seconds", seconds);
     mIFramesIntervalSec = seconds;
     return OK;
 }
 
 status_t StagefrightRecorder::setParam64BitFileOffset(bool use64Bit) {
-    LOGV("setParam64BitFileOffset: %s",
+    ALOGV("setParam64BitFileOffset: %s",
         use64Bit? "use 64 bit file offset": "use 32 bit file offset");
     mUse64BitFileOffset = use64Bit;
     return OK;
 }
 
 status_t StagefrightRecorder::setParamVideoCameraId(int32_t cameraId) {
-    LOGV("setParamVideoCameraId: %d", cameraId);
+    ALOGV("setParamVideoCameraId: %d", cameraId);
     if (cameraId < 0) {
         return BAD_VALUE;
     }
@@ -462,7 +462,7 @@
 }
 
 status_t StagefrightRecorder::setParamTrackTimeStatus(int64_t timeDurationUs) {
-    LOGV("setParamTrackTimeStatus: %lld", timeDurationUs);
+    ALOGV("setParamTrackTimeStatus: %lld", timeDurationUs);
     if (timeDurationUs < 20000) {  // Infeasible if shorter than 20 ms?
         LOGE("Tracking time duration too short: %lld us", timeDurationUs);
         return BAD_VALUE;
@@ -472,7 +472,7 @@
 }
 
 status_t StagefrightRecorder::setParamVideoEncoderProfile(int32_t profile) {
-    LOGV("setParamVideoEncoderProfile: %d", profile);
+    ALOGV("setParamVideoEncoderProfile: %d", profile);
 
     // Additional check will be done later when we load the encoder.
     // For now, we are accepting values defined in OpenMAX IL.
@@ -481,7 +481,7 @@
 }
 
 status_t StagefrightRecorder::setParamVideoEncoderLevel(int32_t level) {
-    LOGV("setParamVideoEncoderLevel: %d", level);
+    ALOGV("setParamVideoEncoderLevel: %d", level);
 
     // Additional check will be done later when we load the encoder.
     // For now, we are accepting values defined in OpenMAX IL.
@@ -490,7 +490,7 @@
 }
 
 status_t StagefrightRecorder::setParamMovieTimeScale(int32_t timeScale) {
-    LOGV("setParamMovieTimeScale: %d", timeScale);
+    ALOGV("setParamMovieTimeScale: %d", timeScale);
 
     // The range is set to be the same as the audio's time scale range
     // since audio's time scale has a wider range.
@@ -503,7 +503,7 @@
 }
 
 status_t StagefrightRecorder::setParamVideoTimeScale(int32_t timeScale) {
-    LOGV("setParamVideoTimeScale: %d", timeScale);
+    ALOGV("setParamVideoTimeScale: %d", timeScale);
 
     // 60000 is chosen to make sure that each video frame from a 60-fps
     // video has 1000 ticks.
@@ -516,7 +516,7 @@
 }
 
 status_t StagefrightRecorder::setParamAudioTimeScale(int32_t timeScale) {
-    LOGV("setParamAudioTimeScale: %d", timeScale);
+    ALOGV("setParamAudioTimeScale: %d", timeScale);
 
     // 96000 Hz is the highest sampling rate support in AAC.
     if (timeScale < 600 || timeScale > 96000) {
@@ -528,7 +528,7 @@
 }
 
 status_t StagefrightRecorder::setParamTimeLapseEnable(int32_t timeLapseEnable) {
-    LOGV("setParamTimeLapseEnable: %d", timeLapseEnable);
+    ALOGV("setParamTimeLapseEnable: %d", timeLapseEnable);
 
     if(timeLapseEnable == 0) {
         mCaptureTimeLapse = false;
@@ -541,7 +541,7 @@
 }
 
 status_t StagefrightRecorder::setParamTimeBetweenTimeLapseFrameCapture(int64_t timeUs) {
-    LOGV("setParamTimeBetweenTimeLapseFrameCapture: %lld us", timeUs);
+    ALOGV("setParamTimeBetweenTimeLapseFrameCapture: %lld us", timeUs);
 
     // Not allowing time more than a day
     if (timeUs <= 0 || timeUs > 86400*1E6) {
@@ -575,7 +575,7 @@
 
 status_t StagefrightRecorder::setParameter(
         const String8 &key, const String8 &value) {
-    LOGV("setParameter: key (%s) => value (%s)", key.string(), value.string());
+    ALOGV("setParameter: key (%s) => value (%s)", key.string(), value.string());
     if (key == "max-duration") {
         int64_t max_duration_ms;
         if (safe_strtoi64(value.string(), &max_duration_ms)) {
@@ -689,7 +689,7 @@
 }
 
 status_t StagefrightRecorder::setParameters(const String8 &params) {
-    LOGV("setParameters: %s", params.string());
+    ALOGV("setParameters: %s", params.string());
     const char *cparams = params.string();
     const char *key_start = cparams;
     for (;;) {
@@ -1016,7 +1016,7 @@
 }
 
 void StagefrightRecorder::clipVideoFrameRate() {
-    LOGV("clipVideoFrameRate: encoder %d", mVideoEncoder);
+    ALOGV("clipVideoFrameRate: encoder %d", mVideoEncoder);
     int minFrameRate = mEncoderProfiles->getVideoEncoderParamByName(
                         "enc.vid.fps.min", mVideoEncoder);
     int maxFrameRate = mEncoderProfiles->getVideoEncoderParamByName(
@@ -1033,7 +1033,7 @@
 }
 
 void StagefrightRecorder::clipVideoBitRate() {
-    LOGV("clipVideoBitRate: encoder %d", mVideoEncoder);
+    ALOGV("clipVideoBitRate: encoder %d", mVideoEncoder);
     int minBitRate = mEncoderProfiles->getVideoEncoderParamByName(
                         "enc.vid.bps.min", mVideoEncoder);
     int maxBitRate = mEncoderProfiles->getVideoEncoderParamByName(
@@ -1050,7 +1050,7 @@
 }
 
 void StagefrightRecorder::clipVideoFrameWidth() {
-    LOGV("clipVideoFrameWidth: encoder %d", mVideoEncoder);
+    ALOGV("clipVideoFrameWidth: encoder %d", mVideoEncoder);
     int minFrameWidth = mEncoderProfiles->getVideoEncoderParamByName(
                         "enc.vid.width.min", mVideoEncoder);
     int maxFrameWidth = mEncoderProfiles->getVideoEncoderParamByName(
@@ -1082,7 +1082,7 @@
 // Set to use AVC baseline profile if the encoding parameters matches
 // CAMCORDER_QUALITY_LOW profile; this is for the sake of MMS service.
 void StagefrightRecorder::setDefaultProfileIfNecessary() {
-    LOGV("setDefaultProfileIfNecessary");
+    ALOGV("setDefaultProfileIfNecessary");
 
     camcorder_quality quality = CAMCORDER_QUALITY_LOW;
 
@@ -1145,7 +1145,7 @@
 }
 
 void StagefrightRecorder::clipAudioBitRate() {
-    LOGV("clipAudioBitRate: encoder %d", mAudioEncoder);
+    ALOGV("clipAudioBitRate: encoder %d", mAudioEncoder);
 
     int minAudioBitRate =
             mEncoderProfiles->getAudioEncoderParamByName(
@@ -1167,7 +1167,7 @@
 }
 
 void StagefrightRecorder::clipAudioSampleRate() {
-    LOGV("clipAudioSampleRate: encoder %d", mAudioEncoder);
+    ALOGV("clipAudioSampleRate: encoder %d", mAudioEncoder);
 
     int minSampleRate =
             mEncoderProfiles->getAudioEncoderParamByName(
@@ -1189,7 +1189,7 @@
 }
 
 void StagefrightRecorder::clipNumberOfAudioChannels() {
-    LOGV("clipNumberOfAudioChannels: encoder %d", mAudioEncoder);
+    ALOGV("clipNumberOfAudioChannels: encoder %d", mAudioEncoder);
 
     int minChannels =
             mEncoderProfiles->getAudioEncoderParamByName(
@@ -1211,7 +1211,7 @@
 }
 
 void StagefrightRecorder::clipVideoFrameHeight() {
-    LOGV("clipVideoFrameHeight: encoder %d", mVideoEncoder);
+    ALOGV("clipVideoFrameHeight: encoder %d", mVideoEncoder);
     int minFrameHeight = mEncoderProfiles->getVideoEncoderParamByName(
                         "enc.vid.height.min", mVideoEncoder);
     int maxFrameHeight = mEncoderProfiles->getVideoEncoderParamByName(
@@ -1548,7 +1548,7 @@
 }
 
 status_t StagefrightRecorder::pause() {
-    LOGV("pause");
+    ALOGV("pause");
     if (mWriter == NULL) {
         return UNKNOWN_ERROR;
     }
@@ -1573,7 +1573,7 @@
 }
 
 status_t StagefrightRecorder::stop() {
-    LOGV("stop");
+    ALOGV("stop");
     status_t err = OK;
 
     if (mCaptureTimeLapse && mCameraSourceTimeLapse != NULL) {
@@ -1610,14 +1610,14 @@
 }
 
 status_t StagefrightRecorder::close() {
-    LOGV("close");
+    ALOGV("close");
     stop();
 
     return OK;
 }
 
 status_t StagefrightRecorder::reset() {
-    LOGV("reset");
+    ALOGV("reset");
     stop();
 
     // No audio or video source by default
@@ -1664,7 +1664,7 @@
 }
 
 status_t StagefrightRecorder::getMaxAmplitude(int *max) {
-    LOGV("getMaxAmplitude");
+    ALOGV("getMaxAmplitude");
 
     if (max == NULL) {
         LOGE("Null pointer argument");
@@ -1682,7 +1682,7 @@
 
 status_t StagefrightRecorder::dump(
         int fd, const Vector<String16>& args) const {
-    LOGV("dump");
+    ALOGV("dump");
     const size_t SIZE = 256;
     char buffer[SIZE];
     String8 result;
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 93ab704..03aa42e 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -160,7 +160,7 @@
     switch (msg->what()) {
         case kWhatSetDataSource:
         {
-            LOGV("kWhatSetDataSource");
+            ALOGV("kWhatSetDataSource");
 
             CHECK(mSource == NULL);
 
@@ -173,7 +173,7 @@
 
         case kWhatSetVideoNativeWindow:
         {
-            LOGV("kWhatSetVideoNativeWindow");
+            ALOGV("kWhatSetVideoNativeWindow");
 
             sp<RefBase> obj;
             CHECK(msg->findObject("native-window", &obj));
@@ -184,7 +184,7 @@
 
         case kWhatSetAudioSink:
         {
-            LOGV("kWhatSetAudioSink");
+            ALOGV("kWhatSetAudioSink");
 
             sp<RefBase> obj;
             CHECK(msg->findObject("sink", &obj));
@@ -195,7 +195,7 @@
 
         case kWhatStart:
         {
-            LOGV("kWhatStart");
+            ALOGV("kWhatStart");
 
             mVideoIsAVC = false;
             mAudioEOS = false;
@@ -229,7 +229,7 @@
 
             mScanSourcesPending = false;
 
-            LOGV("scanning sources haveAudio=%d, haveVideo=%d",
+            ALOGV("scanning sources haveAudio=%d, haveVideo=%d",
                  mAudioDecoder != NULL, mVideoDecoder != NULL);
 
             instantiateDecoder(false, &mVideoDecoder);
@@ -285,9 +285,9 @@
                 CHECK(codecRequest->findInt32("err", &err));
 
                 if (err == ERROR_END_OF_STREAM) {
-                    LOGV("got %s decoder EOS", audio ? "audio" : "video");
+                    ALOGV("got %s decoder EOS", audio ? "audio" : "video");
                 } else {
-                    LOGV("got %s decoder EOS w/ error %d",
+                    ALOGV("got %s decoder EOS w/ error %d",
                          audio ? "audio" : "video",
                          err);
                 }
@@ -306,10 +306,10 @@
                     mVideoLateByUs = 0;
                 }
 
-                LOGV("decoder %s flush completed", audio ? "audio" : "video");
+                ALOGV("decoder %s flush completed", audio ? "audio" : "video");
 
                 if (needShutdown) {
-                    LOGV("initiating %s decoder shutdown",
+                    ALOGV("initiating %s decoder shutdown",
                          audio ? "audio" : "video");
 
                     (audio ? mAudioDecoder : mVideoDecoder)->initiateShutdown();
@@ -330,7 +330,7 @@
                     int32_t sampleRate;
                     CHECK(codecRequest->findInt32("sample-rate", &sampleRate));
 
-                    LOGV("Audio output format changed to %d Hz, %d channels",
+                    ALOGV("Audio output format changed to %d Hz, %d channels",
                          sampleRate, numChannels);
 
                     mAudioSink->close();
@@ -355,7 +355,7 @@
                                 "crop",
                                 &cropLeft, &cropTop, &cropRight, &cropBottom));
 
-                    LOGV("Video output format changed to %d x %d "
+                    ALOGV("Video output format changed to %d x %d "
                          "(crop: %d x %d @ (%d, %d))",
                          width, height,
                          (cropRight - cropLeft + 1),
@@ -368,7 +368,7 @@
                             cropBottom - cropTop + 1);
                 }
             } else if (what == ACodec::kWhatShutdownCompleted) {
-                LOGV("%s shutdown completed", audio ? "audio" : "video");
+                ALOGV("%s shutdown completed", audio ? "audio" : "video");
                 if (audio) {
                     mAudioDecoder.clear();
 
@@ -415,7 +415,7 @@
                 }
 
                 if (finalResult == ERROR_END_OF_STREAM) {
-                    LOGV("reached %s EOS", audio ? "audio" : "video");
+                    ALOGV("reached %s EOS", audio ? "audio" : "video");
                 } else {
                     LOGE("%s track encountered an error (%d)",
                          audio ? "audio" : "video", finalResult);
@@ -449,7 +449,7 @@
                 int32_t audio;
                 CHECK(msg->findInt32("audio", &audio));
 
-                LOGV("renderer %s flush completed.", audio ? "audio" : "video");
+                ALOGV("renderer %s flush completed.", audio ? "audio" : "video");
             }
             break;
         }
@@ -461,7 +461,7 @@
 
         case kWhatReset:
         {
-            LOGV("kWhatReset");
+            ALOGV("kWhatReset");
 
             if (mRenderer != NULL) {
                 // There's an edge case where the renderer owns all output
@@ -479,8 +479,8 @@
                 // We're currently flushing, postpone the reset until that's
                 // completed.
 
-                LOGV("postponing reset mFlushingAudio=%d, mFlushingVideo=%d",
-                        mFlushingAudio, mFlushingVideo);
+                ALOGV("postponing reset mFlushingAudio=%d, mFlushingVideo=%d",
+                      mFlushingAudio, mFlushingVideo);
 
                 mResetPostponed = true;
                 break;
@@ -510,7 +510,7 @@
             int64_t seekTimeUs;
             CHECK(msg->findInt64("seekTimeUs", &seekTimeUs));
 
-            LOGV("kWhatSeek seekTimeUs=%lld us (%.2f secs)",
+            ALOGV("kWhatSeek seekTimeUs=%lld us (%.2f secs)",
                  seekTimeUs, seekTimeUs / 1E6);
 
             mSource->seekTo(seekTimeUs);
@@ -554,7 +554,7 @@
         return;
     }
 
-    LOGV("both audio and video are flushed now.");
+    ALOGV("both audio and video are flushed now.");
 
     if (mTimeDiscontinuityPending) {
         mRenderer->signalTimeDiscontinuity();
@@ -573,7 +573,7 @@
     mFlushingVideo = NONE;
 
     if (mResetInProgress) {
-        LOGV("reset completed");
+        ALOGV("reset completed");
 
         mResetInProgress = false;
         finishReset();
@@ -758,12 +758,12 @@
         }
     } while (dropAccessUnit);
 
-    // LOGV("returned a valid buffer of %s data", audio ? "audio" : "video");
+    // ALOGV("returned a valid buffer of %s data", audio ? "audio" : "video");
 
 #if 0
     int64_t mediaTimeUs;
     CHECK(accessUnit->meta()->findInt64("timeUs", &mediaTimeUs));
-    LOGV("feeding %s input buffer at media time %.2f secs",
+    ALOGV("feeding %s input buffer at media time %.2f secs",
          audio ? "audio" : "video",
          mediaTimeUs / 1E6);
 #endif
@@ -775,7 +775,7 @@
 }
 
 void NuPlayer::renderBuffer(bool audio, const sp<AMessage> &msg) {
-    // LOGV("renderBuffer %s", audio ? "audio" : "video");
+    // ALOGV("renderBuffer %s", audio ? "audio" : "video");
 
     sp<AMessage> reply;
     CHECK(msg->findMessage("reply", &reply));
@@ -786,7 +786,7 @@
         // so we don't want any output buffers it sent us (from before
         // we initiated the flush) to be stuck in the renderer's queue.
 
-        LOGV("we're still flushing the %s decoder, sending its output buffer"
+        ALOGV("we're still flushing the %s decoder, sending its output buffer"
              " right back.", audio ? "audio" : "video");
 
         reply->post();
@@ -808,7 +808,7 @@
         CHECK(buffer->meta()->findInt64("timeUs", &mediaTimeUs));
 
         if (mediaTimeUs < skipUntilMediaTimeUs) {
-            LOGV("dropping %s buffer at time %lld as requested.",
+            ALOGV("dropping %s buffer at time %lld as requested.",
                  audio ? "audio" : "video",
                  mediaTimeUs);
 
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
index 0cb7f45..d0d9ca6 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
@@ -230,7 +230,7 @@
     if (numFramesAvailableToWrite == mAudioSink->frameCount()) {
         LOGI("audio sink underrun");
     } else {
-        LOGV("audio queue has %d frames left to play",
+        ALOGV("audio queue has %d frames left to play",
              mAudioSink->frameCount() - numFramesAvailableToWrite);
     }
 #endif
@@ -255,7 +255,7 @@
             int64_t mediaTimeUs;
             CHECK(entry->mBuffer->meta()->findInt64("timeUs", &mediaTimeUs));
 
-            LOGV("rendering audio at media time %.2f secs", mediaTimeUs / 1E6);
+            ALOGV("rendering audio at media time %.2f secs", mediaTimeUs / 1E6);
 
             mAnchorTimeMediaUs = mediaTimeUs;
 
@@ -376,9 +376,9 @@
     bool tooLate = (mVideoLateByUs > 40000);
 
     if (tooLate) {
-        LOGV("video late by %lld us (%.2f secs)", lateByUs, lateByUs / 1E6);
+        ALOGV("video late by %lld us (%.2f secs)", lateByUs, lateByUs / 1E6);
     } else {
-        LOGV("rendering video at media time %.2f secs", mediaTimeUs / 1E6);
+        ALOGV("rendering video at media time %.2f secs", mediaTimeUs / 1E6);
     }
 
     entry->mNotifyConsumed->setInt32("render", !tooLate);
@@ -454,7 +454,7 @@
 
     int64_t diff = firstVideoTimeUs - firstAudioTimeUs;
 
-    LOGV("queueDiff = %.2f secs", diff / 1E6);
+    ALOGV("queueDiff = %.2f secs", diff / 1E6);
 
     if (diff > 100000ll) {
         // Audio data starts More than 0.1 secs before video.
@@ -628,8 +628,8 @@
         mAudioSink->pause();
     }
 
-    LOGV("now paused audio queue has %d entries, video has %d entries",
-         mAudioQueue.size(), mVideoQueue.size());
+    ALOGV("now paused audio queue has %d entries, video has %d entries",
+          mAudioQueue.size(), mVideoQueue.size());
 
     mPaused = true;
 }
diff --git a/media/libmediaplayerservice/nuplayer/RTSPSource.cpp b/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
index a3f2bf6..6d28298 100644
--- a/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
@@ -242,7 +242,7 @@
                     // playtime mapping. Assume the first packets correspond
                     // to time 0.
 
-                    LOGV("This is a live stream, assuming time = 0");
+                    ALOGV("This is a live stream, assuming time = 0");
 
                     info->mRTPTime = rtpTime;
                     info->mNormalPlaytimeUs = 0ll;
diff --git a/media/libstagefright/AACExtractor.cpp b/media/libstagefright/AACExtractor.cpp
index 52b1200..33f22f2 100644
--- a/media/libstagefright/AACExtractor.cpp
+++ b/media/libstagefright/AACExtractor.cpp
@@ -22,6 +22,7 @@
 #include "include/avc_utils.h"
 
 #include <media/stagefright/foundation/ABuffer.h>
+#include <media/stagefright/foundation/AMessage.h>
 #include <media/stagefright/DataSource.h>
 #include <media/stagefright/MediaBufferGroup.h>
 #include <media/stagefright/MediaDebug.h>
@@ -131,18 +132,28 @@
     return frameSize;
 }
 
-AACExtractor::AACExtractor(const sp<DataSource> &source)
+AACExtractor::AACExtractor(
+        const sp<DataSource> &source, const sp<AMessage> &_meta)
     : mDataSource(source),
       mInitCheck(NO_INIT),
       mFrameDurationUs(0) {
-    String8 mimeType;
-    float confidence;
-    if (!SniffAAC(mDataSource, &mimeType, &confidence, NULL)) {
-        return;
+    sp<AMessage> meta = _meta;
+
+    if (meta == NULL) {
+        String8 mimeType;
+        float confidence;
+        sp<AMessage> _meta;
+
+        if (!SniffAAC(mDataSource, &mimeType, &confidence, &meta)) {
+            return;
+        }
     }
 
+    int64_t offset;
+    CHECK(meta->findInt64("offset", &offset));
+
     uint8_t profile, sf_index, channel, header[2];
-    if (mDataSource->readAt(2, &header, 2) < 2) {
+    if (mDataSource->readAt(offset + 2, &header, 2) < 2) {
         return;
     }
 
@@ -156,7 +167,6 @@
 
     mMeta = MakeAACCodecSpecificData(profile, sf_index, channel);
 
-    off64_t offset = 0;
     off64_t streamSize, numFrames = 0;
     size_t frameSize = 0;
     int64_t duration = 0;
@@ -245,7 +255,12 @@
 status_t AACSource::start(MetaData *params) {
     CHECK(!mStarted);
 
-    mOffset = 0;
+    if (mOffsetVector.empty()) {
+        mOffset = 0;
+    } else {
+        mOffset = mOffsetVector.itemAt(0);
+    }
+
     mCurrentTimeUs = 0;
     mGroup = new MediaBufferGroup;
     mGroup->add_buffer(new MediaBuffer(kMaxFrameSize));
@@ -318,10 +333,39 @@
 
 bool SniffAAC(
         const sp<DataSource> &source, String8 *mimeType, float *confidence,
-        sp<AMessage> *) {
+        sp<AMessage> *meta) {
+    off64_t pos = 0;
+
+    for (;;) {
+        uint8_t id3header[10];
+        if (source->readAt(pos, id3header, sizeof(id3header))
+                < (ssize_t)sizeof(id3header)) {
+            return false;
+        }
+
+        if (memcmp("ID3", id3header, 3)) {
+            break;
+        }
+
+        // Skip the ID3v2 header.
+
+        size_t len =
+            ((id3header[6] & 0x7f) << 21)
+            | ((id3header[7] & 0x7f) << 14)
+            | ((id3header[8] & 0x7f) << 7)
+            | (id3header[9] & 0x7f);
+
+        len += 10;
+
+        pos += len;
+
+        ALOGV("skipped ID3 tag, new starting offset is %lld (0x%016llx)",
+             pos, pos);
+    }
+
     uint8_t header[2];
 
-    if (source->readAt(0, &header, 2) != 2) {
+    if (source->readAt(pos, &header, 2) != 2) {
         return false;
     }
 
@@ -329,6 +373,10 @@
     if ((header[0] == 0xff) && ((header[1] & 0xf6) == 0xf0)) {
         *mimeType = MEDIA_MIMETYPE_AUDIO_AAC_ADTS;
         *confidence = 0.2;
+
+        *meta = new AMessage;
+        (*meta)->setInt64("offset", pos);
+
         return true;
     }
 
diff --git a/media/libstagefright/AACWriter.cpp b/media/libstagefright/AACWriter.cpp
index d133e91..03fb33b 100644
--- a/media/libstagefright/AACWriter.cpp
+++ b/media/libstagefright/AACWriter.cpp
@@ -40,7 +40,7 @@
       mChannelCount(-1),
       mSampleRate(-1) {
 
-    LOGV("AACWriter Constructor");
+    ALOGV("AACWriter Constructor");
 
     mFd = open(filename, O_CREAT | O_LARGEFILE | O_TRUNC | O_RDWR);
     if (mFd >= 0) {
@@ -209,7 +209,7 @@
     *tableIndex = 0;
     for (int index = 0; index < tableSize; ++index) {
         if (sampleRate == kSampleRateTable[index]) {
-            LOGV("Sample rate: %d and index: %d",
+            ALOGV("Sample rate: %d and index: %d",
                 sampleRate, index);
             *tableIndex = index;
             return true;
@@ -322,7 +322,7 @@
 
         int32_t isCodecSpecific = 0;
         if (buffer->meta_data()->findInt32(kKeyIsCodecConfig, &isCodecSpecific) && isCodecSpecific) {
-            LOGV("Drop codec specific info buffer");
+            ALOGV("Drop codec specific info buffer");
             buffer->release();
             buffer = NULL;
             continue;
@@ -338,7 +338,7 @@
             mResumed = false;
         }
         timestampUs -= previousPausedDurationUs;
-        LOGV("time stamp: %lld, previous paused duration: %lld",
+        ALOGV("time stamp: %lld, previous paused duration: %lld",
             timestampUs, previousPausedDurationUs);
         if (timestampUs > maxTimestampUs) {
             maxTimestampUs = timestampUs;
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index dbc9b7e..ebf5fab 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -342,7 +342,7 @@
 }
 
 void ACodec::signalFlush() {
-    LOGV("[%s] signalFlush", mComponentName.c_str());
+    ALOGV("[%s] signalFlush", mComponentName.c_str());
     (new AMessage(kWhatFlush, id()))->post();
 }
 
@@ -375,7 +375,7 @@
         return err;
     }
 
-    LOGV("[%s] Allocating %lu buffers of size %lu on %s port",
+    ALOGV("[%s] Allocating %lu buffers of size %lu on %s port",
             mComponentName.c_str(),
             def.nBufferCountActual, def.nBufferSize,
             portIndex == kPortIndexInput ? "input" : "output");
@@ -504,7 +504,7 @@
         return err;
     }
 
-    LOGV("[%s] Allocating %lu buffers from a native window of size %lu on "
+    ALOGV("[%s] Allocating %lu buffers from a native window of size %lu on "
          "output port",
          mComponentName.c_str(), def.nBufferCountActual, def.nBufferSize);
 
@@ -535,7 +535,7 @@
 
         mBuffers[kPortIndexOutput].editItemAt(i).mBufferID = bufferId;
 
-        LOGV("[%s] Registered graphic buffer with ID %p (pointer = %p)",
+        ALOGV("[%s] Registered graphic buffer with ID %p (pointer = %p)",
              mComponentName.c_str(),
              bufferId, graphicBuffer.get());
     }
@@ -565,7 +565,7 @@
 status_t ACodec::cancelBufferToNativeWindow(BufferInfo *info) {
     CHECK_EQ((int)info->mStatus, (int)BufferInfo::OWNED_BY_US);
 
-    LOGV("[%s] Calling cancelBuffer on buffer %p",
+    ALOGV("[%s] Calling cancelBuffer on buffer %p",
          mComponentName.c_str(), info->mBufferID);
 
     int err = mNativeWindow->cancelBuffer(
@@ -1114,7 +1114,7 @@
 
         if (info->mStatus != BufferInfo::OWNED_BY_US
                 && info->mStatus != BufferInfo::OWNED_BY_NATIVE_WINDOW) {
-            LOGV("[%s] Buffer %p on port %ld still has status %d",
+            ALOGV("[%s] Buffer %p on port %ld still has status %d",
                     mComponentName.c_str(),
                     info->mBufferID, portIndex, info->mStatus);
             return false;
@@ -1361,7 +1361,7 @@
 bool ACodec::BaseState::onOMXEvent(
         OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) {
     if (event != OMX_EventError) {
-        LOGV("[%s] EVENT(%d, 0x%08lx, 0x%08lx)",
+        ALOGV("[%s] EVENT(%d, 0x%08lx, 0x%08lx)",
              mCodec->mComponentName.c_str(), event, data1, data2);
 
         return false;
@@ -1375,7 +1375,7 @@
 }
 
 bool ACodec::BaseState::onOMXEmptyBufferDone(IOMX::buffer_id bufferID) {
-    LOGV("[%s] onOMXEmptyBufferDone %p",
+    ALOGV("[%s] onOMXEmptyBufferDone %p",
          mCodec->mComponentName.c_str(), bufferID);
 
     BufferInfo *info =
@@ -1438,7 +1438,7 @@
     if (!msg->findObject("buffer", &obj)) {
         CHECK(msg->findInt32("err", &err));
 
-        LOGV("[%s] saw error %d instead of an input buffer",
+        ALOGV("[%s] saw error %d instead of an input buffer",
              mCodec->mComponentName.c_str(), err);
 
         obj.clear();
@@ -1482,7 +1482,7 @@
 
                 if (buffer != info->mData) {
                     if (0 && !(flags & OMX_BUFFERFLAG_CODECCONFIG)) {
-                        LOGV("[%s] Needs to copy input data.",
+                        ALOGV("[%s] Needs to copy input data.",
                              mCodec->mComponentName.c_str());
                     }
 
@@ -1491,10 +1491,10 @@
                 }
 
                 if (flags & OMX_BUFFERFLAG_CODECCONFIG) {
-                    LOGV("[%s] calling emptyBuffer %p w/ codec specific data",
+                    ALOGV("[%s] calling emptyBuffer %p w/ codec specific data",
                          mCodec->mComponentName.c_str(), bufferID);
                 } else {
-                    LOGV("[%s] calling emptyBuffer %p w/ time %lld us",
+                    ALOGV("[%s] calling emptyBuffer %p w/ time %lld us",
                          mCodec->mComponentName.c_str(), bufferID, timeUs);
                 }
 
@@ -1512,15 +1512,15 @@
                 getMoreInputDataIfPossible();
             } else if (!mCodec->mPortEOS[kPortIndexInput]) {
                 if (err != ERROR_END_OF_STREAM) {
-                    LOGV("[%s] Signalling EOS on the input port "
+                    ALOGV("[%s] Signalling EOS on the input port "
                          "due to error %d",
                          mCodec->mComponentName.c_str(), err);
                 } else {
-                    LOGV("[%s] Signalling EOS on the input port",
+                    ALOGV("[%s] Signalling EOS on the input port",
                          mCodec->mComponentName.c_str());
                 }
 
-                LOGV("[%s] calling emptyBuffer %p signalling EOS",
+                ALOGV("[%s] calling emptyBuffer %p signalling EOS",
                      mCodec->mComponentName.c_str(), bufferID);
 
                 CHECK_EQ(mCodec->mOMX->emptyBuffer(
@@ -1582,7 +1582,7 @@
         int64_t timeUs,
         void *platformPrivate,
         void *dataPtr) {
-    LOGV("[%s] onOMXFillBufferDone %p time %lld us",
+    ALOGV("[%s] onOMXFillBufferDone %p time %lld us",
          mCodec->mComponentName.c_str(), bufferID, timeUs);
 
     ssize_t index;
@@ -1603,7 +1603,7 @@
         {
             if (rangeLength == 0) {
                 if (!(flags & OMX_BUFFERFLAG_EOS)) {
-                    LOGV("[%s] calling fillBuffer %p",
+                    ALOGV("[%s] calling fillBuffer %p",
                          mCodec->mComponentName.c_str(), info->mBufferID);
 
                     CHECK_EQ(mCodec->mOMX->fillBuffer(
@@ -1717,7 +1717,7 @@
                 }
 
                 if (info != NULL) {
-                    LOGV("[%s] calling fillBuffer %p",
+                    ALOGV("[%s] calling fillBuffer %p",
                          mCodec->mComponentName.c_str(), info->mBufferID);
 
                     CHECK_EQ(mCodec->mOMX->fillBuffer(mCodec->mNode, info->mBufferID),
@@ -1870,7 +1870,7 @@
 }
 
 void ACodec::LoadedToIdleState::stateEntered() {
-    LOGV("[%s] Now Loaded->Idle", mCodec->mComponentName.c_str());
+    ALOGV("[%s] Now Loaded->Idle", mCodec->mComponentName.c_str());
 
     status_t err;
     if ((err = allocateBuffers()) != OK) {
@@ -1934,7 +1934,7 @@
 }
 
 void ACodec::IdleToExecutingState::stateEntered() {
-    LOGV("[%s] Now Idle->Executing", mCodec->mComponentName.c_str());
+    ALOGV("[%s] Now Idle->Executing", mCodec->mComponentName.c_str());
 }
 
 bool ACodec::IdleToExecutingState::onMessageReceived(const sp<AMessage> &msg) {
@@ -2001,7 +2001,7 @@
             CHECK_EQ((int)info->mStatus, (int)BufferInfo::OWNED_BY_US);
         }
 
-        LOGV("[%s] calling fillBuffer %p",
+        ALOGV("[%s] calling fillBuffer %p",
              mCodec->mComponentName.c_str(), info->mBufferID);
 
         CHECK_EQ(mCodec->mOMX->fillBuffer(mCodec->mNode, info->mBufferID),
@@ -2013,7 +2013,7 @@
 
 void ACodec::ExecutingState::resume() {
     if (mActive) {
-        LOGV("[%s] We're already active, no need to resume.",
+        ALOGV("[%s] We're already active, no need to resume.",
              mCodec->mComponentName.c_str());
 
         return;
@@ -2031,7 +2031,7 @@
 }
 
 void ACodec::ExecutingState::stateEntered() {
-    LOGV("[%s] Now Executing", mCodec->mComponentName.c_str());
+    ALOGV("[%s] Now Executing", mCodec->mComponentName.c_str());
 
     mCodec->processDeferredMessages();
 }
@@ -2056,7 +2056,7 @@
 
         case kWhatFlush:
         {
-            LOGV("[%s] ExecutingState flushing now "
+            ALOGV("[%s] ExecutingState flushing now "
                  "(codec owns %d/%d input, %d/%d output).",
                     mCodec->mComponentName.c_str(),
                     mCodec->countBuffersOwnedByComponent(kPortIndexInput),
@@ -2111,7 +2111,7 @@
             } else if (data2 == OMX_IndexConfigCommonOutputCrop) {
                 mCodec->mSentFormat = false;
             } else {
-                LOGV("[%s] OMX_EventPortSettingsChanged 0x%08lx",
+                ALOGV("[%s] OMX_EventPortSettingsChanged 0x%08lx",
                      mCodec->mComponentName.c_str(), data2);
             }
 
@@ -2156,7 +2156,7 @@
         case kWhatResume:
         {
             if (msg->what() == kWhatResume) {
-                LOGV("[%s] Deferring resume", mCodec->mComponentName.c_str());
+                ALOGV("[%s] Deferring resume", mCodec->mComponentName.c_str());
             }
 
             mCodec->deferMessage(msg);
@@ -2173,7 +2173,7 @@
 }
 
 void ACodec::OutputPortSettingsChangedState::stateEntered() {
-    LOGV("[%s] Now handling output port settings change",
+    ALOGV("[%s] Now handling output port settings change",
          mCodec->mComponentName.c_str());
 }
 
@@ -2185,7 +2185,7 @@
             if (data1 == (OMX_U32)OMX_CommandPortDisable) {
                 CHECK_EQ(data2, (OMX_U32)kPortIndexOutput);
 
-                LOGV("[%s] Output port now disabled.",
+                ALOGV("[%s] Output port now disabled.",
                         mCodec->mComponentName.c_str());
 
                 CHECK(mCodec->mBuffers[kPortIndexOutput].isEmpty());
@@ -2217,7 +2217,7 @@
 
                 mCodec->mSentFormat = false;
 
-                LOGV("[%s] Output port now reenabled.",
+                ALOGV("[%s] Output port now reenabled.",
                         mCodec->mComponentName.c_str());
 
                 if (mCodec->mExecutingState->active()) {
@@ -2272,7 +2272,7 @@
 }
 
 void ACodec::ExecutingToIdleState::stateEntered() {
-    LOGV("[%s] Now Executing->Idle", mCodec->mComponentName.c_str());
+    ALOGV("[%s] Now Executing->Idle", mCodec->mComponentName.c_str());
 
     mCodec->mSentFormat = false;
 }
@@ -2364,7 +2364,7 @@
 }
 
 void ACodec::IdleToLoadedState::stateEntered() {
-    LOGV("[%s] Now Idle->Loaded", mCodec->mComponentName.c_str());
+    ALOGV("[%s] Now Idle->Loaded", mCodec->mComponentName.c_str());
 }
 
 bool ACodec::IdleToLoadedState::onOMXEvent(
@@ -2375,7 +2375,7 @@
             CHECK_EQ(data1, (OMX_U32)OMX_CommandStateSet);
             CHECK_EQ(data2, (OMX_U32)OMX_StateLoaded);
 
-            LOGV("[%s] Now Loaded", mCodec->mComponentName.c_str());
+            ALOGV("[%s] Now Loaded", mCodec->mComponentName.c_str());
 
             CHECK_EQ(mCodec->mOMX->freeNode(mCodec->mNode), (status_t)OK);
 
@@ -2405,7 +2405,7 @@
 }
 
 void ACodec::FlushingState::stateEntered() {
-    LOGV("[%s] Now Flushing", mCodec->mComponentName.c_str());
+    ALOGV("[%s] Now Flushing", mCodec->mComponentName.c_str());
 
     mFlushComplete[kPortIndexInput] = mFlushComplete[kPortIndexOutput] = false;
 }
@@ -2437,7 +2437,7 @@
 
 bool ACodec::FlushingState::onOMXEvent(
         OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) {
-    LOGV("[%s] FlushingState onOMXEvent(%d,%ld)",
+    ALOGV("[%s] FlushingState onOMXEvent(%d,%ld)",
             mCodec->mComponentName.c_str(), event, data1);
 
     switch (event) {
@@ -2473,7 +2473,7 @@
             msg->setInt32("data1", data1);
             msg->setInt32("data2", data2);
 
-            LOGV("[%s] Deferring OMX_EventPortSettingsChanged",
+            ALOGV("[%s] Deferring OMX_EventPortSettingsChanged",
                  mCodec->mComponentName.c_str());
 
             mCodec->deferMessage(msg);
diff --git a/media/libstagefright/AMRWriter.cpp b/media/libstagefright/AMRWriter.cpp
index 6436071..6c4e307 100644
--- a/media/libstagefright/AMRWriter.cpp
+++ b/media/libstagefright/AMRWriter.cpp
@@ -235,7 +235,7 @@
             mResumed = false;
         }
         timestampUs -= previousPausedDurationUs;
-        LOGV("time stamp: %lld, previous paused duration: %lld",
+        ALOGV("time stamp: %lld, previous paused duration: %lld",
                 timestampUs, previousPausedDurationUs);
         if (timestampUs > maxTimestampUs) {
             maxTimestampUs = timestampUs;
diff --git a/media/libstagefright/AVIExtractor.cpp b/media/libstagefright/AVIExtractor.cpp
index 815f987..142fa5b 100644
--- a/media/libstagefright/AVIExtractor.cpp
+++ b/media/libstagefright/AVIExtractor.cpp
@@ -457,7 +457,7 @@
 
         uint32_t subFourcc = U32_AT(&tmp[8]);
 
-        LOGV("%s offset 0x%08llx LIST of '%c%c%c%c', size %d",
+        ALOGV("%s offset 0x%08llx LIST of '%c%c%c%c', size %d",
              prefix,
              offset,
              (char)(subFourcc >> 24),
@@ -486,7 +486,7 @@
             }
         }
     } else {
-        LOGV("%s offset 0x%08llx CHUNK '%c%c%c%c'",
+        ALOGV("%s offset 0x%08llx CHUNK '%c%c%c%c'",
              prefix,
              offset,
              (char)(fourcc >> 24),
@@ -856,7 +856,7 @@
             }
         }
 
-        LOGV("Chunk offsets are %s",
+        ALOGV("Chunk offsets are %s",
              mOffsetsAreAbsolute ? "absolute" : "movie-chunk relative");
     }
 
@@ -908,7 +908,7 @@
         CHECK_EQ((status_t)OK,
                  getSampleTime(i, track->mSamples.size() - 1, &durationUs));
 
-        LOGV("track %d duration = %.2f secs", i, durationUs / 1E6);
+        ALOGV("track %d duration = %.2f secs", i, durationUs / 1E6);
 
         track->mMeta->setInt64(kKeyDuration, durationUs);
         track->mMeta->setInt32(kKeyMaxInputSize, track->mMaxSampleSize);
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index 690deac..0aeb515 100644
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -9,6 +9,7 @@
         AACWriter.cpp                     \
         AMRExtractor.cpp                  \
         AMRWriter.cpp                     \
+        AVIExtractor.cpp                  \
         AudioPlayer.cpp                   \
         AudioSource.cpp                   \
         AwesomePlayer.cpp                 \
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp
index 2581a62..9a9c3ef 100644
--- a/media/libstagefright/AudioPlayer.cpp
+++ b/media/libstagefright/AudioPlayer.cpp
@@ -92,7 +92,7 @@
 
     mFirstBufferResult = mSource->read(&mFirstBuffer, &options);
     if (mFirstBufferResult == INFO_FORMAT_CHANGED) {
-        LOGV("INFO_FORMAT_CHANGED!!!");
+        ALOGV("INFO_FORMAT_CHANGED!!!");
 
         CHECK(mFirstBuffer == NULL);
         mFirstBufferResult = OK;
@@ -223,7 +223,7 @@
     }
 
     if (mInputBuffer != NULL) {
-        LOGV("AudioPlayer releasing input buffer.");
+        ALOGV("AudioPlayer releasing input buffer.");
 
         mInputBuffer->release();
         mInputBuffer = NULL;
@@ -310,7 +310,7 @@
 
 size_t AudioPlayer::fillBuffer(void *data, size_t size) {
     if (mNumFramesPlayed == 0) {
-        LOGV("AudioCallback");
+        ALOGV("AudioCallback");
     }
 
     if (mReachedEOS) {
@@ -390,12 +390,12 @@
                     int64_t timeToCompletionUs =
                         (1000000ll * numFramesPendingPlayout) / mSampleRate;
 
-                    LOGV("total number of frames played: %lld (%lld us)",
+                    ALOGV("total number of frames played: %lld (%lld us)",
                             (mNumFramesPlayed + numAdditionalFrames),
                             1000000ll * (mNumFramesPlayed + numAdditionalFrames)
                                 / mSampleRate);
 
-                    LOGV("%d frames left to play, %lld us (%.2f secs)",
+                    ALOGV("%d frames left to play, %lld us (%.2f secs)",
                          numFramesPendingPlayout,
                          timeToCompletionUs, timeToCompletionUs / 1E6);
 
@@ -415,7 +415,7 @@
                 ((mNumFramesPlayed + size_done / mFrameSize) * 1000000)
                     / mSampleRate;
 
-            LOGV("buffer->size() = %d, "
+            ALOGV("buffer->size() = %d, "
                  "mPositionTimeMediaUs=%.2f mPositionTimeRealUs=%.2f",
                  mInputBuffer->range_length(),
                  mPositionTimeMediaUs / 1E6, mPositionTimeRealUs / 1E6);
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp
index 99c3682..3fae957 100644
--- a/media/libstagefright/AudioSource.cpp
+++ b/media/libstagefright/AudioSource.cpp
@@ -54,7 +54,7 @@
       mNumFramesReceived(0),
       mNumClientOwnedBuffers(0) {
 
-    LOGV("sampleRate: %d, channels: %d", sampleRate, channels);
+    ALOGV("sampleRate: %d, channels: %d", sampleRate, channels);
     CHECK(channels == 1 || channels == 2);
     uint32_t flags = AudioRecord::RECORD_AGC_ENABLE |
                      AudioRecord::RECORD_NS_ENABLE  |
@@ -114,7 +114,7 @@
 }
 
 void AudioSource::releaseQueuedFrames_l() {
-    LOGV("releaseQueuedFrames_l");
+    ALOGV("releaseQueuedFrames_l");
     List<MediaBuffer *>::iterator it;
     while (!mBuffersReceived.empty()) {
         it = mBuffersReceived.begin();
@@ -124,7 +124,7 @@
 }
 
 void AudioSource::waitOutstandingEncodingFrames_l() {
-    LOGV("waitOutstandingEncodingFrames_l: %lld", mNumClientOwnedBuffers);
+    ALOGV("waitOutstandingEncodingFrames_l: %lld", mNumClientOwnedBuffers);
     while (mNumClientOwnedBuffers > 0) {
         mFrameEncodingCompletionCondition.wait(mLock);
     }
@@ -245,7 +245,7 @@
 }
 
 void AudioSource::signalBufferReturned(MediaBuffer *buffer) {
-    LOGV("signalBufferReturned: %p", buffer->data());
+    ALOGV("signalBufferReturned: %p", buffer->data());
     Mutex::Autolock autoLock(mLock);
     --mNumClientOwnedBuffers;
     buffer->setObserver(0);
@@ -256,7 +256,7 @@
 
 status_t AudioSource::dataCallbackTimestamp(
         const AudioRecord::Buffer& audioBuffer, int64_t timeUs) {
-    LOGV("dataCallbackTimestamp: %lld us", timeUs);
+    ALOGV("dataCallbackTimestamp: %lld us", timeUs);
     Mutex::Autolock autoLock(mLock);
     if (!mStarted) {
         LOGW("Spurious callback from AudioRecord. Drop the audio data.");
@@ -266,7 +266,7 @@
     // Drop retrieved and previously lost audio data.
     if (mNumFramesReceived == 0 && timeUs < mStartTimeUs) {
         mRecord->getInputFramesLost();
-        LOGV("Drop audio data at %lld/%lld us", timeUs, mStartTimeUs);
+        ALOGV("Drop audio data at %lld/%lld us", timeUs, mStartTimeUs);
         return OK;
     }
 
@@ -345,7 +345,7 @@
     }
     int16_t value = mMaxAmplitude;
     mMaxAmplitude = 0;
-    LOGV("max amplitude since last call: %d", value);
+    ALOGV("max amplitude since last call: %d", value);
     return value;
 }
 
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 50c264e..964cb1f 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -247,7 +247,7 @@
 }
 
 void AwesomePlayer::setUID(uid_t uid) {
-    LOGV("AwesomePlayer running on behalf of uid %d", uid);
+    ALOGV("AwesomePlayer running on behalf of uid %d", uid);
 
     mUID = uid;
     mUIDValid = true;
@@ -360,7 +360,7 @@
         if (!meta->findInt32(kKeyBitRate, &bitrate)) {
             const char *mime;
             CHECK(meta->findCString(kKeyMIMEType, &mime));
-            LOGV("track of type '%s' does not publish bitrate", mime);
+            ALOGV("track of type '%s' does not publish bitrate", mime);
 
             totalBitRate = -1;
             break;
@@ -371,7 +371,7 @@
 
     mBitrate = totalBitRate;
 
-    LOGV("mBitrate = %lld bits/sec", mBitrate);
+    ALOGV("mBitrate = %lld bits/sec", mBitrate);
 
     {
         Mutex::Autolock autoLock(mStatsLock);
@@ -637,7 +637,7 @@
     int64_t videoLateByUs = audioTimeUs - mVideoTimeUs;
 
     if (!(mFlags & VIDEO_AT_EOS) && videoLateByUs > 300000ll) {
-        LOGV("video late by %lld ms.", videoLateByUs / 1000ll);
+        ALOGV("video late by %lld ms.", videoLateByUs / 1000ll);
 
         notifyListener_l(
                 MEDIA_INFO,
@@ -665,7 +665,7 @@
                 notifyListener_l(MEDIA_BUFFERING_UPDATE, 100);
             }
             if (mFlags & PREPARING) {
-                LOGV("cache has reached EOS, prepare is done.");
+                ALOGV("cache has reached EOS, prepare is done.");
                 finishAsyncPrepare_l();
             }
         } else {
@@ -701,7 +701,7 @@
                         play_l();
                         notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_END);
                     } else if (mFlags & PREPARING) {
-                        LOGV("cache has filled up (> %d), prepare is done",
+                        ALOGV("cache has filled up (> %d), prepare is done",
                              kHighWaterMarkBytes);
                         finishAsyncPrepare_l();
                     }
@@ -721,7 +721,7 @@
                 notifyListener_l(MEDIA_BUFFERING_UPDATE, 100);
             }
             if (mFlags & PREPARING) {
-                LOGV("cache has reached EOS, prepare is done.");
+                ALOGV("cache has reached EOS, prepare is done.");
                 finishAsyncPrepare_l();
             }
         } else {
@@ -737,7 +737,7 @@
     int64_t cachedDurationUs;
     bool eos;
     if (getCachedDuration_l(&cachedDurationUs, &eos)) {
-        LOGV("cachedDurationUs = %.2f secs, eos=%d",
+        ALOGV("cachedDurationUs = %.2f secs, eos=%d",
              cachedDurationUs / 1E6, eos);
 
         if ((mFlags & PLAYING) && !eos
@@ -757,7 +757,7 @@
                 play_l();
                 notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_END);
             } else if (mFlags & PREPARING) {
-                LOGV("cache has filled up (%.2f secs), prepare is done",
+                ALOGV("cache has filled up (%.2f secs), prepare is done",
                      cachedDurationUs / 1E6);
                 finishAsyncPrepare_l();
             }
@@ -789,7 +789,7 @@
     mStreamDoneEventPending = false;
 
     if (mStreamDoneStatus != ERROR_END_OF_STREAM) {
-        LOGV("MEDIA_ERROR %d", mStreamDoneStatus);
+        ALOGV("MEDIA_ERROR %d", mStreamDoneStatus);
 
         notifyListener_l(
                 MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, mStreamDoneStatus);
@@ -820,7 +820,7 @@
             postVideoEvent_l();
         }
     } else {
-        LOGV("MEDIA_PLAYBACK_COMPLETE");
+        ALOGV("MEDIA_PLAYBACK_COMPLETE");
         notifyListener_l(MEDIA_PLAYBACK_COMPLETE);
 
         pause_l(true /* at eos */);
@@ -991,20 +991,20 @@
         cropRight = width - 1;
         cropBottom = height - 1;
 
-        LOGV("got dimensions only %d x %d", width, height);
+        ALOGV("got dimensions only %d x %d", width, height);
     } else {
-        LOGV("got crop rect %d, %d, %d, %d",
+        ALOGV("got crop rect %d, %d, %d, %d",
              cropLeft, cropTop, cropRight, cropBottom);
     }
 
     int32_t displayWidth;
     if (meta->findInt32(kKeyDisplayWidth, &displayWidth)) {
-        LOGV("Display width changed (%d=>%d)", mDisplayWidth, displayWidth);
+        ALOGV("Display width changed (%d=>%d)", mDisplayWidth, displayWidth);
         mDisplayWidth = displayWidth;
     }
     int32_t displayHeight;
     if (meta->findInt32(kKeyDisplayHeight, &displayHeight)) {
-        LOGV("Display height changed (%d=>%d)", mDisplayHeight, displayHeight);
+        ALOGV("Display height changed (%d=>%d)", mDisplayHeight, displayHeight);
         mDisplayHeight = displayHeight;
     }
 
@@ -1170,7 +1170,7 @@
         usleep(1000);
     }
     IPCThreadState::self()->flushCommands();
-    LOGV("video decoder shutdown completed");
+    ALOGV("video decoder shutdown completed");
 }
 
 status_t AwesomePlayer::setNativeWindow_l(const sp<ANativeWindow> &native) {
@@ -1180,7 +1180,7 @@
         return OK;
     }
 
-    LOGV("attempting to reconfigure to use new surface");
+    ALOGV("attempting to reconfigure to use new surface");
 
     bool wasPlaying = (mFlags & PLAYING) != 0;
 
@@ -1317,7 +1317,7 @@
     }
 
     if (!(mFlags & PLAYING)) {
-        LOGV("seeking while paused, sending SEEK_COMPLETE notification"
+        ALOGV("seeking while paused, sending SEEK_COMPLETE notification"
              " immediately.");
 
         notifyListener_l(MEDIA_SEEK_COMPLETE);
@@ -1470,7 +1470,7 @@
         flags |= OMXCodec::kEnableGrallocUsageProtected;
     }
 #endif
-    LOGV("initVideoDecoder flags=0x%x", flags);
+    ALOGV("initVideoDecoder flags=0x%x", flags);
     mVideoSource = OMXCodec::Create(
             mClient.interface(), mVideoTrack->getFormat(),
             false, // createEncoder
@@ -1534,7 +1534,7 @@
     }
 
     if (mAudioPlayer != NULL) {
-        LOGV("seeking audio to %lld us (%.2f secs).", videoTimeUs, videoTimeUs / 1E6);
+        ALOGV("seeking audio to %lld us (%.2f secs).", videoTimeUs, videoTimeUs / 1E6);
 
         // If we don't have a video time, seek audio to the originally
         // requested seek time instead.
@@ -1597,7 +1597,7 @@
     if (!mVideoBuffer) {
         MediaSource::ReadOptions options;
         if (mSeeking != NO_SEEK) {
-            LOGV("seeking to %lld us (%.2f secs)", mSeekTimeUs, mSeekTimeUs / 1E6);
+            ALOGV("seeking to %lld us (%.2f secs)", mSeekTimeUs, mSeekTimeUs / 1E6);
 
             options.setSeekTo(
                     mSeekTimeUs,
@@ -1613,7 +1613,7 @@
                 CHECK(mVideoBuffer == NULL);
 
                 if (err == INFO_FORMAT_CHANGED) {
-                    LOGV("VideoSource signalled format change.");
+                    ALOGV("VideoSource signalled format change.");
 
                     notifyVideoSize_l();
 
@@ -1628,7 +1628,7 @@
                 // a seek request pending that needs to be applied
                 // to the audio track.
                 if (mSeeking != NO_SEEK) {
-                    LOGV("video stream ended while seeking!");
+                    ALOGV("video stream ended while seeking!");
                 }
                 finishSeekIfNecessary(-1);
 
@@ -1745,13 +1745,13 @@
 
         if (latenessUs > 40000) {
             // We're more than 40ms late.
-            LOGV("we're late by %lld us (%.2f secs)",
+            ALOGV("we're late by %lld us (%.2f secs)",
                  latenessUs, latenessUs / 1E6);
 
             if (!(mFlags & SLOW_DECODER_HACK)
                     || mSinceLastDropped > FRAME_DROP_FREQ)
             {
-                LOGV("we're late by %lld us (%.2f secs) dropping "
+                ALOGV("we're late by %lld us (%.2f secs) dropping "
                      "one after %d frames",
                      latenessUs, latenessUs / 1E6, mSinceLastDropped);
 
@@ -2038,7 +2038,7 @@
                         break;
                     }
 
-                    LOGV("now cached %d bytes of data", cachedDataRemaining);
+                    ALOGV("now cached %d bytes of data", cachedDataRemaining);
 
                     if (metaDataSize < 0
                             && cachedDataRemaining >= kMinBytesForSniffing) {
@@ -2063,7 +2063,7 @@
                         }
 
                         CHECK_GE(metaDataSize, 0ll);
-                        LOGV("metaDataSize = %lld bytes", metaDataSize);
+                        ALOGV("metaDataSize = %lld bytes", metaDataSize);
                     }
 
                     usleep(200000);
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp
index 57989c5..927e122 100755
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -63,12 +63,12 @@
 }
 
 void CameraSourceListener::notify(int32_t msgType, int32_t ext1, int32_t ext2) {
-    LOGV("notify(%d, %d, %d)", msgType, ext1, ext2);
+    ALOGV("notify(%d, %d, %d)", msgType, ext1, ext2);
 }
 
 void CameraSourceListener::postData(int32_t msgType, const sp<IMemory> &dataPtr,
                                     camera_frame_metadata_t *metadata) {
-    LOGV("postData(%d, ptr:%p, size:%d)",
+    ALOGV("postData(%d, ptr:%p, size:%d)",
          msgType, dataPtr->pointer(), dataPtr->size());
 
     sp<CameraSource> source = mSource.promote();
@@ -217,7 +217,7 @@
     int32_t width, int32_t height,
     const Vector<Size>& supportedSizes) {
 
-    LOGV("isVideoSizeSupported");
+    ALOGV("isVideoSizeSupported");
     for (size_t i = 0; i < supportedSizes.size(); ++i) {
         if (width  == supportedSizes[i].width &&
             height == supportedSizes[i].height) {
@@ -294,7 +294,7 @@
         CameraParameters* params,
         int32_t width, int32_t height,
         int32_t frameRate) {
-    LOGV("configureCamera");
+    ALOGV("configureCamera");
     Vector<Size> sizes;
     bool isSetVideoSizeSupportedByCamera = true;
     getSupportedVideoSizes(*params, &isSetVideoSizeSupportedByCamera, sizes);
@@ -326,7 +326,7 @@
         const char* supportedFrameRates =
                 params->get(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES);
         CHECK(supportedFrameRates != NULL);
-        LOGV("Supported frame rates: %s", supportedFrameRates);
+        ALOGV("Supported frame rates: %s", supportedFrameRates);
         char buf[4];
         snprintf(buf, 4, "%d", frameRate);
         if (strstr(supportedFrameRates, buf) == NULL) {
@@ -370,7 +370,7 @@
         const CameraParameters& params,
         int32_t width, int32_t height) {
 
-    LOGV("checkVideoSize");
+    ALOGV("checkVideoSize");
     // The actual video size is the same as the preview size
     // if the camera hal does not support separate video and
     // preview output. In this case, we retrieve the video
@@ -422,7 +422,7 @@
         const CameraParameters& params,
         int32_t frameRate) {
 
-    LOGV("checkFrameRate");
+    ALOGV("checkFrameRate");
     int32_t frameRateActual = params.getPreviewFrameRate();
     if (frameRateActual < 0) {
         LOGE("Failed to retrieve preview frame rate (%d)", frameRateActual);
@@ -468,7 +468,7 @@
         int32_t frameRate,
         bool storeMetaDataInVideoBuffers) {
 
-    LOGV("init");
+    ALOGV("init");
     status_t err = OK;
     int64_t token = IPCThreadState::self()->clearCallingIdentity();
     err = initWithCameraAccess(camera, proxy, cameraId,
@@ -485,7 +485,7 @@
         Size videoSize,
         int32_t frameRate,
         bool storeMetaDataInVideoBuffers) {
-    LOGV("initWithCameraAccess");
+    ALOGV("initWithCameraAccess");
     status_t err = OK;
 
     if ((err = isCameraAvailable(camera, proxy, cameraId)) != OK) {
@@ -558,7 +558,7 @@
 }
 
 void CameraSource::startCameraRecording() {
-    LOGV("startCameraRecording");
+    ALOGV("startCameraRecording");
     // Reset the identity to the current thread because media server owns the
     // camera and recording is started by the applications. The applications
     // will connect to the camera in ICameraRecordingProxy::startRecording.
@@ -576,7 +576,7 @@
 }
 
 status_t CameraSource::start(MetaData *meta) {
-    LOGV("start");
+    ALOGV("start");
     CHECK(!mStarted);
     if (mInitCheck != OK) {
         LOGE("CameraSource is not initialized yet");
@@ -602,7 +602,7 @@
 }
 
 void CameraSource::stopCameraRecording() {
-    LOGV("stopCameraRecording");
+    ALOGV("stopCameraRecording");
     if (mCameraFlags & FLAGS_HOT_CAMERA) {
         mCameraRecordingProxy->stopRecording();
     } else {
@@ -612,11 +612,11 @@
 }
 
 void CameraSource::releaseCamera() {
-    LOGV("releaseCamera");
+    ALOGV("releaseCamera");
     if (mCamera != 0) {
         int64_t token = IPCThreadState::self()->clearCallingIdentity();
         if ((mCameraFlags & FLAGS_HOT_CAMERA) == 0) {
-            LOGV("Camera was cold when we started, stopping preview");
+            ALOGV("Camera was cold when we started, stopping preview");
             mCamera->stopPreview();
             mCamera->disconnect();
         }
@@ -675,7 +675,7 @@
 }
 
 void CameraSource::releaseRecordingFrame(const sp<IMemory>& frame) {
-    LOGV("releaseRecordingFrame");
+    ALOGV("releaseRecordingFrame");
     if (mCameraRecordingProxy != NULL) {
         mCameraRecordingProxy->releaseRecordingFrame(frame);
     } else if (mCamera != NULL) {
@@ -704,7 +704,7 @@
 }
 
 void CameraSource::signalBufferReturned(MediaBuffer *buffer) {
-    LOGV("signalBufferReturned: %p", buffer->data());
+    ALOGV("signalBufferReturned: %p", buffer->data());
     Mutex::Autolock autoLock(mLock);
     for (List<sp<IMemory> >::iterator it = mFramesBeingEncoded.begin();
          it != mFramesBeingEncoded.end(); ++it) {
@@ -723,7 +723,7 @@
 
 status_t CameraSource::read(
         MediaBuffer **buffer, const ReadOptions *options) {
-    LOGV("read");
+    ALOGV("read");
 
     *buffer = NULL;
 
@@ -770,10 +770,10 @@
 
 void CameraSource::dataCallbackTimestamp(int64_t timestampUs,
         int32_t msgType, const sp<IMemory> &data) {
-    LOGV("dataCallbackTimestamp: timestamp %lld us", timestampUs);
+    ALOGV("dataCallbackTimestamp: timestamp %lld us", timestampUs);
     Mutex::Autolock autoLock(mLock);
     if (!mStarted || (mNumFramesReceived == 0 && timestampUs < mStartTimeUs)) {
-        LOGV("Drop frame at %lld/%lld us", timestampUs, mStartTimeUs);
+        ALOGV("Drop frame at %lld/%lld us", timestampUs, mStartTimeUs);
         releaseOneRecordingFrame(data);
         return;
     }
@@ -812,13 +812,13 @@
     mFramesReceived.push_back(data);
     int64_t timeUs = mStartTimeUs + (timestampUs - mFirstFrameTimeUs);
     mFrameTimes.push_back(timeUs);
-    LOGV("initial delay: %lld, current time stamp: %lld",
+    ALOGV("initial delay: %lld, current time stamp: %lld",
         mStartTimeUs, timeUs);
     mFrameAvailableCondition.signal();
 }
 
 bool CameraSource::isMetaDataStoredInVideoBuffers() const {
-    LOGV("isMetaDataStoredInVideoBuffers");
+    ALOGV("isMetaDataStoredInVideoBuffers");
     return mIsMetaDataStoredInVideoBuffers;
 }
 
diff --git a/media/libstagefright/CameraSourceTimeLapse.cpp b/media/libstagefright/CameraSourceTimeLapse.cpp
index eb456f4..4f6c8d1 100644
--- a/media/libstagefright/CameraSourceTimeLapse.cpp
+++ b/media/libstagefright/CameraSourceTimeLapse.cpp
@@ -90,7 +90,7 @@
 }
 
 void CameraSourceTimeLapse::startQuickReadReturns() {
-    LOGV("startQuickReadReturns");
+    ALOGV("startQuickReadReturns");
     Mutex::Autolock autoLock(mQuickStopLock);
 
     // Enable quick stop mode.
@@ -105,7 +105,7 @@
 bool CameraSourceTimeLapse::trySettingVideoSize(
         int32_t width, int32_t height) {
 
-    LOGV("trySettingVideoSize");
+    ALOGV("trySettingVideoSize");
     int64_t token = IPCThreadState::self()->clearCallingIdentity();
     String8 s = mCamera->getParameters();
 
@@ -131,7 +131,7 @@
 
     bool isSuccessful = false;
     if (videoSizeSupported) {
-        LOGV("Video size (%d, %d) is supported", width, height);
+        ALOGV("Video size (%d, %d) is supported", width, height);
         if (videoOutputSupported) {
             params.setVideoSize(width, height);
         } else {
@@ -150,7 +150,7 @@
 }
 
 void CameraSourceTimeLapse::signalBufferReturned(MediaBuffer* buffer) {
-    LOGV("signalBufferReturned");
+    ALOGV("signalBufferReturned");
     Mutex::Autolock autoLock(mQuickStopLock);
     if (mQuickStop && (buffer == mLastReadBufferCopy)) {
         buffer->setObserver(NULL);
@@ -165,7 +165,7 @@
         int64_t frameTime,
         MediaBuffer **newBuffer) {
 
-    LOGV("createMediaBufferCopy");
+    ALOGV("createMediaBufferCopy");
     size_t sourceSize = sourceBuffer.size();
     void* sourcePointer = sourceBuffer.data();
 
@@ -176,7 +176,7 @@
 }
 
 void CameraSourceTimeLapse::fillLastReadBufferCopy(MediaBuffer& sourceBuffer) {
-    LOGV("fillLastReadBufferCopy");
+    ALOGV("fillLastReadBufferCopy");
     int64_t frameTime;
     CHECK(sourceBuffer.meta_data()->findInt64(kKeyTime, &frameTime));
     createMediaBufferCopy(sourceBuffer, frameTime, &mLastReadBufferCopy);
@@ -186,7 +186,7 @@
 
 status_t CameraSourceTimeLapse::read(
         MediaBuffer **buffer, const ReadOptions *options) {
-    LOGV("read");
+    ALOGV("read");
     if (mLastReadBufferCopy == NULL) {
         mLastReadStatus = CameraSource::read(buffer, options);
 
@@ -205,7 +205,7 @@
 }
 
 void CameraSourceTimeLapse::stopCameraRecording() {
-    LOGV("stopCameraRecording");
+    ALOGV("stopCameraRecording");
     CameraSource::stopCameraRecording();
     if (mLastReadBufferCopy) {
         mLastReadBufferCopy->release();
@@ -216,7 +216,7 @@
 sp<IMemory> CameraSourceTimeLapse::createIMemoryCopy(
         const sp<IMemory> &source_data) {
 
-    LOGV("createIMemoryCopy");
+    ALOGV("createIMemoryCopy");
     size_t source_size = source_data->size();
     void* source_pointer = source_data->pointer();
 
@@ -227,7 +227,7 @@
 }
 
 bool CameraSourceTimeLapse::skipCurrentFrame(int64_t timestampUs) {
-    LOGV("skipCurrentFrame");
+    ALOGV("skipCurrentFrame");
     if (mSkipCurrentFrame) {
         mSkipCurrentFrame = false;
         return true;
@@ -237,11 +237,11 @@
 }
 
 bool CameraSourceTimeLapse::skipFrameAndModifyTimeStamp(int64_t *timestampUs) {
-    LOGV("skipFrameAndModifyTimeStamp");
+    ALOGV("skipFrameAndModifyTimeStamp");
     if (mLastTimeLapseFrameRealTimestampUs == 0) {
         // First time lapse frame. Initialize mLastTimeLapseFrameRealTimestampUs
         // to current time (timestampUs) and save frame data.
-        LOGV("dataCallbackTimestamp timelapse: initial frame");
+        ALOGV("dataCallbackTimestamp timelapse: initial frame");
 
         mLastTimeLapseFrameRealTimestampUs = *timestampUs;
         return false;
@@ -253,7 +253,7 @@
         // mForceRead may be set to true by startQuickReadReturns(). In that
         // case don't skip this frame.
         if (mForceRead) {
-            LOGV("dataCallbackTimestamp timelapse: forced read");
+            ALOGV("dataCallbackTimestamp timelapse: forced read");
             mForceRead = false;
             *timestampUs =
                 mLastFrameTimestampUs + mTimeBetweenTimeLapseVideoFramesUs;
@@ -275,14 +275,14 @@
         // Skip all frames from last encoded frame until
         // sufficient time (mTimeBetweenFrameCaptureUs) has passed.
         // Tell the camera to release its recording frame and return.
-        LOGV("dataCallbackTimestamp timelapse: skipping intermediate frame");
+        ALOGV("dataCallbackTimestamp timelapse: skipping intermediate frame");
         return true;
     } else {
         // Desired frame has arrived after mTimeBetweenFrameCaptureUs time:
         // - Reset mLastTimeLapseFrameRealTimestampUs to current time.
         // - Artificially modify timestampUs to be one frame time (1/framerate) ahead
         // of the last encoded frame's time stamp.
-        LOGV("dataCallbackTimestamp timelapse: got timelapse frame");
+        ALOGV("dataCallbackTimestamp timelapse: got timelapse frame");
 
         mLastTimeLapseFrameRealTimestampUs = *timestampUs;
         *timestampUs = mLastFrameTimestampUs + mTimeBetweenTimeLapseVideoFramesUs;
@@ -293,7 +293,7 @@
 
 void CameraSourceTimeLapse::dataCallbackTimestamp(int64_t timestampUs, int32_t msgType,
             const sp<IMemory> &data) {
-    LOGV("dataCallbackTimestamp");
+    ALOGV("dataCallbackTimestamp");
     mSkipCurrentFrame = skipFrameAndModifyTimeStamp(&timestampUs);
     CameraSource::dataCallbackTimestamp(timestampUs, msgType, data);
 }
diff --git a/media/libstagefright/DataSource.cpp b/media/libstagefright/DataSource.cpp
index 43539bb..e471f73 100644
--- a/media/libstagefright/DataSource.cpp
+++ b/media/libstagefright/DataSource.cpp
@@ -15,6 +15,12 @@
  */
 
 #include "include/AMRExtractor.h"
+#include "include/AVIExtractor.h"
+
+#if CHROMIUM_AVAILABLE
+#include "include/DataUriSource.h"
+#endif
+
 #include "include/MP3Extractor.h"
 #include "include/MPEG4Extractor.h"
 #include "include/WAVExtractor.h"
@@ -112,6 +118,7 @@
     RegisterSniffer(SniffMPEG2TS);
     RegisterSniffer(SniffMP3);
     RegisterSniffer(SniffAAC);
+    RegisterSniffer(SniffAVI);
     RegisterSniffer(SniffMPEG2PS);
 
     char value[PROPERTY_VALUE_MAX];
@@ -134,6 +141,10 @@
             return NULL;
         }
         source = new NuCachedSource2(httpSource);
+# if CHROMIUM_AVAILABLE
+    } else if (!strncasecmp("data:", uri, 5)) {
+        source = new DataUriSource(uri);
+#endif
     } else {
         // Assume it's a filename.
         source = new FileSource(uri);
diff --git a/media/libstagefright/ESDS.cpp b/media/libstagefright/ESDS.cpp
index 1f7ee25..1b225fa 100644
--- a/media/libstagefright/ESDS.cpp
+++ b/media/libstagefright/ESDS.cpp
@@ -91,7 +91,7 @@
     }
     while (more);
 
-    LOGV("tag=0x%02x data_size=%d", *tag, *data_size);
+    ALOGV("tag=0x%02x data_size=%d", *tag, *data_size);
 
     if (*data_size > size) {
         return ERROR_MALFORMED;
diff --git a/media/libstagefright/FLACExtractor.cpp b/media/libstagefright/FLACExtractor.cpp
index 8ba5a2d..a0c08e2 100644
--- a/media/libstagefright/FLACExtractor.cpp
+++ b/media/libstagefright/FLACExtractor.cpp
@@ -454,7 +454,7 @@
       mWriteBuffer(NULL),
       mErrorStatus((FLAC__StreamDecoderErrorStatus) -1)
 {
-    LOGV("FLACParser::FLACParser");
+    ALOGV("FLACParser::FLACParser");
     memset(&mStreamInfo, 0, sizeof(mStreamInfo));
     memset(&mWriteHeader, 0, sizeof(mWriteHeader));
     mInitCheck = init();
@@ -462,7 +462,7 @@
 
 FLACParser::~FLACParser()
 {
-    LOGV("FLACParser::~FLACParser");
+    ALOGV("FLACParser::~FLACParser");
     if (mDecoder != NULL) {
         FLAC__stream_decoder_delete(mDecoder);
         mDecoder = NULL;
@@ -606,7 +606,7 @@
             LOGE("FLACParser::readBuffer seek to sample %llu failed", sample);
             return NULL;
         }
-        LOGV("FLACParser::readBuffer seek to sample %llu succeeded", sample);
+        ALOGV("FLACParser::readBuffer seek to sample %llu succeeded", sample);
     } else {
         if (!FLAC__stream_decoder_process_single(mDecoder)) {
             LOGE("FLACParser::readBuffer process_single failed");
@@ -614,7 +614,7 @@
         }
     }
     if (!mWriteCompleted) {
-        LOGV("FLACParser::readBuffer write did not complete");
+        ALOGV("FLACParser::readBuffer write did not complete");
         return NULL;
     }
     // verify that block header keeps the promises made by STREAMINFO
@@ -661,13 +661,13 @@
       mInitCheck(false),
       mStarted(false)
 {
-    LOGV("FLACSource::FLACSource");
+    ALOGV("FLACSource::FLACSource");
     mInitCheck = init();
 }
 
 FLACSource::~FLACSource()
 {
-    LOGV("~FLACSource::FLACSource");
+    ALOGV("~FLACSource::FLACSource");
     if (mStarted) {
         stop();
     }
@@ -675,7 +675,7 @@
 
 status_t FLACSource::start(MetaData *params)
 {
-    LOGV("FLACSource::start");
+    ALOGV("FLACSource::start");
 
     CHECK(!mStarted);
     mParser->allocateBuffers();
@@ -686,7 +686,7 @@
 
 status_t FLACSource::stop()
 {
-    LOGV("FLACSource::stop");
+    ALOGV("FLACSource::stop");
 
     CHECK(mStarted);
     mParser->releaseBuffers();
@@ -729,7 +729,7 @@
 
 status_t FLACSource::init()
 {
-    LOGV("FLACSource::init");
+    ALOGV("FLACSource::init");
     // re-use the same track metadata passed into constructor from FLACExtractor
     mParser = new FLACParser(mDataSource);
     return mParser->initCheck();
@@ -742,13 +742,13 @@
     : mDataSource(dataSource),
       mInitCheck(false)
 {
-    LOGV("FLACExtractor::FLACExtractor");
+    ALOGV("FLACExtractor::FLACExtractor");
     mInitCheck = init();
 }
 
 FLACExtractor::~FLACExtractor()
 {
-    LOGV("~FLACExtractor::FLACExtractor");
+    ALOGV("~FLACExtractor::FLACExtractor");
 }
 
 size_t FLACExtractor::countTracks()
diff --git a/media/libstagefright/MP3Extractor.cpp b/media/libstagefright/MP3Extractor.cpp
index 34e9cd7..ab1dc5c 100644
--- a/media/libstagefright/MP3Extractor.cpp
+++ b/media/libstagefright/MP3Extractor.cpp
@@ -81,7 +81,7 @@
 
             *inout_pos += len;
 
-            LOGV("skipped ID3 tag, new starting offset is %lld (0x%016llx)",
+            ALOGV("skipped ID3 tag, new starting offset is %lld (0x%016llx)",
                  *inout_pos, *inout_pos);
         }
 
@@ -105,7 +105,7 @@
     do {
         if (pos >= *inout_pos + kMaxBytesChecked) {
             // Don't scan forever.
-            LOGV("giving up at offset %lld", pos);
+            ALOGV("giving up at offset %lld", pos);
             break;
         }
 
@@ -155,7 +155,7 @@
             continue;
         }
 
-        LOGV("found possible 1st frame at %lld (header = 0x%08x)", pos, header);
+        ALOGV("found possible 1st frame at %lld (header = 0x%08x)", pos, header);
 
         // We found what looks like a valid frame,
         // now find its successors.
@@ -172,7 +172,7 @@
 
             uint32_t test_header = U32_AT(tmp);
 
-            LOGV("subsequent header is %08x", test_header);
+            ALOGV("subsequent header is %08x", test_header);
 
             if ((test_header & kMask) != (header & kMask)) {
                 valid = false;
@@ -186,7 +186,7 @@
                 break;
             }
 
-            LOGV("found subsequent frame #%d at %lld", j + 2, test_pos);
+            ALOGV("found subsequent frame #%d at %lld", j + 2, test_pos);
 
             test_pos += test_frame_size;
         }
@@ -198,7 +198,7 @@
                 *out_header = header;
             }
         } else {
-            LOGV("no dice, no valid sequence of frames found.");
+            ALOGV("no dice, no valid sequence of frames found.");
         }
 
         ++pos;
@@ -483,7 +483,7 @@
         }
 
         // Lost sync.
-        LOGV("lost sync! header = 0x%08x, old header = 0x%08x\n", header, mFixedHeader);
+        ALOGV("lost sync! header = 0x%08x, old header = 0x%08x\n", header, mFixedHeader);
 
         off64_t pos = mCurrentPos;
         if (!Resync(mDataSource, mFixedHeader, &pos, NULL, NULL)) {
diff --git a/media/libstagefright/MPEG2TSWriter.cpp b/media/libstagefright/MPEG2TSWriter.cpp
index 02eeb40..36009ab 100644
--- a/media/libstagefright/MPEG2TSWriter.cpp
+++ b/media/libstagefright/MPEG2TSWriter.cpp
@@ -644,7 +644,7 @@
                 CHECK(source->lastAccessUnit() == NULL);
                 source->setLastAccessUnit(buffer);
 
-                LOGV("lastAccessUnitTimeUs[%d] = %.2f secs",
+                ALOGV("lastAccessUnitTimeUs[%d] = %.2f secs",
                      sourceIndex, source->lastAccessUnitTimeUs() / 1E6);
 
                 int64_t minTimeUs = -1;
@@ -668,11 +668,11 @@
                 }
 
                 if (minTimeUs < 0) {
-                    LOGV("not a all tracks have valid data.");
+                    ALOGV("not a all tracks have valid data.");
                     break;
                 }
 
-                LOGV("writing access unit at time %.2f secs (index %d)",
+                ALOGV("writing access unit at time %.2f secs (index %d)",
                      minTimeUs / 1E6, minIndex);
 
                 source = mSources.editItemAt(minIndex);
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index f6b06c7..0a69df4 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -683,7 +683,7 @@
         case FOURCC('i', 'l', 's', 't'):
         {
             if (chunk_type == FOURCC('s', 't', 'b', 'l')) {
-                LOGV("sampleTable chunk is %d bytes long.", (size_t)chunk_size);
+                ALOGV("sampleTable chunk is %d bytes long.", (size_t)chunk_size);
 
                 if (mDataSource->flags()
                         & (DataSource::kWantsPrefetching
@@ -1372,8 +1372,9 @@
 
             uint32_t type = ntohl(buffer);
             // For the 3GPP file format, the handler-type within the 'hdlr' box
-            // shall be 'text'
-            if (type == FOURCC('t', 'e', 'x', 't')) {
+            // shall be 'text'. We also want to support 'sbtl' handler type
+            // for a practical reason as various MPEG4 containers use it.
+            if (type == FOURCC('t', 'e', 'x', 't') || type == FOURCC('s', 'b', 't', 'l')) {
                 mLastTrack->meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_TEXT_3GPP);
             }
 
@@ -1417,7 +1418,7 @@
         case FOURCC('c', 'o', 'v', 'r'):
         {
             if (mFileMetaData != NULL) {
-                LOGV("chunk_data_size = %lld and data_offset = %lld",
+                ALOGV("chunk_data_size = %lld and data_offset = %lld",
                         chunk_data_size, data_offset);
                 uint8_t *buffer = new uint8_t[chunk_data_size + 1];
                 if (mDataSource->readAt(
@@ -1820,7 +1821,7 @@
     CHECK(mLastTrack->meta->findInt32(kKeySampleRate, &prevSampleRate));
 
     if (prevSampleRate != sampleRate) {
-        LOGV("mpeg4 audio sample rate different from previous setting. "
+        ALOGV("mpeg4 audio sample rate different from previous setting. "
              "was: %d, now: %d", prevSampleRate, sampleRate);
     }
 
@@ -1830,7 +1831,7 @@
     CHECK(mLastTrack->meta->findInt32(kKeyChannelCount, &prevChannelCount));
 
     if (prevChannelCount != numChannels) {
-        LOGV("mpeg4 audio channel count different from previous setting. "
+        ALOGV("mpeg4 audio channel count different from previous setting. "
              "was: %d, now: %d", prevChannelCount, numChannels);
     }
 
@@ -2407,7 +2408,7 @@
         *meta = new AMessage;
         (*meta)->setInt64("meta-data-size", moovAtomEndOffset);
 
-        LOGV("found metadata size: %lld", moovAtomEndOffset);
+        ALOGV("found metadata size: %lld", moovAtomEndOffset);
     }
 
     return true;
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index 46d87df..dfee281 100755
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -472,7 +472,7 @@
         mTimeScale = 1000;
     }
     CHECK(mTimeScale > 0);
-    LOGV("movie time scale: %d", mTimeScale);
+    ALOGV("movie time scale: %d", mTimeScale);
 
     mStreamableFile = true;
     mWriteMoovBoxToMemory = false;
@@ -569,7 +569,7 @@
  * u, v and w is in 2.30 format.
  */
 void MPEG4Writer::writeCompositionMatrix(int degrees) {
-    LOGV("writeCompositionMatrix");
+    ALOGV("writeCompositionMatrix");
     uint32_t a = 0x00010000;
     uint32_t b = 0;
     uint32_t c = 0;
@@ -1200,7 +1200,7 @@
 }
 
 void MPEG4Writer::Track::setTimeScale() {
-    LOGV("setTimeScale");
+    ALOGV("setTimeScale");
     // Default time scale
     mTimeScale = 90000;
 
@@ -1262,14 +1262,14 @@
 }
 
 void MPEG4Writer::Track::initTrackingProgressStatus(MetaData *params) {
-    LOGV("initTrackingProgressStatus");
+    ALOGV("initTrackingProgressStatus");
     mPreviousTrackTimeUs = -1;
     mTrackingProgressStatus = false;
     mTrackEveryTimeDurationUs = 0;
     {
         int64_t timeUs;
         if (params && params->findInt64(kKeyTrackTimeStatus, &timeUs)) {
-            LOGV("Receive request to track progress status for every %lld us", timeUs);
+            ALOGV("Receive request to track progress status for every %lld us", timeUs);
             mTrackEveryTimeDurationUs = timeUs;
             mTrackingProgressStatus = true;
         }
@@ -1278,14 +1278,14 @@
 
 // static
 void *MPEG4Writer::ThreadWrapper(void *me) {
-    LOGV("ThreadWrapper: %p", me);
+    ALOGV("ThreadWrapper: %p", me);
     MPEG4Writer *writer = static_cast<MPEG4Writer *>(me);
     writer->threadFunc();
     return NULL;
 }
 
 void MPEG4Writer::bufferChunk(const Chunk& chunk) {
-    LOGV("bufferChunk: %p", chunk.mTrack);
+    ALOGV("bufferChunk: %p", chunk.mTrack);
     Mutex::Autolock autolock(mLock);
     CHECK_EQ(mDone, false);
 
@@ -1303,7 +1303,7 @@
 }
 
 void MPEG4Writer::writeChunkToFile(Chunk* chunk) {
-    LOGV("writeChunkToFile: %lld from %s track",
+    ALOGV("writeChunkToFile: %lld from %s track",
         chunk->mTimeStampUs, chunk->mTrack->isAudio()? "audio": "video");
 
     int32_t isFirstSample = true;
@@ -1327,7 +1327,7 @@
 }
 
 void MPEG4Writer::writeAllChunks() {
-    LOGV("writeAllChunks");
+    ALOGV("writeAllChunks");
     size_t outstandingChunks = 0;
     Chunk chunk;
     while (findChunkToWrite(&chunk)) {
@@ -1342,7 +1342,7 @@
 }
 
 bool MPEG4Writer::findChunkToWrite(Chunk *chunk) {
-    LOGV("findChunkToWrite");
+    ALOGV("findChunkToWrite");
 
     int64_t minTimestampUs = 0x7FFFFFFFFFFFFFFFLL;
     Track *track = NULL;
@@ -1358,7 +1358,7 @@
     }
 
     if (track == NULL) {
-        LOGV("Nothing to be written after all");
+        ALOGV("Nothing to be written after all");
         return false;
     }
 
@@ -1387,7 +1387,7 @@
 }
 
 void MPEG4Writer::threadFunc() {
-    LOGV("threadFunc");
+    ALOGV("threadFunc");
 
     prctl(PR_SET_NAME, (unsigned long)"MPEG4Writer", 0, 0, 0);
 
@@ -1413,7 +1413,7 @@
 }
 
 status_t MPEG4Writer::startWriterThread() {
-    LOGV("startWriterThread");
+    ALOGV("startWriterThread");
 
     mDone = false;
     mIsFirstChunk = true;
@@ -1564,7 +1564,7 @@
 }
 
 static void getNalUnitType(uint8_t byte, uint8_t* type) {
-    LOGV("getNalUnitType: %d", byte);
+    ALOGV("getNalUnitType: %d", byte);
 
     // nal_unit_type: 5-bit unsigned integer
     *type = (byte & 0x1F);
@@ -1573,7 +1573,7 @@
 static const uint8_t *findNextStartCode(
         const uint8_t *data, size_t length) {
 
-    LOGV("findNextStartCode: %p %d", data, length);
+    ALOGV("findNextStartCode: %p %d", data, length);
 
     size_t bytesLeft = length;
     while (bytesLeft > 4  &&
@@ -1589,7 +1589,7 @@
 const uint8_t *MPEG4Writer::Track::parseParamSet(
         const uint8_t *data, size_t length, int type, size_t *paramSetLen) {
 
-    LOGV("parseParamSet");
+    ALOGV("parseParamSet");
     CHECK(type == kNalUnitTypeSeqParamSet ||
           type == kNalUnitTypePicParamSet);
 
@@ -1627,7 +1627,7 @@
 
 status_t MPEG4Writer::Track::copyAVCCodecSpecificData(
         const uint8_t *data, size_t size) {
-    LOGV("copyAVCCodecSpecificData");
+    ALOGV("copyAVCCodecSpecificData");
 
     // 2 bytes for each of the parameter set length field
     // plus the 7 bytes for the header
@@ -1645,7 +1645,7 @@
 status_t MPEG4Writer::Track::parseAVCCodecSpecificData(
         const uint8_t *data, size_t size) {
 
-    LOGV("parseAVCCodecSpecificData");
+    ALOGV("parseAVCCodecSpecificData");
     // Data starts with a start code.
     // SPS and PPS are separated with start codes.
     // Also, SPS must come before PPS
@@ -1987,7 +1987,7 @@
             int64_t timeUs = decodingTimeUs;
             cttsDeltaTimeUs = timestampUs - decodingTimeUs;
             timestampUs = decodingTimeUs;
-            LOGV("decoding time: %lld and ctts delta time: %lld",
+            ALOGV("decoding time: %lld and ctts delta time: %lld",
                 timestampUs, cttsDeltaTimeUs);
         }
 
@@ -1998,7 +1998,7 @@
         }
 
         CHECK(timestampUs >= 0);
-        LOGV("%s media time stamp: %lld and previous paused duration %lld",
+        ALOGV("%s media time stamp: %lld and previous paused duration %lld",
                 mIsAudio? "Audio": "Video", timestampUs, previousPausedDurationUs);
         if (timestampUs > mTrackDurationUs) {
             mTrackDurationUs = timestampUs;
@@ -2020,7 +2020,7 @@
             // Force the first sample to have its own stts entry so that
             // we can adjust its value later to maintain the A/V sync.
             if (mNumSamples == 3 || currDurationTicks != lastDurationTicks) {
-                LOGV("%s lastDurationUs: %lld us, currDurationTicks: %lld us",
+                ALOGV("%s lastDurationUs: %lld us, currDurationTicks: %lld us",
                         mIsAudio? "Audio": "Video", lastDurationUs, currDurationTicks);
                 addOneSttsTableEntry(sampleCount, lastDurationTicks);
                 sampleCount = 1;
@@ -2046,7 +2046,7 @@
             }
             previousSampleSize = sampleSize;
         }
-        LOGV("%s timestampUs/lastTimestampUs: %lld/%lld",
+        ALOGV("%s timestampUs/lastTimestampUs: %lld/%lld",
                 mIsAudio? "Audio": "Video", timestampUs, lastTimestampUs);
         lastDurationUs = timestampUs - lastTimestampUs;
         lastDurationTicks = currDurationTicks;
@@ -2232,10 +2232,10 @@
 }
 
 void MPEG4Writer::Track::trackProgressStatus(int64_t timeUs, status_t err) {
-    LOGV("trackProgressStatus: %lld us", timeUs);
+    ALOGV("trackProgressStatus: %lld us", timeUs);
     if (mTrackEveryTimeDurationUs > 0 &&
         timeUs - mPreviousTrackTimeUs >= mTrackEveryTimeDurationUs) {
-        LOGV("Fire time tracking progress status at %lld us", timeUs);
+        ALOGV("Fire time tracking progress status at %lld us", timeUs);
         mOwner->trackProgressStatus(mTrackId, timeUs - mPreviousTrackTimeUs, err);
         mPreviousTrackTimeUs = timeUs;
     }
@@ -2269,13 +2269,13 @@
 }
 
 void MPEG4Writer::setDriftTimeUs(int64_t driftTimeUs) {
-    LOGV("setDriftTimeUs: %lld us", driftTimeUs);
+    ALOGV("setDriftTimeUs: %lld us", driftTimeUs);
     Mutex::Autolock autolock(mLock);
     mDriftTimeUs = driftTimeUs;
 }
 
 int64_t MPEG4Writer::getDriftTimeUs() {
-    LOGV("getDriftTimeUs: %lld us", mDriftTimeUs);
+    ALOGV("getDriftTimeUs: %lld us", mDriftTimeUs);
     Mutex::Autolock autolock(mLock);
     return mDriftTimeUs;
 }
@@ -2285,7 +2285,7 @@
 }
 
 void MPEG4Writer::Track::bufferChunk(int64_t timestampUs) {
-    LOGV("bufferChunk");
+    ALOGV("bufferChunk");
 
     Chunk chunk(this, timestampUs, mChunkSamples);
     mOwner->bufferChunk(chunk);
@@ -2323,7 +2323,7 @@
 
 void MPEG4Writer::Track::writeTrackHeader(bool use32BitOffset) {
 
-    LOGV("%s track time scale: %d",
+    ALOGV("%s track time scale: %d",
         mIsAudio? "Audio": "Video", mTimeScale);
 
     time_t now = time(NULL);
@@ -2730,7 +2730,7 @@
         return;
     }
 
-    LOGV("ctts box has %d entries", mNumCttsTableEntries);
+    ALOGV("ctts box has %d entries", mNumCttsTableEntries);
 
     mOwner->beginBox("ctts");
     if (mHasNegativeCttsDeltaDuration) {
diff --git a/media/libstagefright/MediaExtractor.cpp b/media/libstagefright/MediaExtractor.cpp
index 374ecf7..2171492 100644
--- a/media/libstagefright/MediaExtractor.cpp
+++ b/media/libstagefright/MediaExtractor.cpp
@@ -19,6 +19,7 @@
 #include <utils/Log.h>
 
 #include "include/AMRExtractor.h"
+#include "include/AVIExtractor.h"
 #include "include/MP3Extractor.h"
 #include "include/MPEG4Extractor.h"
 #include "include/WAVExtractor.h"
@@ -58,13 +59,13 @@
     if (mime == NULL) {
         float confidence;
         if (!source->sniff(&tmp, &confidence, &meta)) {
-            LOGV("FAILED to autodetect media content.");
+            ALOGV("FAILED to autodetect media content.");
 
             return NULL;
         }
 
         mime = tmp.string();
-        LOGV("Autodetected media content as '%s' with confidence %.2f",
+        ALOGV("Autodetected media content as '%s' with confidence %.2f",
              mime, confidence);
     }
 
@@ -109,10 +110,12 @@
         ret = new MatroskaExtractor(source);
     } else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_MPEG2TS)) {
         ret = new MPEG2TSExtractor(source);
+    } else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_AVI)) {
+        ret = new AVIExtractor(source);
     } else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_WVM)) {
         ret = new WVMExtractor(source);
     } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC_ADTS)) {
-        ret = new AACExtractor(source);
+        ret = new AACExtractor(source, meta);
     } else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_MPEG2PS)) {
         ret = new MPEG2PSExtractor(source);
     }
diff --git a/media/libstagefright/MediaSourceSplitter.cpp b/media/libstagefright/MediaSourceSplitter.cpp
index abc7012..8af0694 100644
--- a/media/libstagefright/MediaSourceSplitter.cpp
+++ b/media/libstagefright/MediaSourceSplitter.cpp
@@ -51,7 +51,7 @@
 status_t MediaSourceSplitter::start(int clientId, MetaData *params) {
     Mutex::Autolock autoLock(mLock);
 
-    LOGV("start client (%d)", clientId);
+    ALOGV("start client (%d)", clientId);
     if (mClientsStarted[clientId]) {
         return OK;
     }
@@ -59,7 +59,7 @@
     mNumberOfClientsStarted++;
 
     if (!mSourceStarted) {
-        LOGV("Starting real source from client (%d)", clientId);
+        ALOGV("Starting real source from client (%d)", clientId);
         status_t err = mSource->start(params);
 
         if (err == OK) {
@@ -85,12 +85,12 @@
 status_t MediaSourceSplitter::stop(int clientId) {
     Mutex::Autolock autoLock(mLock);
 
-    LOGV("stop client (%d)", clientId);
+    ALOGV("stop client (%d)", clientId);
     CHECK(clientId >= 0 && clientId < mNumberOfClients);
     CHECK(mClientsStarted[clientId]);
 
     if (--mNumberOfClientsStarted == 0) {
-        LOGV("Stopping real source from client (%d)", clientId);
+        ALOGV("Stopping real source from client (%d)", clientId);
         status_t err = mSource->stop();
         mSourceStarted = false;
         mClientsStarted.editItemAt(clientId) = false;
@@ -114,7 +114,7 @@
 sp<MetaData> MediaSourceSplitter::getFormat(int clientId) {
     Mutex::Autolock autoLock(mLock);
 
-    LOGV("getFormat client (%d)", clientId);
+    ALOGV("getFormat client (%d)", clientId);
     return mSource->getFormat();
 }
 
@@ -124,7 +124,7 @@
 
     CHECK(clientId >= 0 && clientId < mNumberOfClients);
 
-    LOGV("read client (%d)", clientId);
+    ALOGV("read client (%d)", clientId);
     *buffer = NULL;
 
     if (!mClientsStarted[clientId]) {
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp
index 1e1de04..20d0632 100644
--- a/media/libstagefright/NuCachedSource2.cpp
+++ b/media/libstagefright/NuCachedSource2.cpp
@@ -135,7 +135,7 @@
 }
 
 void PageCache::copy(size_t from, void *data, size_t size) {
-    LOGV("copy from %d size %d", from, size);
+    ALOGV("copy from %d size %d", from, size);
 
     if (size == 0) {
         return;
@@ -277,7 +277,7 @@
 }
 
 void NuCachedSource2::fetchInternal() {
-    LOGV("fetchInternal");
+    ALOGV("fetchInternal");
 
     bool reconnect = false;
 
@@ -340,10 +340,10 @@
 }
 
 void NuCachedSource2::onFetch() {
-    LOGV("onFetch");
+    ALOGV("onFetch");
 
     if (mFinalStatus != OK && mNumRetriesLeft == 0) {
-        LOGV("EOS reached, done prefetching for now");
+        ALOGV("EOS reached, done prefetching for now");
         mFetching = false;
     }
 
@@ -368,7 +368,7 @@
 
             if (mDisconnectAtHighwatermark
                     && (mSource->flags() & DataSource::kIsHTTPBasedSource)) {
-                LOGV("Disconnecting at high watermark");
+                ALOGV("Disconnecting at high watermark");
                 static_cast<HTTPBase *>(mSource.get())->disconnect();
             }
         }
@@ -393,7 +393,7 @@
 }
 
 void NuCachedSource2::onRead(const sp<AMessage> &msg) {
-    LOGV("onRead");
+    ALOGV("onRead");
 
     int64_t offset;
     CHECK(msg->findInt64("offset", &offset));
@@ -455,7 +455,7 @@
 ssize_t NuCachedSource2::readAt(off64_t offset, void *data, size_t size) {
     Mutex::Autolock autoSerializer(mSerializer);
 
-    LOGV("readAt offset %lld, size %d", offset, size);
+    ALOGV("readAt offset %lld, size %d", offset, size);
 
     Mutex::Autolock autoLock(mLock);
 
@@ -523,7 +523,7 @@
 ssize_t NuCachedSource2::readInternal(off64_t offset, void *data, size_t size) {
     CHECK_LE(size, (size_t)mHighwaterThresholdBytes);
 
-    LOGV("readInternal offset %lld size %d", offset, size);
+    ALOGV("readInternal offset %lld size %d", offset, size);
 
     Mutex::Autolock autoLock(mLock);
 
@@ -571,7 +571,7 @@
         return size;
     }
 
-    LOGV("deferring read");
+    ALOGV("deferring read");
 
     return -EAGAIN;
 }
@@ -663,7 +663,7 @@
         mKeepAliveIntervalUs = kDefaultKeepAliveIntervalUs;
     }
 
-    LOGV("lowwater = %d bytes, highwater = %d bytes, keepalive = %lld us",
+    ALOGV("lowwater = %d bytes, highwater = %d bytes, keepalive = %lld us",
          mLowwaterThresholdBytes,
          mHighwaterThresholdBytes,
          mKeepAliveIntervalUs);
@@ -687,7 +687,7 @@
 
         headers->removeItemsAt(index);
 
-        LOGV("Using special cache config '%s'", cacheConfig->string());
+        ALOGV("Using special cache config '%s'", cacheConfig->string());
     }
 
     if ((index = headers->indexOfKey(
@@ -695,7 +695,7 @@
         *disconnectAtHighwatermark = true;
         headers->removeItemsAt(index);
 
-        LOGV("Client requested disconnection at highwater mark");
+        ALOGV("Client requested disconnection at highwater mark");
     }
 }
 
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 86b3fe4..f9f92d2 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -180,7 +180,7 @@
 #undef OPTIONAL
 
 #define CODEC_LOGI(x, ...) LOGI("[%s] "x, mComponentName, ##__VA_ARGS__)
-#define CODEC_LOGV(x, ...) LOGV("[%s] "x, mComponentName, ##__VA_ARGS__)
+#define CODEC_LOGV(x, ...) ALOGV("[%s] "x, mComponentName, ##__VA_ARGS__)
 #define CODEC_LOGE(x, ...) LOGE("[%s] "x, mComponentName, ##__VA_ARGS__)
 
 struct OMXCodecObserver : public BnOMXObserver {
@@ -467,13 +467,13 @@
                 InstantiateSoftwareEncoder(componentName, source, meta);
 
             if (softwareCodec != NULL) {
-                LOGV("Successfully allocated software codec '%s'", componentName);
+                ALOGV("Successfully allocated software codec '%s'", componentName);
 
                 return softwareCodec;
             }
         }
 
-        LOGV("Attempting to allocate OMX node '%s'", componentName);
+        ALOGV("Attempting to allocate OMX node '%s'", componentName);
 
         uint32_t quirks = getComponentQuirks(componentNameBase, createEncoder);
 
@@ -494,7 +494,7 @@
 
         status_t err = omx->allocateNode(componentName, observer, &node);
         if (err == OK) {
-            LOGV("Successfully allocated OMX node '%s'", componentName);
+            ALOGV("Successfully allocated OMX node '%s'", componentName);
 
             sp<OMXCodec> codec = new OMXCodec(
                     omx, node, quirks, flags,
@@ -513,7 +513,7 @@
                 return codec;
             }
 
-            LOGV("Failed to configure codec '%s'", componentName);
+            ALOGV("Failed to configure codec '%s'", componentName);
         }
     }
 
@@ -600,7 +600,7 @@
 }
 
 status_t OMXCodec::configureCodec(const sp<MetaData> &meta) {
-    LOGV("configureCodec protected=%d",
+    ALOGV("configureCodec protected=%d",
          (mFlags & kEnableGrallocUsageProtected) ? 1 : 0);
 
     if (!(mFlags & kIgnoreCodecSpecificData)) {
@@ -904,7 +904,7 @@
 
 status_t OMXCodec::findTargetColorFormat(
         const sp<MetaData>& meta, OMX_COLOR_FORMATTYPE *colorFormat) {
-    LOGV("findTargetColorFormat");
+    ALOGV("findTargetColorFormat");
     CHECK(mIsEncoder);
 
     *colorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
@@ -924,7 +924,7 @@
 
 status_t OMXCodec::isColorFormatSupported(
         OMX_COLOR_FORMATTYPE colorFormat, int portIndex) {
-    LOGV("isColorFormatSupported: %d", static_cast<int>(colorFormat));
+    ALOGV("isColorFormatSupported: %d", static_cast<int>(colorFormat));
 
     // Enumerate all the color formats supported by
     // the omx component to see whether the given
@@ -1890,7 +1890,7 @@
         }
     }
 
-    LOGV("native_window_set_usage usage=0x%lx", usage);
+    ALOGV("native_window_set_usage usage=0x%lx", usage);
     err = native_window_set_usage(
             mNativeWindow.get(), usage | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP);
     if (err != 0) {
@@ -2568,7 +2568,7 @@
                         // The scale is in 16.16 format.
                         // scale 1.0 = 0x010000. When there is no
                         // need to change the display, skip it.
-                        LOGV("Get OMX_IndexConfigScale: 0x%lx/0x%lx",
+                        ALOGV("Get OMX_IndexConfigScale: 0x%lx/0x%lx",
                                 scale.xWidth, scale.xHeight);
 
                         if (scale.xWidth != 0x010000) {
@@ -3296,7 +3296,7 @@
     }
 
     if (n > 1) {
-        LOGV("coalesced %d frames into one input buffer", n);
+        ALOGV("coalesced %d frames into one input buffer", n);
     }
 
     OMX_U32 flags = OMX_BUFFERFLAG_ENDOFFRAME;
@@ -4466,14 +4466,14 @@
                 inputFormat->findInt32(kKeySampleRate, &sampleRate);
 
                 if ((OMX_U32)numChannels != params.nChannels) {
-                    LOGV("Codec outputs a different number of channels than "
+                    ALOGV("Codec outputs a different number of channels than "
                          "the input stream contains (contains %d channels, "
                          "codec outputs %ld channels).",
                          numChannels, params.nChannels);
                 }
 
                 if (sampleRate != (int32_t)params.nSamplingRate) {
-                    LOGV("Codec outputs at different sampling rate than "
+                    ALOGV("Codec outputs at different sampling rate than "
                          "what the input stream contains (contains data at "
                          "%d Hz, codec outputs %lu Hz)",
                          sampleRate, params.nSamplingRate);
diff --git a/media/libstagefright/OggExtractor.cpp b/media/libstagefright/OggExtractor.cpp
index 29e6907..5a68d79 100644
--- a/media/libstagefright/OggExtractor.cpp
+++ b/media/libstagefright/OggExtractor.cpp
@@ -244,7 +244,7 @@
 
         if (!memcmp(signature, "OggS", 4)) {
             if (*pageOffset > startOffset) {
-                LOGV("skipped %lld bytes of junk to reach next frame",
+                ALOGV("skipped %lld bytes of junk to reach next frame",
                      *pageOffset - startOffset);
             }
 
@@ -272,7 +272,7 @@
             prevGuess = 0;
         }
 
-        LOGV("backing up %lld bytes", pageOffset - prevGuess);
+        ALOGV("backing up %lld bytes", pageOffset - prevGuess);
 
         status_t err = findNextPage(prevGuess, &prevPageOffset);
         if (err != OK) {
@@ -289,7 +289,7 @@
         return UNKNOWN_ERROR;
     }
 
-    LOGV("prevPageOffset at %lld, pageOffset at %lld",
+    ALOGV("prevPageOffset at %lld, pageOffset at %lld",
          prevPageOffset, pageOffset);
 
     for (;;) {
@@ -315,7 +315,7 @@
 
         off64_t pos = timeUs * approxBitrate() / 8000000ll;
 
-        LOGV("seeking to offset %lld", pos);
+        ALOGV("seeking to offset %lld", pos);
         return seekToOffset(pos);
     }
 
@@ -338,7 +338,7 @@
 
     const TOCEntry &entry = mTableOfContents.itemAt(left);
 
-    LOGV("seeking to entry %d / %d at offset %lld",
+    ALOGV("seeking to entry %d / %d at offset %lld",
          left, mTableOfContents.size(), entry.mPageOffset);
 
     return seekToOffset(entry.mPageOffset);
@@ -381,7 +381,7 @@
     ssize_t n;
     if ((n = mSource->readAt(offset, header, sizeof(header)))
             < (ssize_t)sizeof(header)) {
-        LOGV("failed to read %d bytes at offset 0x%016llx, got %ld bytes",
+        ALOGV("failed to read %d bytes at offset 0x%016llx, got %ld bytes",
              sizeof(header), offset, n);
 
         if (n < 0) {
@@ -441,7 +441,7 @@
         tmp.append(x);
     }
 
-    LOGV("%c %s", page->mFlags & 1 ? '+' : ' ', tmp.string());
+    ALOGV("%c %s", page->mFlags & 1 ? '+' : ' ', tmp.string());
 #endif
 
     return sizeof(header) + page->mNumSegments + totalSize;
@@ -505,7 +505,7 @@
                     packetSize);
 
             if (n < (ssize_t)packetSize) {
-                LOGV("failed to read %d bytes at 0x%016llx, got %ld bytes",
+                ALOGV("failed to read %d bytes at 0x%016llx, got %ld bytes",
                      packetSize, dataOffset, n);
                 return ERROR_IO;
             }
@@ -546,7 +546,7 @@
                 buffer = NULL;
             }
 
-            LOGV("readPage returned %ld", n);
+            ALOGV("readPage returned %ld", n);
 
             return n < 0 ? n : (status_t)ERROR_END_OF_STREAM;
         }
@@ -590,7 +590,7 @@
     if ((err = readNextPacket(&packet)) != OK) {
         return err;
     }
-    LOGV("read packet of size %d\n", packet->range_length());
+    ALOGV("read packet of size %d\n", packet->range_length());
     err = verifyHeader(packet, 1);
     packet->release();
     packet = NULL;
@@ -601,7 +601,7 @@
     if ((err = readNextPacket(&packet)) != OK) {
         return err;
     }
-    LOGV("read packet of size %d\n", packet->range_length());
+    ALOGV("read packet of size %d\n", packet->range_length());
     err = verifyHeader(packet, 3);
     packet->release();
     packet = NULL;
@@ -612,7 +612,7 @@
     if ((err = readNextPacket(&packet)) != OK) {
         return err;
     }
-    LOGV("read packet of size %d\n", packet->range_length());
+    ALOGV("read packet of size %d\n", packet->range_length());
     err = verifyHeader(packet, 5);
     packet->release();
     packet = NULL;
@@ -722,10 +722,10 @@
             mMeta->setInt32(kKeySampleRate, mVi.rate);
             mMeta->setInt32(kKeyChannelCount, mVi.channels);
 
-            LOGV("lower-bitrate = %ld", mVi.bitrate_lower);
-            LOGV("upper-bitrate = %ld", mVi.bitrate_upper);
-            LOGV("nominal-bitrate = %ld", mVi.bitrate_nominal);
-            LOGV("window-bitrate = %ld", mVi.bitrate_window);
+            ALOGV("lower-bitrate = %ld", mVi.bitrate_lower);
+            ALOGV("upper-bitrate = %ld", mVi.bitrate_upper);
+            ALOGV("nominal-bitrate = %ld", mVi.bitrate_nominal);
+            ALOGV("window-bitrate = %ld", mVi.bitrate_window);
 
             off64_t size;
             if (mSource->getSize(&size) == OK) {
@@ -893,7 +893,7 @@
 
 static void extractAlbumArt(
         const sp<MetaData> &fileMeta, const void *data, size_t size) {
-    LOGV("extractAlbumArt from '%s'", (const char *)data);
+    ALOGV("extractAlbumArt from '%s'", (const char *)data);
 
     size_t flacSize;
     uint8_t *flac = DecodeBase64((const char *)data, size, &flacSize);
@@ -903,7 +903,7 @@
         return;
     }
 
-    LOGV("got flac of size %d", flacSize);
+    ALOGV("got flac of size %d", flacSize);
 
     uint32_t picType;
     uint32_t typeLen;
@@ -934,7 +934,7 @@
     memcpy(type, &flac[8], typeLen);
     type[typeLen] = '\0';
 
-    LOGV("picType = %d, type = '%s'", picType, type);
+    ALOGV("picType = %d, type = '%s'", picType, type);
 
     if (!strcmp(type, "-->")) {
         // This is not inline cover art, but an external url instead.
@@ -953,7 +953,7 @@
         goto exit;
     }
 
-    LOGV("got image data, %d trailing bytes",
+    ALOGV("got image data, %d trailing bytes",
          flacSize - 32 - typeLen - descLen - dataLen);
 
     fileMeta->setData(
diff --git a/media/libstagefright/SampleIterator.cpp b/media/libstagefright/SampleIterator.cpp
index c7b00b1..7b8e008 100644
--- a/media/libstagefright/SampleIterator.cpp
+++ b/media/libstagefright/SampleIterator.cpp
@@ -52,7 +52,7 @@
 }
 
 status_t SampleIterator::seekTo(uint32_t sampleIndex) {
-    LOGV("seekTo(%d)", sampleIndex);
+    ALOGV("seekTo(%d)", sampleIndex);
 
     if (sampleIndex >= mTable->mNumSampleSizes) {
         return ERROR_END_OF_STREAM;
diff --git a/media/libstagefright/SampleTable.cpp b/media/libstagefright/SampleTable.cpp
index bf31947..8e790fc 100644
--- a/media/libstagefright/SampleTable.cpp
+++ b/media/libstagefright/SampleTable.cpp
@@ -414,7 +414,7 @@
     mNumSyncSamples = U32_AT(&header[4]);
 
     if (mNumSyncSamples < 2) {
-        LOGV("Table of sync samples is empty or has only a single entry!");
+        ALOGV("Table of sync samples is empty or has only a single entry!");
     }
 
     mSyncSamples = new uint32_t[mNumSyncSamples];
@@ -618,26 +618,24 @@
     }
 
     uint32_t left = 0;
-    while (left < mNumSyncSamples) {
-        uint32_t x = mSyncSamples[left];
+    uint32_t right = mNumSyncSamples;
+    while (left < right) {
+        uint32_t center = left + (right - left) / 2;
+        uint32_t x = mSyncSamples[center];
 
-        if (x >= start_sample_index) {
+        if (start_sample_index < x) {
+            right = center;
+        } else if (start_sample_index > x) {
+            left = center + 1;
+        } else {
+            left = center;
             break;
         }
-
-        ++left;
     }
 
-    if (left == mNumSyncSamples) {
-        if (flags == kFlagAfter) {
-            LOGE("tried to find a sync frame after the last one: %d", left);
-            return ERROR_OUT_OF_RANGE;
-        }
-    }
-
-    if (left > 0) {
-        --left;
-    }
+    // Now ssi[left] is the sync sample index just before (or at)
+    // start_sample_index.
+    // Also start_sample_index < ssi[left + 1], if left + 1 < mNumSyncSamples.
 
     uint32_t x = mSyncSamples[left];
 
@@ -682,7 +680,11 @@
 
                 x = mSyncSamples[left - 1];
 
-                CHECK(x <= start_sample_index);
+                if (x > start_sample_index) {
+                    // The table of sync sample indices was not sorted
+                    // properly.
+                    return ERROR_MALFORMED;
+                }
             }
             break;
         }
@@ -696,7 +698,11 @@
 
                 x = mSyncSamples[left + 1];
 
-                CHECK(x >= start_sample_index);
+                if (x < start_sample_index) {
+                    // The table of sync sample indices was not sorted
+                    // properly.
+                    return ERROR_MALFORMED;
+                }
             }
 
             break;
diff --git a/media/libstagefright/StagefrightMediaScanner.cpp b/media/libstagefright/StagefrightMediaScanner.cpp
index 2505096..4345184 100644
--- a/media/libstagefright/StagefrightMediaScanner.cpp
+++ b/media/libstagefright/StagefrightMediaScanner.cpp
@@ -103,7 +103,7 @@
 MediaScanResult StagefrightMediaScanner::processFile(
         const char *path, const char *mimeType,
         MediaScannerClient &client) {
-    LOGV("processFile '%s'.", path);
+    ALOGV("processFile '%s'.", path);
 
     client.setLocale(locale());
     client.beginFile();
@@ -188,7 +188,7 @@
 }
 
 char *StagefrightMediaScanner::extractAlbumArt(int fd) {
-    LOGV("extractAlbumArt %d", fd);
+    ALOGV("extractAlbumArt %d", fd);
 
     off64_t size = lseek64(fd, 0, SEEK_END);
     if (size < 0) {
diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp
index 4491c97..2634da0 100644
--- a/media/libstagefright/StagefrightMetadataRetriever.cpp
+++ b/media/libstagefright/StagefrightMetadataRetriever.cpp
@@ -34,14 +34,14 @@
 StagefrightMetadataRetriever::StagefrightMetadataRetriever()
     : mParsedMetaData(false),
       mAlbumArt(NULL) {
-    LOGV("StagefrightMetadataRetriever()");
+    ALOGV("StagefrightMetadataRetriever()");
 
     DataSource::RegisterDefaultSniffers();
     CHECK_EQ(mClient.connect(), OK);
 }
 
 StagefrightMetadataRetriever::~StagefrightMetadataRetriever() {
-    LOGV("~StagefrightMetadataRetriever()");
+    ALOGV("~StagefrightMetadataRetriever()");
 
     delete mAlbumArt;
     mAlbumArt = NULL;
@@ -51,7 +51,7 @@
 
 status_t StagefrightMetadataRetriever::setDataSource(
         const char *uri, const KeyedVector<String8, String8> *headers) {
-    LOGV("setDataSource(%s)", uri);
+    ALOGV("setDataSource(%s)", uri);
 
     mParsedMetaData = false;
     mMetaData.clear();
@@ -80,7 +80,7 @@
         int fd, int64_t offset, int64_t length) {
     fd = dup(fd);
 
-    LOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
+    ALOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
 
     mParsedMetaData = false;
     mMetaData.clear();
@@ -120,7 +120,7 @@
                 NULL, flags | OMXCodec::kClientNeedsFramebuffer);
 
     if (decoder.get() == NULL) {
-        LOGV("unable to instantiate video decoder.");
+        ALOGV("unable to instantiate video decoder.");
 
         return NULL;
     }
@@ -171,18 +171,18 @@
     if (err != OK) {
         CHECK_EQ(buffer, NULL);
 
-        LOGV("decoding frame failed.");
+        ALOGV("decoding frame failed.");
         decoder->stop();
 
         return NULL;
     }
 
-    LOGV("successfully decoded video frame.");
+    ALOGV("successfully decoded video frame.");
 
     int32_t unreadable;
     if (buffer->meta_data()->findInt32(kKeyIsUnreadable, &unreadable)
             && unreadable != 0) {
-        LOGV("video frame is unreadable, decoder does not give us access "
+        ALOGV("video frame is unreadable, decoder does not give us access "
              "to the video data.");
 
         buffer->release();
@@ -200,7 +200,7 @@
             const char *mime;
             CHECK(trackMeta->findCString(kKeyMIMEType, &mime));
 
-            LOGV("thumbNailTime = %lld us, timeUs = %lld us, mime = %s",
+            ALOGV("thumbNailTime = %lld us, timeUs = %lld us, mime = %s",
                  thumbNailTime, timeUs, mime);
         }
     }
@@ -276,17 +276,17 @@
 VideoFrame *StagefrightMetadataRetriever::getFrameAtTime(
         int64_t timeUs, int option) {
 
-    LOGV("getFrameAtTime: %lld us option: %d", timeUs, option);
+    ALOGV("getFrameAtTime: %lld us option: %d", timeUs, option);
 
     if (mExtractor.get() == NULL) {
-        LOGV("no extractor.");
+        ALOGV("no extractor.");
         return NULL;
     }
 
     sp<MetaData> fileMeta = mExtractor->getMetaData();
 
     if (fileMeta == NULL) {
-        LOGV("extractor doesn't publish metadata, failed to initialize?");
+        ALOGV("extractor doesn't publish metadata, failed to initialize?");
         return NULL;
     }
 
@@ -310,7 +310,7 @@
     }
 
     if (i == n) {
-        LOGV("no video track found.");
+        ALOGV("no video track found.");
         return NULL;
     }
 
@@ -320,7 +320,7 @@
     sp<MediaSource> source = mExtractor->getTrack(i);
 
     if (source.get() == NULL) {
-        LOGV("unable to instantiate video track.");
+        ALOGV("unable to instantiate video track.");
         return NULL;
     }
 
@@ -341,7 +341,7 @@
                 timeUs, option);
 
     if (frame == NULL) {
-        LOGV("Software decoder failed to extract thumbnail, "
+        ALOGV("Software decoder failed to extract thumbnail, "
              "trying hardware decoder.");
 
         frame = extractVideoFrameWithCodecFlags(&mClient, trackMeta, source, 0,
@@ -352,7 +352,7 @@
 }
 
 MediaAlbumArt *StagefrightMetadataRetriever::extractAlbumArt() {
-    LOGV("extractAlbumArt (extractor: %s)", mExtractor.get() != NULL ? "YES" : "NO");
+    ALOGV("extractAlbumArt (extractor: %s)", mExtractor.get() != NULL ? "YES" : "NO");
 
     if (mExtractor == NULL) {
         return NULL;
@@ -395,7 +395,7 @@
     sp<MetaData> meta = mExtractor->getMetaData();
 
     if (meta == NULL) {
-        LOGV("extractor doesn't publish metadata, failed to initialize?");
+        ALOGV("extractor doesn't publish metadata, failed to initialize?");
         return;
     }
 
diff --git a/media/libstagefright/SurfaceMediaSource.cpp b/media/libstagefright/SurfaceMediaSource.cpp
index 86b33d1..51a7541 100644
--- a/media/libstagefright/SurfaceMediaSource.cpp
+++ b/media/libstagefright/SurfaceMediaSource.cpp
@@ -32,6 +32,8 @@
 #include <utils/Log.h>
 #include <utils/String8.h>
 
+#include <private/gui/ComposerService.h>
+
 namespace android {
 
 SurfaceMediaSource::SurfaceMediaSource(uint32_t bufW, uint32_t bufH) :
@@ -50,13 +52,13 @@
                 mNumFramesReceived(0),
                 mNumFramesEncoded(0),
                 mFirstFrameTimestamp(0) {
-    LOGV("SurfaceMediaSource::SurfaceMediaSource");
+    ALOGV("SurfaceMediaSource::SurfaceMediaSource");
     sp<ISurfaceComposer> composer(ComposerService::getComposerService());
     mGraphicBufferAlloc = composer->createGraphicBufferAlloc();
 }
 
 SurfaceMediaSource::~SurfaceMediaSource() {
-    LOGV("SurfaceMediaSource::~SurfaceMediaSource");
+    ALOGV("SurfaceMediaSource::~SurfaceMediaSource");
     if (!mStopped) {
         stop();
     }
@@ -108,7 +110,7 @@
 }
 
 status_t SurfaceMediaSource::setBufferCount(int bufferCount) {
-    LOGV("SurfaceMediaSource::setBufferCount");
+    ALOGV("SurfaceMediaSource::setBufferCount");
     if (bufferCount > NUM_BUFFER_SLOTS) {
         LOGE("setBufferCount: bufferCount is larger than the number of buffer slots");
         return BAD_VALUE;
@@ -150,7 +152,7 @@
 }
 
 status_t SurfaceMediaSource::requestBuffer(int slot, sp<GraphicBuffer>* buf) {
-    LOGV("SurfaceMediaSource::requestBuffer");
+    ALOGV("SurfaceMediaSource::requestBuffer");
     Mutex::Autolock lock(mMutex);
     if (slot < 0 || mBufferCount <= slot) {
         LOGE("requestBuffer: slot index out of range [0, %d]: %d",
@@ -164,7 +166,7 @@
 
 status_t SurfaceMediaSource::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
                                             uint32_t format, uint32_t usage) {
-    LOGV("dequeueBuffer");
+    ALOGV("dequeueBuffer");
     Mutex::Autolock lock(mMutex);
 
     // Check for the buffer size- the client should just use the
@@ -215,7 +217,7 @@
                         (mServerBufferCount < minBufferCountNeeded))) {
             // wait for the FIFO to drain
             while (!mQueue.isEmpty()) {
-                LOGV("Waiting for the FIFO to drain");
+                ALOGV("Waiting for the FIFO to drain");
                 mDequeueCondition.wait(mMutex);
             }
             if (mStopped) {
@@ -293,7 +295,7 @@
         // for for some buffers to be consumed
         tryAgain = mSynchronousMode && (foundSync == INVALID_BUFFER_SLOT);
         if (tryAgain) {
-            LOGV("Waiting..In synchronous mode and no buffer to dequeue");
+            ALOGV("Waiting..In synchronous mode and no buffer to dequeue");
             mDequeueCondition.wait(mMutex);
         }
         if (mStopped) {
@@ -382,7 +384,7 @@
 
 status_t SurfaceMediaSource::connect(int api,
         uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
-    LOGV("SurfaceMediaSource::connect");
+    ALOGV("SurfaceMediaSource::connect");
     Mutex::Autolock lock(mMutex);
 
     if (mStopped) {
@@ -423,7 +425,7 @@
 // that need not be required since the thread supplying the
 // frames is separate than the one calling stop.
 status_t SurfaceMediaSource::disconnect(int api) {
-    LOGV("SurfaceMediaSource::disconnect");
+    ALOGV("SurfaceMediaSource::disconnect");
     Mutex::Autolock lock(mMutex);
 
     if (mStopped) {
@@ -455,7 +457,7 @@
 
 status_t SurfaceMediaSource::queueBuffer(int bufIndex, int64_t timestamp,
         uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) {
-    LOGV("queueBuffer");
+    ALOGV("queueBuffer");
 
     Mutex::Autolock lock(mMutex);
     *outWidth = mDefaultWidth;
@@ -495,7 +497,7 @@
     if (mSynchronousMode) {
         // in synchronous mode we queue all buffers in a FIFO
         mQueue.push_back(bufIndex);
-        LOGV("Client queued buf# %d @slot: %d, Q size = %d, handle = %p, timestamp = %lld",
+        ALOGV("Client queued buf# %d @slot: %d, Q size = %d, handle = %p, timestamp = %lld",
             mNumFramesReceived, bufIndex, mQueue.size(),
             mSlots[bufIndex].mGraphicBuffer->handle, timestamp);
     } else {
@@ -534,7 +536,7 @@
 // wait to hear from StageFrightRecorder to set the buffer FREE
 // Make sure this is called when the mutex is locked
 status_t SurfaceMediaSource::onFrameReceivedLocked() {
-    LOGV("On Frame Received locked");
+    ALOGV("On Frame Received locked");
     // Signal the encoder that a new frame has arrived
     mFrameAvailableCondition.signal();
 
@@ -554,7 +556,7 @@
 
 
 void SurfaceMediaSource::cancelBuffer(int bufIndex) {
-    LOGV("SurfaceMediaSource::cancelBuffer");
+    ALOGV("SurfaceMediaSource::cancelBuffer");
     Mutex::Autolock lock(mMutex);
     if (bufIndex < 0 || bufIndex >= mBufferCount) {
         LOGE("cancelBuffer: slot index out of range [0, %d]: %d",
@@ -570,7 +572,7 @@
 }
 
 nsecs_t SurfaceMediaSource::getTimestamp() {
-    LOGV("SurfaceMediaSource::getTimestamp");
+    ALOGV("SurfaceMediaSource::getTimestamp");
     Mutex::Autolock lock(mMutex);
     return mCurrentTimestamp;
 }
@@ -578,13 +580,13 @@
 
 void SurfaceMediaSource::setFrameAvailableListener(
         const sp<FrameAvailableListener>& listener) {
-    LOGV("SurfaceMediaSource::setFrameAvailableListener");
+    ALOGV("SurfaceMediaSource::setFrameAvailableListener");
     Mutex::Autolock lock(mMutex);
     mFrameAvailableListener = listener;
 }
 
 void SurfaceMediaSource::freeAllBuffersLocked() {
-    LOGV("freeAllBuffersLocked");
+    ALOGV("freeAllBuffersLocked");
     for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
         mSlots[i].mGraphicBuffer = 0;
         mSlots[i].mBufferState = BufferSlot::FREE;
@@ -598,7 +600,7 @@
 
 int SurfaceMediaSource::query(int what, int* outValue)
 {
-    LOGV("query");
+    ALOGV("query");
     Mutex::Autolock lock(mMutex);
     int value;
     switch (what) {
@@ -689,7 +691,7 @@
 }
 
 bool SurfaceMediaSource::isMetaDataStoredInVideoBuffers() const {
-    LOGV("isMetaDataStoredInVideoBuffers");
+    ALOGV("isMetaDataStoredInVideoBuffers");
     return true;
 }
 
@@ -700,7 +702,7 @@
 
 status_t SurfaceMediaSource::start(MetaData *params)
 {
-    LOGV("started!");
+    ALOGV("started!");
 
     mStartTimeNs = 0;
     int64_t startTimeUs;
@@ -714,7 +716,7 @@
 
 status_t SurfaceMediaSource::stop()
 {
-    LOGV("Stop");
+    ALOGV("Stop");
 
     Mutex::Autolock lock(mMutex);
     // TODO: Add waiting on mFrameCompletedCondition here?
@@ -729,7 +731,7 @@
 
 sp<MetaData> SurfaceMediaSource::getFormat()
 {
-    LOGV("getFormat");
+    ALOGV("getFormat");
     Mutex::Autolock autoLock(mMutex);
     sp<MetaData> meta = new MetaData;
 
@@ -751,20 +753,20 @@
 {
     Mutex::Autolock autoLock(mMutex) ;
 
-    LOGV("Read. Size of queued buffer: %d", mQueue.size());
+    ALOGV("Read. Size of queued buffer: %d", mQueue.size());
     *buffer = NULL;
 
     // If the recording has started and the queue is empty, then just
     // wait here till the frames come in from the client side
     while (!mStopped && mQueue.empty()) {
-        LOGV("NO FRAMES! Recorder waiting for FrameAvailableCondition");
+        ALOGV("NO FRAMES! Recorder waiting for FrameAvailableCondition");
         mFrameAvailableCondition.wait(mMutex);
     }
 
     // If the loop was exited as a result of stopping the recording,
     // it is OK
     if (mStopped) {
-        LOGV("Read: SurfaceMediaSource is stopped. Returning ERROR_END_OF_STREAM.");
+        ALOGV("Read: SurfaceMediaSource is stopped. Returning ERROR_END_OF_STREAM.");
         return ERROR_END_OF_STREAM;
     }
 
@@ -785,7 +787,7 @@
     (*buffer)->setObserver(this);
     (*buffer)->add_ref();
     (*buffer)->meta_data()->setInt64(kKeyTime, mCurrentTimestamp / 1000);
-    LOGV("Frames encoded = %d, timestamp = %lld, time diff = %lld",
+    ALOGV("Frames encoded = %d, timestamp = %lld, time diff = %lld",
             mNumFramesEncoded, mCurrentTimestamp / 1000,
             mCurrentTimestamp / 1000 - prevTimeStamp / 1000);
 
@@ -804,7 +806,7 @@
 // --------------------------------------------------------------
 // Note: Call only when you have the lock
 void SurfaceMediaSource::passMetadataBufferLocked(MediaBuffer **buffer) {
-    LOGV("passMetadataBuffer");
+    ALOGV("passMetadataBuffer");
     // MediaBuffer allocates and owns this data
     MediaBuffer *tempBuffer =
         new MediaBuffer(4 + sizeof(buffer_handle_t));
@@ -818,18 +820,18 @@
     memcpy(data + 4, &(mCurrentBuf->handle), sizeof(buffer_handle_t));
     *buffer = tempBuffer;
 
-    LOGV("handle = %p, , offset = %d, length = %d",
+    ALOGV("handle = %p, , offset = %d, length = %d",
             mCurrentBuf->handle, (*buffer)->range_length(), (*buffer)->range_offset());
 }
 
 void SurfaceMediaSource::signalBufferReturned(MediaBuffer *buffer) {
-    LOGV("signalBufferReturned");
+    ALOGV("signalBufferReturned");
 
     bool foundBuffer = false;
     Mutex::Autolock autoLock(mMutex);
 
     if (mStopped) {
-        LOGV("signalBufferReturned: mStopped = true! Nothing to do!");
+        ALOGV("signalBufferReturned: mStopped = true! Nothing to do!");
         return;
     }
 
@@ -838,7 +840,7 @@
             continue;
         }
         if (checkBufferMatchesSlot(id, buffer)) {
-            LOGV("Slot %d returned, matches handle = %p", id,
+            ALOGV("Slot %d returned, matches handle = %p", id,
                     mSlots[id].mGraphicBuffer->handle);
             mSlots[id].mBufferState = BufferSlot::FREE;
             buffer->setObserver(0);
@@ -856,7 +858,7 @@
 }
 
 bool SurfaceMediaSource::checkBufferMatchesSlot(int slot, MediaBuffer *buffer) {
-    LOGV("Check if Buffer matches slot");
+    ALOGV("Check if Buffer matches slot");
     // need to convert to char* for pointer arithmetic and then
     // copy the byte stream into our handle
     buffer_handle_t bufferHandle ;
diff --git a/media/libstagefright/TimedEventQueue.cpp b/media/libstagefright/TimedEventQueue.cpp
index 100d8a3..43511ec 100644
--- a/media/libstagefright/TimedEventQueue.cpp
+++ b/media/libstagefright/TimedEventQueue.cpp
@@ -173,7 +173,7 @@
             mQueueHeadChangedCondition.signal();
         }
 
-        LOGV("cancelling event %d", (*it).event->eventID());
+        ALOGV("cancelling event %d", (*it).event->eventID());
 
         (*it).event->setEventID(0);
         it = mQueue.erase(it);
diff --git a/media/libstagefright/VBRISeeker.cpp b/media/libstagefright/VBRISeeker.cpp
index 6f968be..ecff538 100644
--- a/media/libstagefright/VBRISeeker.cpp
+++ b/media/libstagefright/VBRISeeker.cpp
@@ -69,13 +69,13 @@
     int64_t durationUs =
         numFrames * 1000000ll * (sampleRate >= 32000 ? 1152 : 576) / sampleRate;
 
-    LOGV("duration = %.2f secs", durationUs / 1E6);
+    ALOGV("duration = %.2f secs", durationUs / 1E6);
 
     size_t numEntries = U16_AT(&vbriHeader[18]);
     size_t entrySize = U16_AT(&vbriHeader[22]);
     size_t scale = U16_AT(&vbriHeader[20]);
 
-    LOGV("%d entries, scale=%d, size_per_entry=%d",
+    ALOGV("%d entries, scale=%d, size_per_entry=%d",
          numEntries,
          scale,
          entrySize);
@@ -113,7 +113,7 @@
 
         seeker->mSegments.push(numBytes);
 
-        LOGV("entry #%d: %d offset 0x%08lx", i, numBytes, offset);
+        ALOGV("entry #%d: %d offset 0x%08lx", i, numBytes, offset);
         offset += numBytes;
     }
 
@@ -154,7 +154,7 @@
         *pos += mSegments.itemAt(segmentIndex++);
     }
 
-    LOGV("getOffsetForTime %lld us => 0x%08lx", *timeUs, *pos);
+    ALOGV("getOffsetForTime %lld us => 0x%08lx", *timeUs, *pos);
 
     *timeUs = nowUs;
 
diff --git a/media/libstagefright/VideoSourceDownSampler.cpp b/media/libstagefright/VideoSourceDownSampler.cpp
index ea7b09a..1b66990 100644
--- a/media/libstagefright/VideoSourceDownSampler.cpp
+++ b/media/libstagefright/VideoSourceDownSampler.cpp
@@ -29,7 +29,7 @@
 
 VideoSourceDownSampler::VideoSourceDownSampler(const sp<MediaSource> &videoSource,
         int32_t width, int32_t height) {
-    LOGV("Construct VideoSourceDownSampler");
+    ALOGV("Construct VideoSourceDownSampler");
     CHECK(width > 0);
     CHECK(height > 0);
 
@@ -94,23 +94,23 @@
 }
 
 status_t VideoSourceDownSampler::start(MetaData *params) {
-    LOGV("start");
+    ALOGV("start");
     return mRealVideoSource->start();
 }
 
 status_t VideoSourceDownSampler::stop() {
-    LOGV("stop");
+    ALOGV("stop");
     return mRealVideoSource->stop();
 }
 
 sp<MetaData> VideoSourceDownSampler::getFormat() {
-    LOGV("getFormat");
+    ALOGV("getFormat");
     return mMeta;
 }
 
 status_t VideoSourceDownSampler::read(
         MediaBuffer **buffer, const ReadOptions *options) {
-    LOGV("read");
+    ALOGV("read");
     MediaBuffer *realBuffer;
     status_t err = mRealVideoSource->read(&realBuffer, options);
 
@@ -135,7 +135,7 @@
 }
 
 status_t VideoSourceDownSampler::pause() {
-    LOGV("pause");
+    ALOGV("pause");
     return mRealVideoSource->pause();
 }
 
diff --git a/media/libstagefright/WAVExtractor.cpp b/media/libstagefright/WAVExtractor.cpp
index c406964..0bcaf08 100644
--- a/media/libstagefright/WAVExtractor.cpp
+++ b/media/libstagefright/WAVExtractor.cpp
@@ -275,7 +275,7 @@
 }
 
 status_t WAVSource::start(MetaData *params) {
-    LOGV("WAVSource::start");
+    ALOGV("WAVSource::start");
 
     CHECK(!mStarted);
 
@@ -295,7 +295,7 @@
 }
 
 status_t WAVSource::stop() {
-    LOGV("WAVSource::stop");
+    ALOGV("WAVSource::stop");
 
     CHECK(mStarted);
 
@@ -308,7 +308,7 @@
 }
 
 sp<MetaData> WAVSource::getFormat() {
-    LOGV("WAVSource::getFormat");
+    ALOGV("WAVSource::getFormat");
 
     return mMeta;
 }
diff --git a/media/libstagefright/avc_utils.cpp b/media/libstagefright/avc_utils.cpp
index 153ee33..1ed9e57 100644
--- a/media/libstagefright/avc_utils.cpp
+++ b/media/libstagefright/avc_utils.cpp
@@ -119,7 +119,7 @@
             cropUnitY = subHeightC * (2 - frame_mbs_only_flag);
         }
 
-        LOGV("frame_crop = (%u, %u, %u, %u), cropUnitX = %u, cropUnitY = %u",
+        ALOGV("frame_crop = (%u, %u, %u, %u), cropUnitX = %u, cropUnitY = %u",
              frame_crop_left_offset, frame_crop_right_offset,
              frame_crop_top_offset, frame_crop_bottom_offset,
              cropUnitX, cropUnitY);
diff --git a/media/libstagefright/chromium_http/Android.mk b/media/libstagefright/chromium_http/Android.mk
index 6573e3c..63775f1 100644
--- a/media/libstagefright/chromium_http/Android.mk
+++ b/media/libstagefright/chromium_http/Android.mk
@@ -3,8 +3,9 @@
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES:=       \
-        ChromiumHTTPDataSource.cpp        \
-        support.cpp                     \
+        DataUriSource.cpp \
+        ChromiumHTTPDataSource.cpp \
+        support.cpp
 
 LOCAL_C_INCLUDES:= \
         $(JNI_H_INCLUDE) \
diff --git a/media/libstagefright/chromium_http/DataUriSource.cpp b/media/libstagefright/chromium_http/DataUriSource.cpp
new file mode 100644
index 0000000..ecf3fa1
--- /dev/null
+++ b/media/libstagefright/chromium_http/DataUriSource.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2011 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 <include/DataUriSource.h>
+
+#include <net/base/data_url.h>
+#include <googleurl/src/gurl.h>
+
+
+namespace android {
+
+DataUriSource::DataUriSource(const char *uri) :
+    mDataUri(uri),
+    mInited(NO_INIT) {
+
+    // Copy1: const char *uri -> String8 mDataUri.
+    std::string mimeTypeStr, unusedCharsetStr, dataStr;
+    // Copy2: String8 mDataUri -> std::string
+    const bool ret = net::DataURL::Parse(
+            GURL(std::string(mDataUri.string())),
+            &mimeTypeStr, &unusedCharsetStr, &dataStr);
+    // Copy3: std::string dataStr -> AString mData
+    mData.setTo(dataStr.data(), dataStr.length());
+    mInited = ret ? OK : UNKNOWN_ERROR;
+
+    // The chromium data url implementation defaults to using "text/plain"
+    // if no mime type is specified. We prefer to leave this unspecified
+    // instead, since the mime type is sniffed in most cases.
+    if (mimeTypeStr != "text/plain") {
+        mMimeType = mimeTypeStr.c_str();
+    }
+}
+
+ssize_t DataUriSource::readAt(off64_t offset, void *out, size_t size) {
+    if (mInited != OK) {
+        return mInited;
+    }
+
+    const off64_t length = mData.size();
+    if (offset >= length) {
+        return UNKNOWN_ERROR;
+    }
+
+    const char *dataBuf = mData.c_str();
+    const size_t bytesToCopy =
+            offset + size >= length ? (length - offset) : size;
+
+    if (bytesToCopy > 0) {
+        memcpy(out, dataBuf + offset, bytesToCopy);
+    }
+
+    return bytesToCopy;
+}
+
+}  // namespace android
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC.cpp b/media/libstagefright/codecs/aacdec/SoftAAC.cpp
index 2abdb56..c408b2c 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC.cpp
@@ -317,9 +317,9 @@
          * AAC+/eAAC+ until the first data frame is decoded.
          */
         if (decoderErr == MP4AUDEC_SUCCESS && mInputBufferCount <= 2) {
-            LOGV("audio/extended audio object type: %d + %d",
+            ALOGV("audio/extended audio object type: %d + %d",
                 mConfig->audioObjectType, mConfig->extendedAudioObjectType);
-            LOGV("aac+ upsampling factor: %d desired channels: %d",
+            ALOGV("aac+ upsampling factor: %d desired channels: %d",
                 mConfig->aacPlusUpsamplingFactor, mConfig->desiredChannels);
 
             if (mInputBufferCount == 1) {
diff --git a/media/libstagefright/codecs/aacenc/AACEncoder.cpp b/media/libstagefright/codecs/aacenc/AACEncoder.cpp
index 0bff52d..2b15b75 100644
--- a/media/libstagefright/codecs/aacenc/AACEncoder.cpp
+++ b/media/libstagefright/codecs/aacenc/AACEncoder.cpp
@@ -111,7 +111,7 @@
 }
 
 status_t AACEncoder::setAudioSpecificConfigData() {
-    LOGV("setAudioSpecificConfigData: %d hz, %d bps, and %d channels",
+    ALOGV("setAudioSpecificConfigData: %d hz, %d bps, and %d channels",
          mSampleRate, mBitRate, mChannels);
 
     int32_t index;
diff --git a/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp b/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp
index 0096760..18c5550 100644
--- a/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp
+++ b/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp
@@ -35,7 +35,7 @@
 
 static status_t ConvertOmxAvcProfileToAvcSpecProfile(
         int32_t omxProfile, AVCProfile* pvProfile) {
-    LOGV("ConvertOmxAvcProfileToAvcSpecProfile: %d", omxProfile);
+    ALOGV("ConvertOmxAvcProfileToAvcSpecProfile: %d", omxProfile);
     switch (omxProfile) {
         case OMX_VIDEO_AVCProfileBaseline:
             *pvProfile = AVC_BASELINE;
@@ -48,7 +48,7 @@
 
 static status_t ConvertOmxAvcLevelToAvcSpecLevel(
         int32_t omxLevel, AVCLevel *pvLevel) {
-    LOGV("ConvertOmxAvcLevelToAvcSpecLevel: %d", omxLevel);
+    ALOGV("ConvertOmxAvcLevelToAvcSpecLevel: %d", omxLevel);
     AVCLevel level = AVC_LEVEL5_1;
     switch (omxLevel) {
         case OMX_VIDEO_AVCLevel1:
@@ -194,7 +194,7 @@
 }
 
 AVCEncoder::~AVCEncoder() {
-    LOGV("Destruct software AVCEncoder");
+    ALOGV("Destruct software AVCEncoder");
     if (mStarted) {
         stop();
     }
@@ -204,7 +204,7 @@
 }
 
 status_t AVCEncoder::initCheck(const sp<MetaData>& meta) {
-    LOGV("initCheck");
+    ALOGV("initCheck");
     CHECK(meta->findInt32(kKeyWidth, &mVideoWidth));
     CHECK(meta->findInt32(kKeyHeight, &mVideoHeight));
     CHECK(meta->findInt32(kKeyFrameRate, &mVideoFrameRate));
@@ -295,7 +295,7 @@
         mEncParams->idr_period =
             (iFramesIntervalSec * mVideoFrameRate);
     }
-    LOGV("idr_period: %d, I-frames interval: %d seconds, and frame rate: %d",
+    ALOGV("idr_period: %d, I-frames interval: %d seconds, and frame rate: %d",
         mEncParams->idr_period, iFramesIntervalSec, mVideoFrameRate);
 
     // Set profile and level
@@ -330,7 +330,7 @@
 }
 
 status_t AVCEncoder::start(MetaData *params) {
-    LOGV("start");
+    ALOGV("start");
     if (mInitCheck != OK) {
         return mInitCheck;
     }
@@ -366,7 +366,7 @@
 }
 
 status_t AVCEncoder::stop() {
-    LOGV("stop");
+    ALOGV("stop");
     if (!mStarted) {
         LOGW("Call stop() when encoder has not started");
         return OK;
@@ -396,7 +396,7 @@
 }
 
 void AVCEncoder::releaseOutputBuffers() {
-    LOGV("releaseOutputBuffers");
+    ALOGV("releaseOutputBuffers");
     for (size_t i = 0; i < mOutputBuffers.size(); ++i) {
         MediaBuffer *buffer = mOutputBuffers.editItemAt(i);
         buffer->setObserver(NULL);
@@ -406,7 +406,7 @@
 }
 
 sp<MetaData> AVCEncoder::getFormat() {
-    LOGV("getFormat");
+    ALOGV("getFormat");
     return mFormat;
 }
 
@@ -563,7 +563,7 @@
         if (mIsIDRFrame) {
             outputBuffer->meta_data()->setInt32(kKeyIsSyncFrame, mIsIDRFrame);
             mIsIDRFrame = 0;
-            LOGV("Output an IDR frame");
+            ALOGV("Output an IDR frame");
         }
         mReadyForNextFrame = true;
         AVCFrameIO recon;
diff --git a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
index aa07e57..bedfc58 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
+++ b/media/libstagefright/codecs/m4v_h263/dec/SoftMPEG4.cpp
@@ -489,7 +489,7 @@
     CHECK_LE(disp_width, buf_width);
     CHECK_LE(disp_height, buf_height);
 
-    LOGV("disp_width = %d, disp_height = %d, buf_width = %d, buf_height = %d",
+    ALOGV("disp_width = %d, disp_height = %d, buf_width = %d, buf_height = %d",
             disp_width, disp_height, buf_width, buf_height);
 
     if (mCropRight != disp_width - 1
diff --git a/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp b/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp
index d7249c1..2e3d12d 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp
+++ b/media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp
@@ -37,7 +37,7 @@
         int32_t omxProfile,
         int32_t omxLevel,
         ProfileLevelType* pvProfileLevel) {
-    LOGV("ConvertOmxProfileLevel: %d/%d/%d", mode, omxProfile, omxLevel);
+    ALOGV("ConvertOmxProfileLevel: %d/%d/%d", mode, omxProfile, omxLevel);
     ProfileLevelType profileLevel;
     if (mode == H263_MODE) {
         switch (omxProfile) {
@@ -187,7 +187,7 @@
 }
 
 M4vH263Encoder::~M4vH263Encoder() {
-    LOGV("Destruct software M4vH263Encoder");
+    ALOGV("Destruct software M4vH263Encoder");
     if (mStarted) {
         stop();
     }
@@ -197,7 +197,7 @@
 }
 
 status_t M4vH263Encoder::initCheck(const sp<MetaData>& meta) {
-    LOGV("initCheck");
+    ALOGV("initCheck");
     CHECK(meta->findInt32(kKeyWidth, &mVideoWidth));
     CHECK(meta->findInt32(kKeyHeight, &mVideoHeight));
     CHECK(meta->findInt32(kKeyFrameRate, &mVideoFrameRate));
@@ -308,7 +308,7 @@
 }
 
 status_t M4vH263Encoder::start(MetaData *params) {
-    LOGV("start");
+    ALOGV("start");
     if (mInitCheck != OK) {
         return mInitCheck;
     }
@@ -328,7 +328,7 @@
     if (!PVGetMaxVideoFrameSize(mHandle, &maxSize)) {
         maxSize = 256 * 1024;  // Magic #
     }
-    LOGV("Max output buffer size: %d", maxSize);
+    ALOGV("Max output buffer size: %d", maxSize);
     mGroup->add_buffer(new MediaBuffer(maxSize));
 
     mSource->start(params);
@@ -339,7 +339,7 @@
 }
 
 status_t M4vH263Encoder::stop() {
-    LOGV("stop");
+    ALOGV("stop");
     if (!mStarted) {
         LOGW("Call stop() when encoder has not started");
         return OK;
@@ -369,7 +369,7 @@
 }
 
 sp<MetaData> M4vH263Encoder::getFormat() {
-    LOGV("getFormat");
+    ALOGV("getFormat");
     return mFormat;
 }
 
@@ -389,7 +389,7 @@
             LOGE("Failed to get VOL header");
             return UNKNOWN_ERROR;
         }
-        LOGV("Output VOL header: %d bytes", dataLength);
+        ALOGV("Output VOL header: %d bytes", dataLength);
         outputBuffer->meta_data()->setInt32(kKeyIsCodecConfig, 1);
         outputBuffer->set_range(0, dataLength);
         *out = outputBuffer;
diff --git a/media/libstagefright/codecs/mp3dec/SoftMP3.cpp b/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
index 066c88e..43fb30a 100644
--- a/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
+++ b/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
@@ -219,7 +219,7 @@
         ERROR_CODE decoderErr;
         if ((decoderErr = pvmp3_framedecoder(mConfig, mDecoderBuf))
                 != NO_DECODING_ERROR) {
-            LOGV("mp3 decoder returned error %d", decoderErr);
+            ALOGV("mp3 decoder returned error %d", decoderErr);
 
             if (decoderErr != NO_ENOUGH_MAIN_DATA_ERROR ||
                     mConfig->outputFrameSize == 0) {
diff --git a/media/libstagefright/codecs/on2/dec/SoftVPX.cpp b/media/libstagefright/codecs/on2/dec/SoftVPX.cpp
index 61a02ac..c5fe199 100644
--- a/media/libstagefright/codecs/on2/dec/SoftVPX.cpp
+++ b/media/libstagefright/codecs/on2/dec/SoftVPX.cpp
@@ -126,7 +126,7 @@
     cpuCoreCount = sysconf(_SC_NPROC_ONLN);
 #endif
     CHECK(cpuCoreCount >= 1);
-    LOGV("Number of CPU cores: %d", cpuCoreCount);
+    ALOGV("Number of CPU cores: %d", cpuCoreCount);
     return cpuCoreCount;
 }
 
diff --git a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
index 4091111..47dbd5c 100644
--- a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
+++ b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
@@ -367,7 +367,7 @@
 
         if (mNumFramesLeftOnPage >= 0) {
             if (numFrames > mNumFramesLeftOnPage) {
-                LOGV("discarding %d frames at end of page",
+                ALOGV("discarding %d frames at end of page",
                      numFrames - mNumFramesLeftOnPage);
                 numFrames = mNumFramesLeftOnPage;
             }
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index f67cdac..6f4b875 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -215,7 +215,9 @@
     mDisconnectPending = false;
 }
 
-status_t LiveSession::fetchFile(const char *url, sp<ABuffer> *out) {
+status_t LiveSession::fetchFile(
+        const char *url, sp<ABuffer> *out,
+        int64_t range_offset, int64_t range_length) {
     *out = NULL;
 
     sp<DataSource> source;
@@ -234,8 +236,18 @@
             }
         }
 
-        status_t err = mHTTPDataSource->connect(
-                url, mExtraHeaders.isEmpty() ? NULL : &mExtraHeaders);
+        KeyedVector<String8, String8> headers = mExtraHeaders;
+        if (range_offset > 0 || range_length >= 0) {
+            headers.add(
+                    String8("Range"),
+                    String8(
+                        StringPrintf(
+                            "bytes=%lld-%s",
+                            range_offset,
+                            range_length < 0
+                                ? "" : StringPrintf("%lld", range_offset + range_length - 1).c_str()).c_str()));
+        }
+        status_t err = mHTTPDataSource->connect(url, &headers);
 
         if (err != OK) {
             return err;
@@ -260,7 +272,7 @@
         if (bufferRemaining == 0) {
             bufferRemaining = 32768;
 
-            LOGV("increasing download buffer to %d bytes",
+            ALOGV("increasing download buffer to %d bytes",
                  buffer->size() + bufferRemaining);
 
             sp<ABuffer> copy = new ABuffer(buffer->size() + bufferRemaining);
@@ -270,9 +282,21 @@
             buffer = copy;
         }
 
+        size_t maxBytesToRead = bufferRemaining;
+        if (range_length >= 0) {
+            int64_t bytesLeftInRange = range_length - buffer->size();
+            if (bytesLeftInRange < maxBytesToRead) {
+                maxBytesToRead = bytesLeftInRange;
+
+                if (bytesLeftInRange == 0) {
+                    break;
+                }
+            }
+        }
+
         ssize_t n = source->readAt(
                 buffer->size(), buffer->data() + buffer->size(),
-                bufferRemaining);
+                maxBytesToRead);
 
         if (n < 0) {
             return n;
@@ -321,7 +345,7 @@
 
         *unchanged = true;
 
-        LOGV("Playlist unchanged, refresh state is now %d",
+        ALOGV("Playlist unchanged, refresh state is now %d",
              (int)mRefreshState);
 
         return NULL;
@@ -357,9 +381,9 @@
     int32_t bandwidthBps;
     if (mHTTPDataSource != NULL
             && mHTTPDataSource->estimateBandwidth(&bandwidthBps)) {
-        LOGV("bandwidth estimated at %.2f kbps", bandwidthBps / 1024.0f);
+        ALOGV("bandwidth estimated at %.2f kbps", bandwidthBps / 1024.0f);
     } else {
-        LOGV("no bandwidth estimate.");
+        ALOGV("no bandwidth estimate.");
         return 0;  // Pick the lowest bandwidth stream by default.
     }
 
@@ -369,7 +393,7 @@
         long maxBw = strtoul(value, &end, 10);
         if (end > value && *end == '\0') {
             if (maxBw > 0 && bandwidthBps > maxBw) {
-                LOGV("bandwidth capped to %ld bps", maxBw);
+                ALOGV("bandwidth capped to %ld bps", maxBw);
                 bandwidthBps = maxBw;
             }
         }
@@ -659,8 +683,15 @@
         explicitDiscontinuity = true;
     }
 
+    int64_t range_offset, range_length;
+    if (!itemMeta->findInt64("range-offset", &range_offset)
+            || !itemMeta->findInt64("range-length", &range_length)) {
+        range_offset = 0;
+        range_length = -1;
+    }
+
     sp<ABuffer> buffer;
-    status_t err = fetchFile(uri.c_str(), &buffer);
+    status_t err = fetchFile(uri.c_str(), &buffer, range_offset, range_length);
     if (err != OK) {
         LOGE("failed to fetch .ts segment at url '%s'", uri.c_str());
         mDataSource->queueEOS(err);
diff --git a/media/libstagefright/httplive/M3UParser.cpp b/media/libstagefright/httplive/M3UParser.cpp
index 9df9f59..a50970e 100644
--- a/media/libstagefright/httplive/M3UParser.cpp
+++ b/media/libstagefright/httplive/M3UParser.cpp
@@ -101,7 +101,7 @@
         // "url" is already an absolute URL, ignore base URL.
         out->setTo(url);
 
-        LOGV("base:'%s', url:'%s' => '%s'", baseURL, url, out->c_str());
+        ALOGV("base:'%s', url:'%s' => '%s'", baseURL, url, out->c_str());
 
         return true;
     }
@@ -140,7 +140,7 @@
         }
     }
 
-    LOGV("base:'%s', url:'%s' => '%s'", baseURL, url, out->c_str());
+    ALOGV("base:'%s', url:'%s' => '%s'", baseURL, url, out->c_str());
 
     return true;
 }
@@ -152,6 +152,7 @@
 
     const char *data = (const char *)_data;
     size_t offset = 0;
+    uint64_t segmentRangeOffset = 0;
     while (offset < size) {
         size_t offsetLF = offset;
         while (offsetLF < size && data[offsetLF] != '\n') {
@@ -218,6 +219,24 @@
                 }
                 mIsVariantPlaylist = true;
                 err = parseStreamInf(line, &itemMeta);
+            } else if (line.startsWith("#EXT-X-BYTERANGE")) {
+                if (mIsVariantPlaylist) {
+                    return ERROR_MALFORMED;
+                }
+
+                uint64_t length, offset;
+                err = parseByteRange(line, segmentRangeOffset, &length, &offset);
+
+                if (err == OK) {
+                    if (itemMeta == NULL) {
+                        itemMeta = new AMessage;
+                    }
+
+                    itemMeta->setInt64("range-offset", offset);
+                    itemMeta->setInt64("range-length", length);
+
+                    segmentRangeOffset = offset + length;
+                }
             }
 
             if (err != OK) {
@@ -332,7 +351,7 @@
         AString val(attr, equalPos + 1, attr.size() - equalPos - 1);
         val.trim();
 
-        LOGV("key=%s value=%s", key.c_str(), val.c_str());
+        ALOGV("key=%s value=%s", key.c_str(), val.c_str());
 
         if (!strcasecmp("bandwidth", key.c_str())) {
             const char *s = val.c_str();
@@ -410,7 +429,7 @@
         AString val(attr, equalPos + 1, attr.size() - equalPos - 1);
         val.trim();
 
-        LOGV("key=%s value=%s", key.c_str(), val.c_str());
+        ALOGV("key=%s value=%s", key.c_str(), val.c_str());
 
         key.tolower();
 
@@ -447,6 +466,52 @@
 }
 
 // static
+status_t M3UParser::parseByteRange(
+        const AString &line, uint64_t curOffset,
+        uint64_t *length, uint64_t *offset) {
+    ssize_t colonPos = line.find(":");
+
+    if (colonPos < 0) {
+        return ERROR_MALFORMED;
+    }
+
+    ssize_t atPos = line.find("@", colonPos + 1);
+
+    AString lenStr;
+    if (atPos < 0) {
+        lenStr = AString(line, colonPos + 1, line.size() - colonPos - 1);
+    } else {
+        lenStr = AString(line, colonPos + 1, atPos - colonPos - 1);
+    }
+
+    lenStr.trim();
+
+    const char *s = lenStr.c_str();
+    char *end;
+    *length = strtoull(s, &end, 10);
+
+    if (s == end || *end != '\0') {
+        return ERROR_MALFORMED;
+    }
+
+    if (atPos >= 0) {
+        AString offStr = AString(line, atPos + 1, line.size() - atPos - 1);
+        offStr.trim();
+
+        const char *s = offStr.c_str();
+        *offset = strtoull(s, &end, 10);
+
+        if (s == end || *end != '\0') {
+            return ERROR_MALFORMED;
+        }
+    } else {
+        *offset = curOffset;
+    }
+
+    return OK;
+}
+
+// static
 status_t M3UParser::ParseInt32(const char *s, int32_t *x) {
     char *end;
     long lval = strtol(s, &end, 10);
diff --git a/media/libstagefright/id3/ID3.cpp b/media/libstagefright/id3/ID3.cpp
index 45e018d..943a937 100644
--- a/media/libstagefright/id3/ID3.cpp
+++ b/media/libstagefright/id3/ID3.cpp
@@ -160,7 +160,7 @@
             success = removeUnsynchronizationV2_4(true /* iTunesHack */);
 
             if (success) {
-                LOGV("Had to apply the iTunes hack to parse this ID3 tag");
+                ALOGV("Had to apply the iTunes hack to parse this ID3 tag");
             }
         }
 
@@ -174,7 +174,7 @@
             return false;
         }
     } else if (header.flags & 0x80) {
-        LOGV("removing unsynchronization");
+        ALOGV("removing unsynchronization");
 
         removeUnsynchronization();
     }
@@ -219,7 +219,7 @@
             }
 
             if (extendedFlags & 0x8000) {
-                LOGV("have crc");
+                ALOGV("have crc");
             }
         }
     } else if (header.version_major == 4 && (header.flags & 0x40)) {
@@ -580,7 +580,7 @@
             mFrameSize += 6;
 
             if (mOffset + mFrameSize > mParent.mSize) {
-                LOGV("partial frame at offset %d (size = %d, bytes-remaining = %d)",
+                ALOGV("partial frame at offset %d (size = %d, bytes-remaining = %d)",
                      mOffset, mFrameSize, mParent.mSize - mOffset - 6);
                 return;
             }
@@ -621,7 +621,7 @@
             mFrameSize = 10 + baseSize;
 
             if (mOffset + mFrameSize > mParent.mSize) {
-                LOGV("partial frame at offset %d (size = %d, bytes-remaining = %d)",
+                ALOGV("partial frame at offset %d (size = %d, bytes-remaining = %d)",
                      mOffset, mFrameSize, mParent.mSize - mOffset - 10);
                 return;
             }
@@ -634,7 +634,7 @@
                 // Per-frame unsynchronization and data-length indicator
                 // have already been taken care of.
 
-                LOGV("Skipping unsupported frame (compression, encryption "
+                ALOGV("Skipping unsupported frame (compression, encryption "
                      "or per-frame unsynchronization flagged");
 
                 mOffset += mFrameSize;
diff --git a/media/libstagefright/include/AACExtractor.h b/media/libstagefright/include/AACExtractor.h
index 8e5657b..e98ca82 100644
--- a/media/libstagefright/include/AACExtractor.h
+++ b/media/libstagefright/include/AACExtractor.h
@@ -29,7 +29,7 @@
 
 class AACExtractor : public MediaExtractor {
 public:
-    AACExtractor(const sp<DataSource> &source);
+    AACExtractor(const sp<DataSource> &source, const sp<AMessage> &meta);
 
     virtual size_t countTracks();
     virtual sp<MediaSource> getTrack(size_t index);
diff --git a/media/libstagefright/include/DataUriSource.h b/media/libstagefright/include/DataUriSource.h
new file mode 100644
index 0000000..d223c06
--- /dev/null
+++ b/media/libstagefright/include/DataUriSource.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2011 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 DATA_URI_SOURCE_H_
+
+#define DATA_URI_SOURCE_H_
+
+#include <stdio.h>
+
+#include <media/stagefright/DataSource.h>
+#include <media/stagefright/MediaErrors.h>
+#include <media/stagefright/foundation/AString.h>
+
+namespace android {
+
+class DataUriSource : public DataSource {
+public:
+    DataUriSource(const char *uri);
+
+    virtual status_t initCheck() const {
+        return mInited;
+    }
+
+    virtual ssize_t readAt(off64_t offset, void *data, size_t size);
+
+    virtual status_t getSize(off64_t *size) {
+        if (mInited != OK) {
+            return mInited;
+        }
+
+        *size = mData.size();
+        return OK;
+    }
+
+    virtual String8 getUri() {
+        return mDataUri;
+    }
+
+    virtual String8 getMIMEType() const {
+        return mMimeType;
+    }
+
+protected:
+    virtual ~DataUriSource() {
+        // Nothing to delete.
+    }
+
+private:
+    const String8 mDataUri;
+
+    String8 mMimeType;
+    // Use AString because individual bytes may not be valid UTF8 chars.
+    AString mData;
+    status_t mInited;
+
+    // Disallow copy and assign.
+    DataUriSource(const DataUriSource &);
+    DataUriSource &operator=(const DataUriSource &);
+};
+
+}  // namespace android
+
+#endif  // DATA_URI_SOURCE_H_
diff --git a/media/libstagefright/include/LiveSession.h b/media/libstagefright/include/LiveSession.h
index 116ed0e..3a11612 100644
--- a/media/libstagefright/include/LiveSession.h
+++ b/media/libstagefright/include/LiveSession.h
@@ -120,7 +120,10 @@
     void onMonitorQueue();
     void onSeek(const sp<AMessage> &msg);
 
-    status_t fetchFile(const char *url, sp<ABuffer> *out);
+    status_t fetchFile(
+            const char *url, sp<ABuffer> *out,
+            int64_t range_offset = 0, int64_t range_length = -1);
+
     sp<M3UParser> fetchPlaylist(const char *url, bool *unchanged);
     size_t getBandwidthIndex();
 
diff --git a/media/libstagefright/include/M3UParser.h b/media/libstagefright/include/M3UParser.h
index 478582d..e30d6fd 100644
--- a/media/libstagefright/include/M3UParser.h
+++ b/media/libstagefright/include/M3UParser.h
@@ -72,6 +72,10 @@
     static status_t parseCipherInfo(
             const AString &line, sp<AMessage> *meta, const AString &baseURI);
 
+    static status_t parseByteRange(
+            const AString &line, uint64_t curOffset,
+            uint64_t *length, uint64_t *offset);
+
     static status_t ParseInt32(const char *s, int32_t *x);
     static status_t ParseDouble(const char *s, double *x);
 
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp
index 20a25d7..474c794 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.cpp
+++ b/media/libstagefright/matroska/MatroskaExtractor.cpp
@@ -180,7 +180,7 @@
         CHECK_GE(avccSize, 5u);
 
         mNALSizeLen = 1 + (avcc[4] & 3);
-        LOGV("mNALSizeLen = %d", mNALSizeLen);
+        ALOGV("mNALSizeLen = %d", mNALSizeLen);
     } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC)) {
         mType = AAC;
     }
@@ -230,7 +230,7 @@
 void BlockIterator::advance_l() {
     for (;;) {
         long res = mCluster->GetEntry(mBlockEntryIndex, mBlockEntry);
-        LOGV("GetEntry returned %ld", res);
+        ALOGV("GetEntry returned %ld", res);
 
         long long pos;
         long len;
@@ -240,7 +240,7 @@
             CHECK_EQ(res, mkvparser::E_BUFFER_NOT_FULL);
 
             res = mCluster->Parse(pos, len);
-            LOGV("Parse returned %ld", res);
+            ALOGV("Parse returned %ld", res);
 
             if (res < 0) {
                 // I/O error
@@ -258,7 +258,7 @@
             const mkvparser::Cluster *nextCluster;
             res = mExtractor->mSegment->ParseNext(
                     mCluster, nextCluster, pos, len);
-            LOGV("ParseNext returned %ld", res);
+            ALOGV("ParseNext returned %ld", res);
 
             if (res > 0) {
                 // EOF
@@ -274,7 +274,7 @@
             mCluster = nextCluster;
 
             res = mCluster->Parse(pos, len);
-            LOGV("Parse (2) returned %ld", res);
+            ALOGV("Parse (2) returned %ld", res);
             CHECK_GE(res, 0);
 
             mBlockEntryIndex = 0;
@@ -687,8 +687,8 @@
         }
 
         const char *const codecID = track->GetCodecId();
-        LOGV("codec id = %s", codecID);
-        LOGV("codec name = %s", track->GetCodecNameAsUTF8());
+        ALOGV("codec id = %s", codecID);
+        ALOGV("codec name = %s", track->GetCodecNameAsUTF8());
 
         size_t codecPrivateSize;
         const unsigned char *codecPrivate =
diff --git a/media/libstagefright/mpeg2ts/ATSParser.cpp b/media/libstagefright/mpeg2ts/ATSParser.cpp
index 6cec63a..da911e4 100644
--- a/media/libstagefright/mpeg2ts/ATSParser.cpp
+++ b/media/libstagefright/mpeg2ts/ATSParser.cpp
@@ -39,7 +39,7 @@
 
 // I want the expression "y" evaluated even if verbose logging is off.
 #define MY_LOGV(x, y) \
-    do { unsigned tmp = y; LOGV(x, tmp); } while (0)
+    do { unsigned tmp = y; ALOGV(x, tmp); } while (0)
 
 static const size_t kTSPacketSize = 188;
 
@@ -138,7 +138,7 @@
       mProgramMapPID(programMapPID),
       mFirstPTSValid(false),
       mFirstPTS(0) {
-    LOGV("new program number %u", programNumber);
+    ALOGV("new program number %u", programNumber);
 }
 
 bool ATSParser::Program::parsePID(
@@ -188,18 +188,18 @@
 
 status_t ATSParser::Program::parseProgramMap(ABitReader *br) {
     unsigned table_id = br->getBits(8);
-    LOGV("  table_id = %u", table_id);
+    ALOGV("  table_id = %u", table_id);
     CHECK_EQ(table_id, 0x02u);
 
     unsigned section_syntax_indicator = br->getBits(1);
-    LOGV("  section_syntax_indicator = %u", section_syntax_indicator);
+    ALOGV("  section_syntax_indicator = %u", section_syntax_indicator);
     CHECK_EQ(section_syntax_indicator, 1u);
 
     CHECK_EQ(br->getBits(1), 0u);
     MY_LOGV("  reserved = %u", br->getBits(2));
 
     unsigned section_length = br->getBits(12);
-    LOGV("  section_length = %u", section_length);
+    ALOGV("  section_length = %u", section_length);
     CHECK_EQ(section_length & 0xc00, 0u);
     CHECK_LE(section_length, 1021u);
 
@@ -214,7 +214,7 @@
     MY_LOGV("  reserved = %u", br->getBits(4));
 
     unsigned program_info_length = br->getBits(12);
-    LOGV("  program_info_length = %u", program_info_length);
+    ALOGV("  program_info_length = %u", program_info_length);
     CHECK_EQ(program_info_length & 0xc00, 0u);
 
     br->skipBits(program_info_length * 8);  // skip descriptors
@@ -230,17 +230,17 @@
         CHECK_GE(infoBytesRemaining, 5u);
 
         unsigned streamType = br->getBits(8);
-        LOGV("    stream_type = 0x%02x", streamType);
+        ALOGV("    stream_type = 0x%02x", streamType);
 
         MY_LOGV("    reserved = %u", br->getBits(3));
 
         unsigned elementaryPID = br->getBits(13);
-        LOGV("    elementary_PID = 0x%04x", elementaryPID);
+        ALOGV("    elementary_PID = 0x%04x", elementaryPID);
 
         MY_LOGV("    reserved = %u", br->getBits(4));
 
         unsigned ES_info_length = br->getBits(12);
-        LOGV("    ES_info_length = %u", ES_info_length);
+        ALOGV("    ES_info_length = %u", ES_info_length);
         CHECK_EQ(ES_info_length & 0xc00, 0u);
 
         CHECK_GE(infoBytesRemaining - 5, ES_info_length);
@@ -253,7 +253,7 @@
             MY_LOGV("      tag = 0x%02x", br->getBits(8));
 
             unsigned descLength = br->getBits(8);
-            LOGV("      len = %u", descLength);
+            ALOGV("      len = %u", descLength);
 
             CHECK_GE(info_bytes_remaining, 2 + descLength);
 
@@ -428,7 +428,7 @@
             break;
     }
 
-    LOGV("new stream PID 0x%02x, type 0x%02x", elementaryPID, streamType);
+    ALOGV("new stream PID 0x%02x, type 0x%02x", elementaryPID, streamType);
 
     if (mQueue != NULL) {
         mBuffer = new ABuffer(192 * 1024);
@@ -563,10 +563,10 @@
 status_t ATSParser::Stream::parsePES(ABitReader *br) {
     unsigned packet_startcode_prefix = br->getBits(24);
 
-    LOGV("packet_startcode_prefix = 0x%08x", packet_startcode_prefix);
+    ALOGV("packet_startcode_prefix = 0x%08x", packet_startcode_prefix);
 
     if (packet_startcode_prefix != 1) {
-        LOGV("Supposedly payload_unit_start=1 unit does not start "
+        ALOGV("Supposedly payload_unit_start=1 unit does not start "
              "with startcode.");
 
         return ERROR_MALFORMED;
@@ -575,10 +575,10 @@
     CHECK_EQ(packet_startcode_prefix, 0x000001u);
 
     unsigned stream_id = br->getBits(8);
-    LOGV("stream_id = 0x%02x", stream_id);
+    ALOGV("stream_id = 0x%02x", stream_id);
 
     unsigned PES_packet_length = br->getBits(16);
-    LOGV("PES_packet_length = %u", PES_packet_length);
+    ALOGV("PES_packet_length = %u", PES_packet_length);
 
     if (stream_id != 0xbc  // program_stream_map
             && stream_id != 0xbe  // padding_stream
@@ -597,25 +597,25 @@
         MY_LOGV("original_or_copy = %u", br->getBits(1));
 
         unsigned PTS_DTS_flags = br->getBits(2);
-        LOGV("PTS_DTS_flags = %u", PTS_DTS_flags);
+        ALOGV("PTS_DTS_flags = %u", PTS_DTS_flags);
 
         unsigned ESCR_flag = br->getBits(1);
-        LOGV("ESCR_flag = %u", ESCR_flag);
+        ALOGV("ESCR_flag = %u", ESCR_flag);
 
         unsigned ES_rate_flag = br->getBits(1);
-        LOGV("ES_rate_flag = %u", ES_rate_flag);
+        ALOGV("ES_rate_flag = %u", ES_rate_flag);
 
         unsigned DSM_trick_mode_flag = br->getBits(1);
-        LOGV("DSM_trick_mode_flag = %u", DSM_trick_mode_flag);
+        ALOGV("DSM_trick_mode_flag = %u", DSM_trick_mode_flag);
 
         unsigned additional_copy_info_flag = br->getBits(1);
-        LOGV("additional_copy_info_flag = %u", additional_copy_info_flag);
+        ALOGV("additional_copy_info_flag = %u", additional_copy_info_flag);
 
         MY_LOGV("PES_CRC_flag = %u", br->getBits(1));
         MY_LOGV("PES_extension_flag = %u", br->getBits(1));
 
         unsigned PES_header_data_length = br->getBits(8);
-        LOGV("PES_header_data_length = %u", PES_header_data_length);
+        ALOGV("PES_header_data_length = %u", PES_header_data_length);
 
         unsigned optional_bytes_remaining = PES_header_data_length;
 
@@ -633,7 +633,7 @@
             PTS |= br->getBits(15);
             CHECK_EQ(br->getBits(1), 1u);
 
-            LOGV("PTS = %llu", PTS);
+            ALOGV("PTS = %llu", PTS);
             // LOGI("PTS = %.2f secs", PTS / 90000.0f);
 
             optional_bytes_remaining -= 5;
@@ -650,7 +650,7 @@
                 DTS |= br->getBits(15);
                 CHECK_EQ(br->getBits(1), 1u);
 
-                LOGV("DTS = %llu", DTS);
+                ALOGV("DTS = %llu", DTS);
 
                 optional_bytes_remaining -= 5;
             }
@@ -668,7 +668,7 @@
             ESCR |= br->getBits(15);
             CHECK_EQ(br->getBits(1), 1u);
 
-            LOGV("ESCR = %llu", ESCR);
+            ALOGV("ESCR = %llu", ESCR);
             MY_LOGV("ESCR_extension = %u", br->getBits(9));
 
             CHECK_EQ(br->getBits(1), 1u);
@@ -718,7 +718,7 @@
             size_t payloadSizeBits = br->numBitsLeft();
             CHECK_EQ(payloadSizeBits % 8, 0u);
 
-            LOGV("There's %d bytes of payload.", payloadSizeBits / 8);
+            ALOGV("There's %d bytes of payload.", payloadSizeBits / 8);
         }
     } else if (stream_id == 0xbe) {  // padding_stream
         CHECK_NE(PES_packet_length, 0u);
@@ -736,7 +736,7 @@
         return OK;
     }
 
-    LOGV("flushing stream 0x%04x size = %d", mElementaryPID, mBuffer->size());
+    ALOGV("flushing stream 0x%04x size = %d", mElementaryPID, mBuffer->size());
 
     ABitReader br(mBuffer->data(), mBuffer->size());
 
@@ -750,7 +750,7 @@
 void ATSParser::Stream::onPayloadData(
         unsigned PTS_DTS_flags, uint64_t PTS, uint64_t DTS,
         const uint8_t *data, size_t size) {
-    LOGV("onPayloadData mStreamType=0x%02x", mStreamType);
+    ALOGV("onPayloadData mStreamType=0x%02x", mStreamType);
 
     int64_t timeUs = 0ll;  // no presentation timestamp available.
     if (PTS_DTS_flags == 2 || PTS_DTS_flags == 3) {
@@ -769,7 +769,7 @@
             sp<MetaData> meta = mQueue->getFormat();
 
             if (meta != NULL) {
-                LOGV("Stream PID 0x%08x of type 0x%02x now has data.",
+                ALOGV("Stream PID 0x%08x of type 0x%02x now has data.",
                      mElementaryPID, mStreamType);
 
                 mSource = new AnotherPacketSource(meta);
@@ -846,18 +846,18 @@
 
 void ATSParser::parseProgramAssociationTable(ABitReader *br) {
     unsigned table_id = br->getBits(8);
-    LOGV("  table_id = %u", table_id);
+    ALOGV("  table_id = %u", table_id);
     CHECK_EQ(table_id, 0x00u);
 
     unsigned section_syntax_indictor = br->getBits(1);
-    LOGV("  section_syntax_indictor = %u", section_syntax_indictor);
+    ALOGV("  section_syntax_indictor = %u", section_syntax_indictor);
     CHECK_EQ(section_syntax_indictor, 1u);
 
     CHECK_EQ(br->getBits(1), 0u);
     MY_LOGV("  reserved = %u", br->getBits(2));
 
     unsigned section_length = br->getBits(12);
-    LOGV("  section_length = %u", section_length);
+    ALOGV("  section_length = %u", section_length);
     CHECK_EQ(section_length & 0xc00, 0u);
 
     MY_LOGV("  transport_stream_id = %u", br->getBits(16));
@@ -872,7 +872,7 @@
 
     for (size_t i = 0; i < numProgramBytes / 4; ++i) {
         unsigned program_number = br->getBits(16);
-        LOGV("    program_number = %u", program_number);
+        ALOGV("    program_number = %u", program_number);
 
         MY_LOGV("    reserved = %u", br->getBits(3));
 
@@ -881,7 +881,7 @@
         } else {
             unsigned programMapPID = br->getBits(13);
 
-            LOGV("    program_map_PID = 0x%04x", programMapPID);
+            ALOGV("    program_map_PID = 0x%04x", programMapPID);
 
             bool found = false;
             for (size_t index = 0; index < mPrograms.size(); ++index) {
@@ -931,7 +931,7 @@
     }
 
     if (!handled) {
-        LOGV("PID 0x%04x not handled.", PID);
+        ALOGV("PID 0x%04x not handled.", PID);
     }
 
     return OK;
@@ -945,7 +945,7 @@
 }
 
 status_t ATSParser::parseTS(ABitReader *br) {
-    LOGV("---");
+    ALOGV("---");
 
     unsigned sync_byte = br->getBits(8);
     CHECK_EQ(sync_byte, 0x47u);
@@ -953,20 +953,20 @@
     MY_LOGV("transport_error_indicator = %u", br->getBits(1));
 
     unsigned payload_unit_start_indicator = br->getBits(1);
-    LOGV("payload_unit_start_indicator = %u", payload_unit_start_indicator);
+    ALOGV("payload_unit_start_indicator = %u", payload_unit_start_indicator);
 
     MY_LOGV("transport_priority = %u", br->getBits(1));
 
     unsigned PID = br->getBits(13);
-    LOGV("PID = 0x%04x", PID);
+    ALOGV("PID = 0x%04x", PID);
 
     MY_LOGV("transport_scrambling_control = %u", br->getBits(2));
 
     unsigned adaptation_field_control = br->getBits(2);
-    LOGV("adaptation_field_control = %u", adaptation_field_control);
+    ALOGV("adaptation_field_control = %u", adaptation_field_control);
 
     unsigned continuity_counter = br->getBits(4);
-    LOGV("continuity_counter = %u", continuity_counter);
+    ALOGV("continuity_counter = %u", continuity_counter);
 
     // LOGI("PID = 0x%04x, continuity_counter = %u", PID, continuity_counter);
 
diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp
index f782ce5..d708ba6 100644
--- a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp
+++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp
@@ -143,7 +143,7 @@
 
     int64_t timeUs;
     CHECK(buffer->meta()->findInt64("timeUs", &timeUs));
-    LOGV("queueAccessUnit timeUs=%lld us (%.2f secs)", timeUs, timeUs / 1E6);
+    ALOGV("queueAccessUnit timeUs=%lld us (%.2f secs)", timeUs, timeUs / 1E6);
 
     Mutex::Autolock autoLock(mLock);
     mBuffers.push_back(buffer);
diff --git a/media/libstagefright/mpeg2ts/ESQueue.cpp b/media/libstagefright/mpeg2ts/ESQueue.cpp
index b9a4826..edb4232 100644
--- a/media/libstagefright/mpeg2ts/ESQueue.cpp
+++ b/media/libstagefright/mpeg2ts/ESQueue.cpp
@@ -257,7 +257,7 @@
     if (mBuffer == NULL || neededSize > mBuffer->capacity()) {
         neededSize = (neededSize + 65535) & ~65535;
 
-        LOGV("resizing buffer to size %d", neededSize);
+        ALOGV("resizing buffer to size %d", neededSize);
 
         sp<ABuffer> buffer = new ABuffer(neededSize);
         if (mBuffer != NULL) {
@@ -445,7 +445,7 @@
     }
 
     if (timeUs == 0ll) {
-        LOGV("Returning 0 timestamp");
+        ALOGV("Returning 0 timestamp");
     }
 
     return timeUs;
@@ -529,7 +529,7 @@
                 dstOffset += pos.nalSize + 4;
             }
 
-            LOGV("accessUnit contains nal types %s", out.c_str());
+            ALOGV("accessUnit contains nal types %s", out.c_str());
 
             const NALPosition &pos = nals.itemAt(nals.size() - 1);
             size_t nextScan = pos.nalOffset + pos.nalSize;
@@ -760,7 +760,7 @@
 
                 accessUnit->meta()->setInt64("timeUs", timeUs);
 
-                LOGV("returning MPEG video access unit at time %lld us",
+                ALOGV("returning MPEG video access unit at time %lld us",
                       timeUs);
 
                 // hexdump(accessUnit->data(), accessUnit->size());
@@ -919,7 +919,7 @@
 
                     accessUnit->meta()->setInt64("timeUs", timeUs);
 
-                    LOGV("returning MPEG4 video access unit at time %lld us",
+                    ALOGV("returning MPEG4 video access unit at time %lld us",
                          timeUs);
 
                     // hexdump(accessUnit->data(), accessUnit->size());
diff --git a/media/libstagefright/mpeg2ts/MPEG2PSExtractor.cpp b/media/libstagefright/mpeg2ts/MPEG2PSExtractor.cpp
index a089dbf..df30a9c 100644
--- a/media/libstagefright/mpeg2ts/MPEG2PSExtractor.cpp
+++ b/media/libstagefright/mpeg2ts/MPEG2PSExtractor.cpp
@@ -274,10 +274,10 @@
 
     unsigned packet_startcode_prefix = br.getBits(24);
 
-    LOGV("packet_startcode_prefix = 0x%08x", packet_startcode_prefix);
+    ALOGV("packet_startcode_prefix = 0x%08x", packet_startcode_prefix);
 
     if (packet_startcode_prefix != 1) {
-        LOGV("Supposedly payload_unit_start=1 unit does not start "
+        ALOGV("Supposedly payload_unit_start=1 unit does not start "
              "with startcode.");
 
         return ERROR_MALFORMED;
@@ -286,7 +286,7 @@
     CHECK_EQ(packet_startcode_prefix, 0x000001u);
 
     unsigned stream_id = br.getBits(8);
-    LOGV("stream_id = 0x%02x", stream_id);
+    ALOGV("stream_id = 0x%02x", stream_id);
 
     /* unsigned PES_packet_length = */br.getBits(16);
 
@@ -372,25 +372,25 @@
         /* unsigned original_or_copy = */br.getBits(1);
 
         unsigned PTS_DTS_flags = br.getBits(2);
-        LOGV("PTS_DTS_flags = %u", PTS_DTS_flags);
+        ALOGV("PTS_DTS_flags = %u", PTS_DTS_flags);
 
         unsigned ESCR_flag = br.getBits(1);
-        LOGV("ESCR_flag = %u", ESCR_flag);
+        ALOGV("ESCR_flag = %u", ESCR_flag);
 
         unsigned ES_rate_flag = br.getBits(1);
-        LOGV("ES_rate_flag = %u", ES_rate_flag);
+        ALOGV("ES_rate_flag = %u", ES_rate_flag);
 
         unsigned DSM_trick_mode_flag = br.getBits(1);
-        LOGV("DSM_trick_mode_flag = %u", DSM_trick_mode_flag);
+        ALOGV("DSM_trick_mode_flag = %u", DSM_trick_mode_flag);
 
         unsigned additional_copy_info_flag = br.getBits(1);
-        LOGV("additional_copy_info_flag = %u", additional_copy_info_flag);
+        ALOGV("additional_copy_info_flag = %u", additional_copy_info_flag);
 
         /* unsigned PES_CRC_flag = */br.getBits(1);
         /* PES_extension_flag = */br.getBits(1);
 
         unsigned PES_header_data_length = br.getBits(8);
-        LOGV("PES_header_data_length = %u", PES_header_data_length);
+        ALOGV("PES_header_data_length = %u", PES_header_data_length);
 
         unsigned optional_bytes_remaining = PES_header_data_length;
 
@@ -408,7 +408,7 @@
             PTS |= br.getBits(15);
             CHECK_EQ(br.getBits(1), 1u);
 
-            LOGV("PTS = %llu", PTS);
+            ALOGV("PTS = %llu", PTS);
             // LOGI("PTS = %.2f secs", PTS / 90000.0f);
 
             optional_bytes_remaining -= 5;
@@ -425,7 +425,7 @@
                 DTS |= br.getBits(15);
                 CHECK_EQ(br.getBits(1), 1u);
 
-                LOGV("DTS = %llu", DTS);
+                ALOGV("DTS = %llu", DTS);
 
                 optional_bytes_remaining -= 5;
             }
@@ -443,7 +443,7 @@
             ESCR |= br.getBits(15);
             CHECK_EQ(br.getBits(1), 1u);
 
-            LOGV("ESCR = %llu", ESCR);
+            ALOGV("ESCR = %llu", ESCR);
             /* unsigned ESCR_extension = */br.getBits(9);
 
             CHECK_EQ(br.getBits(1), 1u);
@@ -650,7 +650,7 @@
             sp<MetaData> meta = mQueue->getFormat();
 
             if (meta != NULL) {
-                LOGV("Stream ID 0x%02x now has data.", mStreamID);
+                ALOGV("Stream ID 0x%02x now has data.", mStreamID);
 
                 mSource = new AnotherPacketSource(meta);
                 mSource->queueAccessUnit(accessUnit);
diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp
index 3715fe9..694b12d 100644
--- a/media/libstagefright/omx/OMX.cpp
+++ b/media/libstagefright/omx/OMX.cpp
@@ -115,7 +115,7 @@
 
 void OMX::CallbackDispatcher::dispatch(const omx_message &msg) {
     if (mOwner == NULL) {
-        LOGV("Would have dispatched a message to a node that's already gone.");
+        ALOGV("Would have dispatched a message to a node that's already gone.");
         return;
     }
     mOwner->onMessage(msg);
@@ -231,7 +231,7 @@
             instance, &handle);
 
     if (err != OMX_ErrorNone) {
-        LOGV("FAILED to allocate omx component '%s'", name);
+        ALOGV("FAILED to allocate omx component '%s'", name);
 
         instance->onGetHandleFailed();
 
@@ -384,7 +384,7 @@
         OMX_IN OMX_U32 nData1,
         OMX_IN OMX_U32 nData2,
         OMX_IN OMX_PTR pEventData) {
-    LOGV("OnEvent(%d, %ld, %ld)", eEvent, nData1, nData2);
+    ALOGV("OnEvent(%d, %ld, %ld)", eEvent, nData1, nData2);
 
     omx_message msg;
     msg.type = omx_message::EVENT;
@@ -400,7 +400,7 @@
 
 OMX_ERRORTYPE OMX::OnEmptyBufferDone(
         node_id node, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer) {
-    LOGV("OnEmptyBufferDone buffer=%p", pBuffer);
+    ALOGV("OnEmptyBufferDone buffer=%p", pBuffer);
 
     omx_message msg;
     msg.type = omx_message::EMPTY_BUFFER_DONE;
@@ -414,7 +414,7 @@
 
 OMX_ERRORTYPE OMX::OnFillBufferDone(
         node_id node, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer) {
-    LOGV("OnFillBufferDone buffer=%p", pBuffer);
+    ALOGV("OnFillBufferDone buffer=%p", pBuffer);
 
     omx_message msg;
     msg.type = omx_message::FILL_BUFFER_DONE;
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index 0ff398a..802c429 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -142,7 +142,7 @@
     switch (state) {
         case OMX_StateExecuting:
         {
-            LOGV("forcing Executing->Idle");
+            ALOGV("forcing Executing->Idle");
             sendCommand(OMX_CommandStateSet, OMX_StateIdle);
             OMX_ERRORTYPE err;
             int32_t iteration = 0;
@@ -168,7 +168,7 @@
 
         case OMX_StateIdle:
         {
-            LOGV("forcing Idle->Loaded");
+            ALOGV("forcing Idle->Loaded");
             sendCommand(OMX_CommandStateSet, OMX_StateLoaded);
 
             freeActiveBuffers();
@@ -184,7 +184,7 @@
                     break;
                 }
 
-                LOGV("waiting for Loaded state...");
+                ALOGV("waiting for Loaded state...");
                 usleep(100000);
             }
             CHECK_EQ(err, OMX_ErrorNone);
@@ -201,10 +201,10 @@
             break;
     }
 
-    LOGV("calling destroyComponentInstance");
+    ALOGV("calling destroyComponentInstance");
     OMX_ERRORTYPE err = master->destroyComponentInstance(
             static_cast<OMX_COMPONENTTYPE *>(mHandle));
-    LOGV("destroyComponentInstance returned err %d", err);
+    ALOGV("destroyComponentInstance returned err %d", err);
 
     mHandle = NULL;
 
@@ -215,7 +215,7 @@
     mOwner->invalidateNodeID(mNodeID);
     mNodeID = NULL;
 
-    LOGV("OMXNodeInstance going away.");
+    ALOGV("OMXNodeInstance going away.");
     delete this;
 
     return StatusFromOMXError(err);
diff --git a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
index b705d00..0914f32 100644
--- a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
+++ b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
@@ -589,7 +589,7 @@
 
         if (port->mTransition == PortInfo::DISABLING) {
             if (port->mBuffers.empty()) {
-                LOGV("Port %d now disabled.", i);
+                ALOGV("Port %d now disabled.", i);
 
                 port->mTransition = PortInfo::NONE;
                 notify(OMX_EventCmdComplete, OMX_CommandPortDisable, i, NULL);
@@ -598,7 +598,7 @@
             }
         } else if (port->mTransition == PortInfo::ENABLING) {
             if (port->mDef.bPopulated == OMX_TRUE) {
-                LOGV("Port %d now enabled.", i);
+                ALOGV("Port %d now enabled.", i);
 
                 port->mTransition = PortInfo::NONE;
                 port->mDef.bEnabled = OMX_TRUE;
diff --git a/media/libstagefright/omx/SoftOMXPlugin.cpp b/media/libstagefright/omx/SoftOMXPlugin.cpp
index 1e33f05..8aeb763 100644
--- a/media/libstagefright/omx/SoftOMXPlugin.cpp
+++ b/media/libstagefright/omx/SoftOMXPlugin.cpp
@@ -58,7 +58,7 @@
         const OMX_CALLBACKTYPE *callbacks,
         OMX_PTR appData,
         OMX_COMPONENTTYPE **component) {
-    LOGV("makeComponentInstance '%s'", name);
+    ALOGV("makeComponentInstance '%s'", name);
 
     for (size_t i = 0; i < kNumComponents; ++i) {
         if (strcmp(name, kComponents[i].mName)) {
diff --git a/media/libstagefright/rtsp/AAMRAssembler.cpp b/media/libstagefright/rtsp/AAMRAssembler.cpp
index 328cadf..9d72b1f 100644
--- a/media/libstagefright/rtsp/AAMRAssembler.cpp
+++ b/media/libstagefright/rtsp/AAMRAssembler.cpp
@@ -127,7 +127,7 @@
         mNextExpectedSeqNoValid = true;
         mNextExpectedSeqNo = (uint32_t)buffer->int32Data();
     } else if ((uint32_t)buffer->int32Data() != mNextExpectedSeqNo) {
-        LOGV("Not the sequence number I expected");
+        ALOGV("Not the sequence number I expected");
 
         return WRONG_SEQUENCE_NUMBER;
     }
@@ -138,7 +138,7 @@
         queue->erase(queue->begin());
         ++mNextExpectedSeqNo;
 
-        LOGV("AMR packet too short.");
+        ALOGV("AMR packet too short.");
 
         return MALFORMED_PACKET;
     }
@@ -156,7 +156,7 @@
             queue->erase(queue->begin());
             ++mNextExpectedSeqNo;
 
-            LOGV("Unable to parse TOC.");
+            ALOGV("Unable to parse TOC.");
 
             return MALFORMED_PACKET;
         }
@@ -170,7 +170,7 @@
             queue->erase(queue->begin());
             ++mNextExpectedSeqNo;
 
-            LOGV("Illegal TOC entry.");
+            ALOGV("Illegal TOC entry.");
 
             return MALFORMED_PACKET;
         }
@@ -197,7 +197,7 @@
             queue->erase(queue->begin());
             ++mNextExpectedSeqNo;
 
-            LOGV("AMR packet too short.");
+            ALOGV("AMR packet too short.");
 
             return MALFORMED_PACKET;
         }
diff --git a/media/libstagefright/rtsp/AAVCAssembler.cpp b/media/libstagefright/rtsp/AAVCAssembler.cpp
index 11c6ae7..ed8b1df 100644
--- a/media/libstagefright/rtsp/AAVCAssembler.cpp
+++ b/media/libstagefright/rtsp/AAVCAssembler.cpp
@@ -72,7 +72,7 @@
         mNextExpectedSeqNoValid = true;
         mNextExpectedSeqNo = (uint32_t)buffer->int32Data();
     } else if ((uint32_t)buffer->int32Data() != mNextExpectedSeqNo) {
-        LOGV("Not the sequence number I expected");
+        ALOGV("Not the sequence number I expected");
 
         return WRONG_SEQUENCE_NUMBER;
     }
@@ -83,7 +83,7 @@
     if (size < 1 || (data[0] & 0x80)) {
         // Corrupt.
 
-        LOGV("Ignoring corrupt buffer.");
+        ALOGV("Ignoring corrupt buffer.");
         queue->erase(queue->begin());
 
         ++mNextExpectedSeqNo;
@@ -107,7 +107,7 @@
 
         return success ? OK : MALFORMED_PACKET;
     } else {
-        LOGV("Ignoring unsupported buffer (nalType=%d)", nalType);
+        ALOGV("Ignoring unsupported buffer (nalType=%d)", nalType);
 
         queue->erase(queue->begin());
         ++mNextExpectedSeqNo;
@@ -117,7 +117,7 @@
 }
 
 void AAVCAssembler::addSingleNALUnit(const sp<ABuffer> &buffer) {
-    LOGV("addSingleNALUnit of size %d", buffer->size());
+    ALOGV("addSingleNALUnit of size %d", buffer->size());
 #if !LOG_NDEBUG
     hexdump(buffer->data(), buffer->size());
 #endif
@@ -138,7 +138,7 @@
     size_t size = buffer->size();
 
     if (size < 3) {
-        LOGV("Discarding too small STAP-A packet.");
+        ALOGV("Discarding too small STAP-A packet.");
         return false;
     }
 
@@ -148,7 +148,7 @@
         size_t nalSize = (data[0] << 8) | data[1];
 
         if (size < nalSize + 2) {
-            LOGV("Discarding malformed STAP-A packet.");
+            ALOGV("Discarding malformed STAP-A packet.");
             return false;
         }
 
@@ -164,7 +164,7 @@
     }
 
     if (size != 0) {
-        LOGV("Unexpected padding at end of STAP-A packet.");
+        ALOGV("Unexpected padding at end of STAP-A packet.");
     }
 
     return true;
@@ -184,7 +184,7 @@
     CHECK((indicator & 0x1f) == 28);
 
     if (size < 2) {
-        LOGV("Ignoring malformed FU buffer (size = %d)", size);
+        ALOGV("Ignoring malformed FU buffer (size = %d)", size);
 
         queue->erase(queue->begin());
         ++mNextExpectedSeqNo;
@@ -194,7 +194,7 @@
     if (!(data[1] & 0x80)) {
         // Start bit not set on the first buffer.
 
-        LOGV("Start bit not set on first buffer");
+        ALOGV("Start bit not set on first buffer");
 
         queue->erase(queue->begin());
         ++mNextExpectedSeqNo;
@@ -212,13 +212,13 @@
     if (data[1] & 0x40) {
         // Huh? End bit also set on the first buffer.
 
-        LOGV("Grrr. This isn't fragmented at all.");
+        ALOGV("Grrr. This isn't fragmented at all.");
 
         complete = true;
     } else {
         List<sp<ABuffer> >::iterator it = ++queue->begin();
         while (it != queue->end()) {
-            LOGV("sequence length %d", totalCount);
+            ALOGV("sequence length %d", totalCount);
 
             const sp<ABuffer> &buffer = *it;
 
@@ -226,7 +226,7 @@
             size_t size = buffer->size();
 
             if ((uint32_t)buffer->int32Data() != expectedSeqNo) {
-                LOGV("sequence not complete, expected seqNo %d, got %d",
+                ALOGV("sequence not complete, expected seqNo %d, got %d",
                      expectedSeqNo, (uint32_t)buffer->int32Data());
 
                 return WRONG_SEQUENCE_NUMBER;
@@ -236,7 +236,7 @@
                     || data[0] != indicator
                     || (data[1] & 0x1f) != nalType
                     || (data[1] & 0x80)) {
-                LOGV("Ignoring malformed FU buffer.");
+                ALOGV("Ignoring malformed FU buffer.");
 
                 // Delete the whole start of the FU.
 
@@ -287,7 +287,7 @@
     for (size_t i = 0; i < totalCount; ++i) {
         const sp<ABuffer> &buffer = *it;
 
-        LOGV("piece #%d/%d", i + 1, totalCount);
+        ALOGV("piece #%d/%d", i + 1, totalCount);
 #if !LOG_NDEBUG
         hexdump(buffer->data(), buffer->size());
 #endif
@@ -302,7 +302,7 @@
 
     addSingleNALUnit(unit);
 
-    LOGV("successfully assembled a NAL unit from fragments.");
+    ALOGV("successfully assembled a NAL unit from fragments.");
 
     return OK;
 }
@@ -310,7 +310,7 @@
 void AAVCAssembler::submitAccessUnit() {
     CHECK(!mNALUnits.empty());
 
-    LOGV("Access unit complete (%d nal units)", mNALUnits.size());
+    ALOGV("Access unit complete (%d nal units)", mNALUnits.size());
 
     size_t totalSize = 0;
     for (List<sp<ABuffer> >::iterator it = mNALUnits.begin();
@@ -360,7 +360,7 @@
 
 void AAVCAssembler::packetLost() {
     CHECK(mNextExpectedSeqNoValid);
-    LOGV("packetLost (expected %d)", mNextExpectedSeqNo);
+    ALOGV("packetLost (expected %d)", mNextExpectedSeqNo);
 
     ++mNextExpectedSeqNo;
 
diff --git a/media/libstagefright/rtsp/AMPEG4ElementaryAssembler.cpp b/media/libstagefright/rtsp/AMPEG4ElementaryAssembler.cpp
index 9f6bd29..2f2e2c2 100644
--- a/media/libstagefright/rtsp/AMPEG4ElementaryAssembler.cpp
+++ b/media/libstagefright/rtsp/AMPEG4ElementaryAssembler.cpp
@@ -203,7 +203,7 @@
         mNextExpectedSeqNoValid = true;
         mNextExpectedSeqNo = (uint32_t)buffer->int32Data();
     } else if ((uint32_t)buffer->int32Data() != mNextExpectedSeqNo) {
-        LOGV("Not the sequence number I expected");
+        ALOGV("Not the sequence number I expected");
 
         return WRONG_SEQUENCE_NUMBER;
     }
@@ -336,7 +336,7 @@
 void AMPEG4ElementaryAssembler::submitAccessUnit() {
     CHECK(!mPackets.empty());
 
-    LOGV("Access unit complete (%d nal units)", mPackets.size());
+    ALOGV("Access unit complete (%d nal units)", mPackets.size());
 
     size_t totalSize = 0;
     for (List<sp<ABuffer> >::iterator it = mPackets.begin();
@@ -383,7 +383,7 @@
 
 void AMPEG4ElementaryAssembler::packetLost() {
     CHECK(mNextExpectedSeqNoValid);
-    LOGV("packetLost (expected %d)", mNextExpectedSeqNo);
+    ALOGV("packetLost (expected %d)", mNextExpectedSeqNo);
 
     ++mNextExpectedSeqNo;
 
diff --git a/media/libstagefright/rtsp/ARTPConnection.cpp b/media/libstagefright/rtsp/ARTPConnection.cpp
index cd374e2..c5d8740 100644
--- a/media/libstagefright/rtsp/ARTPConnection.cpp
+++ b/media/libstagefright/rtsp/ARTPConnection.cpp
@@ -336,7 +336,7 @@
             }
 
             if (buffer->size() > 0) {
-                LOGV("Sending RR...");
+                ALOGV("Sending RR...");
 
                 ssize_t n;
                 do {
@@ -369,7 +369,7 @@
 }
 
 status_t ARTPConnection::receive(StreamInfo *s, bool receiveRTP) {
-    LOGV("receiving %s", receiveRTP ? "RTP" : "RTCP");
+    ALOGV("receiving %s", receiveRTP ? "RTP" : "RTCP");
 
     CHECK(!s->mIsInjected);
 
diff --git a/media/libstagefright/rtsp/ARTPSource.cpp b/media/libstagefright/rtsp/ARTPSource.cpp
index 3aa07ce..dc5f17e 100644
--- a/media/libstagefright/rtsp/ARTPSource.cpp
+++ b/media/libstagefright/rtsp/ARTPSource.cpp
@@ -207,7 +207,7 @@
 
     buffer->setRange(buffer->offset(), buffer->size() + 20);
 
-    LOGV("Added FIR request.");
+    ALOGV("Added FIR request.");
 }
 
 void ARTPSource::addReceiverReport(const sp<ABuffer> &buffer) {
diff --git a/media/libstagefright/rtsp/ARTPWriter.cpp b/media/libstagefright/rtsp/ARTPWriter.cpp
index 5a033e1..b602511 100644
--- a/media/libstagefright/rtsp/ARTPWriter.cpp
+++ b/media/libstagefright/rtsp/ARTPWriter.cpp
@@ -277,7 +277,7 @@
     }
 
     if (mediaBuf->range_length() > 0) {
-        LOGV("read buffer of size %d", mediaBuf->range_length());
+        ALOGV("read buffer of size %d", mediaBuf->range_length());
 
         if (mMode == H264) {
             StripStartcode(mediaBuf);
diff --git a/media/libstagefright/rtsp/ARTSPConnection.cpp b/media/libstagefright/rtsp/ARTSPConnection.cpp
index 380b3dc..d8107bc 100644
--- a/media/libstagefright/rtsp/ARTSPConnection.cpp
+++ b/media/libstagefright/rtsp/ARTSPConnection.cpp
@@ -245,7 +245,7 @@
     }
 
     if (mUser.size() > 0) {
-        LOGV("user = '%s', pass = '%s'", mUser.c_str(), mPass.c_str());
+        ALOGV("user = '%s', pass = '%s'", mUser.c_str(), mPass.c_str());
     }
 
     struct hostent *ent = gethostbyname(host.c_str());
@@ -429,7 +429,7 @@
 
     request.insert(cseqHeader, i + 2);
 
-    LOGV("request: '%s'", request.c_str());
+    ALOGV("request: '%s'", request.c_str());
 
     size_t numBytesSent = 0;
     while (numBytesSent < request.size()) {
@@ -669,7 +669,7 @@
             break;
         }
 
-        LOGV("line: '%s'", line.c_str());
+        ALOGV("line: '%s'", line.c_str());
 
         if (line.c_str()[0] == ' ' || line.c_str()[0] == '\t') {
             // Support for folded header values.
diff --git a/media/libstagefright/rtsp/ARawAudioAssembler.cpp b/media/libstagefright/rtsp/ARawAudioAssembler.cpp
index dd47ea3..98bee82 100644
--- a/media/libstagefright/rtsp/ARawAudioAssembler.cpp
+++ b/media/libstagefright/rtsp/ARawAudioAssembler.cpp
@@ -77,7 +77,7 @@
         mNextExpectedSeqNoValid = true;
         mNextExpectedSeqNo = (uint32_t)buffer->int32Data();
     } else if ((uint32_t)buffer->int32Data() != mNextExpectedSeqNo) {
-        LOGV("Not the sequence number I expected");
+        ALOGV("Not the sequence number I expected");
 
         return WRONG_SEQUENCE_NUMBER;
     }
@@ -88,7 +88,7 @@
         queue->erase(queue->begin());
         ++mNextExpectedSeqNo;
 
-        LOGV("raw audio packet too short.");
+        ALOGV("raw audio packet too short.");
 
         return MALFORMED_PACKET;
     }
diff --git a/media/libstagefright/rtsp/ASessionDescription.cpp b/media/libstagefright/rtsp/ASessionDescription.cpp
index f03f7a2..56fdd9d 100644
--- a/media/libstagefright/rtsp/ASessionDescription.cpp
+++ b/media/libstagefright/rtsp/ASessionDescription.cpp
@@ -120,7 +120,7 @@
                 key.trim();
                 value.trim();
 
-                LOGV("adding '%s' => '%s'", key.c_str(), value.c_str());
+                ALOGV("adding '%s' => '%s'", key.c_str(), value.c_str());
 
                 mTracks.editItemAt(mTracks.size() - 1).add(key, value);
                 break;
@@ -128,7 +128,7 @@
 
             case 'm':
             {
-                LOGV("new section '%s'",
+                ALOGV("new section '%s'",
                      AString(line, 2, line.size() - 2).c_str());
 
                 mTracks.push(Attribs());
@@ -148,7 +148,7 @@
                 key.trim();
                 value.trim();
 
-                LOGV("adding '%s' => '%s'", key.c_str(), value.c_str());
+                ALOGV("adding '%s' => '%s'", key.c_str(), value.c_str());
 
                 mTracks.editItemAt(mTracks.size() - 1).add(key, value);
                 break;
diff --git a/media/libstagefright/rtsp/MyHandler.h b/media/libstagefright/rtsp/MyHandler.h
index 5a95f9c..21ef298 100644
--- a/media/libstagefright/rtsp/MyHandler.h
+++ b/media/libstagefright/rtsp/MyHandler.h
@@ -342,7 +342,7 @@
             return false;
         }
 
-        LOGV("successfully poked holes.");
+        ALOGV("successfully poked holes.");
 
         return true;
     }
@@ -840,7 +840,7 @@
                 CHECK(msg->findSize("track-index", &trackIndex));
 
                 if (trackIndex >= mTracks.size()) {
-                    LOGV("late packets ignored.");
+                    ALOGV("late packets ignored.");
                     break;
                 }
 
@@ -863,12 +863,12 @@
                 uint32_t seqNum = (uint32_t)accessUnit->int32Data();
 
                 if (mSeekPending) {
-                    LOGV("we're seeking, dropping stale packet.");
+                    ALOGV("we're seeking, dropping stale packet.");
                     break;
                 }
 
                 if (seqNum < track->mFirstSeqNumInSegment) {
-                    LOGV("dropping stale access-unit (%d < %d)",
+                    ALOGV("dropping stale access-unit (%d < %d)",
                          seqNum, track->mFirstSeqNumInSegment);
                     break;
                 }
@@ -981,7 +981,7 @@
                         ssize_t i = response->mHeaders.indexOfKey("rtp-info");
                         CHECK_GE(i, 0);
 
-                        LOGV("rtp-info: %s", response->mHeaders.valueAt(i).c_str());
+                        ALOGV("rtp-info: %s", response->mHeaders.valueAt(i).c_str());
 
                         LOGI("seek completed.");
                     }
@@ -1092,7 +1092,7 @@
         }
 
         AString range = response->mHeaders.valueAt(i);
-        LOGV("Range: %s", range.c_str());
+        ALOGV("Range: %s", range.c_str());
 
         AString val;
         CHECK(GetAttribute(range.c_str(), "npt", &val));
@@ -1116,7 +1116,7 @@
         for (List<AString>::iterator it = streamInfos.begin();
              it != streamInfos.end(); ++it) {
             (*it).trim();
-            LOGV("streamInfo[%d] = %s", n, (*it).c_str());
+            ALOGV("streamInfo[%d] = %s", n, (*it).c_str());
 
             CHECK(GetAttribute((*it).c_str(), "url", &val));
 
@@ -1140,7 +1140,7 @@
 
             uint32_t rtpTime = strtoul(val.c_str(), &end, 10);
 
-            LOGV("track #%d: rtpTime=%u <=> npt=%.2f", n, rtpTime, npt1);
+            ALOGV("track #%d: rtpTime=%u <=> npt=%.2f", n, rtpTime, npt1);
 
             info->mNormalPlayTimeRTP = rtpTime;
             info->mNormalPlayTimeUs = (int64_t)(npt1 * 1E6);
@@ -1272,7 +1272,7 @@
 
         info->mTimeScale = timescale;
 
-        LOGV("track #%d URL=%s", mTracks.size(), trackURL.c_str());
+        ALOGV("track #%d URL=%s", mTracks.size(), trackURL.c_str());
 
         AString request = "SETUP ";
         request.append(trackURL);
@@ -1363,7 +1363,7 @@
     }
 
     void onTimeUpdate(int32_t trackIndex, uint32_t rtpTime, uint64_t ntpTime) {
-        LOGV("onTimeUpdate track %d, rtpTime = 0x%08x, ntpTime = 0x%016llx",
+        ALOGV("onTimeUpdate track %d, rtpTime = 0x%08x, ntpTime = 0x%016llx",
              trackIndex, rtpTime, ntpTime);
 
         int64_t ntpTimeUs = (int64_t)(ntpTime * 1E6 / (1ll << 32));
@@ -1381,7 +1381,7 @@
 
     void onAccessUnitComplete(
             int32_t trackIndex, const sp<ABuffer> &accessUnit) {
-        LOGV("onAccessUnitComplete track %d", trackIndex);
+        ALOGV("onAccessUnitComplete track %d", trackIndex);
 
         if (mFirstAccessUnit) {
             sp<AMessage> msg = mNotify->dup();
@@ -1404,7 +1404,7 @@
         TrackInfo *track = &mTracks.editItemAt(trackIndex);
 
         if (mNTPAnchorUs < 0 || mMediaAnchorUs < 0 || track->mNTPAnchorUs < 0) {
-            LOGV("storing accessUnit, no time established yet");
+            ALOGV("storing accessUnit, no time established yet");
             track->mPackets.push_back(accessUnit);
             return;
         }
@@ -1443,11 +1443,11 @@
         }
 
         if (mediaTimeUs < 0) {
-            LOGV("dropping early accessUnit.");
+            ALOGV("dropping early accessUnit.");
             return false;
         }
 
-        LOGV("track %d rtpTime=%d mediaTimeUs = %lld us (%.2f secs)",
+        ALOGV("track %d rtpTime=%d mediaTimeUs = %lld us (%.2f secs)",
              trackIndex, rtpTime, mediaTimeUs, mediaTimeUs / 1E6);
 
         accessUnit->meta()->setInt64("timeUs", mediaTimeUs);
diff --git a/media/libstagefright/tests/DummyRecorder.cpp b/media/libstagefright/tests/DummyRecorder.cpp
index 8d75d6b..fbb606d 100644
--- a/media/libstagefright/tests/DummyRecorder.cpp
+++ b/media/libstagefright/tests/DummyRecorder.cpp
@@ -27,7 +27,7 @@
 
 // static
 void *DummyRecorder::threadWrapper(void *pthis) {
-    LOGV("ThreadWrapper: %p", pthis);
+    ALOGV("ThreadWrapper: %p", pthis);
     DummyRecorder *writer = static_cast<DummyRecorder *>(pthis);
     writer->readFromSource();
     return NULL;
@@ -35,7 +35,7 @@
 
 
 status_t DummyRecorder::start() {
-    LOGV("Start");
+    ALOGV("Start");
     mStarted = true;
 
     mSource->start();
@@ -55,7 +55,7 @@
 
 
 status_t DummyRecorder::stop() {
-    LOGV("Stop");
+    ALOGV("Stop");
     mStarted = false;
 
     mSource->stop();
@@ -63,20 +63,20 @@
     pthread_join(mThread, &dummy);
     status_t err = (status_t) dummy;
 
-    LOGV("Ending the reading thread");
+    ALOGV("Ending the reading thread");
     return err;
 }
 
 // pretend to read the source buffers
 void DummyRecorder::readFromSource() {
-    LOGV("ReadFromSource");
+    ALOGV("ReadFromSource");
     if (!mStarted) {
         return;
     }
 
     status_t err = OK;
     MediaBuffer *buffer;
-    LOGV("A fake writer accessing the frames");
+    ALOGV("A fake writer accessing the frames");
     while (mStarted && (err = mSource->read(&buffer)) == OK){
         // if not getting a valid buffer from source, then exit
         if (buffer == NULL) {
diff --git a/media/libstagefright/tests/SurfaceMediaSource_test.cpp b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
index d7bb703..6be5e9a 100644
--- a/media/libstagefright/tests/SurfaceMediaSource_test.cpp
+++ b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
@@ -58,7 +58,7 @@
     }
 
     virtual void SetUp() {
-        LOGV("GLTest::SetUp()");
+        ALOGV("GLTest::SetUp()");
         mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
         ASSERT_EQ(EGL_SUCCESS, eglGetError());
         ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay);
@@ -106,7 +106,7 @@
             mEglSurface = eglCreateWindowSurface(mEglDisplay, mGlConfig,
                     window.get(), NULL);
         } else {
-            LOGV("No actual display. Choosing EGLSurface based on SurfaceMediaSource");
+            ALOGV("No actual display. Choosing EGLSurface based on SurfaceMediaSource");
             sp<SurfaceMediaSource> sms = new SurfaceMediaSource(
                     getSurfaceWidth(), getSurfaceHeight());
             sp<SurfaceTextureClient> stc = new SurfaceTextureClient(sms);
@@ -162,7 +162,7 @@
     }
 
     virtual EGLint const* getConfigAttribs() {
-        LOGV("GLTest getConfigAttribs");
+        ALOGV("GLTest getConfigAttribs");
         static EGLint sDefaultConfigAttribs[] = {
             EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
             EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
@@ -392,7 +392,7 @@
 protected:
 
     virtual void SetUp() {
-        LOGV("SMS-GLTest::SetUp()");
+        ALOGV("SMS-GLTest::SetUp()");
         android::ProcessState::self()->startThreadPool();
         mSMS = new SurfaceMediaSource(mYuvTexWidth, mYuvTexHeight);
         mSTC = new SurfaceTextureClient(mSMS);
@@ -423,7 +423,7 @@
 // Methods in SurfaceMediaSourceGLTest
 /////////////////////////////////////////////////////////////////////
 EGLint const* SurfaceMediaSourceGLTest::getConfigAttribs() {
-        LOGV("SurfaceMediaSourceGLTest getConfigAttribs");
+        ALOGV("SurfaceMediaSourceGLTest getConfigAttribs");
     static EGLint sDefaultConfigAttribs[] = {
         EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
         EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
@@ -474,7 +474,7 @@
     mr->setVideoSize(width, height);
     mr->setVideoFrameRate(fps);
     mr->prepare();
-    LOGV("Starting MediaRecorder...");
+    ALOGV("Starting MediaRecorder...");
     CHECK_EQ(OK, mr->start());
     return mr;
 }
@@ -624,8 +624,8 @@
 // Dummy Encoder
 static int testId = 1;
 TEST_F(SurfaceMediaSourceTest, DISABLED_DummyEncodingFromCpuFilledYV12BufferNpotOneBufferPass) {
-    LOGV("Test # %d", testId++);
-    LOGV("Testing OneBufferPass ******************************");
+    ALOGV("Test # %d", testId++);
+    ALOGV("Testing OneBufferPass ******************************");
 
     ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
             HAL_PIXEL_FORMAT_YV12));
@@ -635,8 +635,8 @@
 // Pass the buffer with the wrong height and weight and should not be accepted
 // Dummy Encoder
 TEST_F(SurfaceMediaSourceTest, DISABLED_DummyEncodingFromCpuFilledYV12BufferNpotWrongSizeBufferPass) {
-    LOGV("Test # %d", testId++);
-    LOGV("Testing Wrong size BufferPass ******************************");
+    ALOGV("Test # %d", testId++);
+    ALOGV("Testing Wrong size BufferPass ******************************");
 
     // setting the client side buffer size different than the server size
     ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(),
@@ -653,8 +653,8 @@
 // pass multiple buffers from the native_window the SurfaceMediaSource
 // Dummy Encoder
 TEST_F(SurfaceMediaSourceTest,  DISABLED_DummyEncodingFromCpuFilledYV12BufferNpotMultiBufferPass) {
-    LOGV("Test # %d", testId++);
-    LOGV("Testing MultiBufferPass, Dummy Recorder *********************");
+    ALOGV("Test # %d", testId++);
+    ALOGV("Testing MultiBufferPass, Dummy Recorder *********************");
     ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
             HAL_PIXEL_FORMAT_YV12));
 
@@ -675,8 +675,8 @@
 // Delayed pass of multiple buffers from the native_window the SurfaceMediaSource
 // Dummy Encoder
 TEST_F(SurfaceMediaSourceTest,  DISABLED_DummyLagEncodingFromCpuFilledYV12BufferNpotMultiBufferPass) {
-    LOGV("Test # %d", testId++);
-    LOGV("Testing MultiBufferPass, Dummy Recorder Lagging **************");
+    ALOGV("Test # %d", testId++);
+    ALOGV("Testing MultiBufferPass, Dummy Recorder Lagging **************");
 
     ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
             HAL_PIXEL_FORMAT_YV12));
@@ -700,8 +700,8 @@
 // pass multiple buffers from the native_window the SurfaceMediaSource
 // A dummy writer (MULTITHREADED) is used to simulate actual MPEG4Writer
 TEST_F(SurfaceMediaSourceTest, DISABLED_DummyThreadedEncodingFromCpuFilledYV12BufferNpotMultiBufferPass) {
-    LOGV("Test # %d", testId++);
-    LOGV("Testing MultiBufferPass, Dummy Recorder Multi-Threaded **********");
+    ALOGV("Test # %d", testId++);
+    ALOGV("Testing MultiBufferPass, Dummy Recorder Multi-Threaded **********");
     ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
             HAL_PIXEL_FORMAT_YV12));
 
@@ -724,9 +724,9 @@
 // Very close to the actual camera, except that the
 // buffers are filled and queueud by the CPU instead of GL.
 TEST_F(SurfaceMediaSourceTest, DISABLED_EncodingFromCpuYV12BufferNpotWriteMediaServer) {
-    LOGV("Test # %d", testId++);
-    LOGV("************** Testing the whole pipeline with actual MediaRecorder ***********");
-    LOGV("************** SurfaceMediaSource is same process as mediaserver    ***********");
+    ALOGV("Test # %d", testId++);
+    ALOGV("************** Testing the whole pipeline with actual MediaRecorder ***********");
+    ALOGV("************** SurfaceMediaSource is same process as mediaserver    ***********");
 
     const char *fileName = "/sdcard/outputSurfEncMSource.mp4";
     int fd = open(fileName, O_RDWR | O_CREAT, 0744);
@@ -752,11 +752,11 @@
     while (nFramesCount <= 300) {
         oneBufferPassNoFill(mYuvTexWidth, mYuvTexHeight);
         nFramesCount++;
-        LOGV("framesCount = %d", nFramesCount);
+        ALOGV("framesCount = %d", nFramesCount);
     }
 
     ASSERT_EQ(NO_ERROR, native_window_api_disconnect(mANW.get(), NATIVE_WINDOW_API_CPU));
-    LOGV("Stopping MediaRecorder...");
+    ALOGV("Stopping MediaRecorder...");
     CHECK_EQ(OK, mr->stop());
     mr.clear();
     close(fd);
@@ -769,8 +769,8 @@
 // Test to examine whether we can choose the Recordable Android GLConfig
 // DummyRecorder used- no real encoding here
 TEST_F(SurfaceMediaSourceGLTest, ChooseAndroidRecordableEGLConfigDummyWriter) {
-    LOGV("Test # %d", testId++);
-    LOGV("Verify creating a surface w/ right config + dummy writer*********");
+    ALOGV("Test # %d", testId++);
+    ALOGV("Verify creating a surface w/ right config + dummy writer*********");
 
     mSMS = new SurfaceMediaSource(mYuvTexWidth, mYuvTexHeight);
     mSTC = new SurfaceTextureClient(mSMS);
@@ -792,7 +792,7 @@
     while (nFramesCount <= 300) {
         oneBufferPassGL();
         nFramesCount++;
-        LOGV("framesCount = %d", nFramesCount);
+        ALOGV("framesCount = %d", nFramesCount);
     }
 
     EXPECT_TRUE(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
@@ -806,8 +806,8 @@
 // Test to examine whether we can render GL buffers in to the surface
 // created with the native window handle
 TEST_F(SurfaceMediaSourceGLTest, RenderingToRecordableEGLSurfaceWorks) {
-    LOGV("Test # %d", testId++);
-    LOGV("RenderingToRecordableEGLSurfaceWorks *********************");
+    ALOGV("Test # %d", testId++);
+    ALOGV("RenderingToRecordableEGLSurfaceWorks *********************");
     // Do the producer side of things
     glClearColor(0.6, 0.6, 0.6, 0.6);
     glClear(GL_COLOR_BUFFER_BIT);
@@ -852,9 +852,9 @@
 // Actual encoder, Actual GL Buffers Filled SurfaceMediaSource
 // The same pattern is rendered every frame
 TEST_F(SurfaceMediaSourceGLTest, EncodingFromGLRgbaSameImageEachBufNpotWrite) {
-    LOGV("Test # %d", testId++);
-    LOGV("************** Testing the whole pipeline with actual Recorder ***********");
-    LOGV("************** GL Filling the buffers ***********");
+    ALOGV("Test # %d", testId++);
+    ALOGV("************** Testing the whole pipeline with actual Recorder ***********");
+    ALOGV("************** GL Filling the buffers ***********");
     // Note: No need to set the colorformat for the buffers. The colorformat is
     // in the GRAlloc buffers itself.
 
@@ -876,7 +876,7 @@
     while (nFramesCount <= 300) {
         oneBufferPassGL();
         nFramesCount++;
-        LOGV("framesCount = %d", nFramesCount);
+        ALOGV("framesCount = %d", nFramesCount);
     }
 
     EXPECT_TRUE(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
@@ -885,7 +885,7 @@
     eglDestroySurface(mEglDisplay, mEglSurface);
     mEglSurface = EGL_NO_SURFACE;
 
-    LOGV("Stopping MediaRecorder...");
+    ALOGV("Stopping MediaRecorder...");
     CHECK_EQ(OK, mr->stop());
     mr.clear();
     close(fd);
@@ -895,9 +895,9 @@
 // Actual encoder, Actual GL Buffers Filled SurfaceMediaSource
 // A different pattern is rendered every frame
 TEST_F(SurfaceMediaSourceGLTest, EncodingFromGLRgbaDiffImageEachBufNpotWrite) {
-    LOGV("Test # %d", testId++);
-    LOGV("************** Testing the whole pipeline with actual Recorder ***********");
-    LOGV("************** Diff GL Filling the buffers ***********");
+    ALOGV("Test # %d", testId++);
+    ALOGV("************** Testing the whole pipeline with actual Recorder ***********");
+    ALOGV("************** Diff GL Filling the buffers ***********");
     // Note: No need to set the colorformat for the buffers. The colorformat is
     // in the GRAlloc buffers itself.
 
@@ -919,7 +919,7 @@
     while (nFramesCount <= 300) {
         oneBufferPassGL(nFramesCount);
         nFramesCount++;
-        LOGV("framesCount = %d", nFramesCount);
+        ALOGV("framesCount = %d", nFramesCount);
     }
 
     EXPECT_TRUE(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
@@ -928,7 +928,7 @@
     eglDestroySurface(mEglDisplay, mEglSurface);
     mEglSurface = EGL_NO_SURFACE;
 
-    LOGV("Stopping MediaRecorder...");
+    ALOGV("Stopping MediaRecorder...");
     CHECK_EQ(OK, mr->stop());
     mr.clear();
     close(fd);
diff --git a/media/libstagefright/timedtext/TimedTextParser.cpp b/media/libstagefright/timedtext/TimedTextParser.cpp
index 0bada16..caea0a4 100644
--- a/media/libstagefright/timedtext/TimedTextParser.cpp
+++ b/media/libstagefright/timedtext/TimedTextParser.cpp
@@ -128,7 +128,7 @@
  *  Subtitle number
  *  Start time --> End time
  *  Text of subtitle (one or more lines)
- *  Blank line
+ *  Blank lines
  *
  * .srt file example:
  *  1
@@ -143,15 +143,20 @@
         off64_t *offset, int64_t *startTimeUs, TextInfo *info) {
     AString data;
     status_t err;
+
+    // To skip blank lines.
+    do {
+        if ((err = readNextLine(offset, &data)) != OK) {
+            return err;
+        }
+        data.trim();
+    } while(data.empty());
+
+    // Just ignore the first non-blank line which is subtitle sequence number.
+
     if ((err = readNextLine(offset, &data)) != OK) {
         return err;
     }
-
-    // to skip the first line
-    if ((err = readNextLine(offset, &data)) != OK) {
-        return err;
-    }
-
     int hour1, hour2, min1, min2, sec1, sec2, msec1, msec2;
     // the start time format is: hours:minutes:seconds,milliseconds
     // 00:00:24,600 --> 00:00:27,800
diff --git a/media/mtp/MtpDevice.cpp b/media/mtp/MtpDevice.cpp
index 2e86159..8a8d493 100644
--- a/media/mtp/MtpDevice.cpp
+++ b/media/mtp/MtpDevice.cpp
@@ -765,7 +765,7 @@
 }
 
 bool MtpDevice::sendRequest(MtpOperationCode operation) {
-    LOGV("sendRequest: %s\n", MtpDebug::getOperationCodeName(operation));
+    ALOGV("sendRequest: %s\n", MtpDebug::getOperationCodeName(operation));
     mReceivedResponse = false;
     mRequest.setOperationCode(operation);
     if (mTransactionID > 0)
@@ -776,7 +776,7 @@
 }
 
 bool MtpDevice::sendData() {
-    LOGV("sendData\n");
+    ALOGV("sendData\n");
     mData.setOperationCode(mRequest.getOperationCode());
     mData.setTransactionID(mRequest.getTransactionID());
     int ret = mData.write(mRequestOut);
@@ -787,7 +787,7 @@
 bool MtpDevice::readData() {
     mData.reset();
     int ret = mData.read(mRequestIn1);
-    LOGV("readData returned %d\n", ret);
+    ALOGV("readData returned %d\n", ret);
     if (ret >= MTP_CONTAINER_HEADER_SIZE) {
         if (mData.getContainerType() == MTP_CONTAINER_TYPE_RESPONSE) {
             LOGD("got response packet instead of data packet");
@@ -801,7 +801,7 @@
         return true;
     }
     else {
-        LOGV("readResponse failed\n");
+        ALOGV("readResponse failed\n");
         return false;
     }
 }
@@ -813,7 +813,7 @@
 }
 
 MtpResponseCode MtpDevice::readResponse() {
-    LOGV("readResponse\n");
+    ALOGV("readResponse\n");
     if (mReceivedResponse) {
         mReceivedResponse = false;
         return mResponse.getResponseCode();
diff --git a/media/mtp/MtpDeviceInfo.cpp b/media/mtp/MtpDeviceInfo.cpp
index 5a9322e..108e2b8 100644
--- a/media/mtp/MtpDeviceInfo.cpp
+++ b/media/mtp/MtpDeviceInfo.cpp
@@ -88,9 +88,9 @@
 }
 
 void MtpDeviceInfo::print() {
-    LOGV("Device Info:\n\tmStandardVersion: %d\n\tmVendorExtensionID: %d\n\tmVendorExtensionVersiony: %d\n",
+    ALOGV("Device Info:\n\tmStandardVersion: %d\n\tmVendorExtensionID: %d\n\tmVendorExtensionVersiony: %d\n",
             mStandardVersion, mVendorExtensionID, mVendorExtensionVersion);
-    LOGV("\tmVendorExtensionDesc: %s\n\tmFunctionalCode: %d\n\tmManufacturer: %s\n\tmModel: %s\n\tmVersion: %s\n\tmSerial: %s\n",
+    ALOGV("\tmVendorExtensionDesc: %s\n\tmFunctionalCode: %d\n\tmManufacturer: %s\n\tmModel: %s\n\tmVersion: %s\n\tmSerial: %s\n",
             mVendorExtensionDesc, mFunctionalCode, mManufacturer, mModel, mVersion, mSerial);
 }
 
diff --git a/media/mtp/MtpPacket.cpp b/media/mtp/MtpPacket.cpp
index baf99e5..39815d4 100644
--- a/media/mtp/MtpPacket.cpp
+++ b/media/mtp/MtpPacket.cpp
@@ -73,15 +73,15 @@
         sprintf(bufptr, "%02X ", mBuffer[i]);
         bufptr += strlen(bufptr);
         if (i % DUMP_BYTES_PER_ROW == (DUMP_BYTES_PER_ROW - 1)) {
-            LOGV("%s", buffer);
+            ALOGV("%s", buffer);
             bufptr = buffer;
         }
     }
     if (bufptr != buffer) {
         // print last line
-        LOGV("%s", buffer);
+        ALOGV("%s", buffer);
     }
-    LOGV("\n");
+    ALOGV("\n");
 }
 
 void MtpPacket::copyFrom(const MtpPacket& src) {
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index 1dcfb74..1334e6c 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -153,12 +153,12 @@
 void MtpServer::run() {
     int fd = mFD;
 
-    LOGV("MtpServer::run fd: %d\n", fd);
+    ALOGV("MtpServer::run fd: %d\n", fd);
 
     while (1) {
         int ret = mRequest.read(fd);
         if (ret < 0) {
-            LOGV("request read returned %d, errno: %d", ret, errno);
+            ALOGV("request read returned %d, errno: %d", ret, errno);
             if (errno == ECANCELED) {
                 // return to top of loop and wait for next command
                 continue;
@@ -168,7 +168,7 @@
         MtpOperationCode operation = mRequest.getOperationCode();
         MtpTransactionID transaction = mRequest.getTransactionID();
 
-        LOGV("operation: %s", MtpDebug::getOperationCodeName(operation));
+        ALOGV("operation: %s", MtpDebug::getOperationCodeName(operation));
         mRequest.dump();
 
         // FIXME need to generalize this
@@ -186,7 +186,7 @@
                 }
                 break;
             }
-            LOGV("received data:");
+            ALOGV("received data:");
             mData.dump();
         } else {
             mData.reset();
@@ -196,7 +196,7 @@
             if (!dataIn && mData.hasData()) {
                 mData.setOperationCode(operation);
                 mData.setTransactionID(transaction);
-                LOGV("sending data:");
+                ALOGV("sending data:");
                 mData.dump();
                 ret = mData.write(fd);
                 if (ret < 0) {
@@ -210,7 +210,7 @@
             }
 
             mResponse.setTransactionID(transaction);
-            LOGV("sending response %04X", mResponse.getResponseCode());
+            ALOGV("sending response %04X", mResponse.getResponseCode());
             ret = mResponse.write(fd);
             mResponse.dump();
             if (ret < 0) {
@@ -222,7 +222,7 @@
                 break;
             }
         } else {
-            LOGV("skipping response\n");
+            ALOGV("skipping response\n");
         }
     }
 
@@ -242,22 +242,22 @@
 }
 
 void MtpServer::sendObjectAdded(MtpObjectHandle handle) {
-    LOGV("sendObjectAdded %d\n", handle);
+    ALOGV("sendObjectAdded %d\n", handle);
     sendEvent(MTP_EVENT_OBJECT_ADDED, handle);
 }
 
 void MtpServer::sendObjectRemoved(MtpObjectHandle handle) {
-    LOGV("sendObjectRemoved %d\n", handle);
+    ALOGV("sendObjectRemoved %d\n", handle);
     sendEvent(MTP_EVENT_OBJECT_REMOVED, handle);
 }
 
 void MtpServer::sendStoreAdded(MtpStorageID id) {
-    LOGV("sendStoreAdded %08X\n", id);
+    ALOGV("sendStoreAdded %08X\n", id);
     sendEvent(MTP_EVENT_STORE_ADDED, id);
 }
 
 void MtpServer::sendStoreRemoved(MtpStorageID id) {
-    LOGV("sendStoreRemoved %08X\n", id);
+    ALOGV("sendStoreRemoved %08X\n", id);
     sendEvent(MTP_EVENT_STORE_REMOVED, id);
 }
 
@@ -267,7 +267,7 @@
         mEvent.setTransactionID(mRequest.getTransactionID());
         mEvent.setParameter(1, param1);
         int ret = mEvent.write(mFD);
-        LOGV("mEvent.write returned %d\n", ret);
+        ALOGV("mEvent.write returned %d\n", ret);
     }
 }
 
@@ -614,7 +614,7 @@
         return MTP_RESPONSE_INVALID_OBJECT_HANDLE;
     MtpObjectHandle handle = mRequest.getParameter(1);
     MtpObjectProperty property = mRequest.getParameter(2);
-    LOGV("GetObjectPropValue %d %s\n", handle,
+    ALOGV("GetObjectPropValue %d %s\n", handle,
             MtpDebug::getObjectPropCodeName(property));
 
     return mDatabase->getObjectPropertyValue(handle, property, mData);
@@ -625,7 +625,7 @@
         return MTP_RESPONSE_INVALID_OBJECT_HANDLE;
     MtpObjectHandle handle = mRequest.getParameter(1);
     MtpObjectProperty property = mRequest.getParameter(2);
-    LOGV("SetObjectPropValue %d %s\n", handle,
+    ALOGV("SetObjectPropValue %d %s\n", handle,
             MtpDebug::getObjectPropCodeName(property));
 
     return mDatabase->setObjectPropertyValue(handle, property, mData);
@@ -633,7 +633,7 @@
 
 MtpResponseCode MtpServer::doGetDevicePropValue() {
     MtpDeviceProperty property = mRequest.getParameter(1);
-    LOGV("GetDevicePropValue %s\n",
+    ALOGV("GetDevicePropValue %s\n",
             MtpDebug::getDevicePropCodeName(property));
 
     return mDatabase->getDevicePropertyValue(property, mData);
@@ -641,7 +641,7 @@
 
 MtpResponseCode MtpServer::doSetDevicePropValue() {
     MtpDeviceProperty property = mRequest.getParameter(1);
-    LOGV("SetDevicePropValue %s\n",
+    ALOGV("SetDevicePropValue %s\n",
             MtpDebug::getDevicePropCodeName(property));
 
     return mDatabase->setDevicePropertyValue(property, mData);
@@ -649,7 +649,7 @@
 
 MtpResponseCode MtpServer::doResetDevicePropValue() {
     MtpDeviceProperty property = mRequest.getParameter(1);
-    LOGV("ResetDevicePropValue %s\n",
+    ALOGV("ResetDevicePropValue %s\n",
             MtpDebug::getDevicePropCodeName(property));
 
     return mDatabase->resetDeviceProperty(property);
@@ -665,7 +665,7 @@
     uint32_t property = mRequest.getParameter(3);
     int groupCode = mRequest.getParameter(4);
     int depth = mRequest.getParameter(5);
-   LOGV("GetObjectPropList %d format: %s property: %s group: %d depth: %d\n",
+   ALOGV("GetObjectPropList %d format: %s property: %s group: %d depth: %d\n",
             handle, MtpDebug::getFormatCodeName(format),
             MtpDebug::getObjectPropCodeName(property), groupCode, depth);
 
@@ -736,7 +736,7 @@
 
     // then transfer the file
     int ret = ioctl(mFD, MTP_SEND_FILE_WITH_HEADER, (unsigned long)&mfr);
-    LOGV("MTP_SEND_FILE_WITH_HEADER returned %d\n", ret);
+    ALOGV("MTP_SEND_FILE_WITH_HEADER returned %d\n", ret);
     close(mfr.fd);
     if (ret < 0) {
         if (errno == ECANCELED)
@@ -802,7 +802,7 @@
 
     // transfer the file
     int ret = ioctl(mFD, MTP_SEND_FILE_WITH_HEADER, (unsigned long)&mfr);
-    LOGV("MTP_SEND_FILE_WITH_HEADER returned %d\n", ret);
+    ALOGV("MTP_SEND_FILE_WITH_HEADER returned %d\n", ret);
     close(mfr.fd);
     if (ret < 0) {
         if (errno == ECANCELED)
@@ -857,7 +857,7 @@
     mData.getString(modified);     // date modified
     // keywords follow
 
-    LOGV("name: %s format: %04X\n", (const char *)name, format);
+    ALOGV("name: %s format: %04X\n", (const char *)name, format);
     time_t modifiedTime;
     if (!parseDateTime(modified, modifiedTime))
         modifiedTime = 0;
@@ -954,10 +954,10 @@
             mfr.length = mSendObjectFileSize - initialData;
         }
 
-        LOGV("receiving %s\n", (const char *)mSendObjectFilePath);
+        ALOGV("receiving %s\n", (const char *)mSendObjectFilePath);
         // transfer the file
         ret = ioctl(mFD, MTP_RECEIVE_FILE, (unsigned long)&mfr);
-        LOGV("MTP_RECEIVE_FILE returned %d\n", ret);
+        ALOGV("MTP_RECEIVE_FILE returned %d\n", ret);
     }
     close(mfr.fd);
 
@@ -1052,7 +1052,7 @@
     int64_t fileLength;
     int result = mDatabase->getObjectFilePath(handle, filePath, fileLength, format);
     if (result == MTP_RESPONSE_OK) {
-        LOGV("deleting %s", (const char *)filePath);
+        ALOGV("deleting %s", (const char *)filePath);
         result = mDatabase->deleteFile(handle);
         // Don't delete the actual files unless the database deletion is allowed
         if (result == MTP_RESPONSE_OK) {
@@ -1066,7 +1066,7 @@
 MtpResponseCode MtpServer::doGetObjectPropDesc() {
     MtpObjectProperty propCode = mRequest.getParameter(1);
     MtpObjectFormat format = mRequest.getParameter(2);
-    LOGV("GetObjectPropDesc %s %s\n", MtpDebug::getObjectPropCodeName(propCode),
+    ALOGV("GetObjectPropDesc %s %s\n", MtpDebug::getObjectPropCodeName(propCode),
                                         MtpDebug::getFormatCodeName(format));
     MtpProperty* property = mDatabase->getObjectPropertyDesc(propCode, format);
     if (!property)
@@ -1078,7 +1078,7 @@
 
 MtpResponseCode MtpServer::doGetDevicePropDesc() {
     MtpDeviceProperty propCode = mRequest.getParameter(1);
-    LOGV("GetDevicePropDesc %s\n", MtpDebug::getDevicePropCodeName(propCode));
+    ALOGV("GetDevicePropDesc %s\n", MtpDebug::getDevicePropCodeName(propCode));
     MtpProperty* property = mDatabase->getDevicePropertyDesc(propCode);
     if (!property)
         return MTP_RESPONSE_DEVICE_PROP_NOT_SUPPORTED;
@@ -1109,7 +1109,7 @@
     }
 
     const char* filePath = (const char *)edit->mPath;
-    LOGV("receiving partial %s %lld %lld\n", filePath, offset, length);
+    ALOGV("receiving partial %s %lld %lld\n", filePath, offset, length);
 
     // read the header, and possibly some data
     int ret = mData.read(mFD);
@@ -1131,7 +1131,7 @@
 
         // transfer the file
         ret = ioctl(mFD, MTP_RECEIVE_FILE, (unsigned long)&mfr);
-        LOGV("MTP_RECEIVE_FILE returned %d", ret);
+        ALOGV("MTP_RECEIVE_FILE returned %d", ret);
     }
     if (ret < 0) {
         mResponse.setParameter(1, 0);
diff --git a/media/mtp/MtpStorage.cpp b/media/mtp/MtpStorage.cpp
index 941e303..d77ca72 100644
--- a/media/mtp/MtpStorage.cpp
+++ b/media/mtp/MtpStorage.cpp
@@ -43,7 +43,7 @@
         mReserveSpace(reserveSpace),
         mRemovable(removable)
 {
-    LOGV("MtpStorage id: %d path: %s\n", id, filePath);
+    ALOGV("MtpStorage id: %d path: %s\n", id, filePath);
 }
 
 MtpStorage::~MtpStorage() {
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index e9ac3f9..b48f23d 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -419,7 +419,7 @@
             mClients.add(pid, client);
         }
 
-        LOGV("createTrack() sessionId: %d", (sessionId == NULL) ? -2 : *sessionId);
+        ALOGV("createTrack() sessionId: %d", (sessionId == NULL) ? -2 : *sessionId);
         if (sessionId != NULL && *sessionId != AUDIO_SESSION_OUTPUT_MIX) {
             for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
                 sp<PlaybackThread> t = mPlaybackThreads.valueAt(i);
@@ -444,7 +444,7 @@
                 *sessionId = lSessionId;
             }
         }
-        LOGV("createTrack() lSessionId: %d", lSessionId);
+        ALOGV("createTrack() lSessionId: %d", lSessionId);
 
         track = thread->createTrack_l(client, streamType, sampleRate, format,
                 channelMask, frameCount, sharedBuffer, lSessionId, &lStatus);
@@ -736,7 +736,7 @@
 {
     status_t result;
 
-    LOGV("setParameters(): io %d, keyvalue %s, tid %d, calling tid %d",
+    ALOGV("setParameters(): io %d, keyvalue %s, tid %d, calling tid %d",
             ioHandle, keyValuePairs.string(), gettid(), IPCThreadState::self()->getCallingPid());
     // check calling permissions
     if (!settingsAllowed()) {
@@ -810,7 +810,7 @@
 
 String8 AudioFlinger::getParameters(int ioHandle, const String8& keys)
 {
-//    LOGV("getParameters() io %d, keys %s, tid %d, calling tid %d",
+//    ALOGV("getParameters() io %d, keys %s, tid %d, calling tid %d",
 //            ioHandle, keys.string(), gettid(), IPCThreadState::self()->getCallingPid());
 
     if (ioHandle == 0) {
@@ -907,7 +907,7 @@
         sp<NotificationClient> notificationClient = new NotificationClient(this,
                                                                             client,
                                                                             pid);
-        LOGV("registerClient() client %p, pid %d", notificationClient.get(), pid);
+        ALOGV("registerClient() client %p, pid %d", notificationClient.get(), pid);
 
         mNotificationClients.add(pid, notificationClient);
 
@@ -933,18 +933,18 @@
     int index = mNotificationClients.indexOfKey(pid);
     if (index >= 0) {
         sp <NotificationClient> client = mNotificationClients.valueFor(pid);
-        LOGV("removeNotificationClient() %p, pid %d", client.get(), pid);
+        ALOGV("removeNotificationClient() %p, pid %d", client.get(), pid);
         mNotificationClients.removeItem(pid);
     }
 
-    LOGV("%d died, releasing its sessions", pid);
+    ALOGV("%d died, releasing its sessions", pid);
     int num = mAudioSessionRefs.size();
     bool removed = false;
     for (int i = 0; i< num; i++) {
         AudioSessionRef *ref = mAudioSessionRefs.itemAt(i);
-        LOGV(" pid %d @ %d", ref->pid, i);
+        ALOGV(" pid %d @ %d", ref->pid, i);
         if (ref->pid == pid) {
-            LOGV(" removing entry for pid %d session %d", pid, ref->sessionid);
+            ALOGV(" removing entry for pid %d session %d", pid, ref->sessionid);
             mAudioSessionRefs.removeAt(i);
             delete ref;
             removed = true;
@@ -969,7 +969,7 @@
 // removeClient_l() must be called with AudioFlinger::mLock held
 void AudioFlinger::removeClient_l(pid_t pid)
 {
-    LOGV("removeClient_l() pid %d, tid %d, calling tid %d", pid, gettid(), IPCThreadState::self()->getCallingPid());
+    ALOGV("removeClient_l() pid %d, tid %d, calling tid %d", pid, gettid(), IPCThreadState::self()->getCallingPid());
     mClients.removeItem(pid);
 }
 
@@ -1003,7 +1003,7 @@
     // destroyed in the middle of requestExitAndWait()
     sp <ThreadBase> strongMe = this;
 
-    LOGV("ThreadBase::exit");
+    ALOGV("ThreadBase::exit");
     {
         AutoMutex lock(&mLock);
         mExiting = true;
@@ -1037,7 +1037,7 @@
 {
     status_t status;
 
-    LOGV("ThreadBase::setParameters() %s", keyValuePairs.string());
+    ALOGV("ThreadBase::setParameters() %s", keyValuePairs.string());
     Mutex::Autolock _l(mLock);
 
     mNewParameters.add(keyValuePairs);
@@ -1066,7 +1066,7 @@
     configEvent->mEvent = event;
     configEvent->mParam = param;
     mConfigEvents.add(configEvent);
-    LOGV("sendConfigEvent() num events %d event %d, param %d", mConfigEvents.size(), event, param);
+    ALOGV("sendConfigEvent() num events %d event %d, param %d", mConfigEvents.size(), event, param);
     mWaitWorkCV.signal();
 }
 
@@ -1074,7 +1074,7 @@
 {
     mLock.lock();
     while(!mConfigEvents.isEmpty()) {
-        LOGV("processConfigEvents() remaining events %d", mConfigEvents.size());
+        ALOGV("processConfigEvents() remaining events %d", mConfigEvents.size());
         ConfigEvent *configEvent = mConfigEvents[0];
         mConfigEvents.removeAt(0);
         // release mLock before locking AudioFlinger mLock: lock order is always
@@ -1188,7 +1188,7 @@
         if (status == NO_ERROR) {
             mWakeLockToken = binder;
         }
-        LOGV("acquireWakeLock_l() %s status %d", mName, status);
+        ALOGV("acquireWakeLock_l() %s status %d", mName, status);
     }
 }
 
@@ -1201,7 +1201,7 @@
 void AudioFlinger::ThreadBase::releaseWakeLock_l()
 {
     if (mWakeLockToken != 0) {
-        LOGV("releaseWakeLock_l() %s", mName);
+        ALOGV("releaseWakeLock_l() %s", mName);
         if (mPowerManager != 0) {
             mPowerManager->releaseWakeLock(mWakeLockToken, 0);
         }
@@ -1264,7 +1264,7 @@
             if (sessionEffects.keyAt(i) == EffectChain::kKeyForSuspendAll) {
                 chain->setEffectSuspendedAll_l(true);
             } else {
-                LOGV("checkSuspendOnAddEffectChain_l() suspending effects %08x",
+                ALOGV("checkSuspendOnAddEffectChain_l() suspending effects %08x",
                      desc->mType.timeLow);
                 chain->setEffectSuspended_l(&desc->mType, true);
             }
@@ -1310,7 +1310,7 @@
                 memcpy(&desc->mType, type, sizeof(effect_uuid_t));
             }
             sessionEffects.add(key, desc);
-            LOGV("updateSuspendedSessions_l() suspend adding effect %08x", key);
+            ALOGV("updateSuspendedSessions_l() suspend adding effect %08x", key);
         }
         desc->mRefCount++;
     } else {
@@ -1319,10 +1319,10 @@
         }
         desc = sessionEffects.valueAt(index);
         if (--desc->mRefCount == 0) {
-            LOGV("updateSuspendedSessions_l() restore removing effect %08x", key);
+            ALOGV("updateSuspendedSessions_l() restore removing effect %08x", key);
             sessionEffects.removeItemsAt(index);
             if (sessionEffects.isEmpty()) {
-                LOGV("updateSuspendedSessions_l() restore removing session %d",
+                ALOGV("updateSuspendedSessions_l() restore removing session %d",
                                  sessionId);
                 mSuspendedSessions.removeItem(sessionId);
             }
@@ -1544,7 +1544,7 @@
 
         sp<EffectChain> chain = getEffectChain_l(sessionId);
         if (chain != 0) {
-            LOGV("createTrack_l() setting main buffer %p", chain->inBuffer());
+            ALOGV("createTrack_l() setting main buffer %p", chain->inBuffer());
             track->setMainBuffer(chain->inBuffer());
             chain->setStrategy(AudioSystem::getStrategyForStream((audio_stream_type_t)track->type()));
             chain->incTrackCnt();
@@ -1638,7 +1638,7 @@
         if (track->mainBuffer() != mMixBuffer) {
             sp<EffectChain> chain = getEffectChain_l(track->sessionId());
             if (chain != 0) {
-                LOGV("addTrack_l() starting track on chain %p for session %d", chain.get(), track->sessionId());
+                ALOGV("addTrack_l() starting track on chain %p for session %d", chain.get(), track->sessionId());
                 chain->incActiveTrackCnt();
             }
         }
@@ -1646,7 +1646,7 @@
         status = NO_ERROR;
     }
 
-    LOGV("mWaitWorkCV.broadcast");
+    ALOGV("mWaitWorkCV.broadcast");
     mWaitWorkCV.broadcast();
 
     return status;
@@ -1692,7 +1692,7 @@
     AudioSystem::OutputDescriptor desc;
     void *param2 = 0;
 
-    LOGV("PlaybackThread::audioConfigChanged_l, thread %p, event %d, param %d", this, event, param);
+    ALOGV("PlaybackThread::audioConfigChanged_l, thread %p, event %d, param %d", this, event, param);
 
     switch (event) {
     case AudioSystem::OUTPUT_OPENED:
@@ -1926,7 +1926,7 @@
             if UNLIKELY((!activeTracks.size() && systemTime() > standbyTime) ||
                         mSuspended) {
                 if (!mStandby) {
-                    LOGV("Audio hardware entering standby, mixer %p, mSuspended %d\n", this, mSuspended);
+                    ALOGV("Audio hardware entering standby, mixer %p, mSuspended %d\n", this, mSuspended);
                     mOutput->stream->common.standby(&mOutput->stream->common);
                     mStandby = true;
                     mBytesWritten = 0;
@@ -1940,9 +1940,9 @@
 
                     releaseWakeLock_l();
                     // wait until we have something to do...
-                    LOGV("MixerThread %p TID %d going to sleep\n", this, gettid());
+                    ALOGV("MixerThread %p TID %d going to sleep\n", this, gettid());
                     mWaitWorkCV.wait(mLock);
-                    LOGV("MixerThread %p TID %d waking up\n", this, gettid());
+                    ALOGV("MixerThread %p TID %d waking up\n", this, gettid());
                     acquireWakeLock_l();
 
                     if (mMasterMute == false) {
@@ -2002,7 +2002,7 @@
                        (mixerStatus == MIXER_TRACKS_ENABLED && longStandbyExit)) {
                 memset (mMixBuffer, 0, mixBufferSize);
                 sleepTime = 0;
-                LOGV_IF((mBytesWritten == 0 && (mixerStatus == MIXER_TRACKS_ENABLED && longStandbyExit)), "anticipated start");
+                ALOGV_IF((mBytesWritten == 0 && (mixerStatus == MIXER_TRACKS_ENABLED && longStandbyExit)), "anticipated start");
             }
             // TODO add standby time extension fct of effect tail
         }
@@ -2061,7 +2061,7 @@
 
     releaseWakeLock();
 
-    LOGV("MixerThread %p exiting", this);
+    ALOGV("MixerThread %p exiting", this);
     return false;
 }
 
@@ -2117,7 +2117,7 @@
         if ((cblk->framesReady() >= minFrames) && track->isReady() &&
                 !track->isPaused() && !track->isTerminated())
         {
-            //LOGV("track %d u=%08x, s=%08x [OK] on thread %p", track->name(), cblk->user, cblk->server, this);
+            //ALOGV("track %d u=%08x, s=%08x [OK] on thread %p", track->name(), cblk->user, cblk->server, this);
 
             mixedTracks++;
 
@@ -2223,7 +2223,7 @@
             track->mRetryCount = kMaxTrackRetries;
             mixerStatus = MIXER_TRACKS_READY;
         } else {
-            //LOGV("track %d u=%08x, s=%08x [NOT READY] on thread %p", track->name(), cblk->user, cblk->server, this);
+            //ALOGV("track %d u=%08x, s=%08x [NOT READY] on thread %p", track->name(), cblk->user, cblk->server, this);
             if (track->isStopped()) {
                 track->reset();
             }
@@ -2235,7 +2235,7 @@
                 // No buffers for this track. Give it a few chances to
                 // fill a buffer, then remove it from active list.
                 if (--(track->mRetryCount) <= 0) {
-                    LOGV("BUFFER TIMEOUT: remove(%d) from active list on thread %p", track->name(), this);
+                    ALOGV("BUFFER TIMEOUT: remove(%d) from active list on thread %p", track->name(), this);
                     tracksToRemove->add(track);
                     // indicate to client process that the track was disabled because of underrun
                     android_atomic_or(CBLK_DISABLED_ON, &cblk->flags);
@@ -2256,7 +2256,7 @@
             if (track->mainBuffer() != mMixBuffer) {
                 chain = getEffectChain_l(track->sessionId());
                 if (chain != 0) {
-                    LOGV("stopping track on chain %p for session Id: %d", chain.get(), track->sessionId());
+                    ALOGV("stopping track on chain %p for session Id: %d", chain.get(), track->sessionId());
                     chain->decActiveTrackCnt();
                 }
             }
@@ -2278,7 +2278,7 @@
 
 void AudioFlinger::MixerThread::invalidateTracks(int streamType)
 {
-    LOGV ("MixerThread::invalidateTracks() mixer %p, streamType %d, mTracks.size %d",
+    ALOGV ("MixerThread::invalidateTracks() mixer %p, streamType %d, mTracks.size %d",
             this,  streamType, mTracks.size());
     Mutex::Autolock _l(mLock);
 
@@ -2294,7 +2294,7 @@
 
 void AudioFlinger::PlaybackThread::setStreamValid(int streamType, bool valid)
 {
-    LOGV ("PlaybackThread::setStreamValid() thread %p, streamType %d, valid %d",
+    ALOGV ("PlaybackThread::setStreamValid() thread %p, streamType %d, valid %d",
             this,  streamType, valid);
     Mutex::Autolock _l(mLock);
 
@@ -2310,7 +2310,7 @@
 // deleteTrackName_l() must be called with ThreadBase::mLock held
 void AudioFlinger::MixerThread::deleteTrackName_l(int name)
 {
-    LOGV("remove track (%d) and delete from mixer", name);
+    ALOGV("remove track (%d) and delete from mixer", name);
     mAudioMixer->deleteTrackName(name);
 }
 
@@ -2596,7 +2596,7 @@
                         mSuspended) {
                 // wait until we have something to do...
                 if (!mStandby) {
-                    LOGV("Audio hardware entering standby, mixer %p\n", this);
+                    ALOGV("Audio hardware entering standby, mixer %p\n", this);
                     mOutput->stream->common.standby(&mOutput->stream->common);
                     mStandby = true;
                     mBytesWritten = 0;
@@ -2609,9 +2609,9 @@
                     if (exitPending()) break;
 
                     releaseWakeLock_l();
-                    LOGV("DirectOutputThread %p TID %d going to sleep\n", this, gettid());
+                    ALOGV("DirectOutputThread %p TID %d going to sleep\n", this, gettid());
                     mWaitWorkCV.wait(mLock);
-                    LOGV("DirectOutputThread %p TID %d waking up in active mode\n", this, gettid());
+                    ALOGV("DirectOutputThread %p TID %d waking up in active mode\n", this, gettid());
                     acquireWakeLock_l();
 
                     if (mMasterMute == false) {
@@ -2644,7 +2644,7 @@
                 if (cblk->framesReady() && track->isReady() &&
                         !track->isPaused() && !track->isTerminated())
                 {
-                    //LOGV("track %d u=%08x, s=%08x [OK]", track->name(), cblk->user, cblk->server);
+                    //ALOGV("track %d u=%08x, s=%08x [OK]", track->name(), cblk->user, cblk->server);
 
                     if (track->mFillingUpStatus == Track::FS_FILLED) {
                         track->mFillingUpStatus = Track::FS_ACTIVE;
@@ -2721,7 +2721,7 @@
                     activeTrack = t;
                     mixerStatus = MIXER_TRACKS_READY;
                 } else {
-                    //LOGV("track %d u=%08x, s=%08x [NOT READY]", track->name(), cblk->user, cblk->server);
+                    //ALOGV("track %d u=%08x, s=%08x [NOT READY]", track->name(), cblk->user, cblk->server);
                     if (track->isStopped()) {
                         track->reset();
                     }
@@ -2733,7 +2733,7 @@
                         // No buffers for this track. Give it a few chances to
                         // fill a buffer, then remove it from active list.
                         if (--(track->mRetryCount) <= 0) {
-                            LOGV("BUFFER TIMEOUT: remove(%d) from active list", track->name());
+                            ALOGV("BUFFER TIMEOUT: remove(%d) from active list", track->name());
                             trackToRemove = track;
                         } else {
                             mixerStatus = MIXER_TRACKS_ENABLED;
@@ -2746,7 +2746,7 @@
             if (UNLIKELY(trackToRemove != 0)) {
                 mActiveTracks.remove(trackToRemove);
                 if (!effectChains.isEmpty()) {
-                    LOGV("stopping track on chain %p for session Id: %d", effectChains[0].get(),
+                    ALOGV("stopping track on chain %p for session Id: %d", effectChains[0].get(),
                             trackToRemove->sessionId());
                     effectChains[0]->decActiveTrackCnt();
                 }
@@ -2833,7 +2833,7 @@
 
     releaseWakeLock();
 
-    LOGV("DirectOutputThread %p exiting", this);
+    ALOGV("DirectOutputThread %p exiting", this);
     return false;
 }
 
@@ -3003,9 +3003,9 @@
                     if (exitPending()) break;
 
                     releaseWakeLock_l();
-                    LOGV("DuplicatingThread %p TID %d going to sleep\n", this, gettid());
+                    ALOGV("DuplicatingThread %p TID %d going to sleep\n", this, gettid());
                     mWaitWorkCV.wait(mLock);
-                    LOGV("DuplicatingThread %p TID %d waking up\n", this, gettid());
+                    ALOGV("DuplicatingThread %p TID %d waking up\n", this, gettid());
                     acquireWakeLock_l();
 
                     if (mMasterMute == false) {
@@ -3111,7 +3111,7 @@
     if (outputTrack->cblk() != NULL) {
         thread->setStreamVolume(AUDIO_STREAM_CNT, 1.0f);
         mOutputTracks.add(outputTrack);
-        LOGV("addOutputTrack() track %p, on thread %p", outputTrack, thread);
+        ALOGV("addOutputTrack() track %p, on thread %p", outputTrack, thread);
         updateWaitTime();
     }
 }
@@ -3127,7 +3127,7 @@
             return;
         }
     }
-    LOGV("removeOutputTrack(): unkonwn thread: %p", thread);
+    ALOGV("removeOutputTrack(): unkonwn thread: %p", thread);
 }
 
 void AudioFlinger::DuplicatingThread::updateWaitTime()
@@ -3155,7 +3155,7 @@
         }
         PlaybackThread *playbackThread = (PlaybackThread *)thread.get();
         if (playbackThread->standby() && !playbackThread->isSuspended()) {
-            LOGV("DuplicatingThread output track %p on thread %p Not Ready", outputTracks[i].get(), thread.get());
+            ALOGV("DuplicatingThread output track %p on thread %p Not Ready", outputTracks[i].get(), thread.get());
             return false;
         }
     }
@@ -3191,7 +3191,7 @@
         mFlags(flags & ~SYSTEM_FLAGS_MASK),
         mSessionId(sessionId)
 {
-    LOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size());
+    ALOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size());
 
     // LOGD("Creating track with %d buffers @ %d bytes", bufferCount, bufferSize);
    size_t size = sizeof(audio_track_cblk_t);
@@ -3276,7 +3276,7 @@
 
     result = cblk->stepServer(mFrameCount);
     if (!result) {
-        LOGV("stepServer failed acquiring cblk mutex");
+        ALOGV("stepServer failed acquiring cblk mutex");
         mFlags |= STEPSERVER_FAILED;
     }
     return result;
@@ -3290,7 +3290,7 @@
     cblk->userBase = 0;
     cblk->serverBase = 0;
     mFlags &= (uint32_t)(~SYSTEM_FLAGS_MASK);
-    LOGV("TrackBase::reset");
+    ALOGV("TrackBase::reset");
 }
 
 sp<IMemory> AudioFlinger::ThreadBase::TrackBase::getCblk() const
@@ -3352,7 +3352,7 @@
             mName = playbackThread->getTrackName_l();
             mMainBuffer = playbackThread->mixBuffer();
         }
-        LOGV("Track constructor name %d, calling thread %d", mName, IPCThreadState::self()->getCallingPid());
+        ALOGV("Track constructor name %d, calling thread %d", mName, IPCThreadState::self()->getCallingPid());
         if (mName < 0) {
             LOGE("no more track names available");
         }
@@ -3367,7 +3367,7 @@
 
 AudioFlinger::PlaybackThread::Track::~Track()
 {
-    LOGV("PlaybackThread::Track destructor");
+    ALOGV("PlaybackThread::Track destructor");
     sp<ThreadBase> thread = mThread.promote();
     if (thread != 0) {
         Mutex::Autolock _l(thread->mLock);
@@ -3438,7 +3438,7 @@
      // Check if last stepServer failed, try to step now
      if (mFlags & TrackBase::STEPSERVER_FAILED) {
          if (!step())  goto getNextBuffer_exit;
-         LOGV("stepServer recovered");
+         ALOGV("stepServer recovered");
          mFlags &= ~TrackBase::STEPSERVER_FAILED;
      }
 
@@ -3466,7 +3466,7 @@
 getNextBuffer_exit:
      buffer->raw = 0;
      buffer->frameCount = 0;
-     LOGV("getNextBuffer() no more data for track %d on thread %p", mName, mThread.unsafe_get());
+     ALOGV("getNextBuffer() no more data for track %d on thread %p", mName, mThread.unsafe_get());
      return NOT_ENOUGH_DATA;
 }
 
@@ -3485,7 +3485,7 @@
 status_t AudioFlinger::PlaybackThread::Track::start()
 {
     status_t status = NO_ERROR;
-    LOGV("start(%d), calling thread %d session %d",
+    ALOGV("start(%d), calling thread %d session %d",
             mName, IPCThreadState::self()->getCallingPid(), mSessionId);
     sp<ThreadBase> thread = mThread.promote();
     if (thread != 0) {
@@ -3495,10 +3495,10 @@
         // in both cases "unstop" the track
         if (mState == PAUSED) {
             mState = TrackBase::RESUMING;
-            LOGV("PAUSED => RESUMING (%d) on thread %p", mName, this);
+            ALOGV("PAUSED => RESUMING (%d) on thread %p", mName, this);
         } else {
             mState = TrackBase::ACTIVE;
-            LOGV("? => ACTIVE (%d) on thread %p", mName, this);
+            ALOGV("? => ACTIVE (%d) on thread %p", mName, this);
         }
 
         if (!isOutputTrack() && state != ACTIVE && state != RESUMING) {
@@ -3527,7 +3527,7 @@
 
 void AudioFlinger::PlaybackThread::Track::stop()
 {
-    LOGV("stop(%d), calling thread %d", mName, IPCThreadState::self()->getCallingPid());
+    ALOGV("stop(%d), calling thread %d", mName, IPCThreadState::self()->getCallingPid());
     sp<ThreadBase> thread = mThread.promote();
     if (thread != 0) {
         Mutex::Autolock _l(thread->mLock);
@@ -3539,7 +3539,7 @@
             if (playbackThread->mActiveTracks.indexOf(this) < 0) {
                 reset();
             }
-            LOGV("(> STOPPED) => STOPPED (%d) on thread %p", mName, playbackThread);
+            ALOGV("(> STOPPED) => STOPPED (%d) on thread %p", mName, playbackThread);
         }
         if (!isOutputTrack() && (state == ACTIVE || state == RESUMING)) {
             thread->mLock.unlock();
@@ -3556,13 +3556,13 @@
 
 void AudioFlinger::PlaybackThread::Track::pause()
 {
-    LOGV("pause(%d), calling thread %d", mName, IPCThreadState::self()->getCallingPid());
+    ALOGV("pause(%d), calling thread %d", mName, IPCThreadState::self()->getCallingPid());
     sp<ThreadBase> thread = mThread.promote();
     if (thread != 0) {
         Mutex::Autolock _l(thread->mLock);
         if (mState == ACTIVE || mState == RESUMING) {
             mState = PAUSING;
-            LOGV("ACTIVE/RESUMING => PAUSING (%d) on thread %p", mName, thread.get());
+            ALOGV("ACTIVE/RESUMING => PAUSING (%d) on thread %p", mName, thread.get());
             if (!isOutputTrack()) {
                 thread->mLock.unlock();
                 AudioSystem::stopOutput(thread->id(),
@@ -3579,7 +3579,7 @@
 
 void AudioFlinger::PlaybackThread::Track::flush()
 {
-    LOGV("flush(%d)", mName);
+    ALOGV("flush(%d)", mName);
     sp<ThreadBase> thread = mThread.promote();
     if (thread != 0) {
         Mutex::Autolock _l(thread->mLock);
@@ -3659,7 +3659,7 @@
         mOverflow(false)
 {
     if (mCblk != NULL) {
-       LOGV("RecordTrack constructor, size %d", (int)mBufferEnd - (int)mBuffer);
+       ALOGV("RecordTrack constructor, size %d", (int)mBufferEnd - (int)mBuffer);
        if (format == AUDIO_FORMAT_PCM_16_BIT) {
            mCblk->frameSize = mChannelCount * sizeof(int16_t);
        } else if (format == AUDIO_FORMAT_PCM_8_BIT) {
@@ -3687,7 +3687,7 @@
      // Check if last stepServer failed, try to step now
     if (mFlags & TrackBase::STEPSERVER_FAILED) {
         if (!step()) goto getNextBuffer_exit;
-        LOGV("stepServer recovered");
+        ALOGV("stepServer recovered");
         mFlags &= ~TrackBase::STEPSERVER_FAILED;
     }
 
@@ -3776,7 +3776,7 @@
         mCblk->volume[0] = mCblk->volume[1] = 0x1000;
         mOutBuffer.frameCount = 0;
         playbackThread->mTracks.add(this);
-        LOGV("OutputTrack constructor mCblk %p, mBuffer %p, mCblk->buffers %p, " \
+        ALOGV("OutputTrack constructor mCblk %p, mBuffer %p, mCblk->buffers %p, " \
                 "mCblk->frameCount %d, mCblk->sampleRate %d, mChannelMask 0x%08x mBufferEnd %p",
                 mCblk, mBuffer, mCblk->buffers,
                 mCblk->frameCount, mCblk->sampleRate, mChannelMask, mBufferEnd);
@@ -3858,7 +3858,7 @@
             mOutBuffer.frameCount = pInBuffer->frameCount;
             nsecs_t startTime = systemTime();
             if (obtainBuffer(&mOutBuffer, waitTimeLeftMs) == (status_t)AudioTrack::NO_MORE_BUFFERS) {
-                LOGV ("OutputTrack::write() %p thread %p no more output buffers", this, mThread.unsafe_get());
+                ALOGV ("OutputTrack::write() %p thread %p no more output buffers", this, mThread.unsafe_get());
                 outputBufferFull = true;
                 break;
             }
@@ -3883,7 +3883,7 @@
                 mBufferQueue.removeAt(0);
                 delete [] pInBuffer->mBuffer;
                 delete pInBuffer;
-                LOGV("OutputTrack::write() %p thread %p released overflow buffer %d", this, mThread.unsafe_get(), mBufferQueue.size());
+                ALOGV("OutputTrack::write() %p thread %p released overflow buffer %d", this, mThread.unsafe_get(), mBufferQueue.size());
             } else {
                 break;
             }
@@ -3901,7 +3901,7 @@
                 pInBuffer->i16 = pInBuffer->mBuffer;
                 memcpy(pInBuffer->raw, inBuffer.raw, inBuffer.frameCount * channelCount * sizeof(int16_t));
                 mBufferQueue.add(pInBuffer);
-                LOGV("OutputTrack::write() %p thread %p adding overflow buffer %d", this, mThread.unsafe_get(), mBufferQueue.size());
+                ALOGV("OutputTrack::write() %p thread %p adding overflow buffer %d", this, mThread.unsafe_get(), mBufferQueue.size());
             } else {
                 LOGW("OutputTrack::write() %p thread %p no more overflow buffers", mThread.unsafe_get(), this);
             }
@@ -3935,7 +3935,7 @@
     audio_track_cblk_t* cblk = mCblk;
     uint32_t framesReq = buffer->frameCount;
 
-//    LOGV("OutputTrack::obtainBuffer user %d, server %d", cblk->user, cblk->server);
+//    ALOGV("OutputTrack::obtainBuffer user %d, server %d", cblk->user, cblk->server);
     buffer->frameCount  = 0;
 
     uint32_t framesAvail = cblk->framesAvailable();
@@ -3947,7 +3947,7 @@
         while (framesAvail == 0) {
             active = mActive;
             if (UNLIKELY(!active)) {
-                LOGV("Not active and NO_MORE_BUFFERS");
+                ALOGV("Not active and NO_MORE_BUFFERS");
                 return AudioTrack::NO_MORE_BUFFERS;
             }
             result = cblk->cv.waitRelative(cblk->lock, milliseconds(waitTimeMs));
@@ -4189,12 +4189,12 @@
 }
 
 status_t AudioFlinger::RecordHandle::start() {
-    LOGV("RecordHandle::start()");
+    ALOGV("RecordHandle::start()");
     return mRecordTrack->start();
 }
 
 void AudioFlinger::RecordHandle::stop() {
-    LOGV("RecordHandle::stop()");
+    ALOGV("RecordHandle::stop()");
     mRecordTrack->stop();
 }
 
@@ -4277,10 +4277,10 @@
                 if (exitPending()) break;
 
                 releaseWakeLock_l();
-                LOGV("RecordThread: loop stopping");
+                ALOGV("RecordThread: loop stopping");
                 // go to sleep
                 mWaitWorkCV.wait(mLock);
-                LOGV("RecordThread: loop starting");
+                ALOGV("RecordThread: loop starting");
                 acquireWakeLock_l();
                 continue;
             }
@@ -4436,7 +4436,7 @@
 
     releaseWakeLock();
 
-    LOGV("RecordThread %p exiting", this);
+    ALOGV("RecordThread %p exiting", this);
     return false;
 }
 
@@ -4489,7 +4489,7 @@
 
 status_t AudioFlinger::RecordThread::start(RecordThread::RecordTrack* recordTrack)
 {
-    LOGV("RecordThread::start");
+    ALOGV("RecordThread::start");
     sp <ThreadBase> strongMe = this;
     status_t status = NO_ERROR;
     {
@@ -4519,7 +4519,7 @@
         }
         mActiveTrack->mState = TrackBase::RESUMING;
         // signal thread to start
-        LOGV("Signal record thread");
+        ALOGV("Signal record thread");
         mWaitWorkCV.signal();
         // do not wait for mStartStopCond if exiting
         if (mExiting) {
@@ -4529,11 +4529,11 @@
         }
         mStartStopCond.wait(mLock);
         if (mActiveTrack == 0) {
-            LOGV("Record failed to start");
+            ALOGV("Record failed to start");
             status = BAD_VALUE;
             goto startError;
         }
-        LOGV("Record started OK");
+        ALOGV("Record started OK");
         return status;
     }
 startError:
@@ -4542,7 +4542,7 @@
 }
 
 void AudioFlinger::RecordThread::stop(RecordThread::RecordTrack* recordTrack) {
-    LOGV("RecordThread::stop");
+    ALOGV("RecordThread::stop");
     sp <ThreadBase> strongMe = this;
     {
         AutoMutex lock(&mLock);
@@ -4558,7 +4558,7 @@
                 mLock.unlock();
                 AudioSystem::stopInput(mId);
                 mLock.lock();
-                LOGV("Record stopped OK");
+                ALOGV("Record stopped OK");
             }
         }
     }
@@ -4891,7 +4891,7 @@
     audio_stream_out_t *outStream;
     audio_hw_device_t *outHwDev;
 
-    LOGV("openOutput(), Device %x, SamplingRate %d, Format %d, Channels %x, flags %x",
+    ALOGV("openOutput(), Device %x, SamplingRate %d, Format %d, Channels %x, flags %x",
             pDevices ? *pDevices : 0,
             samplingRate,
             format,
@@ -4910,7 +4910,7 @@
 
     status = outHwDev->open_output_stream(outHwDev, *pDevices, (int *)&format,
                                           &channels, &samplingRate, &outStream);
-    LOGV("openOutput() openOutputStream returned output %p, SamplingRate %d, Format %d, Channels %x, status %d",
+    ALOGV("openOutput() openOutputStream returned output %p, SamplingRate %d, Format %d, Channels %x, status %d",
             outStream,
             samplingRate,
             format,
@@ -4926,10 +4926,10 @@
             (format != AUDIO_FORMAT_PCM_16_BIT) ||
             (channels != AUDIO_CHANNEL_OUT_STEREO)) {
             thread = new DirectOutputThread(this, output, id, *pDevices);
-            LOGV("openOutput() created direct output: ID %d thread %p", id, thread);
+            ALOGV("openOutput() created direct output: ID %d thread %p", id, thread);
         } else {
             thread = new MixerThread(this, output, id, *pDevices);
-            LOGV("openOutput() created mixer output: ID %d thread %p", id, thread);
+            ALOGV("openOutput() created mixer output: ID %d thread %p", id, thread);
         }
         mPlaybackThreads.add(id, thread);
 
@@ -4978,7 +4978,7 @@
             return BAD_VALUE;
         }
 
-        LOGV("closeOutput() %d", output);
+        ALOGV("closeOutput() %d", output);
 
         if (thread->type() == ThreadBase::MIXER) {
             for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
@@ -5012,7 +5012,7 @@
         return BAD_VALUE;
     }
 
-    LOGV("suspendOutput() %d", output);
+    ALOGV("suspendOutput() %d", output);
     thread->suspend();
 
     return NO_ERROR;
@@ -5027,7 +5027,7 @@
         return BAD_VALUE;
     }
 
-    LOGV("restoreOutput() %d", output);
+    ALOGV("restoreOutput() %d", output);
 
     thread->restore();
 
@@ -5065,7 +5065,7 @@
                                         &channels, &samplingRate,
                                         (audio_in_acoustics_t)acoustics,
                                         &inStream);
-    LOGV("openInput() openInputStream returned input %p, SamplingRate %d, Format %d, Channels %x, acoustics %x, status %d",
+    ALOGV("openInput() openInputStream returned input %p, SamplingRate %d, Format %d, Channels %x, acoustics %x, status %d",
             inStream,
             samplingRate,
             format,
@@ -5080,7 +5080,7 @@
         reqFormat == format && format == AUDIO_FORMAT_PCM_16_BIT &&
         (samplingRate <= 2 * reqSamplingRate) &&
         (popcount(channels) < 3) && (popcount(reqChannels) < 3)) {
-        LOGV("openInput() reopening with proposed sampling rate and channels");
+        ALOGV("openInput() reopening with proposed sampling rate and channels");
         status = inHwDev->open_input_stream(inHwDev, *pDevices, (int *)&format,
                                             &channels, &samplingRate,
                                             (audio_in_acoustics_t)acoustics,
@@ -5102,7 +5102,7 @@
                                   id,
                                   device);
         mRecordThreads.add(id, thread);
-        LOGV("openInput() created record thread: ID %d thread %p", id, thread);
+        ALOGV("openInput() created record thread: ID %d thread %p", id, thread);
         if (pSamplingRate) *pSamplingRate = reqSamplingRate;
         if (pFormat) *pFormat = format;
         if (pChannels) *pChannels = reqChannels;
@@ -5129,7 +5129,7 @@
             return BAD_VALUE;
         }
 
-        LOGV("closeInput() %d", input);
+        ALOGV("closeInput() %d", input);
         void *param2 = 0;
         audioConfigChanged_l(AudioSystem::INPUT_CLOSED, input, param2);
         mRecordThreads.removeItem(input);
@@ -5153,7 +5153,7 @@
         return BAD_VALUE;
     }
 
-    LOGV("setStreamOutput() stream %d to output %d", stream, output);
+    ALOGV("setStreamOutput() stream %d to output %d", stream, output);
     audioConfigChanged_l(AudioSystem::STREAM_CONFIG_CHANGED, output, &stream);
 
     dstThread->setStreamValid(stream, true);
@@ -5181,13 +5181,13 @@
 {
     Mutex::Autolock _l(mLock);
     int caller = IPCThreadState::self()->getCallingPid();
-    LOGV("acquiring %d from %d", audioSession, caller);
+    ALOGV("acquiring %d from %d", audioSession, caller);
     int num = mAudioSessionRefs.size();
     for (int i = 0; i< num; i++) {
         AudioSessionRef *ref = mAudioSessionRefs.editItemAt(i);
         if (ref->sessionid == audioSession && ref->pid == caller) {
             ref->cnt++;
-            LOGV(" incremented refcount to %d", ref->cnt);
+            ALOGV(" incremented refcount to %d", ref->cnt);
             return;
         }
     }
@@ -5196,20 +5196,20 @@
     ref->pid = caller;
     ref->cnt = 1;
     mAudioSessionRefs.push(ref);
-    LOGV(" added new entry for %d", ref->sessionid);
+    ALOGV(" added new entry for %d", ref->sessionid);
 }
 
 void AudioFlinger::releaseAudioSessionId(int audioSession)
 {
     Mutex::Autolock _l(mLock);
     int caller = IPCThreadState::self()->getCallingPid();
-    LOGV("releasing %d from %d", audioSession, caller);
+    ALOGV("releasing %d from %d", audioSession, caller);
     int num = mAudioSessionRefs.size();
     for (int i = 0; i< num; i++) {
         AudioSessionRef *ref = mAudioSessionRefs.itemAt(i);
         if (ref->sessionid == audioSession && ref->pid == caller) {
             ref->cnt--;
-            LOGV(" decremented refcount to %d", ref->cnt);
+            ALOGV(" decremented refcount to %d", ref->cnt);
             if (ref->cnt == 0) {
                 mAudioSessionRefs.removeAt(i);
                 delete ref;
@@ -5223,7 +5223,7 @@
 
 void AudioFlinger::purgeStaleEffects_l() {
 
-    LOGV("purging stale effects");
+    ALOGV("purging stale effects");
 
     Vector< sp<EffectChain> > chains;
 
@@ -5256,7 +5256,7 @@
         for (size_t k = 0; k < numsessionrefs; k++) {
             AudioSessionRef *ref = mAudioSessionRefs.itemAt(k);
             if (ref->sessionid == sessionid) {
-                LOGV(" session %d still exists for %d with %d refs",
+                ALOGV(" session %d still exists for %d with %d refs",
                      sessionid, ref->pid, ref->cnt);
                 found = true;
                 break;
@@ -5386,7 +5386,7 @@
     sp<Client> client;
     wp<Client> wclient;
 
-    LOGV("createEffect pid %d, client %p, priority %d, sessionId %d, io %d",
+    ALOGV("createEffect pid %d, client %p, priority %d, sessionId %d, io %d",
             pid, effectClient.get(), priority, sessionId, io);
 
     if (pDesc == NULL) {
@@ -5525,7 +5525,7 @@
             if (io == 0 && mPlaybackThreads.size()) {
                 io = mPlaybackThreads.keyAt(0);
             }
-            LOGV("createEffect() got io %d for effect %s", io, desc.name);
+            ALOGV("createEffect() got io %d for effect %s", io, desc.name);
         }
         ThreadBase *thread = checkRecordThread_l(io);
         if (thread == NULL) {
@@ -5563,7 +5563,7 @@
 
 status_t AudioFlinger::moveEffects(int sessionId, int srcOutput, int dstOutput)
 {
-    LOGV("moveEffects() session %d, srcOutput %d, dstOutput %d",
+    ALOGV("moveEffects() session %d, srcOutput %d, dstOutput %d",
             sessionId, srcOutput, dstOutput);
     Mutex::Autolock _l(mLock);
     if (srcOutput == dstOutput) {
@@ -5594,7 +5594,7 @@
                                    AudioFlinger::PlaybackThread *dstThread,
                                    bool reRegister)
 {
-    LOGV("moveEffectChain_l() session %d from thread %p to thread %p",
+    ALOGV("moveEffectChain_l() session %d from thread %p to thread %p",
             sessionId, srcThread, dstThread);
 
     sp<EffectChain> chain = srcThread->getEffectChain_l(sessionId);
@@ -5694,7 +5694,7 @@
         goto Exit;
     }
 
-    LOGV("createEffect_l() thread %p effect %s on session %d", this, desc->name, sessionId);
+    ALOGV("createEffect_l() thread %p effect %s on session %d", this, desc->name, sessionId);
 
     { // scope for mLock
         Mutex::Autolock _l(mLock);
@@ -5703,7 +5703,7 @@
         chain = getEffectChain_l(sessionId);
         if (chain == 0) {
             // create a new chain for this session
-            LOGV("createEffect_l() new effect chain for session %d", sessionId);
+            ALOGV("createEffect_l() new effect chain for session %d", sessionId);
             chain = new EffectChain(this, sessionId);
             addEffectChain_l(chain);
             chain->setStrategy(getStrategyForSession_l(sessionId));
@@ -5712,7 +5712,7 @@
             effect = chain->getEffectFromDesc_l(desc);
         }
 
-        LOGV("createEffect_l() got effect %p on chain %p", effect == 0 ? 0 : effect.get(), chain.get());
+        ALOGV("createEffect_l() got effect %p on chain %p", effect == 0 ? 0 : effect.get(), chain.get());
 
         if (effect == 0) {
             int id = mAudioFlinger->nextUniqueId();
@@ -5788,13 +5788,13 @@
 
     if (chain == 0) {
         // create a new chain for this session
-        LOGV("addEffect_l() new effect chain for session %d", sessionId);
+        ALOGV("addEffect_l() new effect chain for session %d", sessionId);
         chain = new EffectChain(this, sessionId);
         addEffectChain_l(chain);
         chain->setStrategy(getStrategyForSession_l(sessionId));
         chainCreated = true;
     }
-    LOGV("addEffect_l() %p chain %p effect %p", this, chain.get(), effect.get());
+    ALOGV("addEffect_l() %p chain %p effect %p", this, chain.get(), effect.get());
 
     if (chain->getEffectFromId_l(effect->id()) != 0) {
         LOGW("addEffect_l() %p effect %s already present in chain %p",
@@ -5817,7 +5817,7 @@
 
 void AudioFlinger::ThreadBase::removeEffect_l(const sp<EffectModule>& effect) {
 
-    LOGV("removeEffect_l() %p effect %p", this, effect.get());
+    ALOGV("removeEffect_l() %p effect %p", this, effect.get());
     effect_descriptor_t desc = effect->desc();
     if ((desc.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_AUXILIARY) {
         detachAuxEffect_l(effect->id());
@@ -5885,7 +5885,7 @@
                                                     bool unpiniflast) {
 
     Mutex::Autolock _l(mLock);
-    LOGV("disconnectEffect() %p effect %p", this, effect.get());
+    ALOGV("disconnectEffect() %p effect %p", this, effect.get());
     // delete the effect module if removing last handle on it
     if (effect->removeHandle(handle) == 0) {
         if (!effect->isPinned() || unpiniflast) {
@@ -5901,7 +5901,7 @@
     int16_t *buffer = mMixBuffer;
     bool ownsBuffer = false;
 
-    LOGV("addEffectChain_l() %p on thread %p for session %d", chain.get(), this, session);
+    ALOGV("addEffectChain_l() %p on thread %p for session %d", chain.get(), this, session);
     if (session > 0) {
         // Only one effect chain can be present in direct output thread and it uses
         // the mix buffer as input
@@ -5909,7 +5909,7 @@
             size_t numSamples = mFrameCount * mChannelCount;
             buffer = new int16_t[numSamples];
             memset(buffer, 0, numSamples * sizeof(int16_t));
-            LOGV("addEffectChain_l() creating new input buffer %p session %d", buffer, session);
+            ALOGV("addEffectChain_l() creating new input buffer %p session %d", buffer, session);
             ownsBuffer = true;
         }
 
@@ -5917,7 +5917,7 @@
         for (size_t i = 0; i < mTracks.size(); ++i) {
             sp<Track> track = mTracks[i];
             if (session == track->sessionId()) {
-                LOGV("addEffectChain_l() track->setMainBuffer track %p buffer %p", track.get(), buffer);
+                ALOGV("addEffectChain_l() track->setMainBuffer track %p buffer %p", track.get(), buffer);
                 track->setMainBuffer(buffer);
                 chain->incTrackCnt();
             }
@@ -5928,7 +5928,7 @@
             sp<Track> track = mActiveTracks[i].promote();
             if (track == 0) continue;
             if (session == track->sessionId()) {
-                LOGV("addEffectChain_l() activating track %p on session %d", track.get(), session);
+                ALOGV("addEffectChain_l() activating track %p on session %d", track.get(), session);
                 chain->incActiveTrackCnt();
             }
         }
@@ -5961,7 +5961,7 @@
 {
     int session = chain->sessionId();
 
-    LOGV("removeEffectChain_l() %p from thread %p for session %d", chain.get(), this, session);
+    ALOGV("removeEffectChain_l() %p from thread %p for session %d", chain.get(), this, session);
 
     for (size_t i = 0; i < mEffectChains.size(); i++) {
         if (chain == mEffectChains[i]) {
@@ -5971,7 +5971,7 @@
                 sp<Track> track = mActiveTracks[i].promote();
                 if (track == 0) continue;
                 if (session == track->sessionId()) {
-                    LOGV("removeEffectChain_l(): stopping track on chain %p for session Id: %d",
+                    ALOGV("removeEffectChain_l(): stopping track on chain %p for session Id: %d",
                             chain.get(), session);
                     chain->decActiveTrackCnt();
                 }
@@ -6037,7 +6037,7 @@
     if (mEffectChains.size() != 0) {
         return INVALID_OPERATION;
     }
-    LOGV("addEffectChain_l() %p on thread %p", chain.get(), this);
+    ALOGV("addEffectChain_l() %p on thread %p", chain.get(), this);
 
     chain->setInBuffer(NULL);
     chain->setOutBuffer(NULL);
@@ -6051,7 +6051,7 @@
 
 size_t AudioFlinger::RecordThread::removeEffectChain_l(const sp<EffectChain>& chain)
 {
-    LOGV("removeEffectChain_l() %p from thread %p", chain.get(), this);
+    ALOGV("removeEffectChain_l() %p from thread %p", chain.get(), this);
     LOGW_IF(mEffectChains.size() != 1,
             "removeEffectChain_l() %p invalid chain size %d on thread %p",
             chain.get(), mEffectChains.size(), this);
@@ -6076,7 +6076,7 @@
     : mThread(wThread), mChain(chain), mId(id), mSessionId(sessionId), mEffectInterface(NULL),
       mStatus(NO_INIT), mState(IDLE), mSuspended(false)
 {
-    LOGV("Constructor %p", this);
+    ALOGV("Constructor %p", this);
     int lStatus;
     sp<ThreadBase> thread = mThread.promote();
     if (thread == 0) {
@@ -6100,17 +6100,17 @@
     if (mSessionId > AUDIO_SESSION_OUTPUT_MIX) {
         mPinned = true;
     }
-    LOGV("Constructor success name %s, Interface %p", mDescriptor.name, mEffectInterface);
+    ALOGV("Constructor success name %s, Interface %p", mDescriptor.name, mEffectInterface);
     return;
 Error:
     EffectRelease(mEffectInterface);
     mEffectInterface = NULL;
-    LOGV("Constructor Error %d", mStatus);
+    ALOGV("Constructor Error %d", mStatus);
 }
 
 AudioFlinger::EffectModule::~EffectModule()
 {
-    LOGV("Destructor %p", this);
+    ALOGV("Destructor %p", this);
     if (mEffectInterface != NULL) {
         if ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_PRE_PROC ||
                 (mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_POST_PROC) {
@@ -6154,7 +6154,7 @@
     } else {
         status = ALREADY_EXISTS;
     }
-    LOGV("addHandle() %p added handle %p in position %d", this, handle.get(), i);
+    ALOGV("addHandle() %p added handle %p in position %d", this, handle.get(), i);
     mHandles.insertAt(handle, i);
     return status;
 }
@@ -6170,12 +6170,12 @@
     if (i == size) {
         return size;
     }
-    LOGV("removeHandle() %p removed handle %p in position %d", this, handle.unsafe_get(), i);
+    ALOGV("removeHandle() %p removed handle %p in position %d", this, handle.unsafe_get(), i);
 
     bool enabled = false;
     EffectHandle *hdl = handle.unsafe_get();
     if (hdl) {
-        LOGV("removeHandle() unsafe_get OK");
+        ALOGV("removeHandle() unsafe_get OK");
         enabled = hdl->enabled();
     }
     mHandles.removeAt(i);
@@ -6210,7 +6210,7 @@
 
 void AudioFlinger::EffectModule::disconnect(const wp<EffectHandle>& handle, bool unpiniflast)
 {
-    LOGV("disconnect() %p handle %p ", this, handle.unsafe_get());
+    ALOGV("disconnect() %p handle %p ", this, handle.unsafe_get());
     // keep a strong reference on this EffectModule to avoid calling the
     // destructor before we exit
     sp<EffectModule> keep(this);
@@ -6370,7 +6370,7 @@
     mConfig.inputCfg.buffer.frameCount = thread->frameCount();
     mConfig.outputCfg.buffer.frameCount = mConfig.inputCfg.buffer.frameCount;
 
-    LOGV("configure() %p thread %p buffer %p framecount %d",
+    ALOGV("configure() %p thread %p buffer %p framecount %d",
             this, thread.get(), mConfig.inputCfg.buffer.raw, mConfig.inputCfg.buffer.frameCount);
 
     status_t cmdStatus;
@@ -6490,7 +6490,7 @@
                                              void *pReplyData)
 {
     Mutex::Autolock _l(mLock);
-//    LOGV("command(), cmdCode: %d, mEffectInterface: %p", cmdCode, mEffectInterface);
+//    ALOGV("command(), cmdCode: %d, mEffectInterface: %p", cmdCode, mEffectInterface);
 
     if (mState == DESTROYED || mEffectInterface == NULL) {
         return NO_INIT;
@@ -6517,7 +6517,7 @@
 {
 
     Mutex::Autolock _l(mLock);
-    LOGV("setEnabled %p enabled %d", this, enabled);
+    ALOGV("setEnabled %p enabled %d", this, enabled);
 
     if (enabled != isEnabled()) {
         status_t status = AudioSystem::setEffectEnabled(mId, enabled);
@@ -6799,7 +6799,7 @@
     mEffect(effect), mEffectClient(effectClient), mClient(client), mCblk(NULL),
     mPriority(priority), mHasControl(false), mEnabled(false)
 {
-    LOGV("constructor %p", this);
+    ALOGV("constructor %p", this);
 
     if (client == 0) {
         return;
@@ -6821,14 +6821,14 @@
 
 AudioFlinger::EffectHandle::~EffectHandle()
 {
-    LOGV("Destructor %p", this);
+    ALOGV("Destructor %p", this);
     disconnect(false);
-    LOGV("Destructor DONE %p", this);
+    ALOGV("Destructor DONE %p", this);
 }
 
 status_t AudioFlinger::EffectHandle::enable()
 {
-    LOGV("enable %p", this);
+    ALOGV("enable %p", this);
     if (!mHasControl) return INVALID_OPERATION;
     if (mEffect == 0) return DEAD_OBJECT;
 
@@ -6860,7 +6860,7 @@
 
 status_t AudioFlinger::EffectHandle::disable()
 {
-    LOGV("disable %p", this);
+    ALOGV("disable %p", this);
     if (!mHasControl) return INVALID_OPERATION;
     if (mEffect == 0) return DEAD_OBJECT;
 
@@ -6890,7 +6890,7 @@
 
 void AudioFlinger::EffectHandle::disconnect(bool unpiniflast)
 {
-    LOGV("disconnect(%s)", unpiniflast ? "true" : "false");
+    ALOGV("disconnect(%s)", unpiniflast ? "true" : "false");
     if (mEffect == 0) {
         return;
     }
@@ -6921,7 +6921,7 @@
                                              uint32_t *replySize,
                                              void *pReplyData)
 {
-//    LOGV("command(), cmdCode: %d, mHasControl: %d, mEffect: %p",
+//    ALOGV("command(), cmdCode: %d, mHasControl: %d, mEffect: %p",
 //              cmdCode, mHasControl, (mEffect == 0) ? 0 : mEffect.get());
 
     // only get parameter command is permitted for applications not controlling the effect
@@ -6997,7 +6997,7 @@
 
 void AudioFlinger::EffectHandle::setControl(bool hasControl, bool signal, bool enabled)
 {
-    LOGV("setControl %p control %d", this, hasControl);
+    ALOGV("setControl %p control %d", this, hasControl);
 
     mHasControl = hasControl;
     mEnabled = enabled;
@@ -7277,7 +7277,7 @@
         }
         mEffects.insertAt(effect, idx_insert);
 
-        LOGV("addEffect_l() effect %p, added in chain %p at rank %d", effect.get(), this, idx_insert);
+        ALOGV("addEffect_l() effect %p, added in chain %p at rank %d", effect.get(), this, idx_insert);
     }
     effect->configure();
     return NO_ERROR;
@@ -7309,7 +7309,7 @@
                 }
             }
             mEffects.removeAt(i);
-            LOGV("removeEffect_l() effect %p, removed from chain %p at rank %d", effect.get(), this, i);
+            ALOGV("removeEffect_l() effect %p, removed from chain %p at rank %d", effect.get(), this, i);
             break;
         }
     }
@@ -7446,7 +7446,7 @@
             desc = new SuspendedEffectDesc();
             memcpy(&desc->mType, type, sizeof(effect_uuid_t));
             mSuspendedEffects.add(type->timeLow, desc);
-            LOGV("setEffectSuspended_l() add entry for %08x", type->timeLow);
+            ALOGV("setEffectSuspended_l() add entry for %08x", type->timeLow);
         }
         if (desc->mRefCount++ == 0) {
             sp<EffectModule> effect = getEffectIfEnabled(type);
@@ -7466,7 +7466,7 @@
             desc->mRefCount = 1;
         }
         if (--desc->mRefCount == 0) {
-            LOGV("setEffectSuspended_l() remove entry for %08x", mSuspendedEffects.keyAt(index));
+            ALOGV("setEffectSuspended_l() remove entry for %08x", mSuspendedEffects.keyAt(index));
             if (desc->mEffect != 0) {
                 sp<EffectModule> effect = desc->mEffect.promote();
                 if (effect != 0) {
@@ -7495,7 +7495,7 @@
         } else {
             desc = new SuspendedEffectDesc();
             mSuspendedEffects.add((int)kKeyForSuspendAll, desc);
-            LOGV("setEffectSuspendedAll_l() add entry for 0");
+            ALOGV("setEffectSuspendedAll_l() add entry for 0");
         }
         if (desc->mRefCount++ == 0) {
             Vector< sp<EffectModule> > effects = getSuspendEligibleEffects();
@@ -7523,7 +7523,7 @@
             for (size_t i = 0; i < types.size(); i++) {
                 setEffectSuspended_l(types[i], false);
             }
-            LOGV("setEffectSuspendedAll_l() remove entry for %08x", mSuspendedEffects.keyAt(index));
+            ALOGV("setEffectSuspendedAll_l() remove entry for %08x", mSuspendedEffects.keyAt(index));
             mSuspendedEffects.removeItem((int)kKeyForSuspendAll);
         }
     }
@@ -7593,7 +7593,7 @@
                 return;
             }
         }
-        LOGV("checkSuspendOnEffectEnabled() enable suspending fx %08x",
+        ALOGV("checkSuspendOnEffectEnabled() enable suspending fx %08x",
              effect->desc().type.timeLow);
         sp<SuspendedEffectDesc> desc = mSuspendedEffects.valueAt(index);
         // if effect is requested to suspended but was not yet enabled, supend it now.
@@ -7606,7 +7606,7 @@
         if (index < 0) {
             return;
         }
-        LOGV("checkSuspendOnEffectEnabled() disable restoring fx %08x",
+        ALOGV("checkSuspendOnEffectEnabled() disable restoring fx %08x",
              effect->desc().type.timeLow);
         sp<SuspendedEffectDesc> desc = mSuspendedEffects.valueAt(index);
         desc->mEffect.clear();
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index 6e9319d..7c7fa56 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -99,7 +99,7 @@
         n++;
     }
     if (mask) {
-        LOGV("add track (%d)", n);
+        ALOGV("add track (%d)", n);
         mTrackNames |= mask;
         return TRACK0 + n;
     }
@@ -118,7 +118,7 @@
  {
     name -= TRACK0;
     if (uint32_t(name) < MAX_NUM_TRACKS) {
-        LOGV("deleteTrackName(%d)", name);
+        ALOGV("deleteTrackName(%d)", name);
         track_t& track(mState.tracks[ name ]);
         if (track.enabled != 0) {
             track.enabled = 0;
@@ -143,7 +143,7 @@
         case MIXING: {
             if (mState.tracks[ mActiveTrack ].enabled != 1) {
                 mState.tracks[ mActiveTrack ].enabled = 1;
-                LOGV("enable(%d)", mActiveTrack);
+                ALOGV("enable(%d)", mActiveTrack);
                 invalidateState(1<<mActiveTrack);
             }
         } break;
@@ -159,7 +159,7 @@
         case MIXING: {
             if (mState.tracks[ mActiveTrack ].enabled != 0) {
                 mState.tracks[ mActiveTrack ].enabled = 0;
-                LOGV("disable(%d)", mActiveTrack);
+                ALOGV("disable(%d)", mActiveTrack);
                 invalidateState(1<<mActiveTrack);
             }
         } break;
@@ -192,7 +192,7 @@
                 if ((channelCount <= MAX_NUM_CHANNELS) && (channelCount)) {
                     mState.tracks[ mActiveTrack ].channelMask = mask;
                     mState.tracks[ mActiveTrack ].channelCount = channelCount;
-                    LOGV("setParameter(TRACK, CHANNEL_MASK, %x)", mask);
+                    ALOGV("setParameter(TRACK, CHANNEL_MASK, %x)", mask);
                     invalidateState(1<<mActiveTrack);
                     return NO_ERROR;
                 }
@@ -203,7 +203,7 @@
         if (name == MAIN_BUFFER) {
             if (mState.tracks[ mActiveTrack ].mainBuffer != valueBuf) {
                 mState.tracks[ mActiveTrack ].mainBuffer = valueBuf;
-                LOGV("setParameter(TRACK, MAIN_BUFFER, %p)", valueBuf);
+                ALOGV("setParameter(TRACK, MAIN_BUFFER, %p)", valueBuf);
                 invalidateState(1<<mActiveTrack);
             }
             return NO_ERROR;
@@ -211,7 +211,7 @@
         if (name == AUX_BUFFER) {
             if (mState.tracks[ mActiveTrack ].auxBuffer != valueBuf) {
                 mState.tracks[ mActiveTrack ].auxBuffer = valueBuf;
-                LOGV("setParameter(TRACK, AUX_BUFFER, %p)", valueBuf);
+                ALOGV("setParameter(TRACK, AUX_BUFFER, %p)", valueBuf);
                 invalidateState(1<<mActiveTrack);
             }
             return NO_ERROR;
@@ -223,7 +223,7 @@
             if (valueInt > 0) {
                 track_t& track = mState.tracks[ mActiveTrack ];
                 if (track.setResampler(uint32_t(valueInt), mSampleRate)) {
-                    LOGV("setParameter(RESAMPLE, SAMPLE_RATE, %u)",
+                    ALOGV("setParameter(RESAMPLE, SAMPLE_RATE, %u)",
                             uint32_t(valueInt));
                     invalidateState(1<<mActiveTrack);
                 }
@@ -242,7 +242,7 @@
         if ((uint32_t(name-VOLUME0) < MAX_NUM_CHANNELS)) {
             track_t& track = mState.tracks[ mActiveTrack ];
             if (track.volume[name-VOLUME0] != valueInt) {
-                LOGV("setParameter(VOLUME, VOLUME0/1: %04x)", valueInt);
+                ALOGV("setParameter(VOLUME, VOLUME0/1: %04x)", valueInt);
                 track.prevVolume[name-VOLUME0] = track.volume[name-VOLUME0] << 16;
                 track.volume[name-VOLUME0] = valueInt;
                 if (target == VOLUME) {
@@ -262,7 +262,7 @@
         } else if (name == AUXLEVEL) {
             track_t& track = mState.tracks[ mActiveTrack ];
             if (track.auxLevel != valueInt) {
-                LOGV("setParameter(VOLUME, AUXLEVEL: %04x)", valueInt);
+                ALOGV("setParameter(VOLUME, AUXLEVEL: %04x)", valueInt);
                 track.prevAuxLevel = track.auxLevel << 16;
                 track.auxLevel = valueInt;
                 if (target == VOLUME) {
@@ -445,7 +445,7 @@
         }
     }
 
-    LOGV("mixer configuration change: %d activeTracks (%08x) "
+    ALOGV("mixer configuration change: %d activeTracks (%08x) "
         "all16BitsStereoNoResample=%d, resampling=%d, volumeRamp=%d",
         countActiveTracks, state->enabledTracks,
         all16BitsStereoNoResample, resampling, volumeRamp);
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp
index 8da5ca1..840d70d 100644
--- a/services/audioflinger/AudioPolicyService.cpp
+++ b/services/audioflinger/AudioPolicyService.cpp
@@ -169,7 +169,7 @@
         return BAD_VALUE;
     }
 
-    LOGV("setDeviceConnectionState() tid %d", gettid());
+    ALOGV("setDeviceConnectionState() tid %d", gettid());
     Mutex::Autolock _l(mLock);
     return mpAudioPolicy->set_device_connection_state(mpAudioPolicy, device,
                                                       state, device_address);
@@ -198,7 +198,7 @@
         return BAD_VALUE;
     }
 
-    LOGV("setPhoneState() tid %d", gettid());
+    ALOGV("setPhoneState() tid %d", gettid());
 
     // TODO: check if it is more appropriate to do it in platform specific policy manager
     AudioSystem::setMode(state);
@@ -236,7 +236,7 @@
     if (config < 0 || config >= AUDIO_POLICY_FORCE_CFG_CNT) {
         return BAD_VALUE;
     }
-    LOGV("setForceUse() tid %d", gettid());
+    ALOGV("setForceUse() tid %d", gettid());
     Mutex::Autolock _l(mLock);
     mpAudioPolicy->set_force_use(mpAudioPolicy, usage, config);
     return NO_ERROR;
@@ -262,7 +262,7 @@
     if (mpAudioPolicy == NULL) {
         return 0;
     }
-    LOGV("getOutput() tid %d", gettid());
+    ALOGV("getOutput() tid %d", gettid());
     Mutex::Autolock _l(mLock);
     return mpAudioPolicy->get_output(mpAudioPolicy, stream, samplingRate, format, channels, flags);
 }
@@ -274,7 +274,7 @@
     if (mpAudioPolicy == NULL) {
         return NO_INIT;
     }
-    LOGV("startOutput() tid %d", gettid());
+    ALOGV("startOutput() tid %d", gettid());
     Mutex::Autolock _l(mLock);
     return mpAudioPolicy->start_output(mpAudioPolicy, output, stream, session);
 }
@@ -286,7 +286,7 @@
     if (mpAudioPolicy == NULL) {
         return NO_INIT;
     }
-    LOGV("stopOutput() tid %d", gettid());
+    ALOGV("stopOutput() tid %d", gettid());
     Mutex::Autolock _l(mLock);
     return mpAudioPolicy->stop_output(mpAudioPolicy, output, stream, session);
 }
@@ -296,7 +296,7 @@
     if (mpAudioPolicy == NULL) {
         return;
     }
-    LOGV("releaseOutput() tid %d", gettid());
+    ALOGV("releaseOutput() tid %d", gettid());
     Mutex::Autolock _l(mLock);
     mpAudioPolicy->release_output(mpAudioPolicy, output);
 }
@@ -672,7 +672,7 @@
                 case START_TONE: {
                     mLock.unlock();
                     ToneData *data = (ToneData *)command->mParam;
-                    LOGV("AudioCommandThread() processing start tone %d on stream %d",
+                    ALOGV("AudioCommandThread() processing start tone %d on stream %d",
                             data->mType, data->mStream);
                     if (mpToneGenerator != NULL)
                         delete mpToneGenerator;
@@ -683,7 +683,7 @@
                     }break;
                 case STOP_TONE: {
                     mLock.unlock();
-                    LOGV("AudioCommandThread() processing stop tone");
+                    ALOGV("AudioCommandThread() processing stop tone");
                     if (mpToneGenerator != NULL) {
                         mpToneGenerator->stopTone();
                         delete mpToneGenerator;
@@ -693,7 +693,7 @@
                     }break;
                 case SET_VOLUME: {
                     VolumeData *data = (VolumeData *)command->mParam;
-                    LOGV("AudioCommandThread() processing set volume stream %d, \
+                    ALOGV("AudioCommandThread() processing set volume stream %d, \
                             volume %f, output %d", data->mStream, data->mVolume, data->mIO);
                     command->mStatus = AudioSystem::setStreamVolume(data->mStream,
                                                                     data->mVolume,
@@ -706,7 +706,7 @@
                     }break;
                 case SET_PARAMETERS: {
                      ParametersData *data = (ParametersData *)command->mParam;
-                     LOGV("AudioCommandThread() processing set parameters string %s, io %d",
+                     ALOGV("AudioCommandThread() processing set parameters string %s, io %d",
                              data->mKeyValuePairs.string(), data->mIO);
                      command->mStatus = AudioSystem::setParameters(data->mIO, data->mKeyValuePairs);
                      if (command->mWaitStatus) {
@@ -717,7 +717,7 @@
                      }break;
                 case SET_VOICE_VOLUME: {
                     VoiceVolumeData *data = (VoiceVolumeData *)command->mParam;
-                    LOGV("AudioCommandThread() processing set voice volume volume %f",
+                    ALOGV("AudioCommandThread() processing set voice volume volume %f",
                             data->mVolume);
                     command->mStatus = AudioSystem::setVoiceVolume(data->mVolume);
                     if (command->mWaitStatus) {
@@ -740,9 +740,9 @@
         if (mName != "" && mAudioCommands.isEmpty()) {
             release_wake_lock(mName.string());
         }
-        LOGV("AudioCommandThread() going to sleep");
+        ALOGV("AudioCommandThread() going to sleep");
         mWaitWorkCV.waitRelative(mLock, waitTime);
-        LOGV("AudioCommandThread() waking up");
+        ALOGV("AudioCommandThread() waking up");
     }
     mLock.unlock();
     return false;
@@ -793,7 +793,7 @@
     command->mWaitStatus = false;
     Mutex::Autolock _l(mLock);
     insertCommand_l(command);
-    LOGV("AudioCommandThread() adding tone start type %d, stream %d", type, stream);
+    ALOGV("AudioCommandThread() adding tone start type %d, stream %d", type, stream);
     mWaitWorkCV.signal();
 }
 
@@ -805,7 +805,7 @@
     command->mWaitStatus = false;
     Mutex::Autolock _l(mLock);
     insertCommand_l(command);
-    LOGV("AudioCommandThread() adding tone stop");
+    ALOGV("AudioCommandThread() adding tone stop");
     mWaitWorkCV.signal();
 }
 
@@ -830,7 +830,7 @@
     }
     Mutex::Autolock _l(mLock);
     insertCommand_l(command, delayMs);
-    LOGV("AudioCommandThread() adding set volume stream %d, volume %f, output %d",
+    ALOGV("AudioCommandThread() adding set volume stream %d, volume %f, output %d",
             stream, volume, output);
     mWaitWorkCV.signal();
     if (command->mWaitStatus) {
@@ -860,7 +860,7 @@
     }
     Mutex::Autolock _l(mLock);
     insertCommand_l(command, delayMs);
-    LOGV("AudioCommandThread() adding set parameter string %s, io %d ,delay %d",
+    ALOGV("AudioCommandThread() adding set parameter string %s, io %d ,delay %d",
             keyValuePairs, ioHandle, delayMs);
     mWaitWorkCV.signal();
     if (command->mWaitStatus) {
@@ -887,7 +887,7 @@
     }
     Mutex::Autolock _l(mLock);
     insertCommand_l(command, delayMs);
-    LOGV("AudioCommandThread() adding set voice volume volume %f", volume);
+    ALOGV("AudioCommandThread() adding set voice volume volume %f", volume);
     mWaitWorkCV.signal();
     if (command->mWaitStatus) {
         command->mCond.wait(mLock);
@@ -922,7 +922,7 @@
             ParametersData *data = (ParametersData *)command->mParam;
             ParametersData *data2 = (ParametersData *)command2->mParam;
             if (data->mIO != data2->mIO) break;
-            LOGV("Comparing parameter command %s to new command %s",
+            ALOGV("Comparing parameter command %s to new command %s",
                     data2->mKeyValuePairs.string(), data->mKeyValuePairs.string());
             AudioParameter param = AudioParameter(data->mKeyValuePairs);
             AudioParameter param2 = AudioParameter(data2->mKeyValuePairs);
@@ -936,7 +936,7 @@
                   param2.getAt(k, key2, value2);
                   if (key2 == key) {
                       param2.remove(key2);
-                      LOGV("Filtering out parameter %s", key2.string());
+                      ALOGV("Filtering out parameter %s", key2.string());
                       break;
                   }
                }
@@ -955,7 +955,7 @@
             VolumeData *data2 = (VolumeData *)command2->mParam;
             if (data->mIO != data2->mIO) break;
             if (data->mStream != data2->mStream) break;
-            LOGV("Filtering out volume command on output %d for stream %d",
+            ALOGV("Filtering out volume command on output %d for stream %d",
                     data->mIO, data->mStream);
             removedCommands.add(command2);
         } break;
@@ -971,7 +971,7 @@
         // removed commands always have time stamps greater than current command
         for (size_t k = i + 1; k < mAudioCommands.size(); k++) {
             if (mAudioCommands[k] == removedCommands[j]) {
-                LOGV("suppressing command: %d", mAudioCommands[k]->mCommand);
+                ALOGV("suppressing command: %d", mAudioCommands[k]->mCommand);
                 mAudioCommands.removeAt(k);
                 break;
             }
@@ -980,14 +980,14 @@
     removedCommands.clear();
 
     // insert command at the right place according to its time stamp
-    LOGV("inserting command: %d at index %d, num commands %d",
+    ALOGV("inserting command: %d at index %d, num commands %d",
             command->mCommand, (int)i+1, mAudioCommands.size());
     mAudioCommands.insertAt(command, i + 1);
 }
 
 void AudioPolicyService::AudioCommandThread::exit()
 {
-    LOGV("AudioCommandThread::exit");
+    ALOGV("AudioCommandThread::exit");
     {
         AutoMutex _l(mLock);
         requestExit();
@@ -1069,7 +1069,7 @@
     int i;
     for (i = AUDIO_SOURCE_MIC; i < AUDIO_SOURCE_CNT; i++) {
         if (strcmp(name, kInputSourceNames[i - AUDIO_SOURCE_MIC]) == 0) {
-            LOGV("inputSourceNameToEnum found source %s %d", name, i);
+            ALOGV("inputSourceNameToEnum found source %s %d", name, i);
             break;
         }
     }
@@ -1102,17 +1102,17 @@
     if (strncmp(node->name, SHORT_TAG, sizeof(SHORT_TAG) + 1) == 0) {
         size_t pos = growParamSize(param, sizeof(short), curSize, totSize);
         *(short *)((char *)param + pos) = (short)atoi(node->value);
-        LOGV("readParamValue() reading short %d", *(short *)((char *)param + pos));
+        ALOGV("readParamValue() reading short %d", *(short *)((char *)param + pos));
         return sizeof(short);
     } else if (strncmp(node->name, INT_TAG, sizeof(INT_TAG) + 1) == 0) {
         size_t pos = growParamSize(param, sizeof(int), curSize, totSize);
         *(int *)((char *)param + pos) = atoi(node->value);
-        LOGV("readParamValue() reading int %d", *(int *)((char *)param + pos));
+        ALOGV("readParamValue() reading int %d", *(int *)((char *)param + pos));
         return sizeof(int);
     } else if (strncmp(node->name, FLOAT_TAG, sizeof(FLOAT_TAG) + 1) == 0) {
         size_t pos = growParamSize(param, sizeof(float), curSize, totSize);
         *(float *)((char *)param + pos) = (float)atof(node->value);
-        LOGV("readParamValue() reading float %f",*(float *)((char *)param + pos));
+        ALOGV("readParamValue() reading float %f",*(float *)((char *)param + pos));
         return sizeof(float);
     } else if (strncmp(node->name, BOOL_TAG, sizeof(BOOL_TAG) + 1) == 0) {
         size_t pos = growParamSize(param, sizeof(bool), curSize, totSize);
@@ -1121,7 +1121,7 @@
         } else {
             *(bool *)((char *)param + pos) = true;
         }
-        LOGV("readParamValue() reading bool %s",*(bool *)((char *)param + pos) ? "true" : "false");
+        ALOGV("readParamValue() reading bool %s",*(bool *)((char *)param + pos) ? "true" : "false");
         return sizeof(bool);
     } else if (strncmp(node->name, STRING_TAG, sizeof(STRING_TAG) + 1) == 0) {
         size_t len = strnlen(node->value, EFFECT_STRING_LEN_MAX);
@@ -1132,7 +1132,7 @@
         strncpy(param + *curSize, node->value, len);
         *curSize += len;
         param[*curSize] = '\0';
-        LOGV("readParamValue() reading string %s", param + *curSize - len);
+        ALOGV("readParamValue() reading string %s", param + *curSize - len);
         return len;
     }
     LOGW("readParamValue() unknown param type %s", node->name);
@@ -1172,7 +1172,7 @@
     fx_param->psize = 0;
     param = param->first_child;
     while (param) {
-        LOGV("loadEffectParameter() reading param of type %s", param->name);
+        ALOGV("loadEffectParameter() reading param of type %s", param->name);
         size_t size = readParamValue(param, (char *)fx_param, &curSize, &totSize);
         if (size == 0) {
             goto error;
@@ -1187,7 +1187,7 @@
     fx_param->vsize = 0;
     value = value->first_child;
     while (value) {
-        LOGV("loadEffectParameter() reading value of type %s", value->name);
+        ALOGV("loadEffectParameter() reading value of type %s", value->name);
         size_t size = readParamValue(value, (char *)fx_param, &curSize, &totSize);
         if (size == 0) {
             goto error;
@@ -1207,7 +1207,7 @@
 {
     cnode *node = root->first_child;
     while (node) {
-        LOGV("loadEffectParameters() loading param %s", node->name);
+        ALOGV("loadEffectParameters() loading param %s", node->name);
         effect_param_t *param = loadEffectParameter(node);
         if (param == NULL) {
             node = node->next;
@@ -1232,18 +1232,18 @@
         size_t i;
         for (i = 0; i < effects.size(); i++) {
             if (strncmp(effects[i]->mName, node->name, EFFECT_STRING_LEN_MAX) == 0) {
-                LOGV("loadInputSource() found effect %s in list", node->name);
+                ALOGV("loadInputSource() found effect %s in list", node->name);
                 break;
             }
         }
         if (i == effects.size()) {
-            LOGV("loadInputSource() effect %s not in list", node->name);
+            ALOGV("loadInputSource() effect %s not in list", node->name);
             node = node->next;
             continue;
         }
         EffectDesc *effect = new EffectDesc(*effects[i]);
         loadEffectParameters(node, effect->mParams);
-        LOGV("loadInputSource() adding effect %s uuid %08x", effect->mName, effect->mUuid.timeLow);
+        ALOGV("loadInputSource() adding effect %s uuid %08x", effect->mName, effect->mUuid.timeLow);
         source->mEffects.add(effect);
         node = node->next;
     }
@@ -1269,7 +1269,7 @@
             node = node->next;
             continue;
         }
-        LOGV("loadInputSources() loading input source %s", node->name);
+        ALOGV("loadInputSources() loading input source %s", node->name);
         InputSourceDesc *desc = loadInputSource(node, effects);
         if (desc == NULL) {
             node = node->next;
@@ -1307,7 +1307,7 @@
     }
     node = node->first_child;
     while (node) {
-        LOGV("loadEffects() loading effect %s", node->name);
+        ALOGV("loadEffects() loading effect %s", node->name);
         EffectDesc *effect = loadEffect(node);
         if (effect == NULL) {
             node = node->next;
diff --git a/services/audioflinger/AudioResampler.cpp b/services/audioflinger/AudioResampler.cpp
index 9ee5a30..e945ce0 100644
--- a/services/audioflinger/AudioResampler.cpp
+++ b/services/audioflinger/AudioResampler.cpp
@@ -96,15 +96,15 @@
     switch (quality) {
     default:
     case LOW_QUALITY:
-        LOGV("Create linear Resampler");
+        ALOGV("Create linear Resampler");
         resampler = new AudioResamplerOrder1(bitDepth, inChannelCount, sampleRate);
         break;
     case MED_QUALITY:
-        LOGV("Create cubic Resampler");
+        ALOGV("Create cubic Resampler");
         resampler = new AudioResamplerCubic(bitDepth, inChannelCount, sampleRate);
         break;
     case HIGH_QUALITY:
-        LOGV("Create sinc Resampler");
+        ALOGV("Create sinc Resampler");
         resampler = new AudioResamplerSinc(bitDepth, inChannelCount, sampleRate);
         break;
     }
@@ -390,6 +390,7 @@
 *       phaseFraction : phase fraction for next interpolation
 *
 *******************************************************************/
+__attribute__((noinline))
 void AudioResamplerOrder1::AsmMono16Loop(int16_t *in, int32_t* maxOutPt, int32_t maxInIdx,
             size_t &outputIndex, int32_t* out, size_t &inputIndex, int32_t vl, int32_t vr,
             uint32_t &phaseFraction, uint32_t phaseIncrement)
@@ -500,6 +501,7 @@
 *       phaseFraction : phase fraction for next interpolation
 *
 *******************************************************************/
+__attribute__((noinline))
 void AudioResamplerOrder1::AsmStereo16Loop(int16_t *in, int32_t* maxOutPt, int32_t maxInIdx,
             size_t &outputIndex, int32_t* out, size_t &inputIndex, int32_t vl, int32_t vr,
             uint32_t &phaseFraction, uint32_t phaseIncrement)
@@ -600,6 +602,5 @@
 
 
 // ----------------------------------------------------------------------------
-}
-; // namespace android
 
+} // namespace android
diff --git a/services/camera/libcameraservice/CameraHardwareInterface.h b/services/camera/libcameraservice/CameraHardwareInterface.h
index c3ced4c..658e25e 100644
--- a/services/camera/libcameraservice/CameraHardwareInterface.h
+++ b/services/camera/libcameraservice/CameraHardwareInterface.h
@@ -112,12 +112,12 @@
     /** Set the ANativeWindow to which preview frames are sent */
     status_t setPreviewWindow(const sp<ANativeWindow>& buf)
     {
-        LOGV("%s(%s) buf %p", __FUNCTION__, mName.string(), buf.get());
+        ALOGV("%s(%s) buf %p", __FUNCTION__, mName.string(), buf.get());
 
         if (mDevice->ops->set_preview_window) {
             mPreviewWindow = buf;
             mHalPreviewWindow.user = this;
-            LOGV("%s &mHalPreviewWindow %p mHalPreviewWindow.user %p", __FUNCTION__,
+            ALOGV("%s &mHalPreviewWindow %p mHalPreviewWindow.user %p", __FUNCTION__,
                     &mHalPreviewWindow, mHalPreviewWindow.user);
             return mDevice->ops->set_preview_window(mDevice,
                     buf.get() ? &mHalPreviewWindow.nw : 0);
@@ -136,7 +136,7 @@
         mDataCbTimestamp = data_cb_timestamp;
         mCbUser = user;
 
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
 
         if (mDevice->ops->set_callbacks) {
             mDevice->ops->set_callbacks(mDevice,
@@ -159,7 +159,7 @@
      */
     void enableMsgType(int32_t msgType)
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->enable_msg_type)
             mDevice->ops->enable_msg_type(mDevice, msgType);
     }
@@ -176,7 +176,7 @@
      */
     void disableMsgType(int32_t msgType)
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->disable_msg_type)
             mDevice->ops->disable_msg_type(mDevice, msgType);
     }
@@ -188,7 +188,7 @@
      */
     int msgTypeEnabled(int32_t msgType)
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->msg_type_enabled)
             return mDevice->ops->msg_type_enabled(mDevice, msgType);
         return false;
@@ -199,7 +199,7 @@
      */
     status_t startPreview()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->start_preview)
             return mDevice->ops->start_preview(mDevice);
         return INVALID_OPERATION;
@@ -210,7 +210,7 @@
      */
     void stopPreview()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->stop_preview)
             mDevice->ops->stop_preview(mDevice);
     }
@@ -220,7 +220,7 @@
      */
     int previewEnabled()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->preview_enabled)
             return mDevice->ops->preview_enabled(mDevice);
         return false;
@@ -260,7 +260,7 @@
 
     status_t storeMetaDataInBuffers(int enable)
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->store_meta_data_in_buffers)
             return mDevice->ops->store_meta_data_in_buffers(mDevice, enable);
         return enable ? INVALID_OPERATION: OK;
@@ -277,7 +277,7 @@
      */
     status_t startRecording()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->start_recording)
             return mDevice->ops->start_recording(mDevice);
         return INVALID_OPERATION;
@@ -288,7 +288,7 @@
      */
     void stopRecording()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->stop_recording)
             mDevice->ops->stop_recording(mDevice);
     }
@@ -298,7 +298,7 @@
      */
     int recordingEnabled()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->recording_enabled)
             return mDevice->ops->recording_enabled(mDevice);
         return false;
@@ -316,7 +316,7 @@
      */
     void releaseRecordingFrame(const sp<IMemory>& mem)
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->release_recording_frame) {
             ssize_t offset;
             size_t size;
@@ -333,7 +333,7 @@
      */
     status_t autoFocus()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->auto_focus)
             return mDevice->ops->auto_focus(mDevice);
         return INVALID_OPERATION;
@@ -347,7 +347,7 @@
      */
     status_t cancelAutoFocus()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->cancel_auto_focus)
             return mDevice->ops->cancel_auto_focus(mDevice);
         return INVALID_OPERATION;
@@ -358,7 +358,7 @@
      */
     status_t takePicture()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->take_picture)
             return mDevice->ops->take_picture(mDevice);
         return INVALID_OPERATION;
@@ -370,7 +370,7 @@
      */
     status_t cancelPicture()
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->cancel_picture)
             return mDevice->ops->cancel_picture(mDevice);
         return INVALID_OPERATION;
@@ -381,7 +381,7 @@
      * invalid or not supported. */
     status_t setParameters(const CameraParameters &params)
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->set_parameters)
             return mDevice->ops->set_parameters(mDevice,
                                                params.flatten().string());
@@ -391,7 +391,7 @@
     /** Return the camera parameters. */
     CameraParameters getParameters() const
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         CameraParameters parms;
         if (mDevice->ops->get_parameters) {
             char *temp = mDevice->ops->get_parameters(mDevice);
@@ -410,7 +410,7 @@
      */
     status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2)
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->send_command)
             return mDevice->ops->send_command(mDevice, cmd, arg1, arg2);
         return INVALID_OPERATION;
@@ -421,7 +421,7 @@
      * *not* done in the destructor.
      */
     void release() {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->release)
             mDevice->ops->release(mDevice);
     }
@@ -431,7 +431,7 @@
      */
     status_t dump(int fd, const Vector<String16>& args) const
     {
-        LOGV("%s(%s)", __FUNCTION__, mName.string());
+        ALOGV("%s(%s)", __FUNCTION__, mName.string());
         if (mDevice->ops->dump)
             return mDevice->ops->dump(mDevice, fd);
         return OK; // It's fine if the HAL doesn't implement dump()
@@ -444,7 +444,7 @@
     static void __notify_cb(int32_t msg_type, int32_t ext1,
                             int32_t ext2, void *user)
     {
-        LOGV("%s", __FUNCTION__);
+        ALOGV("%s", __FUNCTION__);
         CameraHardwareInterface *__this =
                 static_cast<CameraHardwareInterface *>(user);
         __this->mNotifyCb(msg_type, ext1, ext2, __this->mCbUser);
@@ -455,7 +455,7 @@
                           camera_frame_metadata_t *metadata,
                           void *user)
     {
-        LOGV("%s", __FUNCTION__);
+        ALOGV("%s", __FUNCTION__);
         CameraHardwareInterface *__this =
                 static_cast<CameraHardwareInterface *>(user);
         sp<CameraHeapMemory> mem(static_cast<CameraHeapMemory *>(data->handle));
@@ -471,7 +471,7 @@
                              const camera_memory_t *data, unsigned index,
                              void *user)
     {
-        LOGV("%s", __FUNCTION__);
+        ALOGV("%s", __FUNCTION__);
         CameraHardwareInterface *__this =
                 static_cast<CameraHardwareInterface *>(user);
         // Start refcounting the heap object from here on.  When the clients
diff --git a/services/camera/libcameraservice/CameraHardwareStub.cpp b/services/camera/libcameraservice/CameraHardwareStub.cpp
index 863f19e..8558fdd 100644
--- a/services/camera/libcameraservice/CameraHardwareStub.cpp
+++ b/services/camera/libcameraservice/CameraHardwareStub.cpp
@@ -176,7 +176,7 @@
         uint8_t *frame = ((uint8_t *)base) + offset;
         fakeCamera->getNextFrameAsYuv420(frame);
 
-        //LOGV("previewThread: generated frame to buffer %d", mCurrentPreviewFrame);
+        //ALOGV("previewThread: generated frame to buffer %d", mCurrentPreviewFrame);
 
         // Notify the client of a new frame.
         if (mMsgEnabled & CAMERA_MSG_PREVIEW_FRAME)
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index bb0e664..4760f07 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -361,7 +361,7 @@
 
     // Enable zoom, error, focus, and metadata messages by default
     enableMsgType(CAMERA_MSG_ERROR | CAMERA_MSG_ZOOM | CAMERA_MSG_FOCUS |
-                  CAMERA_MSG_PREVIEW_METADATA);
+                  CAMERA_MSG_PREVIEW_METADATA | CAMERA_MSG_FOCUS_MOVE);
 
     // Callback is disabled by default
     mPreviewCallbackFlag = CAMERA_FRAME_CALLBACK_FLAG_NOOP;
