From: Hwankyu Jhun Date: Thu, 7 Sep 2023 04:12:57 +0000 (+0900) Subject: Modify service_app_add_event_handler function X-Git-Tag: accepted/tizen/8.0/unified/20231005.093008~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F40%2F298440%2F3;p=platform%2Fcore%2Fappfw%2Fappcore-agent.git Modify service_app_add_event_handler function To support timezone changed event, this patch modifies the function. Change-Id: I5764c1b38572e6ff0c68c57fe5f0ef265530deeb Signed-off-by: Hwankyu Jhun --- diff --git a/src/service_app_main.cc b/src/service_app_main.cc index 42ebd46..981f95d 100644 --- a/src/service_app_main.cc +++ b/src/service_app_main.cc @@ -75,7 +75,7 @@ int __on_error(app_error_e error, const char* function, return error; } -constexpr int APP_EVENT_MAX = 7; +constexpr int APP_EVENT_MAX = static_cast(IAppCore::IEvent::Type::END); constexpr IAppCore::IEvent::Type __app_event_converter[APP_EVENT_MAX] = { [APP_EVENT_LOW_MEMORY] = IAppCore::IEvent::Type::LOW_MEMORY, [APP_EVENT_LOW_BATTERY] = IAppCore::IEvent::Type::LOW_BATTERY, @@ -85,6 +85,9 @@ constexpr IAppCore::IEvent::Type __app_event_converter[APP_EVENT_MAX] = { [APP_EVENT_REGION_FORMAT_CHANGED] = IAppCore::IEvent::Type::REGION_CHANGE, [APP_EVENT_SUSPENDED_STATE_CHANGED] = IAppCore::IEvent::Type::SUSPENDED_STATE_CHANGE, + [APP_EVENT_UPDATE_REQUESTED] = IAppCore::IEvent::Type::UPDATE_REQUESTED, + [APP_EVENT_TIME_ZONE_CHANGED] = + IAppCore::IEvent::Type::TIME_ZONE_CHANGED, }; class AppContext : public AppCoreBase { @@ -279,7 +282,7 @@ extern "C" EXPORT_API int service_app_add_event_handler( } if (event_type < APP_EVENT_LOW_MEMORY || - event_type > APP_EVENT_SUSPENDED_STATE_CHANGED || + event_type > APP_EVENT_TIME_ZONE_CHANGED || event_type == APP_EVENT_DEVICE_ORIENTATION_CHANGED) { return __on_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid event type"); @@ -324,7 +327,7 @@ extern "C" EXPORT_API int service_app_remove_event_handler( auto type = (*eb)->GetType(); if (type < IAppCore::IEvent::Type::LOW_MEMORY || - type > IAppCore::IEvent::Type::SUSPENDED_STATE_CHANGE || + type > IAppCore::IEvent::Type::TIME_ZONE_CHANGED || type == IAppCore::IEvent::Type::DEVICE_ORIENTATION_CHANGED) return __on_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, nullptr); // LCOV_EXCL_LINE