Merge remote-tracking branch 'goog/ics-aah'
diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c
index fbaca8b..571bbda 100755
--- a/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c
+++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c
@@ -67,8 +67,8 @@
 #include <utils/Log.h>
 
 /* Comment this out to enable logging */
-#undef LOGD
-#define LOGD(...) {}
+#undef ALOGD
+#define ALOGD(...) {}
 
 /*=====================================================================
      External declarations
@@ -99,17 +99,17 @@
     /* Callback not registered, or unexpected ID (shouldn't happen) */
     if (loc_api_saved_cb == NULL || argp->cb_id != LOC_API_CB_ID)
     {
-        LOGD("Warning: No callback handler.\n");
+        ALOGD("Warning: No callback handler.\n");
         ret->loc_event_cb_f_type_result = 0;
         return 1; /* simply return */
     }
 
-    LOGD("proc: %x  prog: %x  vers: %x\n",
+    ALOGD("proc: %x  prog: %x  vers: %x\n",
             (int) req->rq_proc,
             (int) req->rq_prog,
             (int) req->rq_vers);
 
-    LOGD("Callback received: %x (handle=%d ret_ptr=%d)\n",
+    ALOGD("Callback received: %x (handle=%d ret_ptr=%d)\n",
             (int) argp->loc_event,
             (int) argp->loc_handle,
             (int) ret);
@@ -133,7 +133,7 @@
     /*
      * Insert additional freeing code here, if needed
      */
-    // LOGD("***** loc_apicbprog_freeresult\n");
+    // ALOGD("***** loc_apicbprog_freeresult\n");
 
     return 1;
 }
@@ -160,9 +160,9 @@
     if (loc_api_clnt == NULL)
     {
         /* Print msg */
-        LOGD("Trying to create RPC client...\n");
+        ALOGD("Trying to create RPC client...\n");
         loc_api_clnt = clnt_create(NULL, LOC_APIPROG, LOC_APIVERS, NULL);
-        LOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+        ALOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
 
         if (loc_api_clnt == NULL)
         {
@@ -174,7 +174,7 @@
         int rc = loc_apicb_app_init();
         if (rc >= 0)
         {
-            LOGD("Loc API callback initialized.\n");
+            ALOGD("Loc API callback initialized.\n");
         } else {
             fprintf(stderr, "Loc API callback initialization failed.\n");
             return 0;
diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c
index 8c17122..cb9350e 100755
--- a/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c
+++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c
@@ -67,8 +67,8 @@
 #include <utils/Log.h>
 
 /* Comment this out to enable logging */
-#undef LOGD
-#define LOGD(...) {}
+#undef ALOGD
+#define ALOGD(...) {}
 
 /*=====================================================================
      External declarations
@@ -99,17 +99,17 @@
     /* Callback not registered, or unexpected ID (shouldn't happen) */
     if (loc_api_saved_cb == NULL || argp->cb_id != LOC_API_CB_ID)
     {
-        LOGD("Warning: No callback handler.\n");
+        ALOGD("Warning: No callback handler.\n");
         ret->loc_event_cb_f_type_result = 0;
         return 1; /* simply return */
     }
 
-    LOGD("proc: %x  prog: %x  vers: %x\n",
+    ALOGD("proc: %x  prog: %x  vers: %x\n",
             (int) req->rq_proc,
             (int) req->rq_prog,
             (int) req->rq_vers);
 
-    LOGD("Callback received: %x (handle=%d ret_ptr=%d)\n",
+    ALOGD("Callback received: %x (handle=%d ret_ptr=%d)\n",
             (int) argp->loc_event,
             (int) argp->loc_handle,
             (int) ret);
@@ -133,7 +133,7 @@
     /*
      * Insert additional freeing code here, if needed
      */
-    // LOGD("***** loc_apicbprog_freeresult\n");
+    // ALOGD("***** loc_apicbprog_freeresult\n");
 
     return 1;
 }
@@ -160,9 +160,9 @@
     if (loc_api_clnt == NULL)
     {
         /* Print msg */
-        LOGD("Trying to create RPC client...\n");
+        ALOGD("Trying to create RPC client...\n");
         loc_api_clnt = clnt_create(NULL, LOC_APIPROG, /*LOC_APIVERS*/ 0x00010000, NULL);
-        LOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+        ALOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
 
         if (loc_api_clnt == NULL)
         {
@@ -174,7 +174,7 @@
         int rc = loc_apicb_app_init();
         if (rc >= 0)
         {
-            LOGD("Loc API callback initialized.\n");
+            ALOGD("Loc API callback initialized.\n");
         } else {
             fprintf(stderr, "Loc API callback initialization failed.\n");
             return 0;
diff --git a/loc_api/libloc_api-rpc/inc/debug.h b/loc_api/libloc_api-rpc/inc/debug.h
index a71b23a..bef0ad3 100755
--- a/loc_api/libloc_api-rpc/inc/debug.h
+++ b/loc_api/libloc_api-rpc/inc/debug.h
@@ -25,7 +25,7 @@
 #define PRINT(x...) do {                                    \
         fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
         fprintf(stdout, ##x);                               \
-        LOGD(x);                               \
+        ALOGD(x);                               \
     } while(0)
 
 #ifdef DEBUG
@@ -43,14 +43,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/loc_api/libloc_api/gps.c b/loc_api/libloc_api/gps.c
index ec6fbd0..a28a608 100644
--- a/loc_api/libloc_api/gps.c
+++ b/loc_api/libloc_api/gps.c
@@ -55,7 +55,7 @@
     .open = open_gps
 };
 
-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/loc_api/libloc_api/loc_eng.cpp b/loc_api/libloc_api/loc_eng.cpp
index 8a3d412..48c94f3 100755
--- a/loc_api/libloc_api/loc_eng.cpp
+++ b/loc_api/libloc_api/loc_eng.cpp
@@ -57,8 +57,8 @@
 #include <utils/Log.h>
 
 // comment this out to enable logging
-// #undef LOGD
-// #define LOGD(...) {}
+// #undef ALOGD
+// #define ALOGD(...) {}
 
 #define DEBUG_MOCK_NI 0
 
@@ -150,7 +150,7 @@
     property_get("gps.disable", propBuf, "");
     if (propBuf[0] == '1')
     {
-        LOGD("gps_get_interface returning NULL because gps.disable=1\n");
+        ALOGD("gps_get_interface returning NULL because gps.disable=1\n");
         return NULL;
     }
 
@@ -240,7 +240,7 @@
     loc_eng_data.deferred_action_thread = callbacks->create_thread_cb("loc_api",
                                             loc_eng_process_deferred_action, NULL);
 
-    LOGD ("loc_eng_init called, client id = %d\n", (int32) loc_eng_data.client_handle);
+    ALOGD ("loc_eng_init called, client id = %d\n", (int32) loc_eng_data.client_handle);
     return 0;
 }
 
@@ -314,20 +314,20 @@
 static int loc_eng_start()
 {
     int ret_val;
-    LOGD ("loc_eng_start\n");
+    ALOGD ("loc_eng_start\n");
 
     if (loc_eng_data.position_mode != GPS_POSITION_MODE_STANDALONE &&
             loc_eng_data.agps_server_host[0] != 0 &&
             loc_eng_data.agps_server_port != 0) {
         int result = set_agps_server();
-        LOGD ("set_agps_server returned = %d\n", result);
+        ALOGD ("set_agps_server returned = %d\n", result);
     }
 
     ret_val = loc_start_fix (loc_eng_data.client_handle);
 
     if (ret_val != RPC_LOC_API_SUCCESS)
     {
-        LOGD ("loc_eng_start returned error = %d\n", ret_val);
+        ALOGD ("loc_eng_start returned error = %d\n", ret_val);
     }
 
     return 0;
@@ -354,7 +354,7 @@
 {
     int ret_val;
 
-    LOGD ("loc_eng_stop\n");
+    ALOGD ("loc_eng_stop\n");
 
     pthread_mutex_lock(&(loc_eng_data.deferred_stop_mutex));
     // work around problem with loc_eng_stop when AGPS requests are pending
@@ -362,7 +362,7 @@
     if (loc_eng_data.agps_request_pending)
     {
         loc_eng_data.stop_request_pending = true;
-        LOGD ("deferring stop until AGPS data call is finished\n");
+        ALOGD ("deferring stop until AGPS data call is finished\n");
         pthread_mutex_unlock(&(loc_eng_data.deferred_stop_mutex));
         return 0;
     }
@@ -371,7 +371,7 @@
     ret_val = loc_stop_fix (loc_eng_data.client_handle);
     if (ret_val != RPC_LOC_API_SUCCESS)
     {
-        LOGD ("loc_eng_stop returned error = %d\n", ret_val);
+        ALOGD ("loc_eng_stop returned error = %d\n", ret_val);
     }
 
     return 0;
@@ -382,7 +382,7 @@
     rpc_loc_ioctl_data_u_type    ioctl_data;
     boolean                      ret_val;
 
-    LOGD ("loc_eng_set_gps_lock mode, client = %d, lock_type = %d\n",
+    ALOGD ("loc_eng_set_gps_lock mode, client = %d, lock_type = %d\n",
             (int32) loc_eng_data.client_handle, lock_type);
 
     ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = lock_type;
@@ -396,7 +396,7 @@
 
     if (ret_val != TRUE)
     {
-        LOGD ("loc_eng_set_gps_lock mode failed\n");
+        ALOGD ("loc_eng_set_gps_lock mode failed\n");
     }
 
     return 0;
@@ -425,7 +425,7 @@
     rpc_loc_fix_criteria_s_type *fix_criteria_ptr;
     boolean                      ret_val;
 
-    LOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n",
+    ALOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n",
             (int32) loc_eng_data.client_handle, min_interval, mode);
 
     loc_eng_data.position_mode = mode;
@@ -478,7 +478,7 @@
 
     if (ret_val != TRUE)
     {
-        LOGD ("loc_eng_set_position mode failed\n");
+        ALOGD ("loc_eng_set_position mode failed\n");
     }
 
     return 0;
@@ -506,7 +506,7 @@
     rpc_loc_assist_data_time_s_type *time_info_ptr;
     boolean                          ret_val;
 
-    LOGD ("loc_eng_inject_time, uncertainty = %d\n", uncertainty);
+    ALOGD ("loc_eng_inject_time, uncertainty = %d\n", uncertainty);
 
     ioctl_data.disc = RPC_LOC_IOCTL_INJECT_UTC_TIME;
 
@@ -523,7 +523,7 @@
 
     if (ret_val != TRUE)
     {
-        LOGD ("loc_eng_inject_time failed\n");
+        ALOGD ("loc_eng_inject_time failed\n");
     }
 
     return 0;
@@ -708,7 +708,7 @@
     const rpc_loc_event_payload_u_type*  loc_event_payload
     )
 {
-    LOGV ("loc_event_cb, client = %d, loc_event = 0x%x", (int32) client_handle, (uint32) loc_event);
+    ALOGV ("loc_event_cb, client = %d, loc_event = 0x%x", (int32) client_handle, (uint32) loc_event);
     if (client_handle == loc_eng_data.client_handle)
     {
         pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
@@ -723,7 +723,7 @@
     }
     else
     {
-        LOGD ("loc client mismatch: received = %d, expected = %d \n", (int32) client_handle, (int32) loc_eng_data.client_handle);
+        ALOGD ("loc client mismatch: received = %d, expected = %d \n", (int32) client_handle, (int32) loc_eng_data.client_handle);
     }
 
     return RPC_LOC_API_SUCCESS;
@@ -749,7 +749,7 @@
 {
     GpsLocation location;
 
-    LOGV ("loc_eng_report_position: location report, valid mask = 0x%x, sess status = %d\n",
+    ALOGV ("loc_eng_report_position: location report, valid mask = 0x%x, sess status = %d\n",
          (uint32) location_report_ptr->valid_mask, location_report_ptr->session_status);
 
     memset (&location, 0, sizeof(location));
@@ -800,18 +800,18 @@
 
             if (loc_eng_data.location_cb != NULL)
             {
-                LOGV ("loc_eng_report_position: fire callback\n");
+                ALOGV ("loc_eng_report_position: fire callback\n");
                 loc_eng_data.location_cb (&location);
             }
         }
         else
         {
-            LOGV ("loc_eng_report_position: ignore position report when session status = %d\n", location_report_ptr->session_status);
+            ALOGV ("loc_eng_report_position: ignore position report when session status = %d\n", location_report_ptr->session_status);
         }
     }
     else
     {
-        LOGV ("loc_eng_report_position: ignore position report when session status is not set\n");
+        ALOGV ("loc_eng_report_position: ignore position report when session status is not set\n");
     }
 }
 
@@ -837,7 +837,7 @@
     int             num_svs_max, i;
 	const rpc_loc_sv_info_s_type *sv_info_ptr;
 
-    LOGV ("loc_eng_report_sv: valid_mask = 0x%x, num of sv = %d\n",
+    ALOGV ("loc_eng_report_sv: valid_mask = 0x%x, num of sv = %d\n",
             (uint32) gnss_report_ptr->valid_mask,
             gnss_report_ptr->sv_count);
 
@@ -923,7 +923,7 @@
         }
     }
 
-    LOGV ("num_svs = %d, eph mask = %d, alm mask = %d\n", SvStatus.num_svs, SvStatus.ephemeris_mask, SvStatus.almanac_mask );
+    ALOGV ("num_svs = %d, eph mask = %d, alm mask = %d\n", SvStatus.num_svs, SvStatus.ephemeris_mask, SvStatus.almanac_mask );
     if ((SvStatus.num_svs != 0) && (loc_eng_data.sv_status_cb != NULL))
     {
         loc_eng_data.sv_status_cb(&SvStatus);
@@ -950,7 +950,7 @@
 {
     GpsStatus status;
 
-    LOGV ("loc_eng_report_status: event = %d\n", status_report_ptr->event);
+    ALOGV ("loc_eng_report_status: event = %d\n", status_report_ptr->event);
 
     memset (&status, 0, sizeof(status));
     status.size = sizeof(status);
@@ -1024,7 +1024,7 @@
 ===========================================================================*/
 static void loc_eng_process_conn_request (const rpc_loc_server_request_s_type *server_request_ptr)
 {
-    LOGD ("loc_event_cb: get loc event location server request, event = %d\n", server_request_ptr->event);
+    ALOGD ("loc_event_cb: get loc event location server request, event = %d\n", server_request_ptr->event);
 
     // Signal DeferredActionThread to send the APN name
     pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
@@ -1068,14 +1068,14 @@
 ===========================================================================*/
 static void loc_eng_agps_init(AGpsCallbacks* callbacks)
 {
-    LOGV("loc_eng_agps_init\n");
+    ALOGV("loc_eng_agps_init\n");
     loc_eng_data.agps_status_cb = callbacks->status_cb;
 }
 
 static int loc_eng_agps_data_conn_open(const char* apn)
 {
     int apn_len;
-    LOGD("loc_eng_agps_data_conn_open: %s\n", apn);
+    ALOGD("loc_eng_agps_data_conn_open: %s\n", apn);
 
     pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
 
@@ -1085,7 +1085,7 @@
 
         if (apn_len >= sizeof(loc_eng_data.apn_name))
         {
-            LOGD ("loc_eng_set_apn: error, apn name exceeds maximum lenght of 100 chars\n");
+            ALOGD ("loc_eng_set_apn: error, apn name exceeds maximum lenght of 100 chars\n");
             apn_len = sizeof(loc_eng_data.apn_name) - 1;
         }
 
@@ -1103,7 +1103,7 @@
 
 static int loc_eng_agps_data_conn_closed()
 {
-    LOGD("loc_eng_agps_data_conn_closed\n");
+    ALOGD("loc_eng_agps_data_conn_closed\n");
     pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
     /* hold a wake lock while events are pending for deferred_action_thread */
     loc_eng_data.acquire_wakelock_cb();
@@ -1115,7 +1115,7 @@
 
 static int loc_eng_agps_data_conn_failed()
 {
-    LOGD("loc_eng_agps_data_conn_failed\n");
+    ALOGD("loc_eng_agps_data_conn_failed\n");
 
     pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
     /* hold a wake lock while events are pending for deferred_action_thread */
@@ -1163,7 +1163,7 @@
 
     server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val = url;
     server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_len = strlen(url);
-    LOGD ("set_agps_server, addr = %s\n", server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val);
+    ALOGD ("set_agps_server, addr = %s\n", server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val);
 #else
     char* buf = server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr;
     int buf_len = sizeof(server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr);
@@ -1174,7 +1174,7 @@
             (loc_eng_data.agps_server_port & (0x0000ffff)));
 
     server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.length = buf_len;
-    LOGD ("set_agps_server, addr = %s\n", buf);
+    ALOGD ("set_agps_server, addr = %s\n", buf);
 #endif
 
     ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
@@ -1185,19 +1185,19 @@
 
     if (ret_val != TRUE)
     {
-        LOGD ("set_agps_server failed\n");
+        ALOGD ("set_agps_server failed\n");
         return -1;
     }
     else
     {
-        LOGV ("set_agps_server successful\n");
+        ALOGV ("set_agps_server successful\n");
         return 0;
     }
 }
 
 static int loc_eng_agps_set_server(AGpsType type, const char* hostname, int port)
 {
-    LOGD ("loc_eng_set_default_agps_server, type = %d, hostname = %s, port = %d\n", type, hostname, port);
+    ALOGD ("loc_eng_set_default_agps_server, type = %d, hostname = %s, port = %d\n", type, hostname, port);
 
     if (type != AGPS_TYPE_SUPL)
         return -1;
@@ -1246,7 +1246,7 @@
                              LOC_IOCTL_DEFAULT_TIMEOUT,
                              NULL);
 
-    LOGD("loc_eng_ioctl for aiding data deletion returned %d, 1 for success\n", ret_val);
+    ALOGD("loc_eng_ioctl for aiding data deletion returned %d, 1 for success\n", ret_val);
 }
 
 /*===========================================================================
@@ -1274,7 +1274,7 @@
     boolean                             ret_val;
     int                                 agps_status = -1;
 
-    LOGV("loc_eng_process_atl_deferred_action, agps_status = %d\n", loc_eng_data.agps_status);
+    ALOGV("loc_eng_process_atl_deferred_action, agps_status = %d\n", loc_eng_data.agps_status);
 
     memset (&ioctl_data, 0, sizeof (rpc_loc_ioctl_data_u_type));
  
@@ -1304,7 +1304,7 @@
 #endif
             // Delay this so that PDSM ATL module will behave properly
             sleep (1);
-            LOGD("loc_eng_ioctl for ATL with apn_name = %s\n", conn_open_status_ptr->apn_name);
+            ALOGD("loc_eng_ioctl for ATL with apn_name = %s\n", conn_open_status_ptr->apn_name);
         }
         else // data_connection_failed
         {
@@ -1320,7 +1320,7 @@
                              LOC_IOCTL_DEFAULT_TIMEOUT,
                              NULL);
 
-    LOGD("loc_eng_ioctl for ATL returned %d (1 for success)\n", ret_val);
+    ALOGD("loc_eng_ioctl for ATL returned %d (1 for success)\n", ret_val);
 }
 
 /*===========================================================================
@@ -1368,7 +1368,7 @@
         if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
                 RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ)
         {
-            LOGD ("loc_event_cb: xtra download requst");
+            ALOGD ("loc_event_cb: xtra download requst");
 
             // Call Registered callback
             if (loc_eng_data.xtra_module_data.download_request_cb != NULL)
@@ -1429,13 +1429,13 @@
     status.size = sizeof(status);
     status.type = AGPS_TYPE_SUPL;
 
-    LOGD("loc_eng_process_deferred_action started\n");
+    ALOGD("loc_eng_process_deferred_action started\n");
 
     // make sure we do not run in background scheduling group
     set_sched_policy(gettid(), SP_FOREGROUND);
 
     // disable the GPS lock
-    LOGD("Setting GPS privacy lock to RPC_LOC_LOCK_NONE\n");
+    ALOGD("Setting GPS privacy lock to RPC_LOC_LOCK_NONE\n");
     loc_eng_set_gps_lock(RPC_LOC_LOCK_NONE);
 
     while (1)
@@ -1506,10 +1506,10 @@
             loc_eng_data.agps_request_pending = false;
             if (loc_eng_data.stop_request_pending)
             {
-                LOGD ("handling deferred stop\n");
+                ALOGD ("handling deferred stop\n");
                 if (loc_stop_fix(loc_eng_data.client_handle) != RPC_LOC_API_SUCCESS)
                 {
-                    LOGD ("loc_stop_fix failed!\n");
+                    ALOGD ("loc_stop_fix failed!\n");
                 }
             }
             pthread_mutex_unlock(&(loc_eng_data.deferred_stop_mutex));
@@ -1521,10 +1521,10 @@
     }
 
     // reenable the GPS lock
-    LOGD("Setting GPS privacy lock to RPC_LOC_LOCK_ALL\n");
+    ALOGD("Setting GPS privacy lock to RPC_LOC_LOCK_ALL\n");
     loc_eng_set_gps_lock(RPC_LOC_LOCK_ALL);
 
-    LOGD("loc_eng_process_deferred_action thread exiting\n");
+    ALOGD("loc_eng_process_deferred_action thread exiting\n");
     loc_eng_data.release_wakelock_cb();
 
     loc_eng_data.deferred_action_thread = 0;
diff --git a/loc_api/libloc_api/loc_eng_ioctl.cpp b/loc_api/libloc_api/loc_eng_ioctl.cpp
index 87ca5b0..f59cc4e 100755
--- a/loc_api/libloc_api/loc_eng_ioctl.cpp
+++ b/loc_api/libloc_api/loc_eng_ioctl.cpp
@@ -52,8 +52,8 @@
 #include <utils/Log.h>
 
 // comment this out to enable logging
-// #undef LOGD
-// #define LOGD(...) {}
+// #undef ALOGD
+// #define ALOGD(...) {}
 
 // Function declarations
 static boolean loc_eng_ioctl_setup_cb(
@@ -97,7 +97,7 @@
     int                        rpc_ret_val;
     loc_eng_ioctl_data_s_type *ioctl_cb_data_ptr;
 
-    LOGV ("loc_eng_ioctl: client = %d, ioctl_type = %d, cb_data =0x%x\n", (int32) handle, ioctl_type, (uint32) cb_data_ptr);
+    ALOGV ("loc_eng_ioctl: client = %d, ioctl_type = %d, cb_data =0x%x\n", (int32) handle, ioctl_type, (uint32) cb_data_ptr);
 
     ioctl_cb_data_ptr = &(loc_eng_data.ioctl_data);
     // Select the callback we are waiting for
@@ -109,7 +109,7 @@
                                     ioctl_type,
                                     ioctl_data_ptr);
 
-        LOGV ("loc_eng_ioctl: loc_ioctl returned %d \n", rpc_ret_val);
+        ALOGV ("loc_eng_ioctl: loc_ioctl returned %d \n", rpc_ret_val);
 
         if (rpc_ret_val == RPC_LOC_API_SUCCESS)
         {
@@ -164,7 +164,7 @@
     pthread_mutex_lock(&ioctl_cb_data_ptr->cb_data_mutex);
     if (ioctl_cb_data_ptr->cb_is_selected == TRUE)
     {
-        LOGD ("loc_eng_ioctl_setup_cb: ERROR, another ioctl in progress \n");
+        ALOGD ("loc_eng_ioctl_setup_cb: ERROR, another ioctl in progress \n");
         ret_val = FALSE;
     }
     else
@@ -222,7 +222,7 @@
     do {
         if (ioctl_cb_data_ptr->cb_is_selected == FALSE)
         {
-            LOGD ("loc_eng_ioctl_wait_cb: ERROR called when cb_is_waiting is set to FALSE \n");
+            ALOGD ("loc_eng_ioctl_wait_cb: ERROR called when cb_is_waiting is set to FALSE \n");
             ret_val = FALSE;
             break;
         }
@@ -240,7 +240,7 @@
         // Special case where callback is issued before loc_ioctl ever returns
         if (ioctl_cb_data_ptr->cb_has_arrived == TRUE)
         {
-            LOGD ("loc_eng_ioctl_wait_cb: cb has arrived without waiting \n");
+            ALOGD ("loc_eng_ioctl_wait_cb: cb has arrived without waiting \n");
             ret_val = TRUE;
             break;
         }
@@ -260,7 +260,7 @@
             ret_val = FALSE;
         }
 
-        LOGV ("loc_eng_ioctl_wait_cb: pthread_cond_timedwait returned %d\n", rc);
+        ALOGV ("loc_eng_ioctl_wait_cb: pthread_cond_timedwait returned %d\n", rc);
 
     } while (0);
 
@@ -286,7 +286,7 @@
 
     pthread_mutex_unlock(&ioctl_cb_data_ptr->cb_data_mutex);
 
-    LOGV ("loc_eng_ioctl_wait_cb: returned %d\n", ret_val);
+    ALOGV ("loc_eng_ioctl_wait_cb: returned %d\n", ret_val);
     return ret_val;
 }
 
@@ -321,13 +321,13 @@
     pthread_mutex_lock(&ioctl_cb_data_ptr->cb_data_mutex);
     if (client_handle != ioctl_cb_data_ptr->client_handle)
     {
-        LOGD ("loc_eng_ioctl_process_cb: client handle mismatch, received = %d, expected = %d \n",
+        ALOGD ("loc_eng_ioctl_process_cb: client handle mismatch, received = %d, expected = %d \n",
                 (int32) client_handle, (int32) ioctl_cb_data_ptr->client_handle);
         ret_val = FALSE;
     }
     else if (cb_data_ptr->type != ioctl_cb_data_ptr->ioctl_type)
     {
-        LOGD ("loc_eng_ioctl_process_cb: ioctl type mismatch, received = %d, expected = %d \n",
+        ALOGD ("loc_eng_ioctl_process_cb: ioctl type mismatch, received = %d, expected = %d \n",
                  cb_data_ptr->type, ioctl_cb_data_ptr->ioctl_type);
         ret_val = FALSE;
     }
@@ -339,7 +339,7 @@
 
         ioctl_cb_data_ptr->cb_has_arrived = TRUE;
 
-        LOGV ("loc_eng_ioctl_process_cb: callback arrived for client = %d, ioctl = %d, status = %d\n",
+        ALOGV ("loc_eng_ioctl_process_cb: callback arrived for client = %d, ioctl = %d, status = %d\n",
                 (int32) ioctl_cb_data_ptr->client_handle, ioctl_cb_data_ptr->ioctl_type,
                 (int32) ioctl_cb_data_ptr->cb_payload.status);
 
diff --git a/loc_api/libloc_api/loc_eng_ni.cpp b/loc_api/libloc_api/loc_eng_ni.cpp
index 958103a..c763683 100755
--- a/loc_api/libloc_api/loc_eng_ni.cpp
+++ b/loc_api/libloc_api/loc_eng_ni.cpp
@@ -46,8 +46,8 @@
 #include <utils/Log.h>
 
 // comment this out to enable logging
-// #undef LOGD
-// #define LOGD(...) {}
+// #undef ALOGD
+// #define ALOGD(...) {}
 
 /*=============================================================================
  *
@@ -119,7 +119,7 @@
                     const rpc_loc_ni_event_s_type *request_pass_back
 )
 {
-    LOGD("Sending NI response: %s\n", respond_from_enum(resp));
+    ALOGD("Sending NI response: %s\n", respond_from_enum(resp));
 
     rpc_loc_ioctl_data_u_type data;
     rpc_loc_ioctl_callback_s_type callback_payload;
@@ -267,12 +267,12 @@
 
         loc_ni_respond(response, ni_req); */
 #endif
-        LOGW("loc_ni_request_handler, notification in progress, new NI request ignored, type: %d",
+        ALOGW("loc_ni_request_handler, notification in progress, new NI request ignored, type: %d",
                 ni_req->event);
     }
     else {
         /* Print notification */
-        LOGD("NI Notification: %s, event: %d", msg, ni_req->event);
+        ALOGD("NI Notification: %s, event: %d", msg, ni_req->event);
 
         pthread_mutex_lock(&loc_eng_ni_data.loc_ni_lock);
 
@@ -366,9 +366,9 @@
 #endif
                             supl_req->client_name.string_len                                   /* length */
                     );
-                    LOGD("SUPL NI: client_name: %s len=%d", notif.text, supl_req->client_name.string_len);
+                    ALOGD("SUPL NI: client_name: %s len=%d", notif.text, supl_req->client_name.string_len);
                 } else {
-                    LOGD("SUPL NI: client_name not present.");
+                    ALOGD("SUPL NI: client_name not present.");
                 }
 
                 // Requestor ID
@@ -382,9 +382,9 @@
 #endif
                             supl_req->requestor_id.string_len                                    /* length */
                     );
-                    LOGD("SUPL NI: requestor_id: %s len=%d", notif.requestor_id, supl_req->requestor_id.string_len);
+                    ALOGD("SUPL NI: requestor_id: %s len=%d", notif.requestor_id, supl_req->requestor_id.string_len);
                 } else {
-                    LOGD("SUPL NI: requestor_id not present.");
+                    ALOGD("SUPL NI: requestor_id not present.");
                 }
 
                 // Encoding type
@@ -402,20 +402,20 @@
                 break;
 
             default:
-                LOGE("loc_ni_request_handler, unknown request event: %d", ni_req->event);
+                ALOGE("loc_ni_request_handler, unknown request event: %d", ni_req->event);
                 return;
         }
 
         /* Log requestor ID and text for debugging */
-        LOGI("Notification: notif_type: %d, timeout: %d, default_resp: %d", notif.ni_type, notif.timeout, notif.default_response);
-        LOGI("              requestor_id: %s (encoding: %d)", notif.requestor_id, notif.requestor_id_encoding);
-        LOGI("              text: %s text (encoding: %d)", notif.text, notif.text_encoding);
+        ALOGI("Notification: notif_type: %d, timeout: %d, default_resp: %d", notif.ni_type, notif.timeout, notif.default_response);
+        ALOGI("              requestor_id: %s (encoding: %d)", notif.requestor_id, notif.requestor_id_encoding);
+        ALOGI("              text: %s text (encoding: %d)", notif.text, notif.text_encoding);
 
         /* For robustness, always sets a timeout to clear up the notification status, even though
         * the OEM layer in java does not do so.
         **/
         loc_eng_ni_data.response_time_left = 5 + (notif.timeout != 0 ? notif.timeout : LOC_NI_NO_RESPONSE_TIME);
-        LOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", loc_eng_ni_data.response_time_left);
+        ALOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", loc_eng_ni_data.response_time_left);
 
         pthread_mutex_unlock(&loc_eng_ni_data.loc_ni_lock);
 
@@ -440,7 +440,7 @@
 ===========================================================================*/
 int loc_ni_process_user_response(GpsUserResponseType userResponse)
 {
-    LOGD("NI response from UI: %d", userResponse);
+    ALOGD("NI response from UI: %d", userResponse);
 
     rpc_loc_ni_user_resp_e_type resp;
     switch (userResponse)
@@ -493,22 +493,22 @@
         switch (ni_req->event)
         {
             case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
-                LOGI("VX Notification");
+                ALOGI("VX Notification");
                 loc_ni_request_handler("VX Notify", ni_req);
                 break;
 
             case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
-                LOGI("UMTS CP Notification\n");
+                ALOGI("UMTS CP Notification\n");
                 loc_ni_request_handler("UMTS CP Notify", ni_req);
                 break;
 
             case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
-                LOGI("SUPL Notification\n");
+                ALOGI("SUPL Notification\n");
                 loc_ni_request_handler("SUPL Notify", ni_req);
                 break;
 
             default:
-                LOGE("Unknown NI event: %x\n", (int) ni_req->event);
+                ALOGE("Unknown NI event: %x\n", (int) ni_req->event);
                 break;
         }
     }
@@ -522,7 +522,7 @@
 ===========================================================================*/
 static void loc_ni_thread_proc(void *unused)
 {
-    LOGI("Starting Loc NI thread...\n");
+    ALOGI("Starting Loc NI thread...\n");
 
     while (1)
     {
@@ -563,7 +563,7 @@
 ===========================================================================*/
 void loc_eng_ni_init(GpsNiCallbacks *callbacks)
 {
-    LOGD("loc_eng_ni_init: entered.");
+    ALOGD("loc_eng_ni_init: entered.");
 
     if (!loc_eng_ni_data_init)
     {
@@ -600,10 +600,10 @@
 {
     if (notif_id == loc_eng_ni_data.current_notif_id && loc_eng_ni_data.notif_in_progress)
     {
-        LOGI("loc_eng_ni_respond: send user response %d for notif %d", user_response, notif_id);
+        ALOGI("loc_eng_ni_respond: send user response %d for notif %d", user_response, notif_id);
         loc_ni_process_user_response(user_response);
     } else {
-        LOGE("loc_eng_ni_respond: notif_id %d mismatch or notification not in progress, response: %d",
+        ALOGE("loc_eng_ni_respond: notif_id %d mismatch or notification not in progress, response: %d",
             notif_id, user_response);
     }
 }
diff --git a/loc_api/libloc_api/loc_eng_xtra.cpp b/loc_api/libloc_api/loc_eng_xtra.cpp
index 9dda092..c713c27 100755
--- a/loc_api/libloc_api/loc_eng_xtra.cpp
+++ b/loc_api/libloc_api/loc_eng_xtra.cpp
@@ -49,8 +49,8 @@
 #include <utils/Log.h>
 
 // comment this out to enable logging
-// #undef LOGD
-// #define LOGD(...) {}
+// #undef ALOGD
+// #define ALOGD(...) {}
 
 #define LOC_XTRA_INJECT_DEFAULT_TIMEOUT (3100)
 #define XTRA_BLOCK_SIZE                 (400)
@@ -120,7 +120,7 @@
     rpc_loc_ioctl_data_u_type            ioctl_data;
     rpc_loc_predicted_orbits_data_s_type *predicted_orbits_data_ptr;
 
-    LOGV ("qct_loc_eng_inject_xtra_data, xtra size = %d, data ptr = 0x%x\n", length, (int) data);
+    ALOGV ("qct_loc_eng_inject_xtra_data, xtra size = %d, data ptr = 0x%x\n", length, (int) data);
 
     ioctl_data.disc = RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA;
 
@@ -147,8 +147,8 @@
         predicted_orbits_data_ptr->data_ptr.data_ptr_len = predicted_orbits_data_ptr->part_len;
         predicted_orbits_data_ptr->data_ptr.data_ptr_val = data + len_injected;
 
-        LOGV ("qct_loc_eng_inject_xtra_data, inject part = %d, len = %d, len = %d\n", predicted_orbits_data_ptr->part, predicted_orbits_data_ptr->part_len, predicted_orbits_data_ptr->data_ptr.data_ptr_len);
-        LOGV ("qct_loc_eng_inject_xtra_data, total part = %d, len = %d \n", predicted_orbits_data_ptr->part, predicted_orbits_data_ptr->part_len);
+        ALOGV ("qct_loc_eng_inject_xtra_data, inject part = %d, len = %d, len = %d\n", predicted_orbits_data_ptr->part, predicted_orbits_data_ptr->part_len, predicted_orbits_data_ptr->data_ptr.data_ptr_len);
+        ALOGV ("qct_loc_eng_inject_xtra_data, total part = %d, len = %d \n", predicted_orbits_data_ptr->part, predicted_orbits_data_ptr->part_len);
 
         if (part < total_parts)
         {
@@ -159,7 +159,7 @@
 
             if (rpc_ret_val != RPC_LOC_API_SUCCESS)
             {
-                LOGE ("loc_ioctl for xtra returned %d \n", rpc_ret_val);
+                ALOGE ("loc_ioctl for xtra returned %d \n", rpc_ret_val);
                 ret_val = EINVAL; // return error
                 break;
             }
@@ -176,7 +176,7 @@
         }
 
         len_injected += predicted_orbits_data_ptr->part_len;
-        LOGV ("loc_ioctl for xtra len injected %d \n", len_injected);
+        ALOGV ("loc_ioctl for xtra len injected %d \n", len_injected);
     }
 
     return ret_val;