From 39fb2a0008aca9e8c42a4bad85f275fd3328664e Mon Sep 17 00:00:00 2001 From: hyunho Date: Fri, 15 May 2020 12:16:40 +0900 Subject: [PATCH] Fix ambient tick duplication bug Change-Id: I4b328d4ff1dad2e35251af662b2c13229f5df341 Signed-off-by: hyunho --- src/base/watch_base.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/base/watch_base.c b/src/base/watch_base.c index 4a91cbb..b052851 100755 --- a/src/base/watch_base.c +++ b/src/base/watch_base.c @@ -367,6 +367,11 @@ static int __set_ambient_tick_cb(void *data) if (!alarm_info) return -1; + if (alarm_id) { + alarmmgr_remove_alarm(alarm_id); + alarm_id = 0; + } + r = alarmmgr_add_alarm_withcb_with_localtime(alarm_info, __ambient_tick_cb, data, &alarm_id); if (r < 0) @@ -563,6 +568,11 @@ int __on_change_signal(const char *endpoint, aul_app_com_result_e e, _W("__on_change_signal"); bundle_get_str(envelope, "__AMBIENT_MODE__", &mode); bundle_get_str(envelope, "__AMBIENT_EXTRA__", &extra); + + if ((mode == NULL) || (__context.ambient_mode == atoi(mode))) { + _E("invalid state (%d) (%s)", __context.ambient_mode, mode); + return 0; + } __context.extra = bundle_decode((bundle_raw *)extra, strlen(extra)); __handling_ambient_mode(atoi(mode), NULL); -- 2.7.4