mm-iface-modem-3gpp-profile-manager: do not try to deactivate unused profile
'mm_3gpp_profile_list_find_best' can return an unused profile ID, which is later tested for being already activated in 'profile_manager_check_activated_profile_ready' with +GCACT?. Since the profile does not exist, this check always fails, but the profile manager still tries to deactivate it, which is unnecessary. This change checks the return error from 'check_activated_profile' and skips SET_PROFILE_STEP_DEACTIVATE_PROFILE step if error is MM_CORE_ERROR_NOT_FOUND.
This commit is contained in:

committed by
Aleksander Morgado

parent
249e46a70a
commit
85d4ad1158
@@ -306,10 +306,14 @@ profile_manager_check_activated_profile_ready (MMIfaceModem3gppProfileManager *s
|
|||||||
ctx = g_task_get_task_data (task);
|
ctx = g_task_get_task_data (task);
|
||||||
|
|
||||||
if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_activated_profile_finish (self, res, &activated, &error)) {
|
if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_activated_profile_finish (self, res, &activated, &error)) {
|
||||||
|
if (g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND)) {
|
||||||
|
mm_obj_dbg (self, "profile '%s' is not activated: %s", ctx->index_field_value_str, error->message);
|
||||||
|
ctx->step = SET_PROFILE_STEP_STORE_PROFILE;
|
||||||
|
} else {
|
||||||
mm_obj_dbg (self, "couldn't check if profile '%s' is activated: %s", ctx->index_field_value_str, error->message);
|
mm_obj_dbg (self, "couldn't check if profile '%s' is activated: %s", ctx->index_field_value_str, error->message);
|
||||||
ctx->step = SET_PROFILE_STEP_DEACTIVATE_PROFILE;
|
ctx->step = SET_PROFILE_STEP_DEACTIVATE_PROFILE;
|
||||||
}
|
}
|
||||||
else if (activated) {
|
} else if (activated) {
|
||||||
mm_obj_dbg (self, "profile '%s' is activated", ctx->index_field_value_str);
|
mm_obj_dbg (self, "profile '%s' is activated", ctx->index_field_value_str);
|
||||||
ctx->step = SET_PROFILE_STEP_DEACTIVATE_PROFILE;
|
ctx->step = SET_PROFILE_STEP_DEACTIVATE_PROFILE;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user