Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions location/drivers/android.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,30 @@ static bool android_location_start(void *data)

static void android_location_stop(void *data)
{
struct android_app *android_app = (struct android_app*)g_android;
androidlocation_t *androidlocation = (androidlocation_t*)data;
JNIEnv *env = jni_thread_getenv();
if (!env)
if (!androidlocation || !env)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why the original PR added this check. If androidlocation is nullptr, handling it like this is probably wrong.

Thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 Probably in case the app was told to stop multiple times, to avoid multiple unnecessary writes? Not sure it really matters, the calls are supposed to be smart enough to know that nothing needs to be written.

return;

settings_t* settings = config_get_ptr();
bool auto_save_state = settings->bools.auto_save_state;

if (auto_save_state)
{
/* Make a save state */
command_event(CMD_EVENT_SAVE_STATE, NULL);

/* Flush the auto save state to disk */
command_event(CMD_EVENT_AUTOSAVE_DELETE, NULL);
}

/* Flush SRAM to disk */
command_event(CMD_EVENT_SAVE_FILES, NULL);

/* TODO: Save config? */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As hinted at by the original PR, there's this UWP function that seems to save the config:

if (config_save_file(config_path))

I'm not sure if these two functions are supposed to be functionally equivalent.


/* Stop the location service */
struct android_app *android_app = (struct android_app*)g_android;
CALL_VOID_METHOD(env, android_app->activity->clazz,
androidlocation->onLocationStop);
}
Expand Down
Loading