Merge remote-tracking branch 'goog/ics-aah'
diff --git a/libaudio-qdsp5v2/AudioHardware.cpp b/libaudio-qdsp5v2/AudioHardware.cpp
index 6835453..97c34b2 100644
--- a/libaudio-qdsp5v2/AudioHardware.cpp
+++ b/libaudio-qdsp5v2/AudioHardware.cpp
@@ -91,7 +91,7 @@
 void AudioHardware::closeOutputStream(AudioStreamOut* out) {
     Mutex::Autolock lock(mLock);
     if (mOutput == 0 || mOutput != out) {
-        LOGW("Attempt to close invalid output stream");
+        ALOGW("Attempt to close invalid output stream");
     }
     else {
         delete mOutput;
@@ -135,7 +135,7 @@
     AudioParameter request = AudioParameter(keys);
     AudioParameter reply = AudioParameter();
 
-    LOGV("getParameters() %s", keys.string());
+    ALOGV("getParameters() %s", keys.string());
 
     return reply.toString();
 }
@@ -152,7 +152,7 @@
 
 status_t AudioHardware::setMasterVolume(float v)
 {
-    LOGI("Set master volume to %f.\n", v);
+    ALOGI("Set master volume to %f.\n", v);
     // We return an error code here to let the audioflinger do in-software
     // volume on top of the maximum volume that we set through the SND API.
     // return error - software mixer will handle it
@@ -214,30 +214,30 @@
 
 ssize_t AudioHardware::AudioStreamOutQ5V2::write(const void* buffer, size_t bytes)
 {
-    // LOGD("AudioStreamOutQ5V2::write(%p, %u)", buffer, bytes);
+    // ALOGD("AudioStreamOutQ5V2::write(%p, %u)", buffer, bytes);
     status_t status = NO_INIT;
     size_t count = bytes;
     const uint8_t* p = static_cast<const uint8_t*>(buffer);
 
     if (mStandby) {
-        LOGV("open pcm_out driver");
+        ALOGV("open pcm_out driver");
         status = ::open("/dev/msm_pcm_out", O_RDWR);
         if (status < 0) {
-                LOGE("Cannot open /dev/msm_pcm_out errno: %d", errno);
+                ALOGE("Cannot open /dev/msm_pcm_out errno: %d", errno);
             goto Error;
         }
         mFd = status;
 
         // configuration
-        LOGV("get config");
+        ALOGV("get config");
         struct msm_audio_config config;
         status = ioctl(mFd, AUDIO_GET_CONFIG, &config);
         if (status < 0) {
-            LOGE("Cannot read pcm_out config");
+            ALOGE("Cannot read pcm_out config");
             goto Error;
         }
 
-        LOGV("set pcm_out config");
+        ALOGV("set pcm_out config");
         config.channel_count = AudioSystem::popCount(channels());
         config.sample_rate = mSampleRate;
         config.buffer_size = mBufferSize;
@@ -245,25 +245,25 @@
 //        config.codec_type = CODEC_TYPE_PCM;
         status = ioctl(mFd, AUDIO_SET_CONFIG, &config);
         if (status < 0) {
-            LOGE("Cannot set config");
+            ALOGE("Cannot set config");
             goto Error;
         }
 
-        LOGV("buffer_size: %u", config.buffer_size);
-        LOGV("buffer_count: %u", config.buffer_count);
-        LOGV("channel_count: %u", config.channel_count);
-        LOGV("sample_rate: %u", config.sample_rate);
+        ALOGV("buffer_size: %u", config.buffer_size);
+        ALOGV("buffer_count: %u", config.buffer_count);
+        ALOGV("channel_count: %u", config.channel_count);
+        ALOGV("sample_rate: %u", config.sample_rate);
 
 #if 0
         status = ioctl(mFd, AUDIO_START, &acdb_id);
         if (status < 0) {
-            LOGE("Cannot start pcm playback");
+            ALOGE("Cannot start pcm playback");
             goto Error;
         }
 
         status = ioctl(mFd, AUDIO_SET_VOLUME, &stream_volume);
         if (status < 0) {
-            LOGE("Cannot start pcm playback");
+            ALOGE("Cannot start pcm playback");
             goto Error;
         }
 #endif
@@ -278,7 +278,7 @@
         } else {
             if (errno != EAGAIN) return written;
             mRetryCount++;
-            LOGW("EAGAIN - retry");
+            ALOGW("EAGAIN - retry");
         }
     }
 
@@ -303,7 +303,7 @@
         mFd = -1;
     }
     mStandby = true;
-    LOGI("AudioHardware pcm playback is going to standby.");
+    ALOGI("AudioHardware pcm playback is going to standby.");
     return status;
 }
 
@@ -325,7 +325,7 @@
 String8 AudioHardware::AudioStreamOutQ5V2::getParameters(const String8& keys)
 {
     AudioParameter param = AudioParameter(keys);
-    LOGV("AudioStreamOutQ5V2::getParameters() %s", param.toString().string());
+    ALOGV("AudioStreamOutQ5V2::getParameters() %s", param.toString().string());
     return param.toString();
 }
 
diff --git a/libaudio-qdsp5v2/AudioPolicyManager.cpp b/libaudio-qdsp5v2/AudioPolicyManager.cpp
index 82289bf..ea2ff46 100644
--- a/libaudio-qdsp5v2/AudioPolicyManager.cpp
+++ b/libaudio-qdsp5v2/AudioPolicyManager.cpp
@@ -55,7 +55,7 @@
 
     if (fromCache) {
         device = mDeviceForStrategy[strategy];
-        LOGV("getDeviceForStrategy() from cache strategy %d, device %x", strategy, device);
+        ALOGV("getDeviceForStrategy() from cache strategy %d, device %x", strategy, device);
         return device;
     }
 
@@ -109,7 +109,7 @@
             }
             device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_EARPIECE;
             if (device == 0) {
-                LOGE("getDeviceForStrategy() earpiece device not found");
+                ALOGE("getDeviceForStrategy() earpiece device not found");
             }
             break;
 
@@ -132,7 +132,7 @@
             }
             device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
             if (device == 0) {
-                LOGE("getDeviceForStrategy() speaker device not found");
+                ALOGE("getDeviceForStrategy() speaker device not found");
             }
             break;
         }
@@ -152,7 +152,7 @@
         if (mForceUse[AudioSystem::FOR_DOCK] != AudioSystem::FORCE_BT_CAR_DOCK) {
             device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
             if (device == 0) {
-                LOGE("getDeviceForStrategy() speaker device not found");
+                ALOGE("getDeviceForStrategy() speaker device not found");
             }
             if (mForceUse[AudioSystem::FOR_DOCK] == AudioSystem::FORCE_BT_DESK_DOCK) {
                 if (mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE) {
@@ -212,7 +212,7 @@
         // device is DEVICE_OUT_SPEAKER if we come from case STRATEGY_SONIFICATION, 0 otherwise
         device |= device2;
         if (device == 0) {
-            LOGE("getDeviceForStrategy() speaker device not found");
+            ALOGE("getDeviceForStrategy() speaker device not found");
         }
         // Do not play media stream if in call and the requested device would change the hardware
         // output routing
@@ -220,16 +220,16 @@
             !AudioSystem::isA2dpDevice((AudioSystem::audio_devices)device) &&
             device != getDeviceForStrategy(STRATEGY_PHONE, false)) {
             device = 0;
-            LOGV("getDeviceForStrategy() incompatible media and phone devices");
+            ALOGV("getDeviceForStrategy() incompatible media and phone devices");
         }
         } break;
 
     default:
-        LOGW("getDeviceForStrategy() unknown strategy: %d", strategy);
+        ALOGW("getDeviceForStrategy() unknown strategy: %d", strategy);
         break;
     }
 
-    LOGV("getDeviceForStrategy() strategy %d, device %x", strategy, device);
+    ALOGV("getDeviceForStrategy() strategy %d, device %x", strategy, device);
     return device;
 }
 
@@ -250,7 +250,7 @@
     // avoid saturation
     if (mPhoneState == AudioSystem::MODE_IN_CALL && AudioSystem::isBluetoothScoDevice((AudioSystem::audio_devices)device)) {
         if (volume > IN_CALL_SCO_VOLUME_MAX) {
-            LOGV("computeVolume limiting SYSTEM volume %f to %f",volume, IN_CALL_SCO_VOLUME_MAX);
+            ALOGV("computeVolume limiting SYSTEM volume %f to %f",volume, IN_CALL_SCO_VOLUME_MAX);
             volume = IN_CALL_SCO_VOLUME_MAX;
         }
     }
diff --git a/libaudio-qsd8k/AudioHardware.cpp b/libaudio-qsd8k/AudioHardware.cpp
index 9773413..fdc0038 100644
--- a/libaudio-qsd8k/AudioHardware.cpp
+++ b/libaudio-qsd8k/AudioHardware.cpp
@@ -119,7 +119,7 @@
 
     acoustic =:: dlopen("/system/lib/libhtc_acoustic.so", RTLD_NOW);
     if (acoustic == NULL ) {
-        LOGD("Could not open libhtc_acoustic.so");
+        ALOGD("Could not open libhtc_acoustic.so");
         /* this is not really an error on non-htc devices... */
         mNumBTEndpoints = 0;
         mInit = true;
@@ -127,49 +127,49 @@
     }
     set_acoustic_parameters = (int (*)(void))::dlsym(acoustic, "set_acoustic_parameters");
     if ((*set_acoustic_parameters) == 0 ) {
-        LOGE("Could not open set_acoustic_parameters()");
+        ALOGE("Could not open set_acoustic_parameters()");
         return;
     }
 
     set_tpa2018d1_parameters = (int (*)(void))::dlsym(acoustic, "set_tpa2018d1_parameters");
     if ((*set_tpa2018d1_parameters) == 0) {
-        LOGD("set_tpa2018d1_parameters() not present");
+        ALOGD("set_tpa2018d1_parameters() not present");
         support_tpa2018d1 = false;
     }
 
     int rc = set_acoustic_parameters();
     if (rc < 0) {
-        LOGD("Could not set acoustic parameters to share memory: %d", rc);
+        ALOGD("Could not set acoustic parameters to share memory: %d", rc);
     }
 
     if (support_tpa2018d1) {
        rc = set_tpa2018d1_parameters();
        if (rc < 0) {
            support_tpa2018d1 = false;
-           LOGD("speaker amplifier tpa2018 is not supported\n");
+           ALOGD("speaker amplifier tpa2018 is not supported\n");
        }
     }
 
     snd_get_num = (int (*)(void))::dlsym(acoustic, "snd_get_num");
     if ((*snd_get_num) == 0 ) {
-        LOGD("Could not open snd_get_num()");
+        ALOGD("Could not open snd_get_num()");
     }
 
     mNumBTEndpoints = snd_get_num();
-    LOGV("mNumBTEndpoints = %d", mNumBTEndpoints);
+    ALOGV("mNumBTEndpoints = %d", mNumBTEndpoints);
     mBTEndpoints = new msm_bt_endpoint[mNumBTEndpoints];
     mInit = true;
-    LOGV("constructed %d SND endpoints)", mNumBTEndpoints);
+    ALOGV("constructed %d SND endpoints)", mNumBTEndpoints);
     ept = mBTEndpoints;
     snd_get_bt_endpoint = (int (*)(msm_bt_endpoint *))::dlsym(acoustic, "snd_get_bt_endpoint");
     if ((*snd_get_bt_endpoint) == 0 ) {
-        LOGE("Could not open snd_get_bt_endpoint()");
+        ALOGE("Could not open snd_get_bt_endpoint()");
         return;
     }
     snd_get_bt_endpoint(mBTEndpoints);
 
     for (int i = 0; i < mNumBTEndpoints; i++) {
-        LOGV("BT name %s (tx,rx)=(%d,%d)", mBTEndpoints[i].name, mBTEndpoints[i].tx, mBTEndpoints[i].rx);
+        ALOGV("BT name %s (tx,rx)=(%d,%d)", mBTEndpoints[i].name, mBTEndpoints[i].tx, mBTEndpoints[i].rx);
     }
 
     // reset voice mode in case media_server crashed and restarted while in call
@@ -186,21 +186,21 @@
     // Check the system property to enable or not the special recording modes
     property_get("media.a1026.enableA1026", value, "1");
     enable1026 = atoi(value);
-    LOGV("Enable mode selection for A1026 is %d", enable1026);
+    ALOGV("Enable mode selection for A1026 is %d", enable1026);
     // Check the system property for which VR mode to use
     property_get("media.a1026.nsForVoiceRec", value, "0");
     vr_uses_ns = atoi(value);
-    LOGV("Using Noise Suppression for Voice Rec is %d", vr_uses_ns);
+    ALOGV("Using Noise Suppression for Voice Rec is %d", vr_uses_ns);
 
     // Check the system property for enable or not the ALT function
     property_get("htc.audio.alt.enable", value, "0");
     alt_enable = atoi(value);
-    LOGV("Enable ALT function: %d", alt_enable);
+    ALOGV("Enable ALT function: %d", alt_enable);
 
     // Check the system property for enable or not the HAC function
     property_get("htc.audio.hac.enable", value, "0");
     hac_enable = atoi(value);
-    LOGV("Enable HAC function: %d", hac_enable);
+    ALOGV("Enable HAC function: %d", hac_enable);
 
     mInit = true;
 }
@@ -252,7 +252,7 @@
 void AudioHardware::closeOutputStream(AudioStreamOut* out) {
     Mutex::Autolock lock(mLock);
     if (mOutput == 0 || mOutput != out) {
-        LOGW("Attempt to close invalid output stream");
+        ALOGW("Attempt to close invalid output stream");
     }
     else {
         delete mOutput;
@@ -293,7 +293,7 @@
 
     ssize_t index = mInputs.indexOf((AudioStreamInMSM72xx *)in);
     if (index < 0) {
-        LOGW("Attempt to close invalid input stream");
+        ALOGW("Attempt to close invalid input stream");
     } else {
         mLock.unlock();
         delete mInputs[index];
@@ -341,12 +341,12 @@
     int fd = -1;
     fd = open("/dev/msm_audio_ctl", O_RDWR);
     if (fd < 0) {
-        LOGE("Cannot open msm_audio_ctl device\n");
+        ALOGE("Cannot open msm_audio_ctl device\n");
         return -1;
     }
-    LOGD("Setting mic mute to %d\n", mute);
+    ALOGD("Setting mic mute to %d\n", mute);
     if (ioctl(fd, AUDIO_SET_MUTE, &mute)) {
-        LOGE("Cannot set mic mute on current device\n");
+        ALOGE("Cannot set mic mute on current device\n");
         close(fd);
         return -1;
     }
@@ -388,7 +388,7 @@
     const char HAC_VALUE_ON[] = "ON";
 
 
-    LOGV("setParameters() %s", keyValuePairs.string());
+    ALOGV("setParameters() %s", keyValuePairs.string());
 
     if (keyValuePairs.length() == 0) return BAD_VALUE;
 
@@ -397,10 +397,10 @@
         if (param.get(key, value) == NO_ERROR) {
             if (value == HAC_VALUE_ON) {
                 mHACSetting = true;
-                LOGD("Enable HAC");
+                ALOGD("Enable HAC");
             } else {
                 mHACSetting = false;
-                LOGD("Disable HAC");
+                ALOGD("Disable HAC");
             }
         }
     }
@@ -411,7 +411,7 @@
             mBluetoothNrec = true;
         } else {
             mBluetoothNrec = false;
-            LOGD("Turning noise reduction and echo cancellation off for BT "
+            ALOGD("Turning noise reduction and echo cancellation off for BT "
                  "headset");
         }
     }
@@ -423,12 +423,12 @@
             if (!strcasecmp(value.string(), mBTEndpoints[i].name)) {
                 mBluetoothIdTx = mBTEndpoints[i].tx;
                 mBluetoothIdRx = mBTEndpoints[i].rx;
-                LOGD("Using custom acoustic parameters for %s", value.string());
+                ALOGD("Using custom acoustic parameters for %s", value.string());
                 break;
             }
         }
         if (mBluetoothIdTx == 0) {
-            LOGD("Using default acoustic parameters "
+            ALOGD("Using default acoustic parameters "
                  "(%s not in acoustic database)", value.string());
         }
         doRouting();
@@ -451,7 +451,7 @@
 
             if (noiseSuppressionState != mNoiseSuppressionState) {
                 if (!mA1026Init) {
-                    LOGW("Audience A1026 not initialized.\n");
+                    ALOGW("Audience A1026 not initialized.\n");
                     return INVALID_OPERATION;
                 }
 
@@ -459,18 +459,18 @@
                 if (fd_a1026 < 0) {
                     fd_a1026 = open("/dev/audience_a1026", O_RDWR);
                     if (fd_a1026 < 0) {
-                        LOGE("Cannot open audience_a1026 device (%d)\n", fd_a1026);
+                        ALOGE("Cannot open audience_a1026 device (%d)\n", fd_a1026);
                         mA1026Lock.unlock();
                         return -1;
                     }
                 }
-                LOGV("Setting noise suppression %s", value.string());
+                ALOGV("Setting noise suppression %s", value.string());
 
                 int rc = ioctl(fd_a1026, A1026_SET_NS_STATE, &noiseSuppressionState);
                 if (!rc) {
                     mNoiseSuppressionState = noiseSuppressionState;
                 } else {
-                    LOGE("Failed to set noise suppression %s", value.string());
+                    ALOGE("Failed to set noise suppression %s", value.string());
                 }
                 close(fd_a1026);
                 fd_a1026 = -1;
@@ -497,7 +497,7 @@
         }
 
         if (ttyMode != mTTYMode) {
-            LOGV("new tty mode %d", ttyMode);
+            ALOGV("new tty mode %d", ttyMode);
             mTTYMode = ttyMode;
             doRouting();
         }
@@ -513,7 +513,7 @@
     String8 value;
     String8 key;
 
-    LOGV("getParameters() %s", keys.string());
+    ALOGV("getParameters() %s", keys.string());
 
     key = "noise_suppression";
     if (request.get(key, value) == NO_ERROR) {
@@ -577,15 +577,15 @@
 size_t AudioHardware::getInputBufferSize(uint32_t sampleRate, int format, int channelCount)
 {
     if (format != AudioSystem::PCM_16_BIT) {
-        LOGW("getInputBufferSize bad format: %d", format);
+        ALOGW("getInputBufferSize bad format: %d", format);
         return 0;
     }
     if (channelCount < 1 || channelCount > 2) {
-        LOGW("getInputBufferSize bad channel count: %d", channelCount);
+        ALOGW("getInputBufferSize bad channel count: %d", channelCount);
         return 0;
     }
     if (sampleRate < 8000 || sampleRate > 48000) {
-        LOGW("getInputBufferSize bad sample rate: %d", sampleRate);
+        ALOGW("getInputBufferSize bad sample rate: %d", sampleRate);
         return 0;
     }
 
@@ -597,13 +597,13 @@
     int fd = -1;
     fd = open("/dev/msm_audio_ctl", O_RDWR);
     if (fd < 0) {
-        LOGE("Cannot open msm_audio_ctl device\n");
+        ALOGE("Cannot open msm_audio_ctl device\n");
         return -1;
     }
     volume *= 20; //percentage
-    LOGD("Setting in-call volume to %d\n", volume);
+    ALOGD("Setting in-call volume to %d\n", volume);
     if (ioctl(fd, AUDIO_SET_VOLUME, &volume)) {
-        LOGW("Cannot set volume on current device\n");
+        ALOGW("Cannot set volume on current device\n");
     }
     close(fd);
     return NO_ERROR;
@@ -612,10 +612,10 @@
 status_t AudioHardware::setVoiceVolume(float v)
 {
     if (v < 0.0) {
-        LOGW("setVoiceVolume(%f) under 0.0, assuming 0.0", v);
+        ALOGW("setVoiceVolume(%f) under 0.0, assuming 0.0", v);
         v = 0.0;
     } else if (v > 1.0) {
-        LOGW("setVoiceVolume(%f) over 1.0, assuming 1.0", v);
+        ALOGW("setVoiceVolume(%f) over 1.0, assuming 1.0", v);
         v = 1.0;
     }
 
@@ -623,10 +623,10 @@
 
     Mutex::Autolock lock(mLock);
     if (mHACSetting && hac_enable && mCurSndDevice == (int) SND_DEVICE_HANDSET) {
-        LOGD("HAC enable: Setting in-call volume to maximum.\n");
+        ALOGD("HAC enable: Setting in-call volume to maximum.\n");
         set_volume_rpc(VOICE_VOLUME_MAX);
     } else {
-        LOGI("voice volume %d (range is 0 to %d)", vol, VOICE_VOLUME_MAX);
+        ALOGI("voice volume %d (range is 0 to %d)", vol, VOICE_VOLUME_MAX);
         set_volume_rpc(vol); //always set current device
     }
     mVoiceVolume = vol;
@@ -635,7 +635,7 @@
 
 status_t AudioHardware::setMasterVolume(float v)
 {
-    LOGI("Set master volume to %f", v);
+    ALOGI("Set master volume to %f", v);
     // We return an error code here to let the audioflinger do in-software
     // volume on top of the maximum volume that we set through the SND API.
     // return error - software mixer will handle it
@@ -652,70 +652,70 @@
         goto Incall;
 
     // hack -- kernel needs to put these in include file
-    LOGD("Switching audio device to ");
+    ALOGD("Switching audio device to ");
     if (device == SND_DEVICE_HANDSET) {
            out_device = HANDSET_SPKR;
            mic_device = HANDSET_MIC;
-           LOGD("Handset");
+           ALOGD("Handset");
     } else if ((device  == SND_DEVICE_BT) || (device == SND_DEVICE_BT_EC_OFF)) {
            out_device = BT_SCO_SPKR;
            mic_device = BT_SCO_MIC;
-           LOGD("BT Headset");
+           ALOGD("BT Headset");
     } else if (device == SND_DEVICE_SPEAKER ||
                device == SND_DEVICE_SPEAKER_BACK_MIC) {
            out_device = SPKR_PHONE_MONO;
            mic_device = SPKR_PHONE_MIC;
-           LOGD("Speakerphone");
+           ALOGD("Speakerphone");
     } else if (device == SND_DEVICE_HEADSET) {
            out_device = HEADSET_SPKR_STEREO;
            mic_device = HEADSET_MIC;
-           LOGD("Stereo Headset");
+           ALOGD("Stereo Headset");
     } else if (device == SND_DEVICE_HEADSET_AND_SPEAKER) {
            out_device = SPKR_PHONE_HEADSET_STEREO;
            mic_device = HEADSET_MIC;
-           LOGD("Stereo Headset + Speaker");
+           ALOGD("Stereo Headset + Speaker");
     } else if (device == SND_DEVICE_HEADSET_AND_SPEAKER_BACK_MIC) {
            out_device = SPKR_PHONE_HEADSET_STEREO;
            mic_device = SPKR_PHONE_MIC;
-           LOGD("Stereo Headset + Speaker and back mic");
+           ALOGD("Stereo Headset + Speaker and back mic");
     } else if (device == SND_DEVICE_NO_MIC_HEADSET) {
            out_device = HEADSET_SPKR_STEREO;
            mic_device = HANDSET_MIC;
-           LOGD("No microphone Wired Headset");
+           ALOGD("No microphone Wired Headset");
     } else if (device == SND_DEVICE_NO_MIC_HEADSET_BACK_MIC) {
            out_device = HEADSET_SPKR_STEREO;
            mic_device = SPKR_PHONE_MIC;
-           LOGD("No microphone Wired Headset and back mic");
+           ALOGD("No microphone Wired Headset and back mic");
     } else if (device == SND_DEVICE_HANDSET_BACK_MIC) {
            out_device = HANDSET_SPKR;
            mic_device = SPKR_PHONE_MIC;
-           LOGD("Handset and back mic");
+           ALOGD("Handset and back mic");
     } else if (device == SND_DEVICE_FM_HEADSET) {
            out_device = FM_HEADSET;
            mic_device = HEADSET_MIC;
-           LOGD("Stereo FM headset");
+           ALOGD("Stereo FM headset");
     } else if (device == SND_DEVICE_FM_SPEAKER) {
            out_device = FM_SPKR;
            mic_device = HEADSET_MIC;
-           LOGD("Stereo FM speaker");
+           ALOGD("Stereo FM speaker");
     } else if (device == SND_DEVICE_CARKIT) {
            out_device = BT_SCO_SPKR;
            mic_device = BT_SCO_MIC;
-           LOGD("Carkit");
+           ALOGD("Carkit");
     } else if (device == SND_DEVICE_TTY_FULL) {
         out_device = TTY_HEADSET_SPKR;
         mic_device = TTY_HEADSET_MIC;
-        LOGD("TTY FULL headset");
+        ALOGD("TTY FULL headset");
     } else if (device == SND_DEVICE_TTY_VCO) {
         out_device = TTY_HEADSET_SPKR;
         mic_device = SPKR_PHONE_MIC;
-        LOGD("TTY VCO headset");
+        ALOGD("TTY VCO headset");
     } else if (device == SND_DEVICE_TTY_HCO) {
         out_device = SPKR_PHONE_MONO;
         mic_device = TTY_HEADSET_MIC;
-        LOGD("TTY HCO headset");
+        ALOGD("TTY HCO headset");
     } else {
-        LOGE("unknown device %d", device);
+        ALOGE("unknown device %d", device);
         return -1;
     }
 
@@ -725,34 +725,34 @@
         if (fd_fm_device < 0) {
             fd_fm_device = open("/dev/msm_htc_fm", O_RDWR);
             if (fd_fm_device < 0) {
-                LOGE("Cannot open msm_htc_fm device");
+                ALOGE("Cannot open msm_htc_fm device");
                 return -1;
             }
-            LOGD("Opened msm_htc_fm for FM radio");
+            ALOGD("Opened msm_htc_fm for FM radio");
         }
     } else if (fd_fm_device >= 0) {
         close(fd_fm_device);
         fd_fm_device = -1;
-        LOGD("Closed msm_htc_fm after FM radio");
+        ALOGD("Closed msm_htc_fm after FM radio");
     }
 #endif
 
     fd = open("/dev/msm_audio_ctl", O_RDWR);
     if (fd < 0)        {
-       LOGE("Cannot open msm_audio_ctl");
+       ALOGE("Cannot open msm_audio_ctl");
        return -1;
     }
     path[0] = out_device;
     path[1] = rx_acdb_id;
     if (ioctl(fd, AUDIO_SWITCH_DEVICE, &path)) {
-       LOGE("Cannot switch audio device");
+       ALOGE("Cannot switch audio device");
        close(fd);
        return -1;
     }
     path[0] = mic_device;
     path[1] = tx_acdb_id;
     if (ioctl(fd, AUDIO_SWITCH_DEVICE, &path)) {
-       LOGE("Cannot switch mic device");
+       ALOGE("Cannot switch mic device");
        close(fd);
        return -1;
     }
@@ -765,18 +765,18 @@
             fd = open("/dev/msm_audio_ctl", O_RDWR);
 
             if (fd < 0) {
-                LOGE("Cannot open msm_audio_ctl");
+                ALOGE("Cannot open msm_audio_ctl");
                 return -1;
             }
         }
         path[0] = rx_acdb_id;
         path[1] = tx_acdb_id;
         if (ioctl(fd, AUDIO_START_VOICE, &path)) {
-            LOGE("Cannot start voice");
+            ALOGE("Cannot start voice");
             close(fd);
             return -1;
         }
-        LOGD("Voice Started!!");
+        ALOGD("Voice Started!!");
         voice_started = 1;
     }
     else if (inCall == false && voice_started) {
@@ -784,16 +784,16 @@
             fd = open("/dev/msm_audio_ctl", O_RDWR);
 
             if (fd < 0) {
-                LOGE("Cannot open msm_audio_ctl");
+                ALOGE("Cannot open msm_audio_ctl");
                 return -1;
             }
         }
         if (ioctl(fd, AUDIO_STOP_VOICE, NULL)) {
-               LOGE("Cannot stop voice");
+               ALOGE("Cannot stop voice");
                close(fd);
                return -1;
         }
-        LOGD("Voice Stopped!!");
+        ALOGD("Voice Stopped!!");
         voice_started = 0;
     }
 
@@ -826,7 +826,7 @@
             /* use default BT entry defined in AudioBTID.csv */
             rx_acdb_id = mBTEndpoints[0].rx;
             tx_acdb_id = mBTEndpoints[0].tx;
-            LOGD("Update ACDB ID to default BT setting\n");
+            ALOGD("Update ACDB ID to default BT setting\n");
         }
     }  else if (device == (int) SND_DEVICE_CARKIT
                 || device == (int) SND_DEVICE_BT_EC_OFF) {
@@ -837,12 +837,12 @@
             /* use default carkit entry defined in AudioBTID.csv */
             rx_acdb_id = mBTEndpoints[1].rx;
             tx_acdb_id = mBTEndpoints[1].tx;
-            LOGD("Update ACDB ID to default carkit setting");
+            ALOGD("Update ACDB ID to default carkit setting");
         }
     } else if (mMode == AudioSystem::MODE_IN_CALL
                && hac_enable && mHACSetting &&
                device == (int) SND_DEVICE_HANDSET) {
-        LOGD("Update acdb id to hac profile.");
+        ALOGD("Update acdb id to hac profile.");
         rx_acdb_id = ACDB_ID_HAC_HANDSET_SPKR;
         tx_acdb_id = ACDB_ID_HAC_HANDSET_MIC;
     } else {
@@ -851,7 +851,7 @@
         if (mRecordState)
             tx_acdb_id = getACDB(MOD_REC, device);
     }
-    LOGV("doAudioRouteOrMute: rx acdb %d, tx acdb %d\n", rx_acdb_id, tx_acdb_id);
+    ALOGV("doAudioRouteOrMute: rx acdb %d, tx acdb %d\n", rx_acdb_id, tx_acdb_id);
 
     return do_route_audio_dev_ctrl(device, mMode == AudioSystem::MODE_IN_CALL, rx_acdb_id, tx_acdb_id);
 }
@@ -880,12 +880,12 @@
     char get_batt_temp[6] = { 0 };
 
     if ((fd = open(fn, O_RDONLY)) < 0) {
-        LOGE("%s: cannot open %s: %s\n", __FUNCTION__, fn, strerror(errno));
+        ALOGE("%s: cannot open %s: %s\n", __FUNCTION__, fn, strerror(errno));
         return UNKNOWN_ERROR;
     }
 
     if ((len = read(fd, get_batt_temp, sizeof(get_batt_temp))) <= 1) {
-        LOGE("read battery temp fail: %s\n", strerror(errno));
+        ALOGE("read battery temp fail: %s\n", strerror(errno));
         close(fd);
         return BAD_VALUE;
     }
@@ -915,31 +915,31 @@
         fd_a1026 = open(path, O_RDWR | O_NONBLOCK, 0);
 
     if (fd_a1026 < 0) {
-        LOGE("Cannot open %s %d\n", path, fd_a1026);
+        ALOGE("Cannot open %s %d\n", path, fd_a1026);
         support_a1026 = 0;
         goto open_drv_err;
     }
 
     fw_fd = open(fn, O_RDONLY);
     if (fw_fd < 0) {
-        LOGE("Fail to open %s\n", fn);
+        ALOGE("Fail to open %s\n", fn);
         goto ld_img_error;
     } else {
-        LOGD("open %s success\n", fn);
+        ALOGD("open %s success\n", fn);
     }
 
     rc = fstat(fw_fd, &fw_stat);
     if (rc < 0) {
-        LOGE("Cannot stat file %s: %s\n", fn, strerror(errno));
+        ALOGE("Cannot stat file %s: %s\n", fn, strerror(errno));
         goto ld_img_error;
     }
 
     remaining = (int)fw_stat.st_size;
 
-    LOGD("Firmware %s size %d\n", fn, remaining);
+    ALOGD("Firmware %s size %d\n", fn, remaining);
 
     if (remaining > sizeof(local_vpimg_buf)) {
-        LOGE("File %s size %d exceeds internal limit %d\n",
+        ALOGE("File %s size %d exceeds internal limit %d\n",
              fn, remaining, sizeof(local_vpimg_buf));
         goto ld_img_error;
     }
@@ -947,12 +947,12 @@
     while (remaining) {
         nr = read(fw_fd, ptr, remaining);
         if (nr < 0) {
-            LOGE("Error reading firmware: %s\n", strerror(errno));
+            ALOGE("Error reading firmware: %s\n", strerror(errno));
             goto ld_img_error;
         }
         else if (!nr) {
             if (remaining)
-                LOGW("EOF reading firmware %s while %d bytes remain\n",
+                ALOGW("EOF reading firmware %s while %d bytes remain\n",
                      fn, remaining);
             break;
         }
@@ -965,14 +965,14 @@
 
     fwimg.buf = local_vpimg_buf;
     fwimg.img_size = (int)(fw_stat.st_size - remaining);
-    LOGD("Total %d bytes put to user space buffer.\n", fwimg.img_size);
+    ALOGD("Total %d bytes put to user space buffer.\n", fwimg.img_size);
 
     rc = ioctl(fd_a1026, A1026_BOOTUP_INIT, &fwimg);
     if (!rc) {
-        LOGD("audience_a1026 init OK\n");
+        ALOGD("audience_a1026 init OK\n");
         mA1026Init = 1;
     } else
-        LOGE("audience_a1026 init failed\n");
+        ALOGE("audience_a1026 init failed\n");
 
 ld_img_error:
     if (fw_fd >= 0)
@@ -994,7 +994,7 @@
     uint32_t acdb_id = 0;
     int batt_temp = 0;
     if (mMode == AudioSystem::MODE_IN_CALL) {
-        LOGD("skip update ACDB due to in-call");
+        ALOGD("skip update ACDB due to in-call");
         return 0;
     }
 
@@ -1011,11 +1011,11 @@
             case SND_DEVICE_SPEAKER_BACK_MIC:
                 acdb_id = ACDB_ID_SPKR_PLAYBACK;
                 if(alt_enable) {
-                    LOGD("Enable ALT for speaker\n");
+                    ALOGD("Enable ALT for speaker\n");
                     if (get_batt_temp(&batt_temp) == NO_ERROR) {
                         if (batt_temp < 50)
                             acdb_id = ACDB_ID_ALT_SPKR_PLAYBACK;
-                        LOGD("ALT batt temp = %d\n", batt_temp);
+                        ALOGD("ALT batt temp = %d\n", batt_temp);
                     }
                 }
                 break;
@@ -1053,7 +1053,7 @@
                 break;
         }
     }
-    LOGV("getACDB, return ID %d\n", acdb_id);
+    ALOGV("getACDB, return ID %d\n", acdb_id);
     return acdb_id;
 }
 
@@ -1084,7 +1084,7 @@
 
         fd = open("/dev/tpa2018d1", O_RDWR);
         if (fd < 0) {
-            LOGE("can't open /dev/tpa2018d1 %d", fd);
+            ALOGE("can't open /dev/tpa2018d1 %d", fd);
             return -1;
         }
 
@@ -1095,9 +1095,9 @@
         } while (--retry);
 
         if (rc < 0) {
-            LOGE("ioctl TPA2018_SET_MODE failed: %s", strerror(errno));
+            ALOGE("ioctl TPA2018_SET_MODE failed: %s", strerror(errno));
         } else
-            LOGD("Update TPA2018_SET_MODE to mode %d success", mode);
+            ALOGD("Update TPA2018_SET_MODE to mode %d success", mode);
 
         close(fd);
     }
@@ -1110,7 +1110,7 @@
     int retry = 4;
 
     if (!mA1026Init) {
-        LOGW("Audience A1026 not initialized.\n");
+        ALOGW("Audience A1026 not initialized.\n");
         return NO_INIT;
     }
 
@@ -1118,14 +1118,14 @@
     if (fd_a1026 < 0) {
         fd_a1026 = open("/dev/audience_a1026", O_RDWR);
         if (fd_a1026 < 0) {
-            LOGE("Cannot open audience_a1026 device (%d)\n", fd_a1026);
+            ALOGE("Cannot open audience_a1026 device (%d)\n", fd_a1026);
             mA1026Lock.unlock();
             return -1;
         }
     }
 
     if ((Mode < AudioSystem::MODE_CURRENT) || (Mode >= AudioSystem::NUM_MODES)) {
-        LOGW("Illegal value: doAudience_A1026_Control(%d, %u, %u)", Mode, Record, Routes);
+        ALOGW("Illegal value: doAudience_A1026_Control(%d, %u, %u)", Mode, Record, Routes);
         mA1026Lock.unlock();
         return BAD_VALUE;
     }
@@ -1141,10 +1141,10 @@
 	        case SND_DEVICE_TTY_VCO:
 	            if (enable1026) {
                     new_pathid = A1026_PATH_INCALL_RECEIVER;
-                    LOGV("A1026 control: new path is A1026_PATH_INCALL_RECEIVER");
+                    ALOGV("A1026 control: new path is A1026_PATH_INCALL_RECEIVER");
 	            } else {
 	                new_pathid = A1026_PATH_INCALL_NO_NS_RECEIVER;
-	                LOGV("A1026 control: new path is A1026_PATH_INCALL_NO_NS_RECEIVER");
+	                ALOGV("A1026 control: new path is A1026_PATH_INCALL_NO_NS_RECEIVER");
 	            }
 	            break;
 	        case SND_DEVICE_HEADSET:
@@ -1153,24 +1153,24 @@
 	        case SND_DEVICE_FM_SPEAKER:
 	        case SND_DEVICE_HEADSET_AND_SPEAKER_BACK_MIC:
 	            new_pathid = A1026_PATH_INCALL_HEADSET;
-	            LOGV("A1026 control: new path is A1026_PATH_INCALL_HEADSET");
+	            ALOGV("A1026 control: new path is A1026_PATH_INCALL_HEADSET");
 	            break;
 	        case SND_DEVICE_SPEAKER:
 	            //TODO: what do we do for camcorder when in call?
 	        case SND_DEVICE_SPEAKER_BACK_MIC:
 	            new_pathid = A1026_PATH_INCALL_SPEAKER;
-	            LOGV("A1026 control: new path is A1026_PATH_INCALL_SPEAKER");
+	            ALOGV("A1026 control: new path is A1026_PATH_INCALL_SPEAKER");
 	            break;
 	        case SND_DEVICE_BT:
 	        case SND_DEVICE_BT_EC_OFF:
 	        case SND_DEVICE_CARKIT:
 	            new_pathid = A1026_PATH_INCALL_BT;
-	            LOGV("A1026 control: new path is A1026_PATH_INCALL_BT");
+	            ALOGV("A1026 control: new path is A1026_PATH_INCALL_BT");
 	            break;
 	        case SND_DEVICE_TTY_HCO:
 	        case SND_DEVICE_TTY_FULL:
 	            new_pathid = A1026_PATH_INCALL_TTY;
-	            LOGV("A1026 control: new path is A1026_PATH_INCALL_TTY");
+	            ALOGV("A1026 control: new path is A1026_PATH_INCALL_TTY");
 	            break;
 	        default:
 	            break;
@@ -1182,10 +1182,10 @@
 	        case SND_DEVICE_TTY_VCO:
 	            if (enable1026) {
 	                new_pathid = A1026_PATH_INCALL_RECEIVER; /* NS CT mode, Dual MIC */
-                    LOGV("A1026 control: new path is A1026_PATH_INCALL_RECEIVER");
+                    ALOGV("A1026 control: new path is A1026_PATH_INCALL_RECEIVER");
 	            } else {
 	                new_pathid = A1026_PATH_INCALL_NO_NS_RECEIVER;
-	                LOGV("A1026 control: new path is A1026_PATH_INCALL_NO_NS_RECEIVER");
+	                ALOGV("A1026 control: new path is A1026_PATH_INCALL_NO_NS_RECEIVER");
 	            }
 	            break;
 	        case SND_DEVICE_HEADSET:
@@ -1193,22 +1193,22 @@
 	        case SND_DEVICE_FM_HEADSET:
 	        case SND_DEVICE_FM_SPEAKER:
 	            new_pathid = A1026_PATH_INCALL_HEADSET; /* NS disable, Headset MIC */
-	            LOGV("A1026 control: new path is A1026_PATH_INCALL_HEADSET");
+	            ALOGV("A1026 control: new path is A1026_PATH_INCALL_HEADSET");
 	            break;
 	        case SND_DEVICE_SPEAKER:
 	            new_pathid = A1026_PATH_INCALL_SPEAKER; /* NS FT mode, Main MIC */
-	            LOGV("A1026 control: new path is A1026_PATH_INCALL_SPEAKER");
+	            ALOGV("A1026 control: new path is A1026_PATH_INCALL_SPEAKER");
 	            break;
 	        case SND_DEVICE_BT:
 	        case SND_DEVICE_BT_EC_OFF:
 	        case SND_DEVICE_CARKIT:
 	            new_pathid = A1026_PATH_INCALL_BT; /* QCOM NS, BT MIC */
-	            LOGV("A1026 control: new path is A1026_PATH_INCALL_BT");
+	            ALOGV("A1026 control: new path is A1026_PATH_INCALL_BT");
 	            break;
 	        case SND_DEVICE_TTY_HCO:
 	        case SND_DEVICE_TTY_FULL:
 	            new_pathid = A1026_PATH_INCALL_TTY;
-	            LOGV("A1026 control: new path is A1026_PATH_INCALL_TTY");
+	            ALOGV("A1026 control: new path is A1026_PATH_INCALL_TTY");
 	            break;
 	        default:
 	            break;
@@ -1223,14 +1223,14 @@
 	        if (vr_mode_enabled) {
 	            if (vr_uses_ns) {
 	                new_pathid = A1026_PATH_VR_NS_RECEIVER;
-	                LOGV("A1026 control: new path is A1026_PATH_VR_NS_RECEIVER");
+	                ALOGV("A1026 control: new path is A1026_PATH_VR_NS_RECEIVER");
 	            } else {
 	                new_pathid = A1026_PATH_VR_NO_NS_RECEIVER;
-	                LOGV("A1026 control: new path is A1026_PATH_VR_NO_NS_RECEIVER");
+	                ALOGV("A1026 control: new path is A1026_PATH_VR_NO_NS_RECEIVER");
 	            }
 	        } else {
 	            new_pathid = A1026_PATH_RECORD_RECEIVER; /* INT-MIC Recording: NS disable, Main MIC */
-                LOGV("A1026 control: new path is A1026_PATH_RECORD_RECEIVER");
+                ALOGV("A1026 control: new path is A1026_PATH_RECORD_RECEIVER");
 	        }
 	        break;
         case SND_DEVICE_HEADSET:
@@ -1240,14 +1240,14 @@
 	        if (vr_mode_enabled) {
 	            if (vr_uses_ns) {
 	                new_pathid = A1026_PATH_VR_NS_HEADSET;
-	                LOGV("A1026 control: new path is A1026_PATH_VR_NS_HEADSET");
+	                ALOGV("A1026 control: new path is A1026_PATH_VR_NS_HEADSET");
 	            } else {
 	                new_pathid = A1026_PATH_VR_NO_NS_HEADSET;
-	                LOGV("A1026 control: new path is A1026_PATH_VR_NO_NS_HEADSET");
+	                ALOGV("A1026 control: new path is A1026_PATH_VR_NO_NS_HEADSET");
 	            }
 	        } else {
 	            new_pathid = A1026_PATH_RECORD_HEADSET; /* EXT-MIC Recording: NS disable, Headset MIC */
-	            LOGV("A1026 control: new path is A1026_PATH_RECORD_HEADSET");
+	            ALOGV("A1026 control: new path is A1026_PATH_RECORD_HEADSET");
 	        }
 	        break;
         case SND_DEVICE_SPEAKER_BACK_MIC:
@@ -1255,7 +1255,7 @@
         case SND_DEVICE_HANDSET_BACK_MIC:
         case SND_DEVICE_HEADSET_AND_SPEAKER_BACK_MIC:
 	        new_pathid = A1026_PATH_CAMCORDER; /* CAM-Coder: NS FT mode, Back MIC */
-	        LOGV("A1026 control: new path is A1026_PATH_CAMCORDER");
+	        ALOGV("A1026 control: new path is A1026_PATH_CAMCORDER");
 	        break;
         case SND_DEVICE_BT:
         case SND_DEVICE_BT_EC_OFF:
@@ -1263,14 +1263,14 @@
 	        if (vr_mode_enabled) {
 	            if (vr_uses_ns) {
 	                new_pathid = A1026_PATH_VR_NS_BT;
-	                LOGV("A1026 control: new path is A1026_PATH_VR_NS_BT");
+	                ALOGV("A1026 control: new path is A1026_PATH_VR_NS_BT");
 	            } else {
 	                new_pathid = A1026_PATH_VR_NO_NS_BT;
-	                LOGV("A1026 control: new path is A1026_PATH_VR_NO_NS_BT");
+	                ALOGV("A1026 control: new path is A1026_PATH_VR_NO_NS_BT");
 	            }
 	        } else {
 	            new_pathid = A1026_PATH_RECORD_BT; /* BT MIC */
-	            LOGV("A1026 control: new path is A1026_PATH_RECORD_BT");
+	            ALOGV("A1026 control: new path is A1026_PATH_RECORD_BT");
 	        }
 	        break;
         default:
@@ -1283,7 +1283,7 @@
         case SND_DEVICE_BT_EC_OFF:
         case SND_DEVICE_CARKIT:
             new_pathid = A1026_PATH_RECORD_BT; /* BT MIC */
-            LOGV("A1026 control: new path is A1026_PATH_RECORD_BT");
+            ALOGV("A1026 control: new path is A1026_PATH_RECORD_BT");
             break;
         default:
             new_pathid = A1026_PATH_SUSPEND;
@@ -1292,7 +1292,7 @@
     }
 
     if (old_pathid != new_pathid) {
-        //LOGI("A1026: do ioctl(A1026_SET_CONFIG) to %d\n", new_pathid);
+        //ALOGI("A1026: do ioctl(A1026_SET_CONFIG) to %d\n", new_pathid);
         do {
             rc = ioctl(fd_a1026, A1026_SET_CONFIG, &new_pathid);
             if (!rc) {
@@ -1302,23 +1302,23 @@
         } while (--retry);
 
         if (rc < 0) {
-            LOGW("A1026 do hard reset to recover from error!\n");
+            ALOGW("A1026 do hard reset to recover from error!\n");
             rc = doA1026_init(); /* A1026 needs to do hard reset! */
             if (!rc) {
                 /* after doA1026_init(), fd_a1026 is -1*/
                 fd_a1026 = open("/dev/audience_a1026", O_RDWR);
                 if (fd_a1026 < 0) {
-                    LOGE("A1026 Fatal Error: unable to open A1026 after hard reset\n");
+                    ALOGE("A1026 Fatal Error: unable to open A1026 after hard reset\n");
                 } else {
                     rc = ioctl(fd_a1026, A1026_SET_CONFIG, &new_pathid);
                     if (!rc) {
                         old_pathid = new_pathid;
                     } else {
-                        LOGE("A1026 Fatal Error: unable to A1026_SET_CONFIG after hard reset\n");
+                        ALOGE("A1026 Fatal Error: unable to A1026_SET_CONFIG after hard reset\n");
                     }
                 }
             } else
-                LOGE("A1026 Fatal Error: Re-init A1026 Failed\n");
+                ALOGE("A1026 Fatal Error: Re-init A1026 Failed\n");
         }
     }
 
@@ -1359,46 +1359,46 @@
     }
 
     if (sndDevice == -1 && inputDevice != 0) {
-        LOGI("do input routing device %x\n", inputDevice);
+        ALOGI("do input routing device %x\n", inputDevice);
         if (inputDevice & AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET) {
-            LOGI("Routing audio to Bluetooth PCM\n");
+            ALOGI("Routing audio to Bluetooth PCM\n");
             sndDevice = SND_DEVICE_BT;
         } else if (inputDevice & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT) {
-            LOGI("Routing audio to Bluetooth car kit\n");
+            ALOGI("Routing audio to Bluetooth car kit\n");
             sndDevice = SND_DEVICE_CARKIT;
         } else if (inputDevice & AudioSystem::DEVICE_IN_WIRED_HEADSET) {
             if ((outputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET) &&
                     (outputDevices & AudioSystem::DEVICE_OUT_SPEAKER)) {
-                        LOGI("Routing audio to Wired Headset and Speaker\n");
+                        ALOGI("Routing audio to Wired Headset and Speaker\n");
                         sndDevice = SND_DEVICE_HEADSET_AND_SPEAKER;
             } else {
-                LOGI("Routing audio to Wired Headset\n");
+                ALOGI("Routing audio to Wired Headset\n");
                 sndDevice = SND_DEVICE_HEADSET;
             }
         } else if (inputDevice & AudioSystem::DEVICE_IN_BACK_MIC) {
             if (outputDevices & (AudioSystem:: DEVICE_OUT_WIRED_HEADSET) &&
                    (outputDevices & AudioSystem:: DEVICE_OUT_SPEAKER)) {
-                LOGI("Routing audio to Wired Headset and Speaker with back mic\n");
+                ALOGI("Routing audio to Wired Headset and Speaker with back mic\n");
                 sndDevice = SND_DEVICE_HEADSET_AND_SPEAKER_BACK_MIC;
             } else if (outputDevices & AudioSystem::DEVICE_OUT_SPEAKER) {
-                LOGI("Routing audio to Speakerphone with back mic\n");
+                ALOGI("Routing audio to Speakerphone with back mic\n");
                 sndDevice = SND_DEVICE_SPEAKER_BACK_MIC;
             } else if (outputDevices == AudioSystem::DEVICE_OUT_EARPIECE) {
-                LOGI("Routing audio to Handset with back mic\n");
+                ALOGI("Routing audio to Handset with back mic\n");
                 sndDevice = SND_DEVICE_HANDSET_BACK_MIC;
             } else {
-                LOGI("Routing audio to Headset with back mic\n");
+                ALOGI("Routing audio to Headset with back mic\n");
                 sndDevice = SND_DEVICE_NO_MIC_HEADSET_BACK_MIC;
             }
         } else {
             if (outputDevices & AudioSystem::DEVICE_OUT_SPEAKER) {
-                LOGI("Routing audio to Speakerphone\n");
+                ALOGI("Routing audio to Speakerphone\n");
                 sndDevice = SND_DEVICE_SPEAKER;
             } else if (outputDevices == AudioSystem::DEVICE_OUT_WIRED_HEADPHONE) {
-                LOGI("Routing audio to Speakerphone\n");
+                ALOGI("Routing audio to Speakerphone\n");
                 sndDevice = SND_DEVICE_NO_MIC_HEADSET;
             } else {
-                LOGI("Routing audio to Handset\n");
+                ALOGI("Routing audio to Handset\n");
                 sndDevice = SND_DEVICE_HANDSET;
             }
         }
@@ -1408,38 +1408,38 @@
     if (sndDevice == -1) {
         if (outputDevices & (outputDevices - 1)) {
             if ((outputDevices & AudioSystem::DEVICE_OUT_SPEAKER) == 0) {
-                LOGW("Hardware does not support requested route combination (%#X),"
+                ALOGW("Hardware does not support requested route combination (%#X),"
                         " picking closest possible route...", outputDevices);
             }
         }
 
         if (outputDevices &
                 (AudioSystem::DEVICE_OUT_BLUETOOTH_SCO | AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_HEADSET)) {
-                    LOGI("Routing audio to Bluetooth PCM\n");
+                    ALOGI("Routing audio to Bluetooth PCM\n");
                     sndDevice = SND_DEVICE_BT;
         } else if (outputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT) {
-            LOGI("Routing audio to Bluetooth PCM\n");
+            ALOGI("Routing audio to Bluetooth PCM\n");
             sndDevice = SND_DEVICE_CARKIT;
         } else if ((outputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET) &&
                 (outputDevices & AudioSystem::DEVICE_OUT_SPEAKER)) {
-                    LOGI("Routing audio to Wired Headset and Speaker\n");
+                    ALOGI("Routing audio to Wired Headset and Speaker\n");
                     sndDevice = SND_DEVICE_HEADSET_AND_SPEAKER;
         } else if (outputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE) {
             if (outputDevices & AudioSystem::DEVICE_OUT_SPEAKER) {
-                LOGI("Routing audio to No microphone Wired Headset and Speaker (%d,%x)\n", mMode, outputDevices);
+                ALOGI("Routing audio to No microphone Wired Headset and Speaker (%d,%x)\n", mMode, outputDevices);
                 sndDevice = SND_DEVICE_HEADSET_AND_SPEAKER;
             } else {
-                LOGI("Routing audio to No microphone Wired Headset (%d,%x)\n", mMode, outputDevices);
+                ALOGI("Routing audio to No microphone Wired Headset (%d,%x)\n", mMode, outputDevices);
                 sndDevice = SND_DEVICE_NO_MIC_HEADSET;
             }
         } else if (outputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET) {
-            LOGI("Routing audio to Wired Headset\n");
+            ALOGI("Routing audio to Wired Headset\n");
             sndDevice = SND_DEVICE_HEADSET;
         } else if (outputDevices & AudioSystem::DEVICE_OUT_SPEAKER) {
-            LOGI("Routing audio to Speakerphone\n");
+            ALOGI("Routing audio to Speakerphone\n");
             sndDevice = SND_DEVICE_SPEAKER;
         } else {
-            LOGI("Routing audio to Handset\n");
+            ALOGI("Routing audio to Handset\n");
             sndDevice = SND_DEVICE_HANDSET;
         }
     }
@@ -1449,7 +1449,7 @@
         mCurSndDevice = sndDevice;
         if (mMode == AudioSystem::MODE_IN_CALL) {
             if (mHACSetting && hac_enable && mCurSndDevice == (int) SND_DEVICE_HANDSET) {
-                LOGD("HAC enable: Setting in-call volume to maximum.\n");
+                ALOGD("HAC enable: Setting in-call volume to maximum.\n");
                 set_volume_rpc(VOICE_VOLUME_MAX);
             } else {
                 set_volume_rpc(mVoiceVolume);
@@ -1582,22 +1582,22 @@
 
 ssize_t AudioHardware::AudioStreamOutMSM72xx::write(const void* buffer, size_t bytes)
 {
-    // LOGD("AudioStreamOutMSM72xx::write(%p, %u)", buffer, bytes);
+    // ALOGD("AudioStreamOutMSM72xx::write(%p, %u)", buffer, bytes);
     status_t status = NO_INIT;
     size_t count = bytes;
     const uint8_t* p = static_cast<const uint8_t*>(buffer);
 
     if (mStandby) {
 
-        LOGV("acquire output wakelock");
+        ALOGV("acquire output wakelock");
         acquire_wake_lock(PARTIAL_WAKE_LOCK, kOutputWakelockStr);
 
         // open driver
-        LOGV("open pcm_out driver");
+        ALOGV("open pcm_out driver");
         status = ::open("/dev/msm_pcm_out", O_RDWR);
         if (status < 0) {
             if (errCount++ < 10) {
-                LOGE("Cannot open /dev/msm_pcm_out errno: %d", errno);
+                ALOGE("Cannot open /dev/msm_pcm_out errno: %d", errno);
             }
             release_wake_lock(kOutputWakelockStr);
             goto Error;
@@ -1606,15 +1606,15 @@
         mStandby = false;
 
         // configuration
-        LOGV("get config");
+        ALOGV("get config");
         struct msm_audio_config config;
         status = ioctl(mFd, AUDIO_GET_CONFIG, &config);
         if (status < 0) {
-            LOGE("Cannot read pcm_out config");
+            ALOGE("Cannot read pcm_out config");
             goto Error;
         }
 
-        LOGV("set pcm_out config");
+        ALOGV("set pcm_out config");
         config.channel_count = AudioSystem::popCount(channels());
         config.sample_rate = mSampleRate;
         config.buffer_size = mBufferSize;
@@ -1622,25 +1622,25 @@
         config.codec_type = CODEC_TYPE_PCM;
         status = ioctl(mFd, AUDIO_SET_CONFIG, &config);
         if (status < 0) {
-            LOGE("Cannot set config");
+            ALOGE("Cannot set config");
             goto Error;
         }
 
-        LOGV("buffer_size: %u", config.buffer_size);
-        LOGV("buffer_count: %u", config.buffer_count);
-        LOGV("channel_count: %u", config.channel_count);
-        LOGV("sample_rate: %u", config.sample_rate);
+        ALOGV("buffer_size: %u", config.buffer_size);
+        ALOGV("buffer_count: %u", config.buffer_count);
+        ALOGV("channel_count: %u", config.channel_count);
+        ALOGV("sample_rate: %u", config.sample_rate);
 
         uint32_t acdb_id = mHardware->getACDB(MOD_PLAY, mHardware->get_snd_dev());
         status = ioctl(mFd, AUDIO_START, &acdb_id);
         if (status < 0) {
-            LOGE("Cannot start pcm playback");
+            ALOGE("Cannot start pcm playback");
             goto Error;
         }
 
         status = ioctl(mFd, AUDIO_SET_VOLUME, &stream_volume);
         if (status < 0) {
-            LOGE("Cannot start pcm playback");
+            ALOGE("Cannot start pcm playback");
             goto Error;
         }
     }
@@ -1656,7 +1656,7 @@
                 goto Error;
             }
             mRetryCount++;
-            LOGD("EAGAIN - retry");
+            ALOGD("EAGAIN - retry");
         }
     }
 
@@ -1674,12 +1674,12 @@
 status_t AudioHardware::AudioStreamOutMSM72xx::standby()
 {
     if (!mStandby) {
-        LOGD("AudioHardware pcm playback is going to standby.");
+        ALOGD("AudioHardware pcm playback is going to standby.");
         if (mFd >= 0) {
             ::close(mFd);
             mFd = -1;
         }
-        LOGV("release output wakelock");
+        ALOGV("release output wakelock");
         release_wake_lock(kOutputWakelockStr);
         mStandby = true;
     }
@@ -1727,11 +1727,11 @@
     String8 key = String8(AudioParameter::keyRouting);
     status_t status = NO_ERROR;
     int device;
-    LOGV("AudioStreamOutMSM72xx::setParameters() %s", keyValuePairs.string());
+    ALOGV("AudioStreamOutMSM72xx::setParameters() %s", keyValuePairs.string());
 
     if (param.getInt(key, device) == NO_ERROR) {
         mDevices = device;
-        LOGV("set output routing %x", mDevices);
+        ALOGV("set output routing %x", mDevices);
         status = mHardware->doRouting();
         param.remove(key);
     }
@@ -1749,11 +1749,11 @@
     String8 key = String8(AudioParameter::keyRouting);
 
     if (param.get(key, value) == NO_ERROR) {
-        LOGV("get routing %x", mDevices);
+        ALOGV("get routing %x", mDevices);
         param.addInt(key, (int)mDevices);
     }
 
-    LOGV("AudioStreamOutMSM72xx::getParameters() %s", param.toString().string());
+    ALOGV("AudioStreamOutMSM72xx::getParameters() %s", param.toString().string());
     return param.toString();
 }
 
@@ -1798,9 +1798,9 @@
 
     mHardware = hw;
 
-    LOGV("AudioStreamInMSM72xx::set(%d, %d, %u)", *pFormat, *pChannels, *pRate);
+    ALOGV("AudioStreamInMSM72xx::set(%d, %d, %u)", *pFormat, *pChannels, *pRate);
     if (mFd >= 0) {
-        LOGE("Audio record already open");
+        ALOGE("Audio record already open");
         return -EPERM;
     }
 
@@ -1816,13 +1816,13 @@
 
 AudioHardware::AudioStreamInMSM72xx::~AudioStreamInMSM72xx()
 {
-    LOGV("AudioStreamInMSM72xx destructor");
+    ALOGV("AudioStreamInMSM72xx destructor");
     standby();
 }
 
 ssize_t AudioHardware::AudioStreamInMSM72xx::read( void* buffer, ssize_t bytes)
 {
-//    LOGV("AudioStreamInMSM72xx::read(%p, %ld)", buffer, bytes);
+//    ALOGV("AudioStreamInMSM72xx::read(%p, %ld)", buffer, bytes);
     if (!mHardware) return -1;
 
     size_t count = bytes;
@@ -1832,13 +1832,13 @@
     if (mStandby) {
         {   // scope for the lock
             Mutex::Autolock lock(mHardware->mLock);
-            LOGV("acquire input wakelock");
+            ALOGV("acquire input wakelock");
             acquire_wake_lock(PARTIAL_WAKE_LOCK, kInputWakelockStr);
             // open audio input device
             status = ::open("/dev/msm_pcm_in", O_RDWR);
             if (status < 0) {
-                LOGE("Cannot open /dev/msm_pcm_in errno: %d", errno);
-                LOGV("release input wakelock");
+                ALOGE("Cannot open /dev/msm_pcm_in errno: %d", errno);
+                ALOGV("release input wakelock");
                 release_wake_lock(kInputWakelockStr);
                 goto Error;
             }
@@ -1846,15 +1846,15 @@
             mStandby = false;
 
             // configuration
-            LOGV("get config");
+            ALOGV("get config");
             struct msm_audio_config config;
             status = ioctl(mFd, AUDIO_GET_CONFIG, &config);
             if (status < 0) {
-                LOGE("Cannot read config");
+                ALOGE("Cannot read config");
                 goto Error;
             }
 
-            LOGV("set config");
+            ALOGV("set config");
             config.channel_count = AudioSystem::popCount(mChannels);
             config.sample_rate = mSampleRate;
             config.buffer_size = mBufferSize;
@@ -1862,14 +1862,14 @@
             config.codec_type = CODEC_TYPE_PCM;
             status = ioctl(mFd, AUDIO_SET_CONFIG, &config);
             if (status < 0) {
-                LOGE("Cannot set config");
+                ALOGE("Cannot set config");
                 goto Error;
             }
 
-            LOGV("buffer_size: %u", config.buffer_size);
-            LOGV("buffer_count: %u", config.buffer_count);
-            LOGV("channel_count: %u", config.channel_count);
-            LOGV("sample_rate: %u", config.sample_rate);
+            ALOGV("buffer_size: %u", config.buffer_size);
+            ALOGV("buffer_count: %u", config.buffer_count);
+            ALOGV("channel_count: %u", config.channel_count);
+            ALOGV("sample_rate: %u", config.sample_rate);
         }
 
         mHardware->set_mRecordState(1);
@@ -1879,7 +1879,7 @@
 
         uint32_t acdb_id = mHardware->getACDB(MOD_REC, mHardware->get_snd_dev());
         if (ioctl(mFd, AUDIO_START, &acdb_id)) {
-            LOGE("Error starting record");
+            ALOGE("Error starting record");
             goto Error;
         }
     }
@@ -1895,7 +1895,7 @@
                 goto Error;
             }
             mRetryCount++;
-            LOGD("EAGAIN - retrying");
+            ALOGD("EAGAIN - retrying");
         }
     }
     return bytes;
@@ -1912,12 +1912,12 @@
 status_t AudioHardware::AudioStreamInMSM72xx::standby()
 {
     if (!mStandby) {
-        LOGD("AudioHardware PCM record is going to standby.");
+        ALOGD("AudioHardware PCM record is going to standby.");
         if (mFd >= 0) {
             ::close(mFd);
             mFd = -1;
         }
-        LOGV("release input wakelock");
+        ALOGV("release input wakelock");
         release_wake_lock(kInputWakelockStr);
 
         mStandby = true;
@@ -1971,11 +1971,11 @@
     int device;
     String8 key = String8(AudioParameter::keyInputSource);
     int source;
-    LOGV("AudioStreamInMSM72xx::setParameters() %s", keyValuePairs.string());
+    ALOGV("AudioStreamInMSM72xx::setParameters() %s", keyValuePairs.string());
 
     // reading input source for voice recognition mode parameter
     if (param.getInt(key, source) == NO_ERROR) {
-        LOGV("set input source %d", source);
+        ALOGV("set input source %d", source);
         int uses_vr = (source == AUDIO_SOURCE_VOICE_RECOGNITION);
         vr_mode_change = (vr_mode_enabled != uses_vr);
         vr_mode_enabled = uses_vr;
@@ -1985,7 +1985,7 @@
     // reading routing parameter
     key = String8(AudioParameter::keyRouting);
     if (param.getInt(key, device) == NO_ERROR) {
-        LOGV("set input routing %x", device);
+        ALOGV("set input routing %x", device);
         if (device & (device - 1)) {
             status = BAD_VALUE;
         } else {
@@ -2008,11 +2008,11 @@
     String8 key = String8(AudioParameter::keyRouting);
 
     if (param.get(key, value) == NO_ERROR) {
-        LOGV("get routing %x", mDevices);
+        ALOGV("get routing %x", mDevices);
         param.addInt(key, (int)mDevices);
     }
 
-    LOGV("AudioStreamInMSM72xx::getParameters() %s", param.toString().string());
+    ALOGV("AudioStreamInMSM72xx::getParameters() %s", param.toString().string());
     return param.toString();
 }
 
diff --git a/libaudio-qsd8k/AudioPolicyManager.cpp b/libaudio-qsd8k/AudioPolicyManager.cpp
index 2328847..8bdad87 100644
--- a/libaudio-qsd8k/AudioPolicyManager.cpp
+++ b/libaudio-qsd8k/AudioPolicyManager.cpp
@@ -55,7 +55,7 @@
 
     if (fromCache) {
         device = mDeviceForStrategy[strategy];
-        LOGV("getDeviceForStrategy() from cache strategy %d, device %x", strategy, device);
+        ALOGV("getDeviceForStrategy() from cache strategy %d, device %x", strategy, device);
         return device;
     }
 
@@ -109,7 +109,7 @@
             }
             device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_EARPIECE;
             if (device == 0) {
-                LOGE("getDeviceForStrategy() earpiece device not found");
+                ALOGE("getDeviceForStrategy() earpiece device not found");
             }
             break;
 
@@ -132,7 +132,7 @@
             }
             device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
             if (device == 0) {
-                LOGE("getDeviceForStrategy() speaker device not found");
+                ALOGE("getDeviceForStrategy() speaker device not found");
             }
             break;
         }
@@ -152,7 +152,7 @@
         if (mForceUse[AudioSystem::FOR_DOCK] != AudioSystem::FORCE_BT_CAR_DOCK) {
             device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
             if (device == 0) {
-                LOGE("getDeviceForStrategy() speaker device not found");
+                ALOGE("getDeviceForStrategy() speaker device not found");
             }
             if (mForceUse[AudioSystem::FOR_DOCK] == AudioSystem::FORCE_BT_DESK_DOCK) {
                 if (mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE) {
@@ -212,7 +212,7 @@
         // device is DEVICE_OUT_SPEAKER if we come from case STRATEGY_SONIFICATION, 0 otherwise
         device |= device2;
         if (device == 0) {
-            LOGE("getDeviceForStrategy() speaker device not found");
+            ALOGE("getDeviceForStrategy() speaker device not found");
         }
         // Do not play media stream if in call and the requested device would change the hardware
         // output routing
@@ -220,16 +220,16 @@
             !AudioSystem::isA2dpDevice((AudioSystem::audio_devices)device) &&
             device != getDeviceForStrategy(STRATEGY_PHONE, false)) {
             device = 0;
-            LOGV("getDeviceForStrategy() incompatible media and phone devices");
+            ALOGV("getDeviceForStrategy() incompatible media and phone devices");
         }
         } break;
 
     default:
-        LOGW("getDeviceForStrategy() unknown strategy: %d", strategy);
+        ALOGW("getDeviceForStrategy() unknown strategy: %d", strategy);
         break;
     }
 
-    LOGV("getDeviceForStrategy() strategy %d, device %x", strategy, device);
+    ALOGV("getDeviceForStrategy() strategy %d, device %x", strategy, device);
     return device;
 }
 
@@ -257,7 +257,7 @@
     // avoid saturation
     if (mPhoneState == AudioSystem::MODE_IN_CALL && AudioSystem::isBluetoothScoDevice((AudioSystem::audio_devices)device)) {
         if (volume > IN_CALL_SCO_VOLUME_MAX) {
-            LOGV("computeVolume limiting SYSTEM volume %f to %f",volume, IN_CALL_SCO_VOLUME_MAX);
+            ALOGV("computeVolume limiting SYSTEM volume %f to %f",volume, IN_CALL_SCO_VOLUME_MAX);
             volume = IN_CALL_SCO_VOLUME_MAX;
         }
     }
diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp
index 78b6a3e..d7b455d 100644
--- a/libaudio/AudioHardware.cpp
+++ b/libaudio/AudioHardware.cpp
@@ -71,7 +71,7 @@
 
     acoustic = ::dlopen("/system/lib/libhtc_acoustic.so", RTLD_NOW);
     if (acoustic == NULL ) {
-        LOGE("Could not open libhtc_acoustic.so");
+        ALOGE("Could not open libhtc_acoustic.so");
         /* this is not really an error on non-htc devices... */
         mNumSndEndpoints = 0;
         mInit = true;
@@ -80,31 +80,31 @@
 
     set_acoustic_parameters = (int (*)(void))::dlsym(acoustic, "set_acoustic_parameters");
     if ((*set_acoustic_parameters) == 0 ) {
-        LOGE("Could not open set_acoustic_parameters()");
+        ALOGE("Could not open set_acoustic_parameters()");
         return;
     }
 
     int rc = set_acoustic_parameters();
     if (rc < 0) {
-        LOGE("Could not set acoustic parameters to share memory: %d", rc);
+        ALOGE("Could not set acoustic parameters to share memory: %d", rc);
 //        return;
     }
 
     snd_get_num = (int (*)(void))::dlsym(acoustic, "snd_get_num_endpoints");
     if ((*snd_get_num) == 0 ) {
-        LOGE("Could not open snd_get_num()");
+        ALOGE("Could not open snd_get_num()");
 //        return;
     }
 
     mNumSndEndpoints = snd_get_num();
-    LOGD("mNumSndEndpoints = %d", mNumSndEndpoints);
+    ALOGD("mNumSndEndpoints = %d", mNumSndEndpoints);
     mSndEndpoints = new msm_snd_endpoint[mNumSndEndpoints];
     mInit = true;
-    LOGV("constructed %d SND endpoints)", mNumSndEndpoints);
+    ALOGV("constructed %d SND endpoints)", mNumSndEndpoints);
     ept = mSndEndpoints;
     snd_get_endpoint = (int (*)(int, msm_snd_endpoint *))::dlsym(acoustic, "snd_get_endpoint");
     if ((*snd_get_endpoint) == 0 ) {
-        LOGE("Could not open snd_get_endpoint()");
+        ALOGE("Could not open snd_get_endpoint()");
         return;
     }
 
@@ -114,7 +114,7 @@
 #define CHECK_FOR(desc) \
         if (!strcmp(ept->name, #desc)) { \
             SND_DEVICE_##desc = ept->id; \
-            LOGD("BT MATCH " #desc); \
+            ALOGD("BT MATCH " #desc); \
         } else
         CHECK_FOR(CURRENT)
         CHECK_FOR(HANDSET)
@@ -186,7 +186,7 @@
 void AudioHardware::closeOutputStream(AudioStreamOut* out) {
     Mutex::Autolock lock(mLock);
     if (mOutput == 0 || mOutput != out) {
-        LOGW("Attempt to close invalid output stream");
+        ALOGW("Attempt to close invalid output stream");
     }
     else {
         delete mOutput;
@@ -227,7 +227,7 @@
 
     ssize_t index = mInputs.indexOf((AudioStreamInMSM72xx *)in);
     if (index < 0) {
-        LOGW("Attempt to close invalid input stream");
+        ALOGW("Attempt to close invalid input stream");
     } else {
         mLock.unlock();
         delete mInputs[index];
@@ -288,7 +288,7 @@
     const char BT_NREC_VALUE_ON[] = "on";
 
 
-    LOGV("setParameters() %s", keyValuePairs.string());
+    ALOGV("setParameters() %s", keyValuePairs.string());
 
     if (keyValuePairs.length() == 0) return BAD_VALUE;
 
@@ -298,7 +298,7 @@
             mBluetoothNrec = true;
         } else {
             mBluetoothNrec = false;
-            LOGI("Turning noise reduction and echo cancellation off for BT "
+            ALOGI("Turning noise reduction and echo cancellation off for BT "
                  "headset");
         }
     }
@@ -308,12 +308,12 @@
         for (int i = 0; i < mNumSndEndpoints; i++) {
             if (!strcasecmp(value.string(), mSndEndpoints[i].name)) {
                 mBluetoothId = mSndEndpoints[i].id;
-                LOGI("Using custom acoustic parameters for %s", value.string());
+                ALOGI("Using custom acoustic parameters for %s", value.string());
                 break;
             }
         }
         if (mBluetoothId == 0) {
-            LOGI("Using default acoustic parameters "
+            ALOGI("Using default acoustic parameters "
                  "(%s not in acoustic database)", value.string());
             doRouting();
         }
@@ -346,11 +346,11 @@
 size_t AudioHardware::getInputBufferSize(uint32_t sampleRate, int format, int channelCount)
 {
     if (format != AudioSystem::PCM_16_BIT) {
-        LOGW("getInputBufferSize bad format: %d", format);
+        ALOGW("getInputBufferSize bad format: %d", format);
         return 0;
     }
     if (channelCount < 1 || channelCount > 2) {
-        LOGW("getInputBufferSize bad channel count: %d", channelCount);
+        ALOGW("getInputBufferSize bad channel count: %d", channelCount);
         return 0;
     }
 
@@ -363,14 +363,14 @@
 {
     int fd;
 #if LOG_SND_RPC
-    LOGD("rpc_snd_set_volume(%d, %d, %d)\n", device, method, volume);
+    ALOGD("rpc_snd_set_volume(%d, %d, %d)\n", device, method, volume);
 #endif
 
     if (device == -1UL) return NO_ERROR;
 
     fd = open("/dev/msm_snd", O_RDWR);
     if (fd < 0) {
-        LOGE("Can not open snd device");
+        ALOGE("Can not open snd device");
         return -EPERM;
     }
     /* rpc_snd_set_volume(
@@ -388,7 +388,7 @@
      args.volume = volume;
 
      if (ioctl(fd, SND_SET_VOLUME, &args) < 0) {
-         LOGE("snd_set_volume error.");
+         ALOGE("snd_set_volume error.");
          close(fd);
          return -EIO;
      }
@@ -399,16 +399,16 @@
 status_t AudioHardware::setVoiceVolume(float v)
 {
     if (v < 0.0) {
-        LOGW("setVoiceVolume(%f) under 0.0, assuming 0.0\n", v);
+        ALOGW("setVoiceVolume(%f) under 0.0, assuming 0.0\n", v);
         v = 0.0;
     } else if (v > 1.0) {
-        LOGW("setVoiceVolume(%f) over 1.0, assuming 1.0\n", v);
+        ALOGW("setVoiceVolume(%f) over 1.0, assuming 1.0\n", v);
         v = 1.0;
     }
 
     int vol = lrint(v * 5.0);
-    LOGD("setVoiceVolume(%f)\n", v);
-    LOGI("Setting in-call volume to %d (available range is 0 to 5)\n", vol);
+    ALOGD("setVoiceVolume(%f)\n", v);
+    ALOGI("Setting in-call volume to %d (available range is 0 to 5)\n", vol);
 
     Mutex::Autolock lock(mLock);
     set_volume_rpc(SND_DEVICE_CURRENT, SND_METHOD_VOICE, vol);
@@ -419,7 +419,7 @@
 {
     Mutex::Autolock lock(mLock);
     int vol = ceil(v * 5.0);
-    LOGI("Set master volume to %d.\n", vol);
+    ALOGI("Set master volume to %d.\n", vol);
     /*
     set_volume_rpc(SND_DEVICE_HANDSET, SND_METHOD_VOICE, vol);
     set_volume_rpc(SND_DEVICE_SPEAKER, SND_METHOD_VOICE, vol);
@@ -440,12 +440,12 @@
 
     int fd;
 #if LOG_SND_RPC
-    LOGD("rpc_snd_set_device(%d, %d, %d)\n", device, ear_mute, mic_mute);
+    ALOGD("rpc_snd_set_device(%d, %d, %d)\n", device, ear_mute, mic_mute);
 #endif
 
     fd = open("/dev/msm_snd", O_RDWR);
     if (fd < 0) {
-        LOGE("Can not open snd device");
+        ALOGE("Can not open snd device");
         return -EPERM;
     }
     // RPC call to switch audio path
@@ -464,7 +464,7 @@
     args.mic_mute = mic_mute ? SND_MUTE_MUTED : SND_MUTE_UNMUTED;
 
     if (ioctl(fd, SND_SET_DEVICE, &args) < 0) {
-        LOGE("snd_set_device error.");
+        ALOGE("snd_set_device error.");
         close(fd);
         return -EIO;
     }
@@ -483,7 +483,7 @@
             device = SND_DEVICE_BT_EC_OFF;
         }
     }
-    LOGV("doAudioRouteOrMute() device %x, mMode %d, mMicMute %d", device, mMode, mMicMute);
+    ALOGV("doAudioRouteOrMute() device %x, mMode %d, mMicMute %d", device, mMode, mMicMute);
     return do_route_audio_rpc(device,
                               mMode != AudioSystem::MODE_IN_CALL, mMicMute);
 }
@@ -505,27 +505,27 @@
     int sndDevice = -1;
 
     if (inputDevice != 0) {
-        LOGI("do input routing device %x\n", inputDevice);
+        ALOGI("do input routing device %x\n", inputDevice);
         if (inputDevice & AudioSystem::DEVICE_IN_BLUETOOTH_SCO_HEADSET) {
-            LOGI("Routing audio to Bluetooth PCM\n");
+            ALOGI("Routing audio to Bluetooth PCM\n");
             sndDevice = SND_DEVICE_BT;
         } else if (inputDevice & AudioSystem::DEVICE_IN_WIRED_HEADSET) {
             if ((outputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET) &&
                 (outputDevices & AudioSystem::DEVICE_OUT_SPEAKER)) {
-                LOGI("Routing audio to Wired Headset and Speaker\n");
+                ALOGI("Routing audio to Wired Headset and Speaker\n");
                 sndDevice = SND_DEVICE_HEADSET_AND_SPEAKER;
                 audProcess = (ADRC_ENABLE | EQ_ENABLE | RX_IIR_ENABLE);
             } else {
-                LOGI("Routing audio to Wired Headset\n");
+                ALOGI("Routing audio to Wired Headset\n");
                 sndDevice = SND_DEVICE_HEADSET;
             }
         } else {
             if (outputDevices & AudioSystem::DEVICE_OUT_SPEAKER) {
-                LOGI("Routing audio to Speakerphone\n");
+                ALOGI("Routing audio to Speakerphone\n");
                 sndDevice = SND_DEVICE_SPEAKER;
                 audProcess = (ADRC_ENABLE | EQ_ENABLE | RX_IIR_ENABLE);
             } else {
-                LOGI("Routing audio to Handset\n");
+                ALOGI("Routing audio to Handset\n");
                 sndDevice = SND_DEVICE_HANDSET;
             }
         }
@@ -535,41 +535,41 @@
     if (sndDevice == -1) {
         if (outputDevices & (outputDevices - 1)) {
             if ((outputDevices & AudioSystem::DEVICE_OUT_SPEAKER) == 0) {
-                LOGW("Hardware does not support requested route combination (%#X),"
+                ALOGW("Hardware does not support requested route combination (%#X),"
                      " picking closest possible route...", outputDevices);
             }
         }
 
         if (outputDevices &
             (AudioSystem::DEVICE_OUT_BLUETOOTH_SCO | AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_HEADSET)) {
-            LOGI("Routing audio to Bluetooth PCM\n");
+            ALOGI("Routing audio to Bluetooth PCM\n");
             sndDevice = SND_DEVICE_BT;
         } else if (outputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT) {
-            LOGI("Routing audio to Bluetooth PCM\n");
+            ALOGI("Routing audio to Bluetooth PCM\n");
             sndDevice = SND_DEVICE_CARKIT;
         } else if ((outputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET) &&
                    (outputDevices & AudioSystem::DEVICE_OUT_SPEAKER)) {
-            LOGI("Routing audio to Wired Headset and Speaker\n");
+            ALOGI("Routing audio to Wired Headset and Speaker\n");
             sndDevice = SND_DEVICE_HEADSET_AND_SPEAKER;
             audProcess = (ADRC_ENABLE | EQ_ENABLE | RX_IIR_ENABLE);
         } else if (outputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE) {
             if (outputDevices & AudioSystem::DEVICE_OUT_SPEAKER) {
-                LOGI("Routing audio to No microphone Wired Headset and Speaker (%d,%x)\n", mMode, outputDevices);
+                ALOGI("Routing audio to No microphone Wired Headset and Speaker (%d,%x)\n", mMode, outputDevices);
                 sndDevice = SND_DEVICE_HEADSET_AND_SPEAKER;
                 audProcess = (ADRC_ENABLE | EQ_ENABLE | RX_IIR_ENABLE);
             } else {
-                LOGI("Routing audio to No microphone Wired Headset (%d,%x)\n", mMode, outputDevices);
+                ALOGI("Routing audio to No microphone Wired Headset (%d,%x)\n", mMode, outputDevices);
                 sndDevice = SND_DEVICE_NO_MIC_HEADSET;
             }
         } else if (outputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET) {
-            LOGI("Routing audio to Wired Headset\n");
+            ALOGI("Routing audio to Wired Headset\n");
             sndDevice = SND_DEVICE_HEADSET;
         } else if (outputDevices & AudioSystem::DEVICE_OUT_SPEAKER) {
-            LOGI("Routing audio to Speakerphone\n");
+            ALOGI("Routing audio to Speakerphone\n");
             sndDevice = SND_DEVICE_SPEAKER;
             audProcess = (ADRC_ENABLE | EQ_ENABLE | RX_IIR_ENABLE);
         } else {
-            LOGI("Routing audio to Handset\n");
+            ALOGI("Routing audio to Handset\n");
             sndDevice = SND_DEVICE_HANDSET;
         }
     }
@@ -577,7 +577,7 @@
     if (sndDevice != -1 && sndDevice != mCurSndDevice) {
         ret = doAudioRouteOrMute(sndDevice);
         if ((*msm72xx_enable_audpp) == 0 ) {
-            LOGE("Could not open msm72xx_enable_audpp()");
+            ALOGE("Could not open msm72xx_enable_audpp()");
         } else {
             msm72xx_enable_audpp(audProcess);
         }
@@ -702,7 +702,7 @@
 
 ssize_t AudioHardware::AudioStreamOutMSM72xx::write(const void* buffer, size_t bytes)
 {
-    // LOGD("AudioStreamOutMSM72xx::write(%p, %u)", buffer, bytes);
+    // ALOGD("AudioStreamOutMSM72xx::write(%p, %u)", buffer, bytes);
     status_t status = NO_INIT;
     size_t count = bytes;
     const uint8_t* p = static_cast<const uint8_t*>(buffer);
@@ -710,24 +710,24 @@
     if (mStandby) {
 
         // open driver
-        LOGV("open driver");
+        ALOGV("open driver");
         status = ::open("/dev/msm_pcm_out", O_RDWR);
         if (status < 0) {
-            LOGE("Cannot open /dev/msm_pcm_out errno: %d", errno);
+            ALOGE("Cannot open /dev/msm_pcm_out errno: %d", errno);
             goto Error;
         }
         mFd = status;
 
         // configuration
-        LOGV("get config");
+        ALOGV("get config");
         struct msm_audio_config config;
         status = ioctl(mFd, AUDIO_GET_CONFIG, &config);
         if (status < 0) {
-            LOGE("Cannot read config");
+            ALOGE("Cannot read config");
             goto Error;
         }
 
-        LOGV("set config");
+        ALOGV("set config");
         config.channel_count = AudioSystem::popCount(channels());
         config.sample_rate = sampleRate();
         config.buffer_size = bufferSize();
@@ -735,14 +735,14 @@
         config.codec_type = CODEC_TYPE_PCM;
         status = ioctl(mFd, AUDIO_SET_CONFIG, &config);
         if (status < 0) {
-            LOGE("Cannot set config");
+            ALOGE("Cannot set config");
             goto Error;
         }
 
-        LOGV("buffer_size: %u", config.buffer_size);
-        LOGV("buffer_count: %u", config.buffer_count);
-        LOGV("channel_count: %u", config.channel_count);
-        LOGV("sample_rate: %u", config.sample_rate);
+        ALOGV("buffer_size: %u", config.buffer_size);
+        ALOGV("buffer_count: %u", config.buffer_count);
+        ALOGV("channel_count: %u", config.channel_count);
+        ALOGV("sample_rate: %u", config.sample_rate);
 
         // fill 2 buffers before AUDIO_START
         mStartCount = AUDIO_HW_NUM_OUT_BUF;
@@ -757,7 +757,7 @@
         } else {
             if (errno != EAGAIN) return written;
             mRetryCount++;
-            LOGW("EAGAIN - retry");
+            ALOGW("EAGAIN - retry");
         }
     }
 
@@ -831,11 +831,11 @@
     String8 key = String8(AudioParameter::keyRouting);
     status_t status = NO_ERROR;
     int device;
-    LOGV("AudioStreamOutMSM72xx::setParameters() %s", keyValuePairs.string());
+    ALOGV("AudioStreamOutMSM72xx::setParameters() %s", keyValuePairs.string());
 
     if (param.getInt(key, device) == NO_ERROR) {
         mDevices = device;
-        LOGV("set output routing %x", mDevices);
+        ALOGV("set output routing %x", mDevices);
         status = mHardware->doRouting();
         param.remove(key);
     }
@@ -853,11 +853,11 @@
     String8 key = String8(AudioParameter::keyRouting);
 
     if (param.get(key, value) == NO_ERROR) {
-        LOGV("get routing %x", mDevices);
+        ALOGV("get routing %x", mDevices);
         param.addInt(key, (int)mDevices);
     }
 
-    LOGV("AudioStreamOutMSM72xx::getParameters() %s", param.toString().string());
+    ALOGV("AudioStreamOutMSM72xx::getParameters() %s", param.toString().string());
     return param.toString();
 }
 
@@ -902,30 +902,30 @@
 
     mHardware = hw;
 
-    LOGV("AudioStreamInMSM72xx::set(%d, %d, %u)", *pFormat, *pChannels, *pRate);
+    ALOGV("AudioStreamInMSM72xx::set(%d, %d, %u)", *pFormat, *pChannels, *pRate);
     if (mFd >= 0) {
-        LOGE("Audio record already open");
+        ALOGE("Audio record already open");
         return -EPERM;
     }
 
     // open audio input device
     status_t status = ::open("/dev/msm_pcm_in", O_RDWR);
     if (status < 0) {
-        LOGE("Cannot open /dev/msm_pcm_in errno: %d", errno);
+        ALOGE("Cannot open /dev/msm_pcm_in errno: %d", errno);
         goto Error;
     }
     mFd = status;
 
     // configuration
-    LOGV("get config");
+    ALOGV("get config");
     struct msm_audio_config config;
     status = ioctl(mFd, AUDIO_GET_CONFIG, &config);
     if (status < 0) {
-        LOGE("Cannot read config");
+        ALOGE("Cannot read config");
         goto Error;
     }
 
-    LOGV("set config");
+    ALOGV("set config");
     config.channel_count = AudioSystem::popCount(*pChannels);
     config.sample_rate = *pRate;
     config.buffer_size = bufferSize();
@@ -933,7 +933,7 @@
     config.codec_type = CODEC_TYPE_PCM;
     status = ioctl(mFd, AUDIO_SET_CONFIG, &config);
     if (status < 0) {
-        LOGE("Cannot set config");
+        ALOGE("Cannot set config");
         if (ioctl(mFd, AUDIO_GET_CONFIG, &config) == 0) {
             if (config.channel_count == 1) {
                 *pChannels = AudioSystem::CHANNEL_IN_MONO;
@@ -945,16 +945,16 @@
         goto Error;
     }
 
-    LOGV("confirm config");
+    ALOGV("confirm config");
     status = ioctl(mFd, AUDIO_GET_CONFIG, &config);
     if (status < 0) {
-        LOGE("Cannot read config");
+        ALOGE("Cannot read config");
         goto Error;
     }
-    LOGV("buffer_size: %u", config.buffer_size);
-    LOGV("buffer_count: %u", config.buffer_count);
-    LOGV("channel_count: %u", config.channel_count);
-    LOGV("sample_rate: %u", config.sample_rate);
+    ALOGV("buffer_size: %u", config.buffer_size);
+    ALOGV("buffer_count: %u", config.buffer_count);
+    ALOGV("channel_count: %u", config.channel_count);
+    ALOGV("sample_rate: %u", config.sample_rate);
 
     mDevices = devices;
     mFormat = AUDIO_HW_IN_FORMAT;
@@ -970,7 +970,7 @@
 
     audpre_index = calculate_audpre_table_index(mSampleRate);
     tx_iir_index = (audpre_index * 2) + (hw->checkOutputStandby() ? 0 : 1);
-    LOGD("audpre_index = %d, tx_iir_index = %d\n", audpre_index, tx_iir_index);
+    ALOGD("audpre_index = %d, tx_iir_index = %d\n", audpre_index, tx_iir_index);
 
     /**
      * If audio-preprocessing failed, we should not block record.
@@ -979,14 +979,14 @@
     msm72xx_set_audpre_params = (int (*)(int, int))::dlsym(acoustic, "msm72xx_set_audpre_params");
     status = msm72xx_set_audpre_params(audpre_index, tx_iir_index);
     if (status < 0)
-        LOGE("Cannot set audpre parameters");
+        ALOGE("Cannot set audpre parameters");
 
     int (*msm72xx_enable_audpre)(int, int, int);
     msm72xx_enable_audpre = (int (*)(int, int, int))::dlsym(acoustic, "msm72xx_enable_audpre");
     mAcoustics = acoustic_flags;
     status = msm72xx_enable_audpre((int)acoustic_flags, audpre_index, tx_iir_index);
     if (status < 0)
-        LOGE("Cannot enable audpre");
+        ALOGE("Cannot enable audpre");
 
     return NO_ERROR;
 
@@ -1000,13 +1000,13 @@
 
 AudioHardware::AudioStreamInMSM72xx::~AudioStreamInMSM72xx()
 {
-    LOGV("AudioStreamInMSM72xx destructor");
+    ALOGV("AudioStreamInMSM72xx destructor");
     standby();
 }
 
 ssize_t AudioHardware::AudioStreamInMSM72xx::read( void* buffer, ssize_t bytes)
 {
-    LOGV("AudioStreamInMSM72xx::read(%p, %ld)", buffer, bytes);
+    ALOGV("AudioStreamInMSM72xx::read(%p, %ld)", buffer, bytes);
     if (!mHardware) return -1;
 
     size_t count = bytes;
@@ -1025,7 +1025,7 @@
         mHardware->clearCurDevice();
         mHardware->doRouting();
         if (ioctl(mFd, AUDIO_START, 0)) {
-            LOGE("Error starting record");
+            ALOGE("Error starting record");
             standby();
             return -1;
         }
@@ -1039,7 +1039,7 @@
         } else {
             if (errno != EAGAIN) return bytesRead;
             mRetryCount++;
-            LOGW("EAGAIN - retrying");
+            ALOGW("EAGAIN - retrying");
         }
     }
     return bytes;
@@ -1093,10 +1093,10 @@
     String8 key = String8(AudioParameter::keyRouting);
     status_t status = NO_ERROR;
     int device;
-    LOGV("AudioStreamInMSM72xx::setParameters() %s", keyValuePairs.string());
+    ALOGV("AudioStreamInMSM72xx::setParameters() %s", keyValuePairs.string());
 
     if (param.getInt(key, device) == NO_ERROR) {
-        LOGV("set input routing %x", device);
+        ALOGV("set input routing %x", device);
         if (device & (device - 1)) {
             status = BAD_VALUE;
         } else {
@@ -1119,11 +1119,11 @@
     String8 key = String8(AudioParameter::keyRouting);
 
     if (param.get(key, value) == NO_ERROR) {
-        LOGV("get routing %x", mDevices);
+        ALOGV("get routing %x", mDevices);
         param.addInt(key, (int)mDevices);
     }
 
-    LOGV("AudioStreamInMSM72xx::getParameters() %s", param.toString().string());
+    ALOGV("AudioStreamInMSM72xx::getParameters() %s", param.toString().string());
     return param.toString();
 }
 
diff --git a/libcamera/QualcommCameraHardware.cpp b/libcamera/QualcommCameraHardware.cpp
index 9dbc95c..aa5e911 100644
--- a/libcamera/QualcommCameraHardware.cpp
+++ b/libcamera/QualcommCameraHardware.cpp
@@ -49,7 +49,7 @@
 #if PRINT_TIME
     struct timeval time; 
     gettimeofday(&time, NULL);
-    LOGV("time: %lld us.", time.tv_sec * 1000000LL + time.tv_usec);
+    ALOGV("time: %lld us.", time.tv_sec * 1000000LL + time.tv_usec);
 #endif
 }
 
@@ -304,7 +304,7 @@
           mRawSize(0),
           mPreviewCount(0)
     {
-        LOGV("constructor EX");
+        ALOGV("constructor EX");
     }
 
     void QualcommCameraHardware::initDefaultParameters()
@@ -362,7 +362,7 @@
         p.set("iso-values", "auto,high");
 
         if (setParameters(p) != NO_ERROR) {
-            LOGE("Failed to set default parameters?!");
+            ALOGE("Failed to set default parameters?!");
         }
     }
 
@@ -375,10 +375,10 @@
 
 #if DLOPEN_LIBQCAMERA == 1
 
-            LOGV("loading libqcamera");
+            ALOGV("loading libqcamera");
             libqcamera = ::dlopen("liboemcamera.so", RTLD_NOW);
             if (!libqcamera) {
-                LOGE("FATAL ERROR: could not dlopen liboemcamera.so: %s", dlerror());
+                ALOGE("FATAL ERROR: could not dlopen liboemcamera.so: %s", dlerror());
                 return;
             }
   
@@ -452,26 +452,26 @@
             
             rex_init_lock.lock();
             LINK_rex_start();
-            LOGV("waiting for REX to initialize.");
+            ALOGV("waiting for REX to initialize.");
             rex_init_wait.wait(rex_init_lock);
-            LOGV("REX is ready.");
+            ALOGV("REX is ready.");
             rex_init_lock.unlock();
             
             LINK_camera_init();
             
-            LOGV("starting REX emulation");
+            ALOGV("starting REX emulation");
             // NOTE: camera_start() takes (height, width), not (width, height).
             LINK_camera_start(camera_cb, this,
                               mPreviewHeight, mPreviewWidth);
             while(mCameraState != QCS_IDLE &&
                   mCameraState != QCS_ERROR) {
-                LOGV("init camera: waiting for QCS_IDLE");
+                ALOGV("init camera: waiting for QCS_IDLE");
                 mStateWait.wait(mStateLock);
-                LOGV("init camera: woke up");
+                ALOGV("init camera: woke up");
             }
-            LOGV("init camera: initializing parameters");
+            ALOGV("init camera: initializing parameters");
         }
-        else LOGV("camera hardware has been started already");
+        else ALOGV("camera hardware has been started already");
     }
 
     status_t QualcommCameraHardware::dump(int fd, const Vector<String16>& args) const
@@ -520,7 +520,7 @@
 
         setCameraDimensions();
 
-        LOGV("initPreview: preview size=%dx%d", mPreviewWidth, mPreviewHeight);
+        ALOGV("initPreview: preview size=%dx%d", mPreviewWidth, mPreviewHeight);
 
         mPreviewFrameSize = mPreviewWidth * mPreviewHeight * 3 / 2; // reality
         mPreviewHeap =
@@ -549,7 +549,7 @@
     // Called with mStateLock held!
     bool QualcommCameraHardware::initRaw(bool initJpegHeap)
     {
-        LOGV("initRaw E");
+        ALOGV("initRaw E");
         startCameraIfNecessary();
 
         // Tell libqcamera what the preview and raw dimensions are.  We
@@ -561,7 +561,7 @@
 
         setCameraDimensions();
 
-        LOGV("initRaw: picture size=%dx%d",
+        ALOGV("initRaw: picture size=%dx%d",
              mRawWidth, mRawHeight);
 
         // Note that we enforce yuv420 in setParameters().
@@ -571,10 +571,10 @@
 
         mJpegMaxSize = mRawWidth * mRawHeight * 2;
 
-        LOGV("initRaw: clearing old mJpegHeap.");
+        ALOGV("initRaw: clearing old mJpegHeap.");
         mJpegHeap = NULL;
 
-        LOGV("initRaw: initializing mRawHeap.");
+        ALOGV("initRaw: initializing mRawHeap.");
         mRawHeap =
             new RawPmemPool("/dev/pmem_camera",
                             kRawFrameHeaderSize + mJpegMaxSize, /* worst */
@@ -584,13 +584,13 @@
                             "snapshot camera");
 
         if (!mRawHeap->initialized()) {
-            LOGE("initRaw X failed: error initializing mRawHeap");
+            ALOGE("initRaw X failed: error initializing mRawHeap");
             mRawHeap = NULL;
             return false;
         }
 
         if (initJpegHeap) {
-            LOGV("initRaw: initializing mJpegHeap.");
+            ALOGV("initRaw: initializing mJpegHeap.");
             mJpegHeap =
                 new AshmemPool(mJpegMaxSize,
                                kJpegBufferCount,
@@ -598,20 +598,20 @@
                                0,
                                "jpeg");
             if (!mJpegHeap->initialized()) {
-                LOGE("initRaw X failed: error initializing mJpegHeap.");
+                ALOGE("initRaw X failed: error initializing mJpegHeap.");
                 mJpegHeap = NULL;
                 mRawHeap = NULL;
                 return false;
             }
         }
 
-        LOGV("initRaw X success");
+        ALOGV("initRaw X success");
         return true;
     }
 
     void QualcommCameraHardware::release()
     {
-        LOGV("release E");
+        ALOGV("release E");
 
         Mutex::Autolock l(&mLock);
 
@@ -620,7 +620,7 @@
         // is in the idle or init state before destroying this object.
 
         if (mCameraState != QCS_IDLE && mCameraState != QCS_INIT) {
-            LOGE("Serious error: the camera state is %s, "
+            ALOGE("Serious error: the camera state is %s, "
                  "not QCS_IDLE or QCS_INIT!",
                  getCameraStateStr(mCameraState));
         }
@@ -635,45 +635,45 @@
             mCameraState = QCS_INTERNAL_STOPPING;
             mStateLock.unlock();
 
-            LOGV("stopping camera.");
+            ALOGV("stopping camera.");
             LINK_camera_stop(stop_camera_cb, this);
 
             mStateLock.lock();
             if (mCameraState == QCS_INTERNAL_STOPPING) {
                 while (mCameraState != QCS_INIT &&
                        mCameraState != QCS_ERROR) {
-                    LOGV("stopping camera: waiting for QCS_INIT");
+                    ALOGV("stopping camera: waiting for QCS_INIT");
                     mStateWait.wait(mStateLock);
                 }
             }
 
-            LOGV("Shutting REX down.");
+            ALOGV("Shutting REX down.");
             LINK_rex_shutdown();
-            LOGV("REX has shut down.");
+            ALOGV("REX has shut down.");
 #if DLOPEN_LIBQCAMERA
             if (libqcamera) {
                 unsigned ref = ::dlclose(libqcamera);
-                LOGV("dlclose(libqcamera) refcount %d", ref);
+                ALOGV("dlclose(libqcamera) refcount %d", ref);
             }
 #endif
             mCameraState = QCS_INIT;
         }
         mStateLock.unlock();
 
-        LOGV("release X");
+        ALOGV("release X");
     }
 
     QualcommCameraHardware::~QualcommCameraHardware()
     {
-        LOGV("~QualcommCameraHardware E");
+        ALOGV("~QualcommCameraHardware E");
         Mutex::Autolock singletonLock(&singleton_lock);
         singleton.clear();
-        LOGV("~QualcommCameraHardware X");
+        ALOGV("~QualcommCameraHardware X");
     }
 
     sp<IMemoryHeap> QualcommCameraHardware::getPreviewHeap() const
     {
-        LOGV("getPreviewHeap");
+        ALOGV("getPreviewHeap");
         return mPreviewHeap != NULL ? mPreviewHeap->mHeap : NULL;
     }
 
@@ -699,10 +699,10 @@
         preview_callback pcb, void *puser,
         recording_callback rcb, void *ruser)
     {
-        LOGV("startPreview E");
+        ALOGV("startPreview E");
 
         if (mCameraState == QCS_PREVIEW_IN_PROGRESS) {
-            LOGE("startPreview is already in progress, doing nothing.");
+            ALOGE("startPreview is already in progress, doing nothing.");
             // We might want to change the callback functions while preview is
             // streaming, for example to enable or disable recording.
             setCallbacks(pcb, puser, rcb, ruser);
@@ -720,19 +720,19 @@
             mCameraState == QCS_WAITING_JPEG) {
             while (mCameraState != QCS_IDLE &&
                    mCameraState != QCS_ERROR) {
-                LOGV("waiting for QCS_IDLE");
+                ALOGV("waiting for QCS_IDLE");
                 mStateWait.wait(mStateLock);
             }
         }
 
         if (mCameraState != QCS_IDLE) {
-            LOGE("startPreview X Camera state is %s, expecting QCS_IDLE!",
+            ALOGE("startPreview X Camera state is %s, expecting QCS_IDLE!",
                 getCameraStateStr(mCameraState));
             return INVALID_OPERATION;
         }
 
         if (!initPreview()) {
-            LOGE("startPreview X initPreview failed.  Not starting preview.");
+            ALOGE("startPreview X initPreview failed.  Not starting preview.");
             return UNKNOWN_ERROR;
         }
 
@@ -747,26 +747,26 @@
         if (qret == CAMERA_SUCCESS) {
             while(mCameraState != QCS_PREVIEW_IN_PROGRESS &&
                   mCameraState != QCS_ERROR) {
-                LOGV("waiting for QCS_PREVIEW_IN_PROGRESS");
+                ALOGV("waiting for QCS_PREVIEW_IN_PROGRESS");
                 mStateWait.wait(mStateLock);
             }
         }
         else {
-            LOGE("startPreview failed: sensor error.");
+            ALOGE("startPreview failed: sensor error.");
             mCameraState = QCS_ERROR;
         }
 
-        LOGV("startPreview X");
+        ALOGV("startPreview X");
         return mCameraState == QCS_PREVIEW_IN_PROGRESS ?
             NO_ERROR : UNKNOWN_ERROR;
     }
 
     void QualcommCameraHardware::stopPreviewInternal()
     {
-        LOGV("stopPreviewInternal E");
+        ALOGV("stopPreviewInternal E");
 
         if (mCameraState != QCS_PREVIEW_IN_PROGRESS) {
-            LOGE("Preview not in progress!");
+            ALOGE("Preview not in progress!");
             return;
         }
 
@@ -788,15 +788,15 @@
         LINK_camera_stop_preview();
         while (mCameraState != QCS_IDLE &&
                mCameraState != QCS_ERROR)  {
-            LOGV("waiting for QCS_IDLE");
+            ALOGV("waiting for QCS_IDLE");
             mStateWait.wait(mStateLock);
         }
 
-        LOGV("stopPreviewInternal: Freeing preview heap.");
+        ALOGV("stopPreviewInternal: Freeing preview heap.");
         mPreviewHeap = NULL;
         mPreviewCallback = NULL;
 
-        LOGV("stopPreviewInternal: X Preview has stopped.");
+        ALOGV("stopPreviewInternal: X Preview has stopped.");
     }
 
     status_t QualcommCameraHardware::startPreview(
@@ -810,7 +810,7 @@
     }
 
     void QualcommCameraHardware::stopPreview() {
-        LOGV("stopPreview: E");
+        ALOGV("stopPreview: E");
         Mutex::Autolock l(&mLock);
         if (!setCallbacks(NULL, NULL,
                           mRecordingCallback,
@@ -818,7 +818,7 @@
             Mutex::Autolock statelock(&mStateLock);
             stopPreviewInternal();
         }
-        LOGV("stopPreview: X");
+        ALOGV("stopPreview: X");
     }
 
     bool QualcommCameraHardware::previewEnabled() {
@@ -837,7 +837,7 @@
     }
 
     void QualcommCameraHardware::stopRecording() {
-        LOGV("stopRecording: E");
+        ALOGV("stopRecording: E");
         Mutex::Autolock l(&mLock);
         if (!setCallbacks(mPreviewCallback,
                           mPreviewCallbackCookie,
@@ -845,7 +845,7 @@
             Mutex::Autolock statelock(&mStateLock);
             stopPreviewInternal();
         }
-        LOGV("stopRecording: X");
+        ALOGV("stopRecording: X");
     }
 
     bool QualcommCameraHardware::recordingEnabled() {
@@ -865,19 +865,19 @@
     status_t QualcommCameraHardware::autoFocus(autofocus_callback af_cb,
                                                void *user)
     {
-        LOGV("Starting auto focus.");
+        ALOGV("Starting auto focus.");
         Mutex::Autolock l(&mLock);
         Mutex::Autolock lock(&mStateLock);
 
         if (mCameraState != QCS_PREVIEW_IN_PROGRESS) {
-            LOGE("Invalid camera state %s: expecting QCS_PREVIEW_IN_PROGRESS,"
+            ALOGE("Invalid camera state %s: expecting QCS_PREVIEW_IN_PROGRESS,"
                  " cannot start autofocus!",
                  getCameraStateStr(mCameraState));
             return INVALID_OPERATION;
         }
 
         if (mAutoFocusCallback != NULL) {
-            LOGV("Auto focus is already in progress");
+            ALOGV("Auto focus is already in progress");
             return mAutoFocusCallback == af_cb ? NO_ERROR : INVALID_OPERATION;
         }
 
@@ -892,7 +892,7 @@
                                                  jpeg_callback jpeg_cb,
                                                  void* user)
     {
-        LOGV("takePicture: E raw_cb = %p, jpeg_cb = %p",
+        ALOGV("takePicture: E raw_cb = %p, jpeg_cb = %p",
              raw_cb, jpeg_cb);
         print_time();
 
@@ -915,13 +915,13 @@
             mCameraState == QCS_WAITING_JPEG) {
             while (mCameraState != QCS_IDLE &&
                    mCameraState != QCS_ERROR) {
-                LOGV("waiting for QCS_IDLE");
+                ALOGV("waiting for QCS_IDLE");
                 mStateWait.wait(mStateLock);
             }
         }
 
         if (mCameraState != QCS_IDLE) {
-            LOGE("takePicture: %sunexpected state %d, expecting QCS_IDLE",
+            ALOGE("takePicture: %sunexpected state %d, expecting QCS_IDLE",
                  (last_state == QCS_PREVIEW_IN_PROGRESS ?
                   "(stop preview) " : ""),
                  mCameraState);
@@ -934,12 +934,12 @@
         }
 
         if (!initRaw(jpeg_cb != NULL)) {
-            LOGE("initRaw failed.  Not taking picture.");
+            ALOGE("initRaw failed.  Not taking picture.");
             return UNKNOWN_ERROR;
         }
 
         if (mCameraState != QCS_IDLE) {
-            LOGE("takePicture: (init raw) "
+            ALOGE("takePicture: (init raw) "
                  "unexpected state %d, expecting QCS_IDLE",
                 mCameraState);
             // If we had to stop preview in order to take a picture, and
@@ -970,13 +970,13 @@
                mCameraState != QCS_WAITING_JPEG &&
                mCameraState != QCS_IDLE &&
                mCameraState != QCS_ERROR)  {
-            LOGV("takePicture: waiting for QCS_WAITING_RAW or QCS_WAITING_JPEG");
+            ALOGV("takePicture: waiting for QCS_WAITING_RAW or QCS_WAITING_JPEG");
             mStateWait.wait(mStateLock);
-            LOGV("takePicture: woke up, state is %s",
+            ALOGV("takePicture: woke up, state is %s",
                  getCameraStateStr(mCameraState));
         }
 
-        LOGV("takePicture: X");
+        ALOGV("takePicture: X");
         print_time();
         return mCameraState != QCS_ERROR ?
             NO_ERROR : UNKNOWN_ERROR;
@@ -985,7 +985,7 @@
     status_t QualcommCameraHardware::cancelPicture(
         bool cancel_shutter, bool cancel_raw, bool cancel_jpeg)
     {
-        LOGV("cancelPicture: E cancel_shutter = %d, cancel_raw = %d, cancel_jpeg = %d",
+        ALOGV("cancelPicture: E cancel_shutter = %d, cancel_raw = %d, cancel_jpeg = %d",
              cancel_shutter, cancel_raw, cancel_jpeg);
         Mutex::Autolock l(&mLock);
         Mutex::Autolock stateLock(&mStateLock);
@@ -994,7 +994,7 @@
         case QCS_INTERNAL_RAW_REQUESTED:
         case QCS_WAITING_RAW:
         case QCS_WAITING_JPEG:
-            LOGV("camera state is %s, stopping picture.",
+            ALOGV("camera state is %s, stopping picture.",
                  getCameraStateStr(mCameraState));
 
             {
@@ -1006,23 +1006,23 @@
 
             while (mCameraState != QCS_IDLE &&
                    mCameraState != QCS_ERROR)  {
-                LOGV("cancelPicture: waiting for QCS_IDLE");
+                ALOGV("cancelPicture: waiting for QCS_IDLE");
                 mStateWait.wait(mStateLock);
             }
             break;
         default:
-            LOGV("not taking a picture (state %s)",
+            ALOGV("not taking a picture (state %s)",
                  getCameraStateStr(mCameraState));
         }
 
-        LOGV("cancelPicture: X");
+        ALOGV("cancelPicture: X");
         return NO_ERROR;
     }
 
     status_t QualcommCameraHardware::setParameters(
         const CameraParameters& params)
     {
-        LOGV("setParameters: E params = %p", &params);
+        ALOGV("setParameters: E params = %p", &params);
 
         Mutex::Autolock l(&mLock);
         Mutex::Autolock lock(&mStateLock);
@@ -1033,7 +1033,7 @@
         // correct setting is yuv420sp.
         if ((strcmp(params.getPreviewFormat(), "yuv420sp") != 0) &&
                 (strcmp(params.getPreviewFormat(), "yuv422sp") != 0)) {
-            LOGE("Only yuv420sp preview is supported");
+            ALOGE("Only yuv420sp preview is supported");
             return INVALID_OPERATION;
         }
 
@@ -1046,7 +1046,7 @@
         // find closest match that doesn't exceed app's request
         int width, height;
         params.getPreviewSize(&width, &height);
-        LOGV("requested size %d x %d", width, height);
+        ALOGV("requested size %d x %d", width, height);
         preview_size_type* ps = preview_sizes;
         size_t i;
         for (i = 0; i < PREVIEW_SIZE_COUNT; ++i, ++ps) {
@@ -1054,7 +1054,7 @@
         }
         // app requested smaller size than supported, use smallest size
         if (i == PREVIEW_SIZE_COUNT) ps--;
-        LOGV("actual size %d x %d", ps->width, ps->height);
+        ALOGV("actual size %d x %d", ps->width, ps->height);
         mParameters.setPreviewSize(ps->width, ps->height);
 
         mParameters.getPreviewSize(&mPreviewWidth, &mPreviewHeight);
@@ -1067,14 +1067,14 @@
 
         initCameraParameters();
 
-        LOGV("setParameters: X mCameraState=%d", mCameraState);
+        ALOGV("setParameters: X mCameraState=%d", mCameraState);
         return mCameraState == QCS_IDLE ?
             NO_ERROR : UNKNOWN_ERROR;
     }
 
     CameraParameters QualcommCameraHardware::getParameters() const
     {
-        LOGV("getParameters: EX");
+        ALOGV("getParameters: EX");
         return mParameters;
     }
 
@@ -1097,7 +1097,7 @@
 
     extern "C" sp<CameraHardwareInterface> HAL_openCameraHardware(int cameraId)
     {
-        LOGV("openCameraHardware: call createInstance");
+        ALOGV("openCameraHardware: call createInstance");
         return QualcommCameraHardware::createInstance();
     }
 
@@ -1108,13 +1108,13 @@
     // and return it.
     sp<CameraHardwareInterface> QualcommCameraHardware::createInstance()
     {
-        LOGV("createInstance: E");
+        ALOGV("createInstance: E");
 
         singleton_lock.lock();
         if (singleton != 0) {
             sp<CameraHardwareInterface> hardware = singleton.promote();
             if (hardware != 0) {
-                LOGV("createInstance: X return existing hardware=%p",
+                ALOGV("createInstance: X return existing hardware=%p",
                      &(*hardware));
                 singleton_lock.unlock();
                 return hardware;
@@ -1125,7 +1125,7 @@
             struct stat st;
             int rc = stat("/dev/oncrpc", &st);
             if (rc < 0) {
-                LOGV("createInstance: X failed to create hardware: %s",
+                ALOGV("createInstance: X failed to create hardware: %s",
                      strerror(errno));
                 singleton_lock.unlock();
                 return NULL;
@@ -1142,7 +1142,7 @@
         // it still exists, we need to call this function after we have set the
         // singleton.
         cam->initDefaultParameters();
-        LOGV("createInstance: X created hardware=%p", &(*hardware));
+        ALOGV("createInstance: X created hardware=%p", &(*hardware));
         return hardware;
     }
 
@@ -1170,13 +1170,13 @@
                 // against.
                 uint32_t vaddr = (uint32_t)(base + size*index);
 
-                LOGV("get_preview_mem: base %p MALLOC size %d index %d --> %p",
+                ALOGV("get_preview_mem: base %p MALLOC size %d index %d --> %p",
                      base, size, index, (void *)vaddr);
                 *phy_addr = vaddr;
                 return (void *)vaddr;
             }
         }
-        LOGV("get_preview_mem: X NULL");
+        ALOGV("get_preview_mem: X NULL");
         return NULL;
     }
 
@@ -1184,7 +1184,7 @@
                                                   uint32_t size,
                                                   uint32_t index)
     {
-        LOGV("free_preview_mem: EX NOP");
+        ALOGV("free_preview_mem: EX NOP");
         return;
     }
 
@@ -1201,13 +1201,13 @@
                 // patch it against.
                 uint32_t vaddr = (uint32_t)(base + size*index);
 
-                LOGV("get_raw_mem: base %p MALLOC size %d index %d --> %p",
+                ALOGV("get_raw_mem: base %p MALLOC size %d index %d --> %p",
                      base, size, index, (void *)vaddr);
                 *phy_addr = vaddr;
                 return (void *)vaddr;
             }
         }
-        LOGV("get_raw_mem: X NULL");
+        ALOGV("get_raw_mem: X NULL");
         return NULL;
     }
 
@@ -1215,7 +1215,7 @@
                                               uint32_t size,
                                               uint32_t index)
     {
-        LOGV("free_raw_mem: EX NOP");
+        ALOGV("free_raw_mem: EX NOP");
         return;
     }
 
@@ -1238,7 +1238,7 @@
                 (ssize_t)mPreviewHeap->mHeap->virtualSize()) {
 #if 0
             // frame->buffer includes the header, frame->buf_Virt_Addr skips it
-            LOGV("PREVIEW FRAME CALLBACK "
+            ALOGV("PREVIEW FRAME CALLBACK "
                  "base %p addr %p offset %ld "
                  "framesz %dx%d=%ld (expect %d) rotation %d "
                  "(index %ld) size %d header_size 0x%x",
@@ -1274,20 +1274,20 @@
                 LINK_camera_release_frame();
             }
         }
-        else LOGE("Preview frame virtual address %p is out of range!",
+        else ALOGE("Preview frame virtual address %p is out of range!",
                   frame->buf_Virt_Addr);
     }
 
     void
     QualcommCameraHardware::notifyShutter()
     {
-        LOGV("notifyShutter: E");
+        ALOGV("notifyShutter: E");
         print_time();
         Mutex::Autolock lock(&mStateLock);
         if (mShutterCallback)
             mShutterCallback(mPictureCallbackCookie);
         print_time();
-        LOGV("notifyShutter: X");
+        ALOGV("notifyShutter: X");
     }
 
     // Pass the pre-LPM raw picture to raw picture callback.
@@ -1295,7 +1295,7 @@
     // which startPreview() or takePicture() are called.
     void QualcommCameraHardware::receiveRawPicture(camera_frame_type *frame)
     {
-        LOGV("receiveRawPicture: E");
+        ALOGV("receiveRawPicture: E");
         print_time();
 
         Mutex::Autolock cbLock(&mCallbackLock);
@@ -1315,7 +1315,7 @@
 #if 0
                 // frame->buffer includes the header, frame->buf_Virt_Addr
                 // skips it.
-                LOGV("receiveRawPicture: RAW CALLBACK (CB %p) "
+                ALOGV("receiveRawPicture: RAW CALLBACK (CB %p) "
                      "base %p addr %p buffer %p offset %ld "
                      "framesz %dx%d=%ld (expect %d) rotation %d "
                      "(index %ld) size %d header_size 0x%x",
@@ -1335,13 +1335,13 @@
                 mRawPictureCallback(mRawHeap->mBuffers[offset],
                                     mPictureCallbackCookie);
             }
-            else LOGE("receiveRawPicture: virtual address %p is out of range!",
+            else ALOGE("receiveRawPicture: virtual address %p is out of range!",
                       frame->buf_Virt_Addr);
         }
-        else LOGV("Raw-picture callback was canceled--skipping.");
+        else ALOGV("Raw-picture callback was canceled--skipping.");
 
         print_time();
-        LOGV("receiveRawPicture: X");
+        ALOGV("receiveRawPicture: X");
     }
 
     // Encode the post-LPM raw picture.
@@ -1351,7 +1351,7 @@
     void
     QualcommCameraHardware::receivePostLpmRawPicture(camera_frame_type *frame)
     {
-        LOGV("receivePostLpmRawPicture: E");
+        ALOGV("receivePostLpmRawPicture: E");
         print_time();
         qualcomm_camera_state new_state = QCS_ERROR;
 
@@ -1364,20 +1364,20 @@
 #define PARSE_LOCATION(what,type,fmt,desc) do {                                           \
                 pt.what = 0;                                                              \
                 const char *what##_str = mParameters.get("gps-"#what);                    \
-                LOGV("receiveRawPicture: GPS PARM %s --> [%s]", "gps-"#what, what##_str); \
+                ALOGV("receiveRawPicture: GPS PARM %s --> [%s]", "gps-"#what, what##_str); \
                 if (what##_str) {                                                         \
                     type what = 0;                                                        \
                     if (sscanf(what##_str, fmt, &what) == 1)                              \
                         pt.what = what;                                                   \
                     else {                                                                \
-                        LOGE("GPS " #what " %s could not"                                 \
+                        ALOGE("GPS " #what " %s could not"                                 \
                               " be parsed as a " #desc,                                   \
                               what##_str);                                                \
                         encode_location = false;                                          \
                     }                                                                     \
                 }                                                                         \
                 else {                                                                    \
-                    LOGW("receiveRawPicture: GPS " #what " not specified: "               \
+                    ALOGW("receiveRawPicture: GPS " #what " not specified: "               \
                           "defaulting to zero in EXIF header.");                          \
                     encode_location = false;                                              \
                }                                                                          \
@@ -1392,14 +1392,14 @@
 #undef PARSE_LOCATION
 
             if (encode_location) {
-                LOGV("receiveRawPicture: setting image location ALT %d LAT %lf LON %lf",
+                ALOGV("receiveRawPicture: setting image location ALT %d LAT %lf LON %lf",
                      pt.altitude, pt.latitude, pt.longitude);
                 if (LINK_camera_set_position(&pt, NULL, NULL) != CAMERA_SUCCESS) {
-                    LOGE("receiveRawPicture: camera_set_position: error");
+                    ALOGE("receiveRawPicture: camera_set_position: error");
                     /* return; */ // not a big deal
                 }
             }
-            else LOGV("receiveRawPicture: not setting image location");
+            else ALOGV("receiveRawPicture: not setting image location");
 
             mJpegSize = 0;
             camera_handle.device = CAMERA_DEVICE_MEM;
@@ -1416,14 +1416,14 @@
             LINK_camera_encode_picture(frame, &camera_handle, camera_cb, this);
         }
         else {
-            LOGV("JPEG callback was cancelled--not encoding image.");
+            ALOGV("JPEG callback was cancelled--not encoding image.");
             // We need to keep the raw heap around until the JPEG is fully
             // encoded, because the JPEG encode uses the raw image contained in
             // that heap.
             mRawHeap = NULL;
         }                    
         print_time();
-        LOGV("receivePostLpmRawPicture: X");
+        ALOGV("receivePostLpmRawPicture: X");
     }
 
     void
@@ -1438,13 +1438,13 @@
         uint32_t remaining = mJpegHeap->mHeap->virtualSize();
         remaining -= mJpegSize;
 
-        LOGV("receiveJpegPictureFragment: (index %d status %d size %d)",
+        ALOGV("receiveJpegPictureFragment: (index %d status %d size %d)",
              index,
              encInfo->status,
              size);
 
         if (size > remaining) {
-            LOGE("receiveJpegPictureFragment: size %d exceeds what "
+            ALOGE("receiveJpegPictureFragment: size %d exceeds what "
                  "remains in JPEG heap (%d), truncating",
                  size,
                  remaining);
@@ -1462,7 +1462,7 @@
     void
     QualcommCameraHardware::receiveJpegPicture(void)
     {
-        LOGV("receiveJpegPicture: E image (%d bytes out of %d)",
+        ALOGV("receiveJpegPicture: E image (%d bytes out of %d)",
              mJpegSize, mJpegHeap->mBufferSize);
         print_time();
         Mutex::Autolock cbLock(&mCallbackLock);
@@ -1482,7 +1482,7 @@
             mJpegPictureCallback(buffer, mPictureCallbackCookie);
             buffer = NULL;
         }
-        else LOGV("JPEG callback was cancelled--not delivering image.");
+        else ALOGV("JPEG callback was cancelled--not delivering image.");
 
         // NOTE: the JPEG encoder uses the raw image contained in mRawHeap, so we need
         // to keep the heap around until the encoding is complete.
@@ -1498,7 +1498,7 @@
         } /* for */
 
         print_time();
-        LOGV("receiveJpegPicture: X callback done.");
+        ALOGV("receiveJpegPicture: X callback done.");
     }
 
     struct str_map {
@@ -1578,7 +1578,7 @@
 
     void QualcommCameraHardware::initCameraParameters()
     {
-        LOGV("initCameraParameters: E");
+        ALOGV("initCameraParameters: E");
 
         // Because libqcamera is broken, for the camera_set_parm() calls
         // QualcommCameraHardware camera_cb() is called synchronously,
@@ -1588,7 +1588,7 @@
         startCameraIfNecessary();
 
 #define SET_PARM(x,y) do {                                             \
-        LOGV("initCameraParameters: set parm: %s, %d", #x, y);         \
+        ALOGV("initCameraParameters: set parm: %s, %d", #x, y);         \
         LINK_camera_set_parm (x, y, NULL, NULL);                       \
     } while(0)
 
@@ -1601,11 +1601,11 @@
         // Rotation may be negative, but may not be -1, because it has to be a
         // multiple of 90.  That's why we can still interpret -1 as an error,
         if (rotation == -1) {
-            LOGV("rotation not specified or is invalid, defaulting to 0");
+            ALOGV("rotation not specified or is invalid, defaulting to 0");
             rotation = 0;
         }
         else if (rotation % 90) {
-            LOGE("rotation %d is not a multiple of 90 degrees!  Defaulting to zero.",
+            ALOGE("rotation %d is not a multiple of 90 degrees!  Defaulting to zero.",
                  rotation);
             rotation = 0;
         }
@@ -1663,20 +1663,20 @@
 
         int th_w, th_h, th_q;
         th_w = mParameters.getInt("jpeg-thumbnail-width");
-        if (th_w < 0) LOGW("property jpeg-thumbnail-width not specified");
+        if (th_w < 0) ALOGW("property jpeg-thumbnail-width not specified");
 
         th_h = mParameters.getInt("jpeg-thumbnail-height");
-        if (th_h < 0) LOGW("property jpeg-thumbnail-height not specified");
+        if (th_h < 0) ALOGW("property jpeg-thumbnail-height not specified");
 
         th_q = mParameters.getInt("jpeg-thumbnail-quality");
-        if (th_q < 0) LOGW("property jpeg-thumbnail-quality not specified");
+        if (th_q < 0) ALOGW("property jpeg-thumbnail-quality not specified");
 
         if (th_w > 0 && th_h > 0 && th_q > 0) {
-            LOGI("setting thumbnail dimensions to %dx%d, quality %d",
+            ALOGI("setting thumbnail dimensions to %dx%d, quality %d",
                  th_w, th_h, th_q);
             int ret = LINK_camera_set_thumbnail_properties(th_w, th_h, th_q);
             if (ret != CAMERA_SUCCESS) {
-                LOGE("LINK_camera_set_thumbnail_properties returned %d", ret);
+                ALOGE("LINK_camera_set_thumbnail_properties returned %d", ret);
             }
         }
 
@@ -1684,12 +1684,12 @@
         /* Set Default JPEG encoding--this does not cause a callback */
         encode_properties.quality   = mParameters.getInt("jpeg-quality");
         if (encode_properties.quality < 0) {
-            LOGW("JPEG-image quality is not specified "
+            ALOGW("JPEG-image quality is not specified "
                  "or is negative, defaulting to %d",
                  encode_properties.quality);
             encode_properties.quality = 100;
         }
-        else LOGV("Setting JPEG-image quality to %d",
+        else ALOGV("Setting JPEG-image quality to %d",
                   encode_properties.quality);
         encode_properties.format    = CAMERA_JPEG;
         encode_properties.file_size = 0x0;
@@ -1699,14 +1699,14 @@
 #endif
 
 
-        LOGV("initCameraParameters: X");
+        ALOGV("initCameraParameters: X");
     }
 
     // Called with mStateLock held!
     void QualcommCameraHardware::setCameraDimensions()
     {
         if (mCameraState != QCS_IDLE) {
-            LOGE("set camera dimensions: expecting state QCS_IDLE, not %s",
+            ALOGE("set camera dimensions: expecting state QCS_IDLE, not %s",
                  getCameraStateStr(mCameraState));
             return;
         }
@@ -1731,7 +1731,7 @@
             // transition on mStateWait.  That's why we signal(), not
             // broadcast().
 
-            LOGV("state transition %s --> %s",
+            ALOGV("state transition %s --> %s",
                  getCameraStateStr(mCameraState),
                  getCameraStateStr(new_state));
 
@@ -1742,7 +1742,7 @@
         return new_state;
     }
 
-#define CAMERA_STATE(n) case n: if(n != CAMERA_FUNC_START_PREVIEW || cb != CAMERA_EVT_CB_FRAME) LOGV("STATE %s // STATUS %d", #n, cb);
+#define CAMERA_STATE(n) case n: if(n != CAMERA_FUNC_START_PREVIEW || cb != CAMERA_EVT_CB_FRAME) ALOGV("STATE %s // STATUS %d", #n, cb);
 #define TRANSITION(e,s) do { \
             obj->change_state(obj->mCameraState == e ? s : QCS_ERROR); \
         } while(0)
@@ -1780,7 +1780,7 @@
         // Promote the singleton to make sure that we do not get destroyed
         // while this callback is executing.
         if (UNLIKELY(getInstance() == NULL)) {
-            LOGE("camera object has been destroyed--returning immediately");
+            ALOGE("camera object has been destroyed--returning immediately");
             return;
         }
 
@@ -1792,7 +1792,7 @@
             // Autofocus failures occur relatively often and are not fatal, so
             // we do not transition to QCS_ERROR for them.
             if (func != CAMERA_FUNC_START_FOCUS) {
-                LOGE("QualcommCameraHardware::camera_cb: @CAMERA_EXIT_CB_FAILURE(%d) in state %s.",
+                ALOGE("QualcommCameraHardware::camera_cb: @CAMERA_EXIT_CB_FAILURE(%d) in state %s.",
                      parm4,
                      obj->getCameraStateStr(obj->mCameraState));
                 TRANSITION_ALWAYS(QCS_ERROR);
@@ -1814,12 +1814,12 @@
                             obj->receivePreviewFrame((camera_frame_type *)parm4);
                         break;
                     case QCS_INTERNAL_PREVIEW_STOPPING:
-                        LOGE("camera cb: discarding preview frame "
+                        ALOGE("camera cb: discarding preview frame "
                              "while stopping preview");
                         break;
                     default:
                         // transition to QCS_ERROR
-                        LOGE("camera cb: invalid state %s for preview!",
+                        ALOGE("camera cb: invalid state %s for preview!",
                              obj->getCameraStateStr(obj->mCameraState));
                         break;
                     }
@@ -1829,7 +1829,7 @@
                     break;
                 default:
                     // transition to QCS_ERROR
-                    LOGE("unexpected cb %d for CAMERA_FUNC_START_PREVIEW.",
+                    ALOGE("unexpected cb %d for CAMERA_FUNC_START_PREVIEW.",
                          cb);
                 }
                 break;
@@ -1861,7 +1861,7 @@
                     // waiting in cancelPicture(), and then delete this object.
                     // If the order were reversed, we might call
                     // receiveRawPicture on a dead object.
-                    LOGV("Receiving post LPM raw picture.");
+                    ALOGV("Receiving post LPM raw picture.");
                     obj->receivePostLpmRawPicture((camera_frame_type *)parm4);
                     {
                         Mutex::Autolock lock(&obj->mStateLock);
@@ -1872,7 +1872,7 @@
                     }
                 } else {  // transition to QCS_ERROR
                     if (obj->mCameraState == QCS_ERROR) {
-                        LOGE("camera cb: invalid state %s for taking a picture!",
+                        ALOGE("camera cb: invalid state %s for taking a picture!",
                              obj->getCameraStateStr(obj->mCameraState));
                         obj->mRawPictureCallback(NULL, obj->mPictureCallbackCookie);
                         obj->mJpegPictureCallback(NULL, obj->mPictureCallbackCookie);
@@ -1892,7 +1892,7 @@
                         obj->receiveJpegPictureFragment(
                             (JPEGENC_CBrtnType *)parm4);
                     }
-                    else LOGE("camera cb: invalid state %s for receiving "
+                    else ALOGE("camera cb: invalid state %s for receiving "
                               "JPEG fragment!",
                               obj->getCameraStateStr(obj->mCameraState));
                     break;
@@ -1916,13 +1916,13 @@
                         TRANSITION(QCS_WAITING_JPEG, QCS_IDLE);
                     }
                     // transition to QCS_ERROR
-                    else LOGE("camera cb: invalid state %s for "
+                    else ALOGE("camera cb: invalid state %s for "
                               "receiving JPEG!",
                               obj->getCameraStateStr(obj->mCameraState));
                     break;
                 default:
                     // transition to QCS_ERROR
-                    LOGE("camera cb: unknown cb %d for JPEG!", cb);
+                    ALOGE("camera cb: unknown cb %d for JPEG!", cb);
                 }
             break;
             CAMERA_STATE(CAMERA_FUNC_START_FOCUS) {
@@ -1933,10 +1933,10 @@
                 if (obj->mAutoFocusCallback) {
                     switch (cb) {
                     case CAMERA_RSP_CB_SUCCESS:
-                        LOGV("camera cb: autofocus has started.");
+                        ALOGV("camera cb: autofocus has started.");
                         break;
                     case CAMERA_EXIT_CB_DONE: {
-                        LOGV("camera cb: autofocus succeeded.");
+                        ALOGV("camera cb: autofocus succeeded.");
                         Mutex::Autolock lock(&obj->mStateLock);
                         if (obj->mAutoFocusCallback) {
                             obj->mAutoFocusCallback(true,
@@ -1946,10 +1946,10 @@
                     }
                         break;
                     case CAMERA_EXIT_CB_ABORT:
-                        LOGE("camera cb: autofocus aborted");
+                        ALOGE("camera cb: autofocus aborted");
                         break;
                     case CAMERA_EXIT_CB_FAILED: {
-                        LOGE("camera cb: autofocus failed");
+                        ALOGE("camera cb: autofocus failed");
                         Mutex::Autolock lock(&obj->mStateLock);
                         if (obj->mAutoFocusCallback) {
                             obj->mAutoFocusCallback(false,
@@ -1959,14 +1959,14 @@
                     }
                         break;
                     default:
-                        LOGE("camera cb: unknown cb %d for "
+                        ALOGE("camera cb: unknown cb %d for "
                              "CAMERA_FUNC_START_FOCUS!", cb);
                     }
                 }
             } break;
         default:
             // transition to QCS_ERROR
-            LOGE("Unknown camera-callback status %d", cb);
+            ALOGE("Unknown camera-callback status %d", cb);
         }
     }
 
@@ -2025,7 +2025,7 @@
                                         frame_offset,
                                         name)
     {
-            LOGV("constructing MemPool %s backed by ashmem: "
+            ALOGV("constructing MemPool %s backed by ashmem: "
                  "%d frames @ %d bytes, offset %d, "
                  "buffer size %d",
                  mName,
@@ -2052,7 +2052,7 @@
                                         frame_offset,
                                         name)
     {
-        LOGV("constructing MemPool %s backed by pmem pool %s: "
+        ALOGV("constructing MemPool %s backed by pmem pool %s: "
              "%d frames @ %d bytes, offset %d, buffer size %d",
              mName,
              pmem_pool, num_buffers, frame_size, frame_offset,
@@ -2073,20 +2073,20 @@
             
             mFd = mHeap->getHeapID();
             if (::ioctl(mFd, PMEM_GET_SIZE, &mSize)) {
-                LOGE("pmem pool %s ioctl(PMEM_GET_SIZE) error %s (%d)",
+                ALOGE("pmem pool %s ioctl(PMEM_GET_SIZE) error %s (%d)",
                      pmem_pool,
                      ::strerror(errno), errno);
                 mHeap.clear();
                 return;
             }
             
-            LOGV("pmem pool %s ioctl(PMEM_GET_SIZE) is %ld",
+            ALOGV("pmem pool %s ioctl(PMEM_GET_SIZE) is %ld",
                  pmem_pool,
                  mSize.len);
             
             completeInitialization();
         }
-        else LOGE("pmem pool %s error: could not create master heap!",
+        else ALOGE("pmem pool %s error: could not create master heap!",
                   pmem_pool);
     }
 
@@ -2102,7 +2102,7 @@
                                          frame_offset,
                                          name)
     {
-        LOGV("constructing PreviewPmemPool");
+        ALOGV("constructing PreviewPmemPool");
         if (initialized()) {
             LINK_camera_assoc_pmem(QDSP_MODULE_VFETASK,
                                    mFd,
@@ -2114,10 +2114,10 @@
 
     QualcommCameraHardware::PreviewPmemPool::~PreviewPmemPool()
     {
-        LOGV("destroying PreviewPmemPool");
+        ALOGV("destroying PreviewPmemPool");
         if(initialized()) {
             void *base = mHeap->base();
-            LOGV("releasing PreviewPmemPool memory %p from module %d",
+            ALOGV("releasing PreviewPmemPool memory %p from module %d",
                  base, QDSP_MODULE_VFETASK);
             LINK_camera_release_pmem(QDSP_MODULE_VFETASK, base,
                                      mAlignedSize,
@@ -2138,7 +2138,7 @@
                                          frame_offset,
                                          name)
     {
-        LOGV("constructing RawPmemPool");
+        ALOGV("constructing RawPmemPool");
 
         if (initialized()) {
             LINK_camera_assoc_pmem(QDSP_MODULE_VFETASK,
@@ -2161,10 +2161,10 @@
 
     QualcommCameraHardware::RawPmemPool::~RawPmemPool()
     {
-        LOGV("destroying RawPmemPool");
+        ALOGV("destroying RawPmemPool");
         if(initialized()) {
             void *base = mHeap->base();
-            LOGV("releasing RawPmemPool memory %p from modules %d, %d, and %d",
+            ALOGV("releasing RawPmemPool memory %p from modules %d, %d, and %d",
                  base, QDSP_MODULE_VFETASK, QDSP_MODULE_LPMTASK,
                  QDSP_MODULE_JPEGTASK);
             LINK_camera_release_pmem(QDSP_MODULE_VFETASK,
@@ -2178,11 +2178,11 @@
     
     QualcommCameraHardware::MemPool::~MemPool()
     {
-        LOGV("destroying MemPool %s", mName);
+        ALOGV("destroying MemPool %s", mName);
         if (mFrameSize > 0)
             delete [] mBuffers;
         mHeap.clear();
-        LOGV("destroying MemPool %s completed", mName);        
+        ALOGV("destroying MemPool %s completed", mName);        
     }
     
     status_t QualcommCameraHardware::MemPool::dump(int fd, const Vector<String16>& args) const
@@ -2254,7 +2254,7 @@
 
     static void cb_rex_signal_ready(void)
     {
-        LOGV("Received REX-ready signal.");
+        ALOGV("Received REX-ready signal.");
         rex_init_lock.lock();
         rex_init_wait.broadcast();
         rex_init_lock.unlock();
diff --git a/libcopybit/copybit.cpp b/libcopybit/copybit.cpp
index 7130ca7..f5326e2 100644
--- a/libcopybit/copybit.cpp
+++ b/libcopybit/copybit.cpp
@@ -205,14 +205,14 @@
 {
     int err = ioctl(dev->mFD, MSMFB_BLIT,
                     (struct mdp_blit_req_list const*)list);
-    LOGE_IF(err<0, "copyBits failed (%s)", strerror(errno));
+    ALOGE_IF(err<0, "copyBits failed (%s)", strerror(errno));
     if (err == 0) {
         return 0;
     } else {
 #if DEBUG_MDP_ERRORS
         struct mdp_blit_req_list const* l = (struct mdp_blit_req_list const*)list;
         for (int i=0 ; i<l->count ; i++) {
-            LOGD("%d: src={w=%d, h=%d, f=%d, rect={%d,%d,%d,%d}}\n"
+            ALOGD("%d: src={w=%d, h=%d, f=%d, rect={%d,%d,%d,%d}}\n"
                  "    dst={w=%d, h=%d, f=%d, rect={%d,%d,%d,%d}}\n"
                  "    flags=%08lx"
                     ,
@@ -269,7 +269,7 @@
                 ctx->mFlags |= MDP_ROT_270;
                 break;
             default:
-                LOGE("Invalid value for COPYBIT_ROTATION_DEG");
+                ALOGE("Invalid value for COPYBIT_ROTATION_DEG");
                 status = -EINVAL;
                 break;
             }
@@ -456,7 +456,7 @@
     
     if (ctx->mFD < 0) {
         status = errno;
-        LOGE("Error opening frame buffer errno=%d (%s)",
+        ALOGE("Error opening frame buffer errno=%d (%s)",
              status, strerror(status));
         status = -status;
     } else {
@@ -466,11 +466,11 @@
                 /* Success */
                 status = 0;
             } else {
-                LOGE("Error not msm frame buffer");
+                ALOGE("Error not msm frame buffer");
                 status = -EINVAL;
             }
         } else {
-            LOGE("Error executing ioctl for screen info");
+            ALOGE("Error executing ioctl for screen info");
             status = -errno;
         }
     }
diff --git a/libgralloc-qsd8k/allocator.cpp b/libgralloc-qsd8k/allocator.cpp
index e7645b1..f2a3c6b 100644
--- a/libgralloc-qsd8k/allocator.cpp
+++ b/libgralloc-qsd8k/allocator.cpp
@@ -113,7 +113,7 @@
                 mList.insertBefore(free_chunk, split);
             }
 
-            LOGE_IF(((free_chunk->start*kMemoryAlign)&(pagesize-1)),
+            ALOGE_IF(((free_chunk->start*kMemoryAlign)&(pagesize-1)),
                     "page is not aligned!!!");
 
             const ssize_t tail_free = free_size - (size+extra);
diff --git a/libgralloc-qsd8k/framebuffer.cpp b/libgralloc-qsd8k/framebuffer.cpp
index 11b303a..0f71078 100644
--- a/libgralloc-qsd8k/framebuffer.cpp
+++ b/libgralloc-qsd8k/framebuffer.cpp
@@ -115,7 +115,7 @@
         m->info.activate = FB_ACTIVATE_VBL;
         m->info.yoffset = offset / m->finfo.line_length;
         if (ioctl(m->framebuffer->fd, FBIOPUT_VSCREENINFO, &m->info) == -1) {
-            LOGE("FBIOPUT_VSCREENINFO failed");
+            ALOGE("FBIOPUT_VSCREENINFO failed");
             m->base.unlock(&m->base, buffer); 
             return -errno;
         }
@@ -238,14 +238,14 @@
     if (ioctl(fd, FBIOPUT_VSCREENINFO, &info) == -1) {
         info.yres_virtual = info.yres;
         flags &= ~PAGE_FLIP;
-        LOGW("FBIOPUT_VSCREENINFO failed, page flipping not supported");
+        ALOGW("FBIOPUT_VSCREENINFO failed, page flipping not supported");
     }
 
     if (info.yres_virtual < info.yres * 2) {
         // we need at least 2 for page-flipping
         info.yres_virtual = info.yres;
         flags &= ~PAGE_FLIP;
-        LOGW("page flipping not supported (yres_virtual=%d, requested=%d)",
+        ALOGW("page flipping not supported (yres_virtual=%d, requested=%d)",
                 info.yres_virtual, info.yres*2);
     }
 
@@ -275,7 +275,7 @@
     float ydpi = (info.yres * 25.4f) / info.height;
     float fps  = refreshRate / 1000.0f;
 
-    LOGI(   "using (fd=%d)\n"
+    ALOGI(   "using (fd=%d)\n"
             "id           = %s\n"
             "xres         = %d px\n"
             "yres         = %d px\n"
@@ -297,7 +297,7 @@
             info.blue.offset, info.blue.length
     );
 
-    LOGI(   "width        = %d mm (%f dpi)\n"
+    ALOGI(   "width        = %d mm (%f dpi)\n"
             "height       = %d mm (%f dpi)\n"
             "refresh rate = %.2f Hz\n",
             info.width,  xdpi,
@@ -334,7 +334,7 @@
 
     void* vaddr = mmap(0, fbSize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
     if (vaddr == MAP_FAILED) {
-        LOGE("Error mapping the framebuffer (%s)", strerror(errno));
+        ALOGE("Error mapping the framebuffer (%s)", strerror(errno));
         return -errno;
     }
     module->framebuffer->base = intptr_t(vaddr);
@@ -403,7 +403,7 @@
             if (m->finfo.reserved[0] == 0x5444 &&
                     m->finfo.reserved[1] == 0x5055) {
                 dev->device.setUpdateRect = fb_setUpdateRect;
-                LOGD("UPDATE_ON_DEMAND supported");
+                ALOGD("UPDATE_ON_DEMAND supported");
             }
 
             *device = &dev->device.common;
@@ -449,5 +449,5 @@
     blit.req.src_rect.h = blit.req.dst_rect.h = h;
 
     if (ioctl(fd, MSMFB_BLIT, &blit))
-        LOGE("MSMFB_BLIT failed = %d", -errno);
+        ALOGE("MSMFB_BLIT failed = %d", -errno);
 }
diff --git a/libgralloc-qsd8k/gpu.cpp b/libgralloc-qsd8k/gpu.cpp
index 90ff445..1ed7264 100644
--- a/libgralloc-qsd8k/gpu.cpp
+++ b/libgralloc-qsd8k/gpu.cpp
@@ -148,7 +148,7 @@
 
         if ((flags & private_handle_t::PRIV_FLAGS_USES_PMEM) != 0) {
           if ((flags & private_handle_t::PRIV_FLAGS_USES_PMEM_ADSP) != 0) {
-              LOGE("attempting to allocate a gralloc buffer with both the "
+              ALOGE("attempting to allocate a gralloc buffer with both the "
                    "USES_PMEM and USES_PMEM_ADSP flags.  Unsetting the "
                    "USES_PMEM_ADSP flag.");
               flags &= ~private_handle_t::PRIV_FLAGS_USES_PMEM_ADSP;
@@ -171,14 +171,14 @@
                 err = 0;
                 goto try_ashmem;
             } else {
-                LOGE("couldn't open pmem (%s)", strerror(errno));
+                ALOGE("couldn't open pmem (%s)", strerror(errno));
             }
         }
     } else {
 try_ashmem:
         fd = deps.ashmem_create_region("gralloc-buffer", size);
         if (fd < 0) {
-            LOGE("couldn't create ashmem (%s)", strerror(errno));
+            ALOGE("couldn't create ashmem (%s)", strerror(errno));
             err = -errno;
         }
     }
@@ -191,7 +191,7 @@
         *pHandle = hnd;
     }
 
-    LOGE_IF(err, "gralloc failed err=%s", strerror(-err));
+    ALOGE_IF(err, "gralloc failed err=%s", strerror(-err));
 
     return err;
 }
@@ -240,7 +240,7 @@
 
         case HAL_PIXEL_FORMAT_YV12:
             if ((w&1) || (h&1)) {
-                LOGE("w or h is odd for HAL_PIXEL_FORMAT_YV12");
+                ALOGE("w or h is odd for HAL_PIXEL_FORMAT_YV12");
                 return -EINVAL;
             }
             alignedw = ALIGN(w, 16);
@@ -250,7 +250,7 @@
             break;
 
         default:
-            LOGE("unrecognized pixel format: %d", format);
+            ALOGE("unrecognized pixel format: %d", format);
             return -EINVAL;
     }
 
diff --git a/libgralloc-qsd8k/gralloc_priv.h b/libgralloc-qsd8k/gralloc_priv.h
index c573941..2aca95f 100644
--- a/libgralloc-qsd8k/gralloc_priv.h
+++ b/libgralloc-qsd8k/gralloc_priv.h
@@ -147,7 +147,7 @@
                 h->numInts != sNumInts || h->numFds != sNumFds ||
                 hnd->magic != sMagic) 
         {
-            LOGE("invalid gralloc handle (at %p)", h);
+            ALOGE("invalid gralloc handle (at %p)", h);
             return -EINVAL;
         }
         return 0;
diff --git a/libgralloc-qsd8k/mapper.cpp b/libgralloc-qsd8k/mapper.cpp
index 6de7346..753686e 100644
--- a/libgralloc-qsd8k/mapper.cpp
+++ b/libgralloc-qsd8k/mapper.cpp
@@ -63,13 +63,13 @@
         void* mappedAddress = mmap(0, size,
                 PROT_READ|PROT_WRITE, MAP_SHARED, hnd->fd, 0);
         if (mappedAddress == MAP_FAILED) {
-            LOGE("Could not mmap handle %p, fd=%d (%s)",
+            ALOGE("Could not mmap handle %p, fd=%d (%s)",
                     handle, hnd->fd, strerror(errno));
             hnd->base = 0;
             return -errno;
         }
         hnd->base = intptr_t(mappedAddress) + hnd->offset;
-        //LOGD("gralloc_map() succeeded fd=%d, off=%d, size=%d, vaddr=%p", 
+        //ALOGD("gralloc_map() succeeded fd=%d, off=%d, size=%d, vaddr=%p", 
         //        hnd->fd, hnd->offset, hnd->size, mappedAddress);
     }
     *vaddr = (void*)hnd->base;
@@ -87,9 +87,9 @@
         base = (void*)(intptr_t(base) - hnd->offset);
         size += hnd->offset;
 #endif
-        //LOGD("unmapping from %p, size=%d", base, size);
+        //ALOGD("unmapping from %p, size=%d", base, size);
         if (munmap(base, size) < 0) {
-            LOGE("Could not unmap %s", strerror(errno));
+            ALOGE("Could not unmap %s", strerror(errno));
         }
     }
     hnd->base = 0;
@@ -141,7 +141,7 @@
 
     private_handle_t* hnd = (private_handle_t*)handle;
     
-    LOGE_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK,
+    ALOGE_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK,
             "[unregister] handle %p still locked (state=%08x)",
             hnd, hnd->lockState);
 
@@ -165,7 +165,7 @@
      * to un-map it. It's an error to be here with a locked buffer.
      */
 
-    LOGE_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK,
+    ALOGE_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK,
             "[terminate] handle %p still locked (state=%08x)",
             hnd, hnd->lockState);
 
@@ -206,16 +206,16 @@
 
         if (current_value & private_handle_t::LOCK_STATE_WRITE) {
             // already locked for write 
-            LOGE("handle %p already locked for write", handle);
+            ALOGE("handle %p already locked for write", handle);
             return -EBUSY;
         } else if (current_value & private_handle_t::LOCK_STATE_READ_MASK) {
             // already locked for read
             if (usage & (GRALLOC_USAGE_SW_WRITE_MASK | GRALLOC_USAGE_HW_RENDER)) {
-                LOGE("handle %p already locked for read", handle);
+                ALOGE("handle %p already locked for read", handle);
                 return -EBUSY;
             } else {
                 // this is not an error
-                //LOGD("%p already locked for read... count = %d", 
+                //ALOGD("%p already locked for read... count = %d", 
                 //        handle, (current_value & ~(1<<31)));
             }
         }
@@ -285,7 +285,7 @@
         region.offset = hnd->offset;
         region.len = hnd->size;
         err = ioctl(hnd->fd, PMEM_CACHE_FLUSH, &region);
-        LOGE_IF(err < 0, "cannot flush handle %p (offs=%x len=%x)\n",
+        ALOGE_IF(err < 0, "cannot flush handle %p (offs=%x len=%x)\n",
                 hnd, hnd->offset, hnd->size);
         hnd->flags &= ~private_handle_t::PRIV_FLAGS_NEEDS_FLUSH;
     }
@@ -303,7 +303,7 @@
         }
 
         if ((new_value & private_handle_t::LOCK_STATE_READ_MASK) == 0) {
-            LOGE("handle %p not locked", handle);
+            ALOGE("handle %p not locked", handle);
             return -EINVAL;
         }
 
diff --git a/libgralloc-qsd8k/pmemalloc.cpp b/libgralloc-qsd8k/pmemalloc.cpp
index e42e898..73093ed 100644
--- a/libgralloc-qsd8k/pmemalloc.cpp
+++ b/libgralloc-qsd8k/pmemalloc.cpp
@@ -32,8 +32,8 @@
 #include "pmemalloc.h"
 
 
-#define BEGIN_FUNC LOGV("%s begin", __PRETTY_FUNCTION__)
-#define END_FUNC LOGV("%s end", __PRETTY_FUNCTION__)
+#define BEGIN_FUNC ALOGV("%s begin", __PRETTY_FUNCTION__)
+#define END_FUNC ALOGV("%s end", __PRETTY_FUNCTION__)
 
 
 static int get_open_flags(int usage) {
@@ -89,7 +89,7 @@
         size_t size = 0;
         err = deps.getPmemTotalSize(fd, &size);
         if (err < 0) {
-            LOGE("%s: PMEM_GET_TOTAL_SIZE failed (%d), limp mode", pmemdev,
+            ALOGE("%s: PMEM_GET_TOTAL_SIZE failed (%d), limp mode", pmemdev,
                     err);
             size = 8<<20;   // 8 MiB
         }
@@ -98,7 +98,7 @@
         void* base = deps.mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
                 0);
         if (base == MAP_FAILED) {
-            LOGE("%s: failed to map pmem master fd: %s", pmemdev,
+            ALOGE("%s: failed to map pmem master fd: %s", pmemdev,
                     strerror(deps.getErrno()));
             err = -deps.getErrno();
             base = 0;
@@ -109,7 +109,7 @@
             master_base = base;
         }
     } else {
-        LOGE("%s: failed to open pmem device: %s", pmemdev,
+        ALOGE("%s: failed to open pmem device: %s", pmemdev,
                 strerror(deps.getErrno()));
         err = -deps.getErrno();
     }
@@ -127,7 +127,7 @@
         // first time, try to initialize pmem
         err = init_pmem_area_locked();
         if (err) {
-            LOGE("%s: failed to initialize pmem area", pmemdev);
+            ALOGE("%s: failed to initialize pmem area", pmemdev);
             master_fd = err;
         }
     } else if (err < 0) {
@@ -152,12 +152,12 @@
         int offset = allocator.allocate(size);
         if (offset < 0) {
             // no more pmem memory
-            LOGE("%s: no more pmem available", pmemdev);
+            ALOGE("%s: no more pmem available", pmemdev);
             err = -ENOMEM;
         } else {
             int openFlags = get_open_flags(usage);
 
-            //LOGD("%s: allocating pmem at offset 0x%p", pmemdev, offset);
+            //ALOGD("%s: allocating pmem at offset 0x%p", pmemdev, offset);
 
             // now create the "sub-heap"
             int fd = deps.open(pmemdev, openFlags, 0);
@@ -172,20 +172,20 @@
                 err = deps.mapPmem(fd, offset, size);
 
             if (err < 0) {
-                LOGE("%s: failed to initialize pmem sub-heap: %d", pmemdev,
+                ALOGE("%s: failed to initialize pmem sub-heap: %d", pmemdev,
                         err);
                 err = -deps.getErrno();
                 deps.close(fd);
                 allocator.deallocate(offset);
                 fd = -1;
             } else {
-                LOGV("%s: mapped fd %d at offset %d, size %d", pmemdev, fd, offset, size);
+                ALOGV("%s: mapped fd %d at offset %d, size %d", pmemdev, fd, offset, size);
                 memset((char*)base + offset, 0, size);
                 *pBase = base;
                 *pOffset = offset;
                 *pFd = fd;
             }
-            //LOGD_IF(!err, "%s: allocating pmem size=%d, offset=%d", pmemdev, size, offset);
+            //ALOGD_IF(!err, "%s: allocating pmem size=%d, offset=%d", pmemdev, size, offset);
         }
     }
     END_FUNC;
@@ -199,7 +199,7 @@
     int err = 0;
     if (fd >= 0) {
         int err = deps.unmapPmem(fd, offset, size);
-        LOGE_IF(err<0, "PMEM_UNMAP failed (%s), fd=%d, sub.offset=%u, "
+        ALOGE_IF(err<0, "PMEM_UNMAP failed (%s), fd=%d, sub.offset=%u, "
                 "sub.size=%u", strerror(deps.getErrno()), fd, offset, size);
         if (err == 0) {
             // we can't deallocate the memory in case of UNMAP failure
@@ -281,7 +281,7 @@
 
     void* base = deps.mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
     if (base == MAP_FAILED) {
-        LOGE("%s: failed to map pmem fd: %s", pmemdev,
+        ALOGE("%s: failed to map pmem fd: %s", pmemdev,
              strerror(deps.getErrno()));
         err = -deps.getErrno();
         deps.close(fd);
@@ -310,7 +310,7 @@
     int err = deps.munmap(base, size);
     if (err < 0) {
         err = deps.getErrno();
-        LOGW("%s: error unmapping pmem fd: %s", pmemdev, strerror(err));
+        ALOGW("%s: error unmapping pmem fd: %s", pmemdev, strerror(err));
         return -err;
     }
     END_FUNC;
diff --git a/libgralloc/allocator.cpp b/libgralloc/allocator.cpp
index e7645b1..f2a3c6b 100644
--- a/libgralloc/allocator.cpp
+++ b/libgralloc/allocator.cpp
@@ -113,7 +113,7 @@
                 mList.insertBefore(free_chunk, split);
             }
 
-            LOGE_IF(((free_chunk->start*kMemoryAlign)&(pagesize-1)),
+            ALOGE_IF(((free_chunk->start*kMemoryAlign)&(pagesize-1)),
                     "page is not aligned!!!");
 
             const ssize_t tail_free = free_size - (size+extra);
diff --git a/libgralloc/framebuffer.cpp b/libgralloc/framebuffer.cpp
index 35d0971..fffbbb1 100644
--- a/libgralloc/framebuffer.cpp
+++ b/libgralloc/framebuffer.cpp
@@ -101,7 +101,7 @@
         m->info.activate = FB_ACTIVATE_VBL;
         m->info.yoffset = offset / m->finfo.line_length;
         if (ioctl(m->framebuffer->fd, FBIOPUT_VSCREENINFO, &m->info) == -1) {
-            LOGE("FBIOPUT_VSCREENINFO failed");
+            ALOGE("FBIOPUT_VSCREENINFO failed");
             m->base.unlock(&m->base, buffer); 
             return -errno;
         }
@@ -202,14 +202,14 @@
     if (ioctl(fd, FBIOPUT_VSCREENINFO, &info) == -1) {
         info.yres_virtual = info.yres;
         flags &= ~PAGE_FLIP;
-        LOGW("FBIOPUT_VSCREENINFO failed, page flipping not supported");
+        ALOGW("FBIOPUT_VSCREENINFO failed, page flipping not supported");
     }
 
     if (info.yres_virtual < info.yres * 2) {
         // we need at least 2 for page-flipping
         info.yres_virtual = info.yres;
         flags &= ~PAGE_FLIP;
-        LOGW("page flipping not supported (yres_virtual=%d, requested=%d)",
+        ALOGW("page flipping not supported (yres_virtual=%d, requested=%d)",
                 info.yres_virtual, info.yres*2);
     }
 
@@ -239,7 +239,7 @@
     float ydpi = (info.yres * 25.4f) / info.height;
     float fps  = refreshRate / 1000.0f;
 
-    LOGI(   "using (fd=%d)\n"
+    ALOGI(   "using (fd=%d)\n"
             "id           = %s\n"
             "xres         = %d px\n"
             "yres         = %d px\n"
@@ -261,7 +261,7 @@
             info.blue.offset, info.blue.length
     );
 
-    LOGI(   "width        = %d mm (%f dpi)\n"
+    ALOGI(   "width        = %d mm (%f dpi)\n"
             "height       = %d mm (%f dpi)\n"
             "refresh rate = %.2f Hz\n",
             info.width,  xdpi,
@@ -298,7 +298,7 @@
 
     void* vaddr = mmap(0, fbSize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
     if (vaddr == MAP_FAILED) {
-        LOGE("Error mapping the framebuffer (%s)", strerror(errno));
+        ALOGE("Error mapping the framebuffer (%s)", strerror(errno));
         return -errno;
     }
     module->framebuffer->base = intptr_t(vaddr);
@@ -367,7 +367,7 @@
             if (m->finfo.reserved[0] == 0x5444 &&
                     m->finfo.reserved[1] == 0x5055) {
                 dev->device.setUpdateRect = fb_setUpdateRect;
-                LOGD("UPDATE_ON_DEMAND supported");
+                ALOGD("UPDATE_ON_DEMAND supported");
             }
 
             *device = &dev->device.common;
@@ -412,5 +412,5 @@
     blit.req.src_rect.h = blit.req.dst_rect.h = h;
 
     if (ioctl(fd, MSMFB_BLIT, &blit))
-        LOGE("MSMFB_BLIT failed = %d", -errno);
+        ALOGE("MSMFB_BLIT failed = %d", -errno);
 }
diff --git a/libgralloc/gralloc.cpp b/libgralloc/gralloc.cpp
index 2424121..4b6b4ac 100644
--- a/libgralloc/gralloc.cpp
+++ b/libgralloc/gralloc.cpp
@@ -200,7 +200,7 @@
         size_t size;
         pmem_region region;
         if (ioctl(master_fd, PMEM_GET_TOTAL_SIZE, &region) < 0) {
-            LOGE("PMEM_GET_TOTAL_SIZE failed, limp mode");
+            ALOGE("PMEM_GET_TOTAL_SIZE failed, limp mode");
             size = 8<<20;   // 8 MiB
         } else {
             size = region.len;
@@ -247,22 +247,22 @@
 {
     int err = 0;
     int gpu = open("/dev/msm_hw3dm", O_RDWR, 0);
-    LOGE_IF(gpu<0, "could not open hw3dm (%s)", strerror(errno));
+    ALOGE_IF(gpu<0, "could not open hw3dm (%s)", strerror(errno));
     if (gpu >= 0) {
         struct hw3d_region regions[HW3D_NUM_REGIONS];
         if (ioctl(gpu, HW3D_GET_REGIONS, regions) < 0) {
-            LOGE("HW3D_GET_REGIONS failed (%s)", strerror(errno));
+            ALOGE("HW3D_GET_REGIONS failed (%s)", strerror(errno));
             err = -errno;
         } else {
-            LOGD("smi: offset=%08lx, len=%08lx, phys=%p", 
+            ALOGD("smi: offset=%08lx, len=%08lx, phys=%p", 
                     regions[HW3D_SMI].map_offset, 
                     regions[HW3D_SMI].len, 
                     regions[HW3D_SMI].phys);
-            LOGD("ebi: offset=%08lx, len=%08lx, phys=%p", 
+            ALOGD("ebi: offset=%08lx, len=%08lx, phys=%p", 
                     regions[HW3D_EBI].map_offset,
                     regions[HW3D_EBI].len,
                     regions[HW3D_EBI].phys);
-            LOGD("reg: offset=%08lx, len=%08lx, phys=%p", 
+            ALOGD("reg: offset=%08lx, len=%08lx, phys=%p", 
                     regions[HW3D_REGS].map_offset,
                     regions[HW3D_REGS].len,
                     regions[HW3D_REGS].phys);
@@ -272,7 +272,7 @@
                     gpu, regions[FB_ARENA].map_offset);
 
             if (base == MAP_FAILED) {
-                LOGE("mmap EBI1 (%s)", strerror(errno));
+                ALOGE("mmap EBI1 (%s)", strerror(errno));
                 err = -errno;
                 base = 0;
                 close(gpu);
@@ -338,7 +338,7 @@
 try_ashmem:
         fd = ashmem_create_region("gralloc-buffer", size);
         if (fd < 0) {
-            LOGE("couldn't create ashmem (%s)", strerror(errno));
+            ALOGE("couldn't create ashmem (%s)", strerror(errno));
             err = -errno;
         }
     } else if ((usage & GRALLOC_USAGE_HW_RENDER) == 0) {
@@ -375,7 +375,7 @@
                     fd = -1;
                 }
                 memset((char*)base + offset, 0, size);
-                //LOGD_IF(!err, "allocating pmem size=%d, offset=%d", size, offset);
+                //ALOGD_IF(!err, "allocating pmem size=%d, offset=%d", size, offset);
             }
         } else {
             if ((usage & GRALLOC_USAGE_HW_2D) == 0) {
@@ -384,7 +384,7 @@
                 err = 0;
                 goto try_ashmem;
             } else {
-                LOGE("couldn't open pmem (%s)", strerror(errno));
+                ALOGE("couldn't open pmem (%s)", strerror(errno));
             }
         }
     } else {
@@ -409,13 +409,13 @@
                 offset = sAllocatorGPU.allocate(size);
                 if (offset < 0) {
                     // no more pmem memory
-                    LOGW("%d KiB allocation failed in GPU memory, retrying...",
+                    ALOGW("%d KiB allocation failed in GPU memory, retrying...",
                             size/1024);
                     err = -ENOMEM;
                     sleeptime += 250000;
                     usleep(sleeptime);
                 } else {
-                    LOGD("allocating GPU size=%d, offset=%d", size, offset);
+                    ALOGD("allocating GPU size=%d, offset=%d", size, offset);
                     fd = open("/dev/null", O_RDONLY); // just so marshalling doesn't fail
                     gpu_fd = m->gpu;
                     memset((char*)base + offset, 0, size);
@@ -451,7 +451,7 @@
         }
     }
     
-    LOGE_IF(err, "gralloc failed err=%s", strerror(-err));
+    ALOGE_IF(err, "gralloc failed err=%s", strerror(-err));
     
     return err;
 }
@@ -534,7 +534,7 @@
             if (hnd->fd >= 0) {
                 struct pmem_region sub = { hnd->offset, hnd->size };
                 int err = ioctl(hnd->fd, PMEM_UNMAP, &sub);
-                LOGE_IF(err<0, "PMEM_UNMAP failed (%s), "
+                ALOGE_IF(err<0, "PMEM_UNMAP failed (%s), "
                         "fd=%d, sub.offset=%lu, sub.size=%lu",
                         strerror(errno), hnd->fd, hnd->offset, hnd->size);
                 if (err == 0) {
@@ -545,7 +545,7 @@
                 }
             }
         } else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_GPU) {
-            LOGD("freeing GPU buffer at %d", hnd->offset);
+            ALOGD("freeing GPU buffer at %d", hnd->offset);
             sAllocatorGPU.deallocate(hnd->offset);
         }
 
diff --git a/libgralloc/gralloc_priv.h b/libgralloc/gralloc_priv.h
index 3925d79..921c385 100644
--- a/libgralloc/gralloc_priv.h
+++ b/libgralloc/gralloc_priv.h
@@ -109,7 +109,7 @@
                 h->numInts != sNumInts || h->numFds != sNumFds ||
                 hnd->magic != sMagic) 
         {
-            LOGE("invalid gralloc handle (at %p)", h);
+            ALOGE("invalid gralloc handle (at %p)", h);
             return -EINVAL;
         }
         return 0;
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp
index 7a5fdc6..d20a5f0 100644
--- a/libgralloc/mapper.cpp
+++ b/libgralloc/mapper.cpp
@@ -63,13 +63,13 @@
         void* mappedAddress = mmap(0, size,
                 PROT_READ|PROT_WRITE, MAP_SHARED, hnd->fd, 0);
         if (mappedAddress == MAP_FAILED) {
-            LOGE("Could not mmap handle %p, fd=%d (%s)",
+            ALOGE("Could not mmap handle %p, fd=%d (%s)",
                     handle, hnd->fd, strerror(errno));
             hnd->base = 0;
             return -errno;
         }
         hnd->base = intptr_t(mappedAddress) + hnd->offset;
-        //LOGD("gralloc_map() succeeded fd=%d, off=%d, size=%d, vaddr=%p", 
+        //ALOGD("gralloc_map() succeeded fd=%d, off=%d, size=%d, vaddr=%p", 
         //        hnd->fd, hnd->offset, hnd->size, mappedAddress);
     }
     *vaddr = (void*)hnd->base;
@@ -87,9 +87,9 @@
         base = (void*)(intptr_t(base) - hnd->offset);
         size += hnd->offset;
 #endif
-        //LOGD("unmapping from %p, size=%d, flags=%08x", base, size, hnd->flags);
+        //ALOGD("unmapping from %p, size=%d, flags=%08x", base, size, hnd->flags);
         if (munmap(base, size) < 0) {
-            LOGE("Could not unmap %s", strerror(errno));
+            ALOGE("Could not unmap %s", strerror(errno));
         }
     }
     hnd->base = 0;
diff --git a/liblights/lights.c b/liblights/lights.c
index 555833b..f75b7e3 100644
--- a/liblights/lights.c
+++ b/liblights/lights.c
@@ -113,7 +113,7 @@
         return amt == -1 ? -errno : 0;
     } else {
         if (already_warned == 0) {
-            LOGE("write_int failed to open %s\n", path);
+            ALOGE("write_int failed to open %s\n", path);
             already_warned = 1;
         }
         return -errno;
@@ -134,7 +134,7 @@
     if (mode == 7 && g_backlight) {
         mode = 0;
     }
-    LOGV("%s g_backlight = %d, mode = %d, g_attention = %d\n",
+    ALOGV("%s g_backlight = %d, mode = %d, g_attention = %d\n",
         __func__, g_backlight, mode, g_attention);
 
     // If the value isn't changing, don't set it, because this
@@ -220,7 +220,7 @@
     colorRGB = state->color;
 
 #if 0
-    LOGD("set_speaker_light_locked colorRGB=%08X, onMS=%d, offMS=%d\n",
+    ALOGD("set_speaker_light_locked colorRGB=%08X, onMS=%d, offMS=%d\n",
             colorRGB, onMS, offMS);
 #endif
 
@@ -311,7 +311,7 @@
 {
     pthread_mutex_lock(&g_lock);
     g_notification = *state;
-    LOGV("set_light_notifications g_trackball=%d color=0x%08x",
+    ALOGV("set_light_notifications g_trackball=%d color=0x%08x",
             g_trackball, state->color);
     if (g_haveTrackballLight) {
         handle_trackball_light_locked(dev);
@@ -326,7 +326,7 @@
         struct light_state_t const* state)
 {
     pthread_mutex_lock(&g_lock);
-    LOGV("set_light_attention g_trackball=%d color=0x%08x",
+    ALOGV("set_light_attention g_trackball=%d color=0x%08x",
             g_trackball, state->color);
     if (state->flashMode == LIGHT_FLASH_HARDWARE) {
         g_attention = state->flashOnMS;
@@ -410,7 +410,7 @@
 /*
  * The lights Module
  */
-const struct hw_module_t HAL_MODULE_INFO_SYM = {
+struct hw_module_t HAL_MODULE_INFO_SYM = {
     .tag = HARDWARE_MODULE_TAG,
     .version_major = 1,
     .version_minor = 0,
diff --git a/librpc/debug.h b/librpc/debug.h
index 4910e28..fb42214 100644
--- a/librpc/debug.h
+++ b/librpc/debug.h
@@ -31,10 +31,10 @@
 #define PRINT(x...) do {                                    \
         fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
         fprintf(stdout, ##x);                               \
-        LOGI(x);                               \
+        ALOGI(x);                               \
     } while(0)
 #else
-#define PRINT(x...) LOGI(x)
+#define PRINT(x...) ALOGI(x)
 #endif
 
 #ifdef DEBUG
@@ -52,14 +52,14 @@
 #define E(x...) do {                                        \
         fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \
         fprintf(stderr, ##x);                               \
-        LOGE(x);                                            \
+        ALOGE(x);                                            \
     } while(0)
 
 #define FAILIF(cond, msg...) do {                                              \
         if (__builtin_expect (cond, 0)) {                                      \
             fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \
             fprintf(stderr, ##msg);                                            \
-            LOGE(msg);                                                         \
+            ALOGE(msg);                                                         \
         }                                                                      \
     } while(0)
 
diff --git a/libstagefrighthw/Android.mk b/libstagefrighthw/Android.mk
index 725e578..1d41d35 100644
--- a/libstagefrighthw/Android.mk
+++ b/libstagefrighthw/Android.mk
@@ -23,7 +23,8 @@
 LOCAL_CFLAGS := $(PV_CFLAGS_MINUS_VISIBILITY)
 
 LOCAL_C_INCLUDES:= \
-        $(TOP)/frameworks/base/include/media/stagefright/openmax
+        $(TOP)/frameworks/native/include/media/hardware \
+        $(TOP)/frameworks/native/include/media/openmax
 
 LOCAL_SHARED_LIBRARIES :=       \
         libbinder               \
diff --git a/libstagefrighthw/QComOMXPlugin.cpp b/libstagefrighthw/QComOMXPlugin.cpp
index 1663815..26eb818 100644
--- a/libstagefrighthw/QComOMXPlugin.cpp
+++ b/libstagefrighthw/QComOMXPlugin.cpp
@@ -18,8 +18,7 @@
 
 #include <dlfcn.h>
 
-#include <media/stagefright/HardwareAPI.h>
-#include <media/stagefright/MediaDebug.h>
+#include <HardwareAPI.h>
 
 namespace android {
 
@@ -124,12 +123,15 @@
         err = (*mGetRolesOfComponentHandle)(
                 const_cast<OMX_STRING>(name), &numRoles2, array);
 
-        CHECK_EQ(err, OMX_ErrorNone);
-        CHECK_EQ(numRoles, numRoles2);
+        if (err == OMX_ErrorNone && numRoles != numRoles2) {
+            err = OMX_ErrorUndefined;
+        }
 
         for (OMX_U32 i = 0; i < numRoles; ++i) {
-            String8 s((const char *)array[i]);
-            roles->push(s);
+            if (err == OMX_ErrorNone) {
+                String8 s((const char *)array[i]);
+                roles->push(s);
+            }
 
             delete[] array[i];
             array[i] = NULL;
@@ -139,7 +141,7 @@
         array = NULL;
     }
 
-    return OMX_ErrorNone;
+    return err;
 }
 
 }  // namespace android
diff --git a/libstagefrighthw/QComOMXPlugin.h b/libstagefrighthw/QComOMXPlugin.h
index 14b83d3..432e19a 100644
--- a/libstagefrighthw/QComOMXPlugin.h
+++ b/libstagefrighthw/QComOMXPlugin.h
@@ -18,7 +18,7 @@
 
 #define QCOM_OMX_PLUGIN_H_
 
-#include <media/stagefright/OMXPluginBase.h>
+#include <OMXPluginBase.h>
 
 namespace android {