Merge changes Ib10d1000,Ibc332506,Ib429c9b5,I9a87ab49,I948ff132

* changes:
  Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF)
  Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF)
  Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF)
  Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF)
  Rename LOGV(_IF) to ALOGV(_IF)
diff --git a/libril/ril.cpp b/libril/ril.cpp
index d1d5d3b..5fba532 100644
--- a/libril/ril.cpp
+++ b/libril/ril.cpp
@@ -92,11 +92,11 @@
     #define startRequest           sprintf(printBuf, "(")
     #define closeRequest           sprintf(printBuf, "%s)", printBuf)
     #define printRequest(token, req)           \
-            LOGD("[%04d]> %s %s", token, requestToString(req), printBuf)
+            ALOGD("[%04d]> %s %s", token, requestToString(req), printBuf)
 
     #define startResponse           sprintf(printBuf, "%s {", printBuf)
     #define closeResponse           sprintf(printBuf, "%s}", printBuf)
-    #define printResponse           LOGD("%s", printBuf)
+    #define printResponse           ALOGD("%s", printBuf)
 
     #define clearPrintBuf           printBuf[0] = 0
     #define removeLastChar          printBuf[strlen(printBuf)-1] = 0
@@ -312,7 +312,7 @@
     ret = pthread_mutex_unlock(&s_pendingRequestsMutex);
     assert (ret == 0);
 
-    LOGD("C[locl]> %s", requestToString(request));
+    ALOGD("C[locl]> %s", requestToString(request));
 
     s_callbacks.onRequest(request, data, len, pRI);
 }
@@ -335,12 +335,12 @@
     status = p.readInt32 (&token);
 
     if (status != NO_ERROR) {
-        LOGE("invalid request block");
+        ALOGE("invalid request block");
         return 0;
     }
 
     if (request < 1 || request >= (int32_t)NUM_ELEMS(s_commands)) {
-        LOGE("unsupported request code %d token %d", request, token);
+        ALOGE("unsupported request code %d token %d", request, token);
         // FIXME this should perhaps return a response
         return 0;
     }
@@ -369,7 +369,7 @@
 
 static void
 invalidCommandBlock (RequestInfo *pRI) {
-    LOGE("invalid command block for token %d request %s",
+    ALOGE("invalid command block for token %d request %s",
                 pRI->token, requestToString(pRI->pCI->requestNumber));
 }
 
@@ -1236,7 +1236,7 @@
         if (written >= 0) {
             writeOffset += written;
         } else {   // written < 0
-            LOGE ("RIL Response: unexpected error on write errno:%d", errno);
+            ALOGE ("RIL Response: unexpected error on write errno:%d", errno);
             close(fd);
             return -1;
         }
@@ -1256,7 +1256,7 @@
     }
 
     if (dataSize > MAX_COMMAND_BYTES) {
-        LOGE("RIL: packet larger than %u (%u)",
+        ALOGE("RIL: packet larger than %u (%u)",
                 MAX_COMMAND_BYTES, (unsigned int )dataSize);
 
         return -1;
@@ -1298,11 +1298,11 @@
     int numInts;
 
     if (response == NULL && responselen != 0) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
     if (responselen % sizeof(int) != 0) {
-        LOGE("invalid response length %d expected multiple of %d\n",
+        ALOGE("invalid response length %d expected multiple of %d\n",
             (int)responselen, (int)sizeof(int));
         return RIL_ERRNO_INVALID_RESPONSE;
     }
@@ -1336,11 +1336,11 @@
     int numStrings;
 
     if (response == NULL && responselen != 0) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
     if (responselen % sizeof(char *) != 0) {
-        LOGE("invalid response length %d expected multiple of %d\n",
+        ALOGE("invalid response length %d expected multiple of %d\n",
             (int)responselen, (int)sizeof(char *));
         return RIL_ERRNO_INVALID_RESPONSE;
     }
@@ -1391,12 +1391,12 @@
     int num;
 
     if (response == NULL && responselen != 0) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
     if (responselen % sizeof (RIL_Call *) != 0) {
-        LOGE("invalid response length %d expected multiple of %d\n",
+        ALOGE("invalid response length %d expected multiple of %d\n",
             (int)responselen, (int)sizeof (RIL_Call *));
         return RIL_ERRNO_INVALID_RESPONSE;
     }
@@ -1459,12 +1459,12 @@
 
 static int responseSMS(Parcel &p, void *response, size_t responselen) {
     if (response == NULL) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
     if (responselen != sizeof (RIL_SMS_Response) ) {
-        LOGE("invalid response length %d expected %d",
+        ALOGE("invalid response length %d expected %d",
                 (int)responselen, (int)sizeof (RIL_SMS_Response));
         return RIL_ERRNO_INVALID_RESPONSE;
     }
@@ -1486,12 +1486,12 @@
 static int responseDataCallListV4(Parcel &p, void *response, size_t responselen)
 {
     if (response == NULL && responselen != 0) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
     if (responselen % sizeof(RIL_Data_Call_Response_v4) != 0) {
-        LOGE("invalid response length %d expected multiple of %d",
+        ALOGE("invalid response length %d expected multiple of %d",
                 (int)responselen, (int)sizeof(RIL_Data_Call_Response_v4));
         return RIL_ERRNO_INVALID_RESPONSE;
     }
@@ -1529,12 +1529,12 @@
         return responseDataCallListV4(p, response, responselen);
     } else {
         if (response == NULL && responselen != 0) {
-            LOGE("invalid response: NULL");
+            ALOGE("invalid response: NULL");
             return RIL_ERRNO_INVALID_RESPONSE;
         }
 
         if (responselen % sizeof(RIL_Data_Call_Response_v6) != 0) {
-            LOGE("invalid response length %d expected multiple of %d",
+            ALOGE("invalid response length %d expected multiple of %d",
                     (int)responselen, (int)sizeof(RIL_Data_Call_Response_v6));
             return RIL_ERRNO_INVALID_RESPONSE;
         }
@@ -1583,7 +1583,7 @@
 
 static int responseRaw(Parcel &p, void *response, size_t responselen) {
     if (response == NULL && responselen != 0) {
-        LOGE("invalid response: NULL with responselen != 0");
+        ALOGE("invalid response: NULL with responselen != 0");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
@@ -1601,12 +1601,12 @@
 
 static int responseSIM_IO(Parcel &p, void *response, size_t responselen) {
     if (response == NULL) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
     if (responselen != sizeof (RIL_SIM_IO_Response) ) {
-        LOGE("invalid response length was %d expected %d",
+        ALOGE("invalid response length was %d expected %d",
                 (int)responselen, (int)sizeof (RIL_SIM_IO_Response));
         return RIL_ERRNO_INVALID_RESPONSE;
     }
@@ -1629,12 +1629,12 @@
     int num;
 
     if (response == NULL && responselen != 0) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
     if (responselen % sizeof(RIL_CallForwardInfo *) != 0) {
-        LOGE("invalid response length %d expected multiple of %d",
+        ALOGE("invalid response length %d expected multiple of %d",
                 (int)responselen, (int)sizeof(RIL_CallForwardInfo *));
         return RIL_ERRNO_INVALID_RESPONSE;
     }
@@ -1667,12 +1667,12 @@
 
 static int responseSsn(Parcel &p, void *response, size_t responselen) {
     if (response == NULL) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
     if (responselen != sizeof(RIL_SuppSvcNotification)) {
-        LOGE("invalid response length was %d expected %d",
+        ALOGE("invalid response length was %d expected %d",
                 (int)responselen, (int)sizeof (RIL_SuppSvcNotification));
         return RIL_ERRNO_INVALID_RESPONSE;
     }
@@ -1698,12 +1698,12 @@
     int num;
 
     if (response == NULL && responselen != 0) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
     if (responselen % sizeof (RIL_NeighboringCell *) != 0) {
-        LOGE("invalid response length %d expected multiple of %d\n",
+        ALOGE("invalid response length %d expected multiple of %d\n",
             (int)responselen, (int)sizeof (RIL_NeighboringCell *));
         return RIL_ERRNO_INVALID_RESPONSE;
     }
@@ -1747,12 +1747,12 @@
     RIL_CDMA_InformationRecord *infoRec;
 
     if (response == NULL && responselen != 0) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
     if (responselen != sizeof (RIL_CDMA_InformationRecords)) {
-        LOGE("invalid response length %d expected multiple of %d\n",
+        ALOGE("invalid response length %d expected multiple of %d\n",
             (int)responselen, (int)sizeof (RIL_CDMA_InformationRecords *));
         return RIL_ERRNO_INVALID_RESPONSE;
     }
@@ -1772,7 +1772,7 @@
             case RIL_CDMA_EXTENDED_DISPLAY_INFO_REC:
                 if (infoRec->rec.display.alpha_len >
                                          CDMA_ALPHA_INFO_BUFFER_LENGTH) {
-                    LOGE("invalid display info response length %d \
+                    ALOGE("invalid display info response length %d \
                           expected not more than %d\n",
                          (int)infoRec->rec.display.alpha_len,
                          CDMA_ALPHA_INFO_BUFFER_LENGTH);
@@ -1792,7 +1792,7 @@
             case RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC:
             case RIL_CDMA_CONNECTED_NUMBER_INFO_REC:
                 if (infoRec->rec.number.len > CDMA_NUMBER_INFO_BUFFER_LENGTH) {
-                    LOGE("invalid display info response length %d \
+                    ALOGE("invalid display info response length %d \
                           expected not more than %d\n",
                          (int)infoRec->rec.number.len,
                          CDMA_NUMBER_INFO_BUFFER_LENGTH);
@@ -1829,7 +1829,7 @@
             case RIL_CDMA_REDIRECTING_NUMBER_INFO_REC:
                 if (infoRec->rec.redir.redirectingNumber.len >
                                               CDMA_NUMBER_INFO_BUFFER_LENGTH) {
-                    LOGE("invalid display info response length %d \
+                    ALOGE("invalid display info response length %d \
                           expected not more than %d\n",
                          (int)infoRec->rec.redir.redirectingNumber.len,
                          CDMA_NUMBER_INFO_BUFFER_LENGTH);
@@ -1884,10 +1884,10 @@
                 break;
             case RIL_CDMA_T53_RELEASE_INFO_REC:
                 // TODO(Moto): See David Krause, he has the answer:)
-                LOGE("RIL_CDMA_T53_RELEASE_INFO_REC: return INVALID_RESPONSE");
+                ALOGE("RIL_CDMA_T53_RELEASE_INFO_REC: return INVALID_RESPONSE");
                 return RIL_ERRNO_INVALID_RESPONSE;
             default:
-                LOGE("Incorrect name value");
+                ALOGE("Incorrect name value");
                 return RIL_ERRNO_INVALID_RESPONSE;
         }
     }
@@ -1899,7 +1899,7 @@
 static int responseRilSignalStrength(Parcel &p,
                     void *response, size_t responselen) {
     if (response == NULL && responselen != 0) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
@@ -1946,7 +1946,7 @@
         closeResponse;
 
     } else {
-        LOGE("invalid response length");
+        ALOGE("invalid response length");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
@@ -1963,12 +1963,12 @@
 
 static int responseCdmaSignalInfoRecord(Parcel &p, void *response, size_t responselen) {
     if (response == NULL || responselen == 0) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
     if (responselen != sizeof (RIL_CDMA_SignalInfoRecord)) {
-        LOGE("invalid response length %d expected sizeof (RIL_CDMA_SignalInfoRecord) of %d\n",
+        ALOGE("invalid response length %d expected sizeof (RIL_CDMA_SignalInfoRecord) of %d\n",
             (int)responselen, (int)sizeof (RIL_CDMA_SignalInfoRecord));
         return RIL_ERRNO_INVALID_RESPONSE;
     }
@@ -1993,12 +1993,12 @@
 static int responseCdmaCallWaiting(Parcel &p, void *response,
             size_t responselen) {
     if (response == NULL && responselen != 0) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
     if (responselen < sizeof(RIL_CDMA_CallWaiting_v6)) {
-        LOGW("Upgrade to ril version %d\n", RIL_VERSION);
+        ALOGW("Upgrade to ril version %d\n", RIL_VERSION);
     }
 
     RIL_CDMA_CallWaiting_v6 *p_cur = ((RIL_CDMA_CallWaiting_v6 *) response);
@@ -2083,7 +2083,7 @@
     int i;
 
     if (response == NULL && responselen != 0) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
@@ -2108,7 +2108,7 @@
 
         sendSimStatusAppInfo(p, p_cur->num_applications, p_cur->applications);
     } else {
-        LOGE("responseSimStatus: A RilCardStatus_v6 or _v5 expected\n");
+        ALOGE("responseSimStatus: A RilCardStatus_v6 or _v5 expected\n");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
@@ -2170,15 +2170,15 @@
     uint8_t uct;
     void* dest;
 
-    LOGD("Inside responseCdmaSms");
+    ALOGD("Inside responseCdmaSms");
 
     if (response == NULL && responselen != 0) {
-        LOGE("invalid response: NULL");
+        ALOGE("invalid response: NULL");
         return RIL_ERRNO_INVALID_RESPONSE;
     }
 
     if (responselen != sizeof(RIL_CDMA_SMS_Message)) {
-        LOGE("invalid response length was %d expected %d",
+        ALOGE("invalid response length was %d expected %d",
                 (int)responselen, (int)sizeof(RIL_CDMA_SMS_Message));
         return RIL_ERRNO_INVALID_RESPONSE;
     }
@@ -2230,7 +2230,7 @@
     char buff[16];
     int ret;
 
-    LOGV("processWakeupCallback");
+    ALOGV("processWakeupCallback");
 
     /* empty our wakeup socket out */
     do {
@@ -2287,9 +2287,9 @@
     if (ret == 0 || !(errno == EAGAIN || errno == EINTR)) {
         /* fatal error or end-of-stream */
         if (ret != 0) {
-            LOGE("error on reading command socket errno:%d\n", errno);
+            ALOGE("error on reading command socket errno:%d\n", errno);
         } else {
-            LOGW("EOS.  Closing command socket.");
+            ALOGW("EOS.  Closing command socket.");
         }
 
         close(s_fdCommand);
@@ -2329,11 +2329,11 @@
     if (s_callbacks.getVersion != NULL) {
         const char *version;
         version = s_callbacks.getVersion();
-        LOGI("RIL Daemon version: %s\n", version);
+        ALOGI("RIL Daemon version: %s\n", version);
 
         property_set(PROPERTY_RIL_IMPL, version);
     } else {
-        LOGI("RIL Daemon version: unavailable\n");
+        ALOGI("RIL Daemon version: unavailable\n");
         property_set(PROPERTY_RIL_IMPL, "unavailable");
     }
 
@@ -2359,7 +2359,7 @@
     s_fdCommand = accept(s_fdListen, (sockaddr *) &peeraddr, &socklen);
 
     if (s_fdCommand < 0 ) {
-        LOGE("Error on accept() errno:%d", errno);
+        ALOGE("Error on accept() errno:%d", errno);
         /* start listening for new connections again */
         rilEventAddWakeup(&s_listen_event);
 	      return;
@@ -2380,17 +2380,17 @@
             if (strcmp(pwd->pw_name, PHONE_PROCESS) == 0) {
                 is_phone_socket = 1;
             } else {
-                LOGE("RILD can't accept socket from process %s", pwd->pw_name);
+                ALOGE("RILD can't accept socket from process %s", pwd->pw_name);
             }
         } else {
-            LOGE("Error on getpwuid() errno: %d", errno);
+            ALOGE("Error on getpwuid() errno: %d", errno);
         }
     } else {
-        LOGD("Error on getsockopt() errno: %d", errno);
+        ALOGD("Error on getsockopt() errno: %d", errno);
     }
 
     if ( !is_phone_socket ) {
-      LOGE("RILD must accept socket from %s", PHONE_PROCESS);
+      ALOGE("RILD must accept socket from %s", PHONE_PROCESS);
 
       close(s_fdCommand);
       s_fdCommand = -1;
@@ -2406,10 +2406,10 @@
     ret = fcntl(s_fdCommand, F_SETFL, O_NONBLOCK);
 
     if (ret < 0) {
-        LOGE ("Error setting O_NONBLOCK errno:%d", errno);
+        ALOGE ("Error setting O_NONBLOCK errno:%d", errno);
     }
 
-    LOGI("libril: new connection");
+    ALOGI("libril: new connection");
 
     p_rs = record_stream_new(s_fdCommand, MAX_COMMAND_BYTES);
 
@@ -2446,12 +2446,12 @@
     acceptFD = accept (fd,  (sockaddr *) &peeraddr, &socklen);
 
     if (acceptFD < 0) {
-        LOGE ("error accepting on debug port: %d\n", errno);
+        ALOGE ("error accepting on debug port: %d\n", errno);
         return;
     }
 
     if (recv(acceptFD, &number, sizeof(int), 0) != sizeof(int)) {
-        LOGE ("error reading on socket: number of Args: \n");
+        ALOGE ("error reading on socket: number of Args: \n");
         return;
     }
     args = (char **) malloc(sizeof(char*) * number);
@@ -2459,7 +2459,7 @@
     for (int i = 0; i < number; i++) {
         int len;
         if (recv(acceptFD, &len, sizeof(int), 0) != sizeof(int)) {
-            LOGE ("error reading on socket: Len of Args: \n");
+            ALOGE ("error reading on socket: Len of Args: \n");
             freeDebugCallbackArgs(i, args);
             return;
         }
@@ -2467,7 +2467,7 @@
         args[i] = (char *) malloc((sizeof(char) * len) + 1);
         if (recv(acceptFD, args[i], sizeof(char) * len, 0)
             != (int)sizeof(char) * len) {
-            LOGE ("error reading on socket: Args[%d] \n", i);
+            ALOGE ("error reading on socket: Args[%d] \n", i);
             freeDebugCallbackArgs(i, args);
             return;
         }
@@ -2477,11 +2477,11 @@
 
     switch (atoi(args[0])) {
         case 0:
-            LOGI ("Connection on debug port: issuing reset.");
+            ALOGI ("Connection on debug port: issuing reset.");
             issueLocalRequest(RIL_REQUEST_RESET_RADIO, NULL, 0);
             break;
         case 1:
-            LOGI ("Connection on debug port: issuing radio power off.");
+            ALOGI ("Connection on debug port: issuing radio power off.");
             data = 0;
             issueLocalRequest(RIL_REQUEST_RADIO_POWER, &data, sizeof(int));
             // Close the socket
@@ -2489,12 +2489,12 @@
             s_fdCommand = -1;
             break;
         case 2:
-            LOGI ("Debug port: issuing unsolicited voice network change.");
+            ALOGI ("Debug port: issuing unsolicited voice network change.");
             RIL_onUnsolicitedResponse(RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED,
                                       NULL, 0);
             break;
         case 3:
-            LOGI ("Debug port: QXDM log enable.");
+            ALOGI ("Debug port: QXDM log enable.");
             qxdm_data[0] = 65536;     // head.func_tag
             qxdm_data[1] = 16;        // head.len
             qxdm_data[2] = 1;         // mode: 1 for 'start logging'
@@ -2505,7 +2505,7 @@
                               6 * sizeof(int));
             break;
         case 4:
-            LOGI ("Debug port: QXDM log disable.");
+            ALOGI ("Debug port: QXDM log disable.");
             qxdm_data[0] = 65536;
             qxdm_data[1] = 16;
             qxdm_data[2] = 0;          // mode: 0 for 'stop logging'
@@ -2516,7 +2516,7 @@
                               6 * sizeof(int));
             break;
         case 5:
-            LOGI("Debug port: Radio On");
+            ALOGI("Debug port: Radio On");
             data = 1;
             issueLocalRequest(RIL_REQUEST_RADIO_POWER, &data, sizeof(int));
             sleep(2);
@@ -2524,33 +2524,33 @@
             issueLocalRequest(RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, NULL, 0);
             break;
         case 6:
-            LOGI("Debug port: Setup Data Call, Apn :%s\n", args[1]);
+            ALOGI("Debug port: Setup Data Call, Apn :%s\n", args[1]);
             actData[0] = args[1];
             issueLocalRequest(RIL_REQUEST_SETUP_DATA_CALL, &actData,
                               sizeof(actData));
             break;
         case 7:
-            LOGI("Debug port: Deactivate Data Call");
+            ALOGI("Debug port: Deactivate Data Call");
             issueLocalRequest(RIL_REQUEST_DEACTIVATE_DATA_CALL, &deactData,
                               sizeof(deactData));
             break;
         case 8:
-            LOGI("Debug port: Dial Call");
+            ALOGI("Debug port: Dial Call");
             dialData.clir = 0;
             dialData.address = args[1];
             issueLocalRequest(RIL_REQUEST_DIAL, &dialData, sizeof(dialData));
             break;
         case 9:
-            LOGI("Debug port: Answer Call");
+            ALOGI("Debug port: Answer Call");
             issueLocalRequest(RIL_REQUEST_ANSWER, NULL, 0);
             break;
         case 10:
-            LOGI("Debug port: End Call");
+            ALOGI("Debug port: End Call");
             issueLocalRequest(RIL_REQUEST_HANGUP, &hangupData,
                               sizeof(hangupData));
             break;
         default:
-            LOGE ("Invalid request");
+            ALOGE ("Invalid request");
             break;
     }
     freeDebugCallbackArgs(number, args);
@@ -2592,7 +2592,7 @@
     ret = pipe(filedes);
 
     if (ret < 0) {
-        LOGE("Error in pipe() errno:%d", errno);
+        ALOGE("Error in pipe() errno:%d", errno);
         return NULL;
     }
 
@@ -2608,7 +2608,7 @@
 
     // Only returns on error
     ril_event_loop();
-    LOGE ("error in event_loop_base errno:%d", errno);
+    ALOGE ("error in event_loop_base errno:%d", errno);
     // kill self to restart on error
     kill(0, SIGKILL);
 
@@ -2635,7 +2635,7 @@
     pthread_mutex_unlock(&s_startupMutex);
 
     if (ret < 0) {
-        LOGE("Failed to create dispatch thread errno:%d", errno);
+        ALOGE("Failed to create dispatch thread errno:%d", errno);
         return;
     }
 }
@@ -2651,23 +2651,23 @@
     int flags;
 
     if (callbacks == NULL) {
-        LOGE("RIL_register: RIL_RadioFunctions * null");
+        ALOGE("RIL_register: RIL_RadioFunctions * null");
         return;
     }
     if (callbacks->version < RIL_VERSION_MIN) {
-        LOGE("RIL_register: version %d is to old, min version is %d",
+        ALOGE("RIL_register: version %d is to old, min version is %d",
              callbacks->version, RIL_VERSION_MIN);
         return;
     }
     if (callbacks->version > RIL_VERSION) {
-        LOGE("RIL_register: version %d is too new, max version is %d",
+        ALOGE("RIL_register: version %d is too new, max version is %d",
              callbacks->version, RIL_VERSION);
         return;
     }
-    LOGE("RIL_register: RIL version %d", callbacks->version);
+    ALOGE("RIL_register: RIL version %d", callbacks->version);
 
     if (s_registerCalled > 0) {
-        LOGE("RIL_register has been called more than once. "
+        ALOGE("RIL_register has been called more than once. "
                 "Subsequent call ignored");
         return;
     }
@@ -2701,7 +2701,7 @@
             ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM);
 
     if (ret < 0) {
-        LOGE("Unable to bind socket errno:%d", errno);
+        ALOGE("Unable to bind socket errno:%d", errno);
         exit (-1);
     }
     s_fdListen = ret;
@@ -2709,14 +2709,14 @@
 #else
     s_fdListen = android_get_control_socket(SOCKET_NAME_RIL);
     if (s_fdListen < 0) {
-        LOGE("Failed to get socket '" SOCKET_NAME_RIL "'");
+        ALOGE("Failed to get socket '" SOCKET_NAME_RIL "'");
         exit(-1);
     }
 
     ret = listen(s_fdListen, 4);
 
     if (ret < 0) {
-        LOGE("Failed to listen on control socket '%d': %s",
+        ALOGE("Failed to listen on control socket '%d': %s",
              s_fdListen, strerror(errno));
         exit(-1);
     }
@@ -2734,14 +2734,14 @@
 
     s_fdDebug = android_get_control_socket(SOCKET_NAME_RIL_DEBUG);
     if (s_fdDebug < 0) {
-        LOGE("Failed to get socket '" SOCKET_NAME_RIL_DEBUG "' errno:%d", errno);
+        ALOGE("Failed to get socket '" SOCKET_NAME_RIL_DEBUG "' errno:%d", errno);
         exit(-1);
     }
 
     ret = listen(s_fdDebug, 4);
 
     if (ret < 0) {
-        LOGE("Failed to listen on ril debug socket '%d': %s",
+        ALOGE("Failed to listen on ril debug socket '%d': %s",
              s_fdDebug, strerror(errno));
         exit(-1);
     }
@@ -2791,14 +2791,14 @@
     pRI = (RequestInfo *)t;
 
     if (!checkAndDequeueRequestInfo(pRI)) {
-        LOGE ("RIL_onRequestComplete: invalid RIL_Token");
+        ALOGE ("RIL_onRequestComplete: invalid RIL_Token");
         return;
     }
 
     if (pRI->local > 0) {
         // Locally issued command...void only!
         // response does not go back up the command socket
-        LOGD("C[locl]< %s", requestToString(pRI->pCI->requestNumber));
+        ALOGD("C[locl]< %s", requestToString(pRI->pCI->requestNumber));
 
         goto done;
     }
@@ -2831,7 +2831,7 @@
         }
 
         if (s_fdCommand < 0) {
-            LOGD ("RIL onRequestComplete: Command channel closed");
+            ALOGD ("RIL onRequestComplete: Command channel closed");
         }
         sendResponse(p);
     }
@@ -2858,11 +2858,11 @@
 wakeTimeoutCallback (void *param) {
     // We're using "param != NULL" as a cancellation mechanism
     if (param == NULL) {
-        //LOGD("wakeTimeout: releasing wake lock");
+        //ALOGD("wakeTimeout: releasing wake lock");
 
         releaseWakeLock();
     } else {
-        //LOGD("wakeTimeout: releasing wake lock CANCELLED");
+        //ALOGD("wakeTimeout: releasing wake lock CANCELLED");
     }
 }
 
@@ -2877,7 +2877,7 @@
 
     if (s_registerCalled == 0) {
         // Ignore RIL_onUnsolicitedResponse before RIL_register
-        LOGW("RIL_onUnsolicitedResponse called before RIL_register");
+        ALOGW("RIL_onUnsolicitedResponse called before RIL_register");
         return;
     }
 
@@ -2885,7 +2885,7 @@
 
     if ((unsolResponseIndex < 0)
         || (unsolResponseIndex >= (int32_t)NUM_ELEMS(s_unsolResponses))) {
-        LOGE("unsupported unsolicited response code %d", unsolResponse);
+        ALOGE("unsupported unsolicited response code %d", unsolResponse);
         return;
     }
 
diff --git a/libril/ril_event.cpp b/libril/ril_event.cpp
index 4a4b330..93511e9 100644
--- a/libril/ril_event.cpp
+++ b/libril/ril_event.cpp
@@ -75,7 +75,7 @@
 #define DEBUG 0
 
 #if DEBUG
-#define dlog(x...) LOGD( x )
+#define dlog(x...) ALOGD( x )
 static void dump_event(struct ril_event * ev)
 {
     dlog("~~~~ Event %x ~~~~", (unsigned int)ev);
@@ -370,7 +370,7 @@
         if (n < 0) {
             if (errno == EINTR) continue;
 
-            LOGE("ril_event: select error (%d)", errno);
+            ALOGE("ril_event: select error (%d)", errno);
             // bail?
             return;
         }
diff --git a/mock-ril/src/cpp/ctrl_server.cpp b/mock-ril/src/cpp/ctrl_server.cpp
index 90b6d4c..3ac3a9f 100644
--- a/mock-ril/src/cpp/ctrl_server.cpp
+++ b/mock-ril/src/cpp/ctrl_server.cpp
@@ -39,7 +39,7 @@
 //#define CONTROL_SERVER_DEBUG
 #ifdef  CONTROL_SERVER_DEBUG
 
-#define DBG(...) LOGD(__VA_ARGS__)
+#define DBG(...) ALOGD(__VA_ARGS__)
 
 #else
 
@@ -198,7 +198,7 @@
         server_accept_socket_ = socket_inaddr_any_server(
             MOCK_RIL_CONTROL_SERVER_SOCKET, SOCK_STREAM);
         if (server_accept_socket_ < 0) {
-            LOGE("CtrlServerThread::Run error creating server_accept_socket_ '%s'",
+            ALOGE("CtrlServerThread::Run error creating server_accept_socket_ '%s'",
                     strerror(errno));
             return STATUS_ERR;
         }
@@ -207,7 +207,7 @@
         stop_server_fd_ = socket_loopback_server(
                 MOCK_RIL_CONTROL_SERVER_STOPPING_SOCKET, SOCK_STREAM);
         if (stop_server_fd_ < 0) {
-            LOGE("CtrlServerThread::Run error creating stop_server_fd_ '%s'",
+            ALOGE("CtrlServerThread::Run error creating stop_server_fd_ '%s'",
                     strerror(errno));
             return STATUS_ERR;
         }
@@ -216,7 +216,7 @@
         stop_client_fd_ = socket_loopback_client(
                 MOCK_RIL_CONTROL_SERVER_STOPPING_SOCKET, SOCK_STREAM);
         if (stop_client_fd_ < 0) {
-            LOGE("CtrlServerThread::Run error creating stop_client_fd_ '%s'",
+            ALOGE("CtrlServerThread::Run error creating stop_client_fd_ '%s'",
                     strerror(errno));
             return STATUS_ERR;
         }
@@ -224,7 +224,7 @@
         // Accept the connection of the stop_client_fd_
         stopper_fd_ = accept(stop_server_fd_, NULL, NULL);
         if (stopper_fd_ < 0) {
-            LOGE("CtrlServerThread::Run error accepting stop_client_fd '%s'",
+            ALOGE("CtrlServerThread::Run error accepting stop_client_fd '%s'",
                     strerror(errno));
             return STATUS_ERR;
         }
@@ -241,7 +241,7 @@
             done_ = true;
             int rv = send(stop_client_fd_, &done_, sizeof(done_), 0);
             if (rv <= 0) {
-                LOGE("CtrlServerThread::Stop could not send stop"
+                ALOGE("CtrlServerThread::Stop could not send stop"
                             "WE WILL PROBABLY HANG");
             }
             WaitUntilStopped();
@@ -308,7 +308,7 @@
         }
 
         if (status != STATUS_OK) {
-            LOGE("sendToCtrlServer Error: status=%d", status);
+            ALOGE("sendToCtrlServer Error: status=%d", status);
             // An error report complete now
             mh->set_length_data(0);
             mh->set_status(ril_proto::CTRL_STATUS_ERR);
@@ -356,7 +356,7 @@
                     if (status != STATUS_OK) break;
 
                     if (mh.cmd() == ril_proto::CTRL_CMD_ECHO) {
-                        LOGD("CtrlServerThread::Worker echo");
+                        ALOGD("CtrlServerThread::Worker echo");
                         status = WriteMessage(&mh, buffer);
                         if (status != STATUS_OK) break;
                     } else {
@@ -407,7 +407,7 @@
      */
     if (args.Length() < 3) {
         // Expecting a reqNum, ERROR and token
-        LOGE("SendCtrlRequestComplete X %d parameters"
+        ALOGE("SendCtrlRequestComplete X %d parameters"
              " expecting at least 3: status, reqNum, and token",
                 args.Length());
         return v8::Undefined();
@@ -448,16 +448,16 @@
     g_ctrl_server = new CtrlServerThread(context);
     status = g_ctrl_server->Run();
     if (status != STATUS_OK) {
-        LOGE("mock_ril control server could not start");
+        ALOGE("mock_ril control server could not start");
     } else {
-        LOGD("CtrlServer started");
+        ALOGD("CtrlServer started");
     }
 
 #if 0
-    LOGD("Test CtrlServerThread stop sleeping 10 seconds...");
+    ALOGD("Test CtrlServerThread stop sleeping 10 seconds...");
     v8::Unlocker unlocker;
     sleep(10);
-    LOGD("Test CtrlServerThread call Stop");
+    ALOGD("Test CtrlServerThread call Stop");
     g_ctrl_server->Stop();
     v8::Locker locker;
 
@@ -465,7 +465,7 @@
     g_ctrl_server = new CtrlServerThread(context);
     status = g_ctrl_server->Run();
     if (status != STATUS_OK) {
-        LOGE("mock_ril control server could not start");
+        ALOGE("mock_ril control server could not start");
     } else {
         DBG("mock_ril control server started");
     }
diff --git a/mock-ril/src/cpp/experiments.cpp b/mock-ril/src/cpp/experiments.cpp
index 5fa6fec..0bb6b98 100644
--- a/mock-ril/src/cpp/experiments.cpp
+++ b/mock-ril/src/cpp/experiments.cpp
@@ -39,17 +39,17 @@
     int data[] = {1, 2, 3};
 
     int *param = data;
-    LOGD("before push q.size=%d", q.size());
+    ALOGD("before push q.size=%d", q.size());
     q.push(param);
-    LOGD("after push q.size=%d", q.size());
+    ALOGD("after push q.size=%d", q.size());
     void *p = q.front();
     if (p == param) {
-        LOGD("q.push succeeded");
+        ALOGD("q.push succeeded");
     } else {
-        LOGD("q.push failed");
+        ALOGD("q.push failed");
     }
     q.pop();
-    LOGD("after pop q.size=%d", q.size());
+    ALOGD("after pop q.size=%d", q.size());
 }
 
 v8::Handle<v8::Value> GetReqScreenState(v8::Local<v8::String> property,
@@ -59,7 +59,7 @@
             v8::Local<v8::External>::Cast(self->GetInternalField(0));
     void *p = wrap->Value();
     int state = static_cast<int *>(p)[0];
-    LOGD("GetReqScreenState state=%d", state);
+    ALOGD("GetReqScreenState state=%d", state);
     return v8::Integer::New(state);
 }
 
@@ -73,7 +73,7 @@
     v8::Handle<v8::Value> onRilRequestFunctionValue = context->Global()->Get(name);
     if(!onRilRequestFunctionValue->IsFunction()) {
         // Wasn't a function
-        LOGD("callOnRilRequest X wasn't a function");
+        ALOGD("callOnRilRequest X wasn't a function");
         return false;
     }
     v8::Handle<v8::Function> onRilRequestFunction =
@@ -87,9 +87,9 @@
             v8::ObjectTemplate::New()->NewInstance();
     switch(request) {
         case(RIL_REQUEST_SCREEN_STATE): {
-            LOGD("callOnRilRequest RIL_REQUEST_SCREEN_STATE");
+            ALOGD("callOnRilRequest RIL_REQUEST_SCREEN_STATE");
             if (datalen < sizeof(int)) {
-                LOGD("callOnRilRequest err size < sizeof int");
+                ALOGD("callOnRilRequest err size < sizeof int");
             } else {
                 v8::Handle<v8::ObjectTemplate> params_obj_template =
                         v8::ObjectTemplate::New();
@@ -105,7 +105,7 @@
             break;
         }
         default: {
-            LOGD("callOnRilRequest X unknown request");
+            ALOGD("callOnRilRequest X unknown request");
             break;
         }
     }
@@ -117,19 +117,19 @@
     v8::Handle<v8::Value> result =
         onRilRequestFunction->Call(context->Global(), argc, argv);
     if (try_catch.HasCaught()) {
-        LOGD("callOnRilRequest error");
+        ALOGD("callOnRilRequest error");
         ReportException(&try_catch);
         retValue = false;
     } else {
         v8::String::Utf8Value result_string(result);
-        LOGD("callOnRilRequest result=%s", ToCString(result_string));
+        ALOGD("callOnRilRequest result=%s", ToCString(result_string));
         retValue = true;
     }
     return retValue;
 }
 
 void testOnRilRequestUsingCppRequestObjs(v8::Handle<v8::Context> context) {
-    LOGD("testOnRilRequestUsingCppRequestObjs E:");
+    ALOGD("testOnRilRequestUsingCppRequestObjs E:");
     v8::HandleScope handle_scope;
 
     v8::TryCatch try_catch;
@@ -149,94 +149,94 @@
         callOnRilRequest(context, RIL_REQUEST_SCREEN_STATE, data,
                 sizeof(data), NULL);
     }
-    LOGD("testOnRilRequestUsingCppRequestObjs X:");
+    ALOGD("testOnRilRequestUsingCppRequestObjs X:");
 }
 
 void testReqScreenStateProtobuf() {
     v8::HandleScope handle_scope;
     v8::TryCatch try_catch;
 
-    LOGD("testReqScreenStateProtobuf E");
+    ALOGD("testReqScreenStateProtobuf E");
 
-    LOGD("create ReqScreenState");
+    ALOGD("create ReqScreenState");
     ril_proto::ReqScreenState* ss = new ril_proto::ReqScreenState();
     ss->set_state(true);
     bool state = ss->state();
-    LOGD("state=%d", state);
+    ALOGD("state=%d", state);
     ss->set_state(false);
     state = ss->state();
-    LOGD("state=%d", state);
+    ALOGD("state=%d", state);
     int len = ss->ByteSize();
-    LOGD("create buffer len=%d", len);
+    ALOGD("create buffer len=%d", len);
     char *buffer = new char[len];
-    LOGD("serialize");
+    ALOGD("serialize");
     bool ok = ss->SerializeToArray(buffer, len);
     if (!ok) {
-        LOGD("testReqScreenStateProtobuf X: Could not serialize ss");
+        ALOGD("testReqScreenStateProtobuf X: Could not serialize ss");
         return;
     }
-    LOGD("ReqScreenState serialized ok");
+    ALOGD("ReqScreenState serialized ok");
     ril_proto::ReqScreenState *newSs = new ril_proto::ReqScreenState();
     ok = newSs->ParseFromArray(buffer, len);
     if (!ok) {
-        LOGD("testReqScreenStateProtobuf X: Could not deserialize ss");
+        ALOGD("testReqScreenStateProtobuf X: Could not deserialize ss");
         return;
     }
-    LOGD("newSs->state=%d", newSs->state());
+    ALOGD("newSs->state=%d", newSs->state());
 
     delete [] buffer;
     delete ss;
     delete newSs;
-    LOGD("testReqScreenStateProtobuf X");
+    ALOGD("testReqScreenStateProtobuf X");
 }
 
 void testReqHangUpProtobuf() {
     v8::HandleScope handle_scope;
     v8::TryCatch try_catch;
 
-    LOGD("testReqHangUpProtobuf E");
+    ALOGD("testReqHangUpProtobuf E");
 
-    LOGD("create ReqHangUp");
+    ALOGD("create ReqHangUp");
     ril_proto::ReqHangUp* hu = new ril_proto::ReqHangUp();
     hu->set_connection_index(3);
     bool connection_index = hu->connection_index();
-    LOGD("connection_index=%d", connection_index);
+    ALOGD("connection_index=%d", connection_index);
     hu->set_connection_index(2);
     connection_index = hu->connection_index();
-    LOGD("connection_index=%d", connection_index);
-    LOGD("create buffer");
+    ALOGD("connection_index=%d", connection_index);
+    ALOGD("create buffer");
     int len = hu->ByteSize();
     char *buffer = new char[len];
-    LOGD("serialize");
+    ALOGD("serialize");
     bool ok = hu->SerializeToArray(buffer, len);
     if (!ok) {
-        LOGD("testReqHangUpProtobuf X: Could not serialize hu");
+        ALOGD("testReqHangUpProtobuf X: Could not serialize hu");
         return;
     }
-    LOGD("ReqHangUp serialized ok");
+    ALOGD("ReqHangUp serialized ok");
     ril_proto::ReqHangUp *newHu = new ril_proto::ReqHangUp();
     ok = newHu->ParseFromArray(buffer, len);
     if (!ok) {
-        LOGD("testReqHangUpProtobuf X: Could not deserialize hu");
+        ALOGD("testReqHangUpProtobuf X: Could not deserialize hu");
         return;
     }
-    LOGD("newHu->connection_index=%d", newHu->connection_index());
+    ALOGD("newHu->connection_index=%d", newHu->connection_index());
 
     delete [] buffer;
     delete hu;
     delete newHu;
-    LOGD("testReqHangUpProtobuf X");
+    ALOGD("testReqHangUpProtobuf X");
 }
 
 void testProtobufV8(v8::Handle<v8::Context> context) {
-    LOGD("testProtobufV8 E:");
+    ALOGD("testProtobufV8 E:");
     v8::HandleScope handle_scope;
 
     v8::TryCatch try_catch;
     try_catch.SetVerbose(true);
 
     if (try_catch.HasCaught()) {
-        LOGD("TryCatch.hasCaught is true after protobuf_v8::init");
+        ALOGD("TryCatch.hasCaught is true after protobuf_v8::init");
         ReportException(&try_catch);
     }
     runJs(context, &try_catch, "local-string",
@@ -268,14 +268,14 @@
         "print('serializedOriginalReqScreenState.length=' + serializedOriginalReqScreenState.length);\n"
         "newReqScreenState = ReqScreenStateSchema.parse(serializedOriginalReqScreenState);\n"
         "print('newReqScreenState: state=' + newReqScreenState.state);\n");
-    LOGD("testProtobufV8 X");
+    ALOGD("testProtobufV8 X");
 }
 
 void experiments(v8::Handle<v8::Context> context) {
-    LOGD("experiments E: ********");
+    ALOGD("experiments E: ********");
     testStlPort();
     testReqScreenStateProtobuf();
     testOnRilRequestUsingCppRequestObjs(context);
     testProtobufV8(context);
-    LOGD("experiments X: ********\n");
+    ALOGD("experiments X: ********\n");
 }
diff --git a/mock-ril/src/cpp/js_support.cpp b/mock-ril/src/cpp/js_support.cpp
index a2ce9c5..ec10e38 100644
--- a/mock-ril/src/cpp/js_support.cpp
+++ b/mock-ril/src/cpp/js_support.cpp
@@ -34,7 +34,7 @@
 //#define JS_SUPPORT_DEBUG
 #ifdef  JS_SUPPORT_DEBUG
 
-#define DBG(...) LOGD(__VA_ARGS__)
+#define DBG(...) ALOGD(__VA_ARGS__)
 
 #else
 
@@ -88,7 +88,7 @@
         const char* cstr = ToCString(strUtf8);
         offset += snprintf(&str[offset], str_size, "%s", cstr);
     }
-    LOGD("%s", str);
+    ALOGD("%s", str);
     delete [] str;
     return v8::Undefined();
 }
@@ -290,18 +290,18 @@
     v8::Handle<v8::Script> script = v8::Script::Compile(
                 v8::String::New(code), v8::String::New(fileName));
     if (try_catch->HasCaught()) {
-        LOGE("-- Compiling the source failed");
+        ALOGE("-- Compiling the source failed");
     } else {
         // Run the resulting script
         v8::Handle<v8::Value> result = script->Run();
         if (try_catch->HasCaught()) {
-            LOGE("-- Running the script failed");
+            ALOGE("-- Running the script failed");
         }
     }
 }
 
 void testRadioState(v8::Handle<v8::Context> context) {
-    LOGD("testRadioState E:");
+    ALOGD("testRadioState E:");
     v8::HandleScope handle_scope;
 
     v8::TryCatch try_catch;
@@ -314,11 +314,11 @@
         "}\n"
         "gRadioState = 1;\n"
         "print('last gRadioState=' + gRadioState);\n");
-    LOGD("testRadioState X:");
+    ALOGD("testRadioState X:");
 }
 
 void testMsSleep(v8::Handle<v8::Context> context) {
-    LOGD("testMsSleep E:");
+    ALOGD("testMsSleep E:");
     v8::HandleScope handle_scope;
 
     v8::TryCatch try_catch;
@@ -330,22 +330,22 @@
         "  print('msSleep ' + sleeptime);\n"
         "  msSleep(sleeptime);\n"
         "}\n");
-    LOGD("testMsSleep X:");
+    ALOGD("testMsSleep X:");
 }
 
 void testPrint(v8::Handle<v8::Context> context) {
-    LOGD("testPrint E:");
+    ALOGD("testPrint E:");
     v8::HandleScope handle_scope;
 
     v8::TryCatch try_catch;
     try_catch.SetVerbose(true);
 
     runJs(context, &try_catch, "local-string", "print(\"Hello\")");
-    LOGD("testPrint X:");
+    ALOGD("testPrint X:");
 }
 
 void testCompileError(v8::Handle<v8::Context> context) {
-    LOGD("testCompileError E:");
+    ALOGD("testCompileError E:");
     v8::HandleScope handle_scope;
 
     v8::TryCatch try_catch;
@@ -353,11 +353,11 @@
 
     // +++ generate a compile time error
     runJs(context, &try_catch, "local-string", "+++");
-    LOGD("testCompileError X:");
+    ALOGD("testCompileError X:");
 }
 
 void testRuntimeError(v8::Handle<v8::Context> context) {
-    LOGD("testRuntimeError E:");
+    ALOGD("testRuntimeError E:");
     v8::HandleScope handle_scope;
 
     v8::TryCatch try_catch;
@@ -369,7 +369,7 @@
         "  print(\"Hi there\");\n"
         "}\n"
         "helloo()");
-    LOGD("testRuntimeError X:");
+    ALOGD("testRuntimeError X:");
 }
 
 void testReadFile() {
@@ -377,18 +377,18 @@
     size_t length;
     int status;
 
-    LOGD("testReadFile E:");
+    ALOGD("testReadFile E:");
 
     status = ReadFile("/sdcard/data/no-file", &buffer, &length);
-    LOGD("testReadFile expect status != 0, status=%d, buffer=%p, length=%d",
+    ALOGD("testReadFile expect status != 0, status=%d, buffer=%p, length=%d",
             status, buffer, length);
 
-    LOGD("testReadFile X:");
+    ALOGD("testReadFile X:");
 }
 
 
 void testReadFileToStringBuffer(v8::Handle<v8::Context> context) {
-    LOGD("testReadFileToStringBuffer E:");
+    ALOGD("testReadFileToStringBuffer E:");
     v8::HandleScope handle_scope;
 
     v8::TryCatch try_catch;
@@ -399,11 +399,11 @@
         "print(\"fileContents:\\n\" + fileContents);\n"
         "buffer = readFileToBuffer(\"ril.desc\");\n"
         "print(\"buffer.length=\" + buffer.length);\n");
-    LOGD("testReadFileToStringBuffer X:");
+    ALOGD("testReadFileToStringBuffer X:");
 }
 
 void testJsSupport(v8::Handle<v8::Context> context) {
-    LOGD("testJsSupport E: ********");
+    ALOGD("testJsSupport E: ********");
     testRadioState(context);
     testMsSleep(context);
     testPrint(context);
@@ -411,5 +411,5 @@
     testRuntimeError(context);
     testReadFile();
     testReadFileToStringBuffer(context);
-    LOGD("testJsSupport X: ********\n");
+    ALOGD("testJsSupport X: ********\n");
 }
diff --git a/mock-ril/src/cpp/mock_ril.cpp b/mock-ril/src/cpp/mock_ril.cpp
index f6b6807..7c199c9 100644
--- a/mock-ril/src/cpp/mock_ril.cpp
+++ b/mock-ril/src/cpp/mock_ril.cpp
@@ -59,7 +59,7 @@
 //#define MOCK_RIL_DEBUG
 #ifdef  MOCK_RIL_DEBUG
 
-#define DBG(...) LOGD(__VA_ARGS__)
+#define DBG(...) ALOGD(__VA_ARGS__)
 
 #else
 
@@ -243,7 +243,7 @@
 
     void * Worker(void *param)
     {
-        LOGD("UnsolicitedThread::Worker E param=%p", param);
+        ALOGD("UnsolicitedThread::Worker E param=%p", param);
 
         v8::Locker locker;
 
@@ -261,7 +261,7 @@
             v8::Locker locker;
         }
 
-        LOGD("UnsolicitedThread::Worker X param=%p", param);
+        ALOGD("UnsolicitedThread::Worker X param=%p", param);
 
         return NULL;
     }
@@ -280,12 +280,12 @@
 
     v8::Handle<v8::Value> result = start->Call(context->Global(), 0, NULL);
     if (try_catch.HasCaught()) {
-        LOGE("startMockRil error");
+        ALOGE("startMockRil error");
         ReportException(&try_catch);
-        LOGE("FATAL ERROR: Unsable to startMockRil.");
+        ALOGE("FATAL ERROR: Unsable to startMockRil.");
     } else {
         v8::String::Utf8Value result_string(result);
-        LOGE("startMockRil result=%s", ToCString(result_string));
+        ALOGE("startMockRil result=%s", ToCString(result_string));
     }
 
 }
@@ -296,7 +296,7 @@
     int ret;
     pthread_attr_t attr;
 
-    LOGD("RIL_Init E: ----------------");
+    ALOGD("RIL_Init E: ----------------");
 
     // Initialize V8
     v8::V8::Initialize();
@@ -326,7 +326,7 @@
         runJs(context, &try_catch, "mock_ril.js", buffer);
         if (try_catch.HasCaught()) {
             // TODO: Change to event this is fatal
-            LOGE("FATAL ERROR: Unable to run mock_ril.js");
+            ALOGE("FATAL ERROR: Unable to run mock_ril.js");
         }
     }
 
@@ -335,13 +335,13 @@
     responsesInit(context);
 
 #if 0
-    LOGD("RIL_Init run tests #####################");
+    ALOGD("RIL_Init run tests #####################");
     testJsSupport(context);
     testRequests(context);
     experiments(context);
     testWorker();
     testWorkerV8(context);
-    LOGD("RIL_Init tests completed ###############");
+    ALOGD("RIL_Init tests completed ###############");
 #endif
 
     // Register our call backs so when we startMockRil
@@ -357,6 +357,6 @@
     ut->Run(NULL);
 #endif
 
-    LOGD("RIL_Init X: ----------------");
+    ALOGD("RIL_Init X: ----------------");
     return &s_callbacks;
 }
diff --git a/mock-ril/src/cpp/node_buffer.cpp b/mock-ril/src/cpp/node_buffer.cpp
index d72e19e..4c08a26 100644
--- a/mock-ril/src/cpp/node_buffer.cpp
+++ b/mock-ril/src/cpp/node_buffer.cpp
@@ -41,7 +41,7 @@
 //#define BUFFER_DEBUG
 #ifdef  BUFFER_DEBUG
 
-#define DBG(...) LOGD(__VA_ARGS__)
+#define DBG(...) ALOGD(__VA_ARGS__)
 
 #else
 
diff --git a/mock-ril/src/cpp/protobuf_v8.cpp b/mock-ril/src/cpp/protobuf_v8.cpp
index 1622ba5..19f87c1 100644
--- a/mock-ril/src/cpp/protobuf_v8.cpp
+++ b/mock-ril/src/cpp/protobuf_v8.cpp
@@ -34,7 +34,7 @@
 //#define PROTOBUF_V8_DEBUG
 #ifdef  PROTOBUF_V8_DEBUG
 
-#define DBG(...) LOGD(__VA_ARGS__)
+#define DBG(...) ALOGD(__VA_ARGS__)
 
 #else
 
@@ -372,7 +372,7 @@
           } else {
             str_value = ToCString(value);
             // TODO: Why can str_value be corrupted sometimes?
-            LOGD("str_value=%s", str_value);
+            ALOGD("str_value=%s", str_value);
             vd = ed->FindValueByName(str_value);
             if (vd == NULL) {
               snprintf(error_buff, sizeof(error_buff),
diff --git a/mock-ril/src/cpp/requests.cpp b/mock-ril/src/cpp/requests.cpp
index 366ba30..72cbd00 100644
--- a/mock-ril/src/cpp/requests.cpp
+++ b/mock-ril/src/cpp/requests.cpp
@@ -38,7 +38,7 @@
 //#define REQUESTS_DEBUG
 #ifdef  REQUESTS_DEBUG
 
-#define DBG(...) LOGD(__VA_ARGS__)
+#define DBG(...) ALOGD(__VA_ARGS__)
 
 #else
 
@@ -73,7 +73,7 @@
 
     DBG("ReqEnterSimPin E");
     if (datalen < sizeof(int)) {
-        LOGE("ReqEnterSimPin: data to small err size < sizeof int");
+        ALOGE("ReqEnterSimPin: data to small err size < sizeof int");
         status = STATUS_BAD_DATA;
     } else {
         ril_proto::ReqEnterSimPin *req = new ril_proto::ReqEnterSimPin();
@@ -101,7 +101,7 @@
     DBG("data=%p datalen=%d t=%p", data, datalen, t);
 
     if (datalen < sizeof(int)) {
-        LOGE("ReqDial: data to small err size < sizeof int");
+        ALOGE("ReqDial: data to small err size < sizeof int");
         status = STATUS_BAD_DATA;
     } else {
         ril_proto::ReqDial *req = new ril_proto::ReqDial();
@@ -158,7 +158,7 @@
 
     DBG("ReqHangUp E");
     if (datalen < sizeof(int)) {
-        LOGE("ReqHangUp: data to small err size < sizeof int");
+        ALOGE("ReqHangUp: data to small err size < sizeof int");
         status = STATUS_BAD_DATA;
     } else {
         ril_proto::ReqHangUp *req = new ril_proto::ReqHangUp();
@@ -185,7 +185,7 @@
 
     DBG("ReqSeparateConnection E");
     if (datalen < sizeof(int)) {
-        LOGE("ReqSetMute: data to small err size < sizeof int");
+        ALOGE("ReqSetMute: data to small err size < sizeof int");
         status = STATUS_BAD_DATA;
     } else {
         ril_proto::ReqSeparateConnection *req = new ril_proto::ReqSeparateConnection();
@@ -213,7 +213,7 @@
 
     DBG("ReqSetMute E");
     if (datalen < sizeof(int)) {
-        LOGE("ReqSetMute: data to small err size < sizeof int");
+        ALOGE("ReqSetMute: data to small err size < sizeof int");
         status = STATUS_BAD_DATA;
     } else {
         ril_proto::ReqSetMute *req = new ril_proto::ReqSetMute();
@@ -242,7 +242,7 @@
     DBG("ReqScreenState E data=%p datalen=%d t=%p",
          data, datalen, t);
     if (datalen < sizeof(int)) {
-        LOGE("ReqScreenState: data to small err size < sizeof int");
+        ALOGE("ReqScreenState: data to small err size < sizeof int");
         status = STATUS_BAD_DATA;
     } else {
         ril_proto::ReqScreenState *req = new ril_proto::ReqScreenState();
@@ -293,7 +293,7 @@
     v8::Handle<v8::Value> result =
         onRilRequestFunction->Call(context->Global(), argc, argv);
     if (try_catch.HasCaught()) {
-        LOGE("callOnRilRequest error");
+        ALOGE("callOnRilRequest error");
         ReportException(&try_catch);
         status = STATUS_ERR;
     } else {
@@ -350,7 +350,7 @@
     if (itr != rilReqConversionMap.end()) {
         status = itr->second(&buffer, data, datalen, token);
     } else {
-        LOGE("RilRequestWorkerQueue:AddRequest: X unknown request %d", request);
+        ALOGE("RilRequestWorkerQueue:AddRequest: X unknown request %d", request);
         status = STATUS_UNSUPPORTED_REQUEST;
     }
 
@@ -403,7 +403,7 @@
 }
 
 int requestsInit(v8::Handle<v8::Context> context, RilRequestWorkerQueue **rwq) {
-    LOGD("requestsInit E");
+    ALOGD("requestsInit E");
 
     rilReqConversionMap[RIL_REQUEST_GET_SIM_STATUS] = ReqWithNoData; // 1
     rilReqConversionMap[RIL_REQUEST_ENTER_SIM_PIN] = ReqEnterSimPin; // 2
@@ -433,7 +433,7 @@
     *rwq = new RilRequestWorkerQueue(context);
     int status = (*rwq)->Run();
 
-    LOGD("requestsInit X: status=%d", status);
+    ALOGD("requestsInit X: status=%d", status);
     return status;
 }
 
@@ -446,24 +446,24 @@
     ReqConversionMap::iterator itr;
     int status;
 
-    LOGD("testRilRequest: request=%d", request);
+    ALOGD("testRilRequest: request=%d", request);
 
     itr = rilReqConversionMap.find(request);
     if (itr != rilReqConversionMap.end()) {
         status = itr->second(&buffer, data, sizeof(data), (void *)0x12345677);
     } else {
-        LOGE("testRequests X unknown request %d", request);
+        ALOGE("testRequests X unknown request %d", request);
         status = STATUS_UNSUPPORTED_REQUEST;
     }
     if (status == STATUS_OK) {
         callOnRilRequest(context, request, buffer, (void *)0x12345677);
     } else {
-        LOGE("testRilRequest X, serialize error");
+        ALOGE("testRilRequest X, serialize error");
     }
 }
 
 void testRequests(v8::Handle<v8::Context> context) {
-    LOGD("testRequests E: ********");
+    ALOGD("testRequests E: ********");
 
     v8::TryCatch try_catch;
 
@@ -521,5 +521,5 @@
         }
     }
 
-    LOGD("testRequests X: ********\n");
+    ALOGD("testRequests X: ********\n");
 }
diff --git a/mock-ril/src/cpp/responses.cpp b/mock-ril/src/cpp/responses.cpp
index d13fecf..89ca488 100644
--- a/mock-ril/src/cpp/responses.cpp
+++ b/mock-ril/src/cpp/responses.cpp
@@ -35,7 +35,7 @@
 //#define RESPONSES_DEBUG
 #ifdef  RESPONSES_DEBUG
 
-#define DBG(...) LOGD(__VA_ARGS__)
+#define DBG(...) ALOGD(__VA_ARGS__)
 
 #else
 
@@ -346,7 +346,7 @@
 void UnsolRspSignalStrength(int cmd, Buffer* buffer) {
 
     DBG("UnsolRspSignalStrength E");
-    LOGE("unsolicited response command: %d", cmd);
+    ALOGE("unsolicited response command: %d", cmd);
     // Retrieve response from response message
     ril_proto::RspSignalStrength *rsp = new ril_proto::RspSignalStrength();
     rsp->ParseFromArray(buffer->data(), buffer->length());
@@ -395,7 +395,7 @@
      */
     if (args.Length() < REQUEST_COMPLETE_REQUIRED_CMDS) {
         // Expecting a cmd, ERROR and token
-        LOGE("SendRilRequestComplete X %d parameters"
+        ALOGE("SendRilRequestComplete X %d parameters"
              " expecting at least %d: rilErrno, cmd, and token",
                 args.Length(), REQUEST_COMPLETE_REQUIRED_CMDS);
         return v8::Undefined();
@@ -430,7 +430,7 @@
             rilErrno = RIL_E_SUCCESS;
         } else {
             // There was a buffer but we don't support the resonse yet.
-            LOGE("SendRilRequestComplete: No conversion routine for cmd %d,"
+            ALOGE("SendRilRequestComplete: No conversion routine for cmd %d,"
                     " return RIL_E_REQUEST_NOT_SUPPORTED", cmd);
             rilErrno = RIL_E_REQUEST_NOT_SUPPORTED;
         }
@@ -462,7 +462,7 @@
      */
     if (args.Length() < UNSOL_RESPONSE_REQUIRED_CMDS) {
         // Expecting a cmd
-        LOGE("SendRilUnsolicitedResponse X %d parameters"
+        ALOGE("SendRilUnsolicitedResponse X %d parameters"
              " expecting at least a cmd",
                 args.Length());
         return v8::Undefined();
@@ -488,7 +488,7 @@
             datalen = 0;
         } else {
             // There was a buffer but we don't support the response yet.
-            LOGE("SendRilUnsolicitedResponse: No conversion routine for cmd %d,"
+            ALOGE("SendRilUnsolicitedResponse: No conversion routine for cmd %d,"
                     " return RIL_E_REQUEST_NOT_SUPPORTED", cmd);
             data = NULL;
             datalen = 0;
@@ -501,7 +501,7 @@
 }
 
 int responsesInit(v8::Handle<v8::Context> context) {
-    LOGD("responsesInit E");
+    ALOGD("responsesInit E");
     int status = STATUS_OK;
 
     rilRspConversionMap[RIL_REQUEST_GET_SIM_STATUS] = RspGetSimStatus; // 1
@@ -531,6 +531,6 @@
     unsolRilRspConversionMap[RIL_UNSOL_SIGNAL_STRENGTH] = UnsolRspSignalStrength;  // 1009
 
 
-    LOGD("responsesInit X: status=%d", status);
+    ALOGD("responsesInit X: status=%d", status);
     return STATUS_OK;
 }
diff --git a/mock-ril/src/cpp/util.cpp b/mock-ril/src/cpp/util.cpp
index 6d0bf1a..97d9f9a 100644
--- a/mock-ril/src/cpp/util.cpp
+++ b/mock-ril/src/cpp/util.cpp
@@ -44,20 +44,20 @@
         // V8 didn't provide any extra information about this error; just
         // print the exception.
         if (alternate_message == NULL || strlen(alternate_message) == 0) {
-            LOGD("LogErrorMessage no message");
+            ALOGD("LogErrorMessage no message");
         } else {
-            LOGD("LogErrorMessage no message: %s", alternate_message);
+            ALOGD("LogErrorMessage no message: %s", alternate_message);
         }
     } else {
         v8::String::Utf8Value filename(message->GetScriptResourceName());
         const char* filename_string = ToCString(filename);
         int linenum = message->GetLineNumber();
-        LOGD("file:%s line:%i", filename_string, linenum);
+        ALOGD("file:%s line:%i", filename_string, linenum);
 
         // Print line of source code.
         v8::String::Utf8Value sourceline(message->GetSourceLine());
         const char* sourceline_string = ToCString(sourceline);
-        LOGD("%s", sourceline_string);
+        ALOGD("%s", sourceline_string);
 
         // Print location information under source line
         int start = message->GetStartColumn();
@@ -72,8 +72,8 @@
         memset(error_string, ' ', start);
         memset(&error_string[start], '^', lenErr);
         error_string[size-1] = 0;
-        LOGD("%s", error_string);
-        LOGD("%s", ToCString(v8::String::Utf8Value(message->Get())));
+        ALOGD("%s", error_string);
+        ALOGD("%s", ToCString(v8::String::Utf8Value(message->Get())));
         delete [] error_string;
     }
 }
diff --git a/mock-ril/src/cpp/worker.cpp b/mock-ril/src/cpp/worker.cpp
index 0379621..63eda56 100644
--- a/mock-ril/src/cpp/worker.cpp
+++ b/mock-ril/src/cpp/worker.cpp
@@ -23,7 +23,7 @@
 //#define WORKER_DEBUG
 #ifdef  WORKER_DEBUG
 
-#define DBG(...) LOGD(__VA_ARGS__)
+#define DBG(...) ALOGD(__VA_ARGS__)
 
 #else
 
@@ -96,19 +96,19 @@
 
     ret = pthread_attr_init(&attr_);
     if (ret != 0) {
-        LOGE("RIL_Init X: pthread_attr_init failed err=%s", strerror(ret));
+        ALOGE("RIL_Init X: pthread_attr_init failed err=%s", strerror(ret));
         return STATUS_ERR;
     }
     ret = pthread_attr_setdetachstate(&attr_, PTHREAD_CREATE_DETACHED);
     if (ret != 0) {
-        LOGE("RIL_Init X: pthread_attr_setdetachstate failed err=%s",
+        ALOGE("RIL_Init X: pthread_attr_setdetachstate failed err=%s",
                 strerror(ret));
         return STATUS_ERR;
     }
     ret = pthread_create(&tid_, &attr_,
                 (void * (*)(void *))&WorkerThread::Work, this);
     if (ret != 0) {
-        LOGE("RIL_Init X: pthread_create failed err=%s", strerror(ret));
+        ALOGE("RIL_Init X: pthread_create failed err=%s", strerror(ret));
         return STATUS_ERR;
     }
 
@@ -306,7 +306,7 @@
 
 class TestWorkerQueue : public WorkerQueue {
     virtual void Process(void *p) {
-        LOGD("TestWorkerQueue::Process: EX p=%p", p);
+        ALOGD("TestWorkerQueue::Process: EX p=%p", p);
     }
 };
 
@@ -314,7 +314,7 @@
   public:
     void * Worker(void *param)
     {
-        LOGD("TesterThread::Worker E param=%p", param);
+        ALOGD("TesterThread::Worker E param=%p", param);
         WorkerQueue *wq = (WorkerQueue *)param;
 
         // Test AddDelayed
@@ -327,7 +327,7 @@
         wq->AddDelayed((void *)2000, 2000);
 
         for (int i = 1; isRunning(); i++) {
-            LOGD("TesterThread: looping %d", i);
+            ALOGD("TesterThread: looping %d", i);
             wq->Add((void *)i);
             wq->Add((void *)i);
             wq->Add((void *)i);
@@ -335,14 +335,14 @@
             sleep(1);
         }
 
-        LOGD("TesterThread::Worker X param=%p", param);
+        ALOGD("TesterThread::Worker X param=%p", param);
 
         return NULL;
     }
 };
 
 void testWorker() {
-    LOGD("testWorker E: ********");
+    ALOGD("testWorker E: ********");
 
     // Test we can create a thread and delete it
     TesterThread *tester = new TesterThread();
@@ -350,18 +350,18 @@
 
     TestWorkerQueue *wq = new TestWorkerQueue();
     if (wq->Run() == STATUS_OK) {
-        LOGD("testWorker WorkerQueue %p running", wq);
+        ALOGD("testWorker WorkerQueue %p running", wq);
 
         // Test we can run a thread, stop it then delete it
         tester = new TesterThread();
         tester->Run(wq);
-        LOGD("testWorker tester %p running", tester);
+        ALOGD("testWorker tester %p running", tester);
         sleep(10);
-        LOGD("testWorker tester %p stopping", tester);
+        ALOGD("testWorker tester %p stopping", tester);
         tester->Stop();
-        LOGD("testWorker tester %p stopped", tester);
+        ALOGD("testWorker tester %p stopped", tester);
         wq->Stop();
-        LOGD("testWorker wq %p stopped", wq);
+        ALOGD("testWorker wq %p stopped", wq);
     }
-    LOGD("testWorker X: ********\n");
+    ALOGD("testWorker X: ********\n");
 }
diff --git a/mock-ril/src/cpp/worker_v8.cpp b/mock-ril/src/cpp/worker_v8.cpp
index 61e1d3b..0e71b06 100644
--- a/mock-ril/src/cpp/worker_v8.cpp
+++ b/mock-ril/src/cpp/worker_v8.cpp
@@ -30,7 +30,7 @@
 //#define WORKER_V8_V8_DEBUG
 #ifdef  WORKER_V8_V8_DEBUG
 
-#define DBG(...) LOGD(__VA_ARGS__)
+#define DBG(...) ALOGD(__VA_ARGS__)
 
 #else
 
@@ -193,13 +193,13 @@
 }
 
 void testWorkerV8(v8::Handle<v8::Context> context) {
-    LOGD("testWorkerV8 E: ********");
+    ALOGD("testWorkerV8 E: ********");
     v8::HandleScope handle_scope;
 
     v8::TryCatch try_catch;
     try_catch.SetVerbose(true);
 
-    LOGD("testWorkerV8 runJs");
+    ALOGD("testWorkerV8 runJs");
     runJs(context, &try_catch, "local-string",
         "var w1 = new Worker(function (msg) {"
         "     print('w1: ' + msg);\n"
@@ -214,7 +214,7 @@
         "w1.add('two');\n"
         "w1.addDelayed('four', 2000);\n"
     );
-    LOGD("testWorkerV8 X: ********");
+    ALOGD("testWorkerV8 X: ********");
 }
 
 extern void WorkerV8ObjectTemplateInit(v8::Handle<v8::ObjectTemplate> target) {
diff --git a/reference-ril/atchannel.c b/reference-ril/atchannel.c
index f878b35..5e7a1c1 100644
--- a/reference-ril/atchannel.c
+++ b/reference-ril/atchannel.c
@@ -69,7 +69,7 @@
 {
     if (len < 0)
         len = strlen(buff);
-    LOGD("%.*s", len, buff);
+    ALOGD("%.*s", len, buff);
 }
 #endif
 
@@ -290,7 +290,7 @@
         break;
 
         default: /* this should never be reached */
-            LOGE("Unsupported AT command type %d\n", s_type);
+            ALOGE("Unsupported AT command type %d\n", s_type);
             handleUnsolicited(line);
         break;
     }
@@ -371,7 +371,7 @@
 
     while (p_eol == NULL) {
         if (0 == MAX_AT_RESPONSE - (p_read - s_ATBuffer)) {
-            LOGE("ERROR: Input line exceeded buffer\n");
+            ALOGE("ERROR: Input line exceeded buffer\n");
             /* ditch buffer and start over again */
             s_ATBufferCur = s_ATBuffer;
             *s_ATBufferCur = '\0';
@@ -398,9 +398,9 @@
         } else if (count <= 0) {
             /* read error encountered or EOF reached */
             if(count == 0) {
-                LOGD("atchannel: EOF reached");
+                ALOGD("atchannel: EOF reached");
             } else {
-                LOGD("atchannel: read error %s", strerror(errno));
+                ALOGD("atchannel: read error %s", strerror(errno));
             }
             return NULL;
         }
@@ -413,7 +413,7 @@
     s_ATBufferCur = p_eol + 1; /* this will always be <= p_read,    */
                               /* and there will be a \0 at *p_read */
 
-    LOGD("AT< %s\n", ret);
+    ALOGD("AT< %s\n", ret);
     return ret;
 }
 
@@ -499,7 +499,7 @@
         return AT_ERROR_CHANNEL_CLOSED;
     }
 
-    LOGD("AT> %s\n", s);
+    ALOGD("AT> %s\n", s);
 
     AT_DUMP( ">> ", s, strlen(s) );
 
@@ -538,7 +538,7 @@
         return AT_ERROR_CHANNEL_CLOSED;
     }
 
-    LOGD("AT> %s^Z\n", s);
+    ALOGD("AT> %s^Z\n", s);
 
     AT_DUMP( ">* ", s, strlen(s) );
 
diff --git a/reference-ril/reference-ril.c b/reference-ril/reference-ril.c
index ce2b0ce..aa8296c 100644
--- a/reference-ril/reference-ril.c
+++ b/reference-ril/reference-ril.c
@@ -208,7 +208,7 @@
     return 0;
 
 error:
-    LOGE("invalid CLCC line\n");
+    ALOGE("invalid CLCC line\n");
     return -1;
 }
 
@@ -517,7 +517,7 @@
     return;
 error:
     at_response_free(p_response);
-    LOGE("requestQueryNetworkSelectionMode must never return error when radio is on");
+    ALOGE("requestQueryNetworkSelectionMode must never return error when radio is on");
     RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
@@ -618,7 +618,7 @@
                     && p_calls[i].state == RIL_CALL_ACTIVE
                     && s_repollCallsCount < REPOLL_CALLS_COUNT_MAX
             ) {
-                LOGI(
+                ALOGI(
                     "Hit WORKAROUND_ERRONOUS_ANSWER case."
                     " Repoll count: %d\n", s_repollCallsCount);
                 s_repollCallsCount++;
@@ -757,7 +757,7 @@
     return;
 
 error:
-    LOGE("requestSignalStrength must never return an error when radio is on");
+    ALOGE("requestSignalStrength must never return an error when radio is on");
     RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);
     at_response_free(p_response);
 }
@@ -892,7 +892,7 @@
 
     return;
 error:
-    LOGE("requestRegistrationState must never return an error when radio is on");
+    ALOGE("requestRegistrationState must never return an error when radio is on");
     RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);
     at_response_free(p_response);
 }
@@ -963,7 +963,7 @@
 
     return;
 error:
-    LOGE("requestOperator must not return error when radio is on");
+    ALOGE("requestOperator must not return error when radio is on");
     RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);
     at_response_free(p_response);
 }
@@ -1033,12 +1033,12 @@
     int retry = 10;
     const char *pdp_type;
 
-    LOGD("requesting data connection to APN '%s'", apn);
+    ALOGD("requesting data connection to APN '%s'", apn);
 
     fd = open ("/dev/qmi", O_RDWR);
     if (fd >= 0) { /* the device doesn't exist on the emulator */
 
-        LOGD("opened the qmi device\n");
+        ALOGD("opened the qmi device\n");
         asprintf(&cmd, "up:%s", apn);
         len = strlen(cmd);
 
@@ -1048,7 +1048,7 @@
             } while (written < 0 && errno == EINTR);
 
             if (written < 0) {
-                LOGE("### ERROR writing to /dev/qmi");
+                ALOGE("### ERROR writing to /dev/qmi");
                 close(fd);
                 goto error;
             }
@@ -1065,25 +1065,25 @@
             } while (rlen < 0 && errno == EINTR);
 
             if (rlen < 0) {
-                LOGE("### ERROR reading from /dev/qmi");
+                ALOGE("### ERROR reading from /dev/qmi");
                 close(fd);
                 goto error;
             } else {
                 status[rlen] = '\0';
-                LOGD("### status: %s", status);
+                ALOGD("### status: %s", status);
             }
         } while (strncmp(status, "STATE=up", 8) && strcmp(status, "online") && --retry);
 
         close(fd);
 
         if (retry == 0) {
-            LOGE("### Failed to get data connection up\n");
+            ALOGE("### Failed to get data connection up\n");
             goto error;
         }
 
         qmistatus = system("netcfg rmnet0 dhcp");
 
-        LOGD("netcfg rmnet0 dhcp: status %d\n", qmistatus);
+        ALOGD("netcfg rmnet0 dhcp: status %d\n", qmistatus);
 
         if (qmistatus < 0) goto error;
 
@@ -1143,7 +1143,7 @@
     } else if (ackSuccess == 0)  {
         err = at_send_command("AT+CNMA=2", NULL);
     } else {
-        LOGE("unsupported arg to RIL_REQUEST_SMS_ACKNOWLEDGE\n");
+        ALOGE("unsupported arg to RIL_REQUEST_SMS_ACKNOWLEDGE\n");
         goto error;
     }
 
@@ -1273,7 +1273,7 @@
     ATResponse *p_response;
     int err;
 
-    LOGD("onRequest: %s", requestToString(request));
+    ALOGD("onRequest: %s", requestToString(request));
 
     /* Ignore all requests except RIL_REQUEST_GET_SIM_STATUS
      * when RADIO_STATE_UNAVAILABLE.
@@ -1506,12 +1506,12 @@
             int i;
             const char ** cur;
 
-            LOGD("got OEM_HOOK_STRINGS: 0x%8p %lu", data, (long)datalen);
+            ALOGD("got OEM_HOOK_STRINGS: 0x%8p %lu", data, (long)datalen);
 
 
             for (i = (datalen / sizeof (char *)), cur = (const char **)data ;
                     i > 0 ; cur++, i --) {
-                LOGD("> '%s'", *cur);
+                ALOGD("> '%s'", *cur);
             }
 
             // echo back strings
@@ -1975,7 +1975,7 @@
         err = at_tok_nextstr(&line, &response);
 
         if (err != 0) {
-            LOGE("invalid NITZ line %s\n", s);
+            ALOGE("invalid NITZ line %s\n", s);
         } else {
             RIL_onUnsolicitedResponse (
                 RIL_UNSOL_NITZ_TIME_RECEIVED,
@@ -2026,7 +2026,7 @@
 /* Called on command or reader thread */
 static void onATReaderClosed()
 {
-    LOGI("AT channel closed\n");
+    ALOGI("AT channel closed\n");
     at_close();
     s_closed = 1;
 
@@ -2036,7 +2036,7 @@
 /* Called on command thread */
 static void onATTimeout()
 {
-    LOGI("AT channel timeout; closing\n");
+    ALOGI("AT channel timeout; closing\n");
     at_close();
 
     s_closed = 1;
@@ -2122,7 +2122,7 @@
         ret = at_open(fd, onUnsolicited);
 
         if (ret < 0) {
-            LOGE ("AT error %d on at_open\n", ret);
+            ALOGE ("AT error %d on at_open\n", ret);
             return 0;
         }
 
@@ -2133,7 +2133,7 @@
         sleep(1);
 
         waitForClose();
-        LOGI("Re-opening after close");
+        ALOGI("Re-opening after close");
     }
 }
 
@@ -2158,18 +2158,18 @@
                     usage(argv[0]);
                     return NULL;
                 }
-                LOGI("Opening loopback port %d\n", s_port);
+                ALOGI("Opening loopback port %d\n", s_port);
             break;
 
             case 'd':
                 s_device_path = optarg;
-                LOGI("Opening tty device %s\n", s_device_path);
+                ALOGI("Opening tty device %s\n", s_device_path);
             break;
 
             case 's':
                 s_device_path   = optarg;
                 s_device_socket = 1;
-                LOGI("Opening socket %s\n", s_device_path);
+                ALOGI("Opening socket %s\n", s_device_path);
             break;
 
             default:
@@ -2203,18 +2203,18 @@
                 if (s_port == 0) {
                     usage(argv[0]);
                 }
-                LOGI("Opening loopback port %d\n", s_port);
+                ALOGI("Opening loopback port %d\n", s_port);
             break;
 
             case 'd':
                 s_device_path = optarg;
-                LOGI("Opening tty device %s\n", s_device_path);
+                ALOGI("Opening tty device %s\n", s_device_path);
             break;
 
             case 's':
                 s_device_path   = optarg;
                 s_device_socket = 1;
-                LOGI("Opening socket %s\n", s_device_path);
+                ALOGI("Opening socket %s\n", s_device_path);
             break;
 
             default:
diff --git a/rild/rild.c b/rild/rild.c
index 18ff671..77dec1e 100644
--- a/rild/rild.c
+++ b/rild/rild.c
@@ -148,7 +148,7 @@
         int           fd = open("/proc/cmdline",O_RDONLY);
 
         if (fd < 0) {
-            LOGD("could not open /proc/cmdline:%s", strerror(errno));
+            ALOGD("could not open /proc/cmdline:%s", strerror(errno));
             goto OpenLib;
         }
 
@@ -157,7 +157,7 @@
         while (len == -1 && errno == EINTR);
 
         if (len < 0) {
-            LOGD("could not read /proc/cmdline:%s", strerror(errno));
+            ALOGD("could not read /proc/cmdline:%s", strerror(errno));
             close(fd);
             goto OpenLib;
         }
@@ -193,13 +193,13 @@
                     done = 1;
                     break;
                 }
-                LOGD("could not connect to %s socket: %s",
+                ALOGD("could not connect to %s socket: %s",
                     QEMUD_SOCKET_NAME, strerror(errno));
                 if (--tries == 0)
                     break;
             }
             if (!done) {
-                LOGE("could not connect to %s socket (giving up): %s",
+                ALOGE("could not connect to %s socket (giving up): %s",
                     QEMUD_SOCKET_NAME, strerror(errno));
                 while(1)
                     sleep(0x00ffffff);
@@ -235,7 +235,7 @@
             hasLibArgs = 1;
             rilLibPath = REFERENCE_RIL_PATH;
 
-            LOGD("overriding with %s %s", arg_overrides[1], arg_overrides[2]);
+            ALOGD("overriding with %s %s", arg_overrides[1], arg_overrides[2]);
         }
     }
 OpenLib: