Skip to content

Commit

Permalink
[ofono] Store one-time data SIM selection. JB#48462
Browse files Browse the repository at this point in the history
This way, automatic choice survives a reboot.
  • Loading branch information
monich committed Feb 13, 2020
1 parent b2df7de commit 7c07139
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion ofono/plugins/sailfish_manager/sailfish_manager.c
Expand Up @@ -743,18 +743,32 @@ static int sailfish_manager_update_modem_paths(struct sailfish_manager_priv *p)
*/
if (sailfish_manager_all_sims_are_initialized(p)) {
slot = sailfish_manager_find_slot_imsi(p, NULL);
if (slot && slot->watch->online &&
if (slot && slot->watch->imsi && slot->watch->online &&
p->auto_data_sim == SIM_AUTO_SELECT_ONCE) {
const char *imsi = slot->watch->imsi;

/*
* Data SIM only needs to be auto-selected
* once and it's done. Write that down.
*/
DBG("Default data sim set to %s once", imsi);
p->auto_data_sim_done = TRUE;
g_key_file_set_boolean(p->storage,
SF_STORE_GROUP,
SF_STORE_AUTO_DATA_SIM_DONE,
p->auto_data_sim_done);

g_free(p->default_data_imsi);
p->pub.default_data_imsi =
p->default_data_imsi = g_strdup(imsi);
g_key_file_set_string(p->storage,
SF_STORE_GROUP,
SF_STORE_DEFAULT_DATA_SIM,
imsi);

storage_sync(NULL, SF_STORE, p->storage);
sailfish_manager_dbus_signal(p->dbus,
SAILFISH_MANAGER_SIGNAL_DATA_IMSI);
}
} else {
DBG("Skipping auto-selection of data SIM");
Expand Down

0 comments on commit 7c07139

Please sign in to comment.