* limitations under the License.
*/
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
} autofill_svc_s;
static GList *__client_list = NULL;
+static bool __initialized;
//LCOV_EXCL_START
static bool __autofill_item_cb(rpc_port_stub_autofill_svc_item_h items, void *user_data)
{
LOGI("autofill service initialize");
+ if (__initialized)
+ return AUTOFILL_ERROR_NONE;
+
int ret;
rpc_port_stub_AutofillSvcPort_callback_s callback = {
};
ret = rpc_port_stub_AutofillSvcPort_register(&callback, NULL);
- if (ret != 0)
+ if (ret != 0) {
LOGW("Failed to register message");
- else
+ } else {
LOGI("Succeeded to register message");
+ __initialized = true;
+ }
return ret;
}
{
LOGI("autofill service deinitialize");
+ if (!__initialized)
+ return AUTOFILL_ERROR_NONE;
+
if (__client_list) {
g_list_free_full(__client_list, __destroy_client);
__client_list = NULL;
}
rpc_port_stub_AutofillSvcPort_unregister();
+ __initialized = false;
return AUTOFILL_ERROR_NONE;
}