From 91cfd13d2926018bd1da9166d99a47fd88255ef6 Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Fri, 22 Jan 2010 08:47:48 -0500 Subject: [PATCH] loc_api: Send GPS_STATUS_ENGINE_ON and GPS_STATUS_SESSION_END so GpsLocationProvider will release its wake lock when the GPS shuts down. Signed-off-by: Mike Lockwood --- loc_api/libloc_api/loc_eng.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/loc_api/libloc_api/loc_eng.cpp b/loc_api/libloc_api/loc_eng.cpp index acc4dfd6..8a1b05bb 100755 --- a/loc_api/libloc_api/loc_eng.cpp +++ b/loc_api/libloc_api/loc_eng.cpp @@ -523,7 +523,7 @@ static void loc_eng_delete_aiding_data (GpsAidingData f) loc_eng_data.aiding_data_for_deletion |= f; } - if ((loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON) && + if ((loc_eng_data.engine_status != GPS_STATUS_SESSION_BEGIN) && (loc_eng_data.aiding_data_for_deletion != 0)) { pthread_cond_signal(&(loc_eng_data.deferred_action_cond)); @@ -966,25 +966,25 @@ static void loc_eng_report_status (const rpc_loc_status_event_s_type *status_rep { if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_ON) { + status.status = GPS_STATUS_ENGINE_ON; + loc_eng_data.status_cb (&status); status.status = GPS_STATUS_SESSION_BEGIN; + loc_eng_data.status_cb (&status); } else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_OFF) { status.status = GPS_STATUS_SESSION_END; + loc_eng_data.status_cb (&status); + status.status = GPS_STATUS_ENGINE_OFF; + loc_eng_data.status_cb (&status); } } - if ((status.status != GPS_STATUS_NONE) && (loc_eng_data.status_cb != NULL)) - { - LOGV ("loc_eng_report_status: issue callback with status %d\n", status.status); - loc_eng_data.status_cb (&status); - } - pthread_mutex_lock (&loc_eng_data.deferred_action_mutex); loc_eng_data.engine_status = status.status; // Wake up the thread for aiding data deletion. - if ((loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON) && + if ((loc_eng_data.engine_status != GPS_STATUS_SESSION_BEGIN) && (loc_eng_data.aiding_data_for_deletion != 0)) { pthread_cond_signal(&(loc_eng_data.deferred_action_cond)); @@ -1350,7 +1350,7 @@ static void* loc_eng_process_deferred_action (void* arg) pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex)); // send_delete_aiding_data must be done when GPS engine is off - if ((loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON) && + if ((loc_eng_data.engine_status != GPS_STATUS_SESSION_BEGIN) && (loc_eng_data.aiding_data_for_deletion != 0)) { loc_eng_delete_aiding_data_deferred_action ();