loc_api: Disable code that completely shuts down our connection with the GPS

This avoids a race condition that can crash the BP if the GPS is disabled
in settings while it is running.

This also fixes a problem with the GPS icon in the status bar not
getting removed when the GPS is disabled.

BUG: 3005091

Change-Id: I539eef716231cefae3d4d0a8203135da9827b45d
Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
Mike Lockwood 2010-09-22 14:27:57 -04:00
parent 5153d56321
commit 9391343952

View file

@ -174,8 +174,18 @@ SIDE EFFECTS
N/A N/A
===========================================================================*/ ===========================================================================*/
// fully shutting down the GPS is temporarily disabled to avoid intermittent BP crash
#define DISABLE_CLEANUP 1
static int loc_eng_init(GpsCallbacks* callbacks) static int loc_eng_init(GpsCallbacks* callbacks)
{ {
#if DISABLE_CLEANUP
if (loc_eng_data.deferred_action_thread) {
// already initialized
return 0;
}
#endif
// Start the LOC api RPC service // Start the LOC api RPC service
loc_api_glue_init (); loc_api_glue_init ();
@ -226,7 +236,6 @@ static int loc_eng_init(GpsCallbacks* callbacks)
pthread_mutex_init (&(loc_eng_data.ioctl_data.cb_data_mutex), NULL); pthread_mutex_init (&(loc_eng_data.ioctl_data.cb_data_mutex), NULL);
pthread_cond_init(&loc_eng_data.ioctl_data.cb_arrived_cond, NULL); pthread_cond_init(&loc_eng_data.ioctl_data.cb_arrived_cond, NULL);
loc_eng_data.deferred_action_thread = NULL;
loc_eng_data.deferred_action_thread = callbacks->create_thread_cb("loc_api", loc_eng_data.deferred_action_thread = callbacks->create_thread_cb("loc_api",
loc_eng_process_deferred_action, NULL); loc_eng_process_deferred_action, NULL);
@ -252,6 +261,9 @@ SIDE EFFECTS
===========================================================================*/ ===========================================================================*/
static void loc_eng_cleanup() static void loc_eng_cleanup()
{ {
#if DISABLE_CLEANUP
return;
#else
if (loc_eng_data.deferred_action_thread) if (loc_eng_data.deferred_action_thread)
{ {
/* Terminate deferred action working thread */ /* Terminate deferred action working thread */
@ -278,6 +290,7 @@ static void loc_eng_cleanup()
// Do not call this as it can result in the ARM9 crashing if it sends events while we are disabled // Do not call this as it can result in the ARM9 crashing if it sends events while we are disabled
// loc_apicb_app_deinit(); // loc_apicb_app_deinit();
#endif
} }