tizen 2.3.1 release
[framework/appfw/alarm-manager.git] / src / alarm-lib-stub.c
1 /*
2  *  alarm-manager
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Venkatesha Sarpangala <sarpangala.v@samsung.com>, Jayoun Lee <airjany@samsung.com>,
7  * Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23
24
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <errno.h>
28 #include <sys/types.h>
29 #include <string.h>
30 #include <glib.h>
31 #include "alarm.h"
32 #include "alarm-internal.h"
33 #include "alarm-mgr-stub.h"
34 #include "security-server.h"
35
36 #define ALARM_SERVICE_NAME      "appframework.alarm"
37 #define ALARM_OBJECT_PATH       "/appframework/alarm"
38 #define ALARM_INTERFACE_NAME "appframework.alarm"
39
40
41 bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
42                         alarm_id_t *alarm_id, const char *dst_service_name, const char *dst_service_name_mod,
43                         int *error_code);
44 bool _send_alarm_create_periodic(alarm_context_t context, int interval, int is_ref,
45                         int method, alarm_id_t *alarm_id, int *error_code);
46 bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info,
47                         alarm_id_t *alarm_id, bundle *b,int *error_code);
48 bool _send_alarm_delete(alarm_context_t context, alarm_id_t alarm_id,
49                         int *error_code);
50 bool _send_alarm_get_list_of_ids(alarm_context_t context, int maxnum_of_ids,
51                                  alarm_id_t *alarm_id, int *num_of_ids,
52                                  int *error_code);
53 bool _send_alarm_get_number_of_ids(alarm_context_t context, int *num_of_ids,
54                                    int *error_code);
55 bool _send_alarm_get_info(alarm_context_t context, alarm_id_t alarm_id,
56                           alarm_info_t *alarm_info, int *error_code);
57
58 char* __get_cookie(int *error_code)
59 {
60         char *e_cookie = NULL;
61         char cookie[256] = {0,};
62         int size = 0;
63         int retval = 0;
64
65         size = security_server_get_cookie_size();
66         retval = security_server_request_cookie(cookie, size);
67         if (retval < 0) {
68                 ALARM_MGR_EXCEPTION_PRINT("security_server_request_cookie() is failed. retval = %d", retval);
69                 if (error_code) {
70                         *error_code = ERR_ALARM_SYSTEM_FAIL;
71                 }
72                 return NULL;
73         }
74
75         e_cookie = g_base64_encode((const guchar *)cookie, size);
76         if (e_cookie == NULL) {
77                 ALARM_MGR_EXCEPTION_PRINT("g_base64_encode() is failed.");
78                 if (error_code) {
79                         *error_code = ERR_ALARM_SYSTEM_FAIL;
80                 }
81                 return NULL;
82         }
83
84         ALARM_MGR_LOG_PRINT("Gets the cookie successfully.");
85         return e_cookie;
86 }
87
88
89 bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info,
90                         alarm_id_t *alarm_id, bundle *b,
91                         int *error_code)
92 {
93         GError *error = NULL;
94         int return_code = 0;
95         char *e_cookie = NULL;
96         bundle_raw *b_data = NULL;
97         int datalen = 0;
98
99         if (bundle_encode(b, &b_data, &datalen))
100         {
101                 ALARM_MGR_EXCEPTION_PRINT("Unable to encode the bundle data\n");
102                 if (error_code) {
103                         *error_code = ERR_ALARM_SYSTEM_FAIL;
104                 }
105                 return false;
106         }
107
108         e_cookie = __get_cookie(error_code);
109         if (e_cookie == NULL) {
110                 ALARM_MGR_EXCEPTION_PRINT("Getting the cookie is failed. error_code = %d", *error_code);
111                 return false;
112         }
113
114         if (!alarm_manager_call_alarm_create_appsvc_sync((AlarmManager*)context.proxy, context.pid,
115                                                     alarm_info->start.year,
116                                                     alarm_info->start.month,
117                                                     alarm_info->start.day,
118                                                     alarm_info->start.hour,
119                                                     alarm_info->start.min,
120                                                     alarm_info->start.sec,
121                                                     alarm_info->end.year,
122                                                     alarm_info->end.month,
123                                                     alarm_info->end.day,
124                                                     alarm_info->mode.u_interval.day_of_week,
125                                                     alarm_info->mode.repeat,
126                                                     alarm_info->alarm_type,
127                                                     alarm_info->reserved_info,
128                                                     (char *)b_data, e_cookie,
129                                                     alarm_id, &return_code,
130                                                     NULL, &error)) {
131                 /* g_dbus_proxy_call_sync error */
132                 /* error_code should be set */
133                 ALARM_MGR_EXCEPTION_PRINT(
134                 "alarm_manager_call_alarm_create_appsvc_sync()failed. alarm_id[%d], return_code[%d].", alarm_id, return_code);
135                 ALARM_MGR_EXCEPTION_PRINT("error->message is %s.", error->message);
136         }
137
138         g_free(e_cookie);
139
140         if (b_data) {
141                 free(b_data);
142                 b_data = NULL;
143         }
144
145         if (return_code != 0) {
146                 if (error_code) {
147                         *error_code = return_code;
148                 }
149                 return false;
150         }
151
152         return true;
153 }
154
155
156 bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
157                         alarm_id_t *alarm_id, const char *dst_service_name, const char *dst_service_name_mod,
158                         int *error_code)
159 {
160         GError *error = NULL;
161         int return_code = 0;
162         char *e_cookie = NULL;
163
164         /*TODO: Dbus bus name validation is must & will be added to avoid alarm-server crash*/
165         if (g_quark_to_string(context.quark_app_service_name) == NULL
166                 && strlen(dst_service_name) == 4
167                 && strncmp(dst_service_name, "null",4) == 0) {
168                         ALARM_MGR_EXCEPTION_PRINT("Invalid arg. Provide valid destination or call alarmmgr_init()\n");
169                 if (error_code) {
170                         *error_code = ERR_ALARM_INVALID_PARAM;
171                 }
172                 return false;
173         }
174
175         e_cookie = __get_cookie(error_code);
176         if (e_cookie == NULL) {
177                 ALARM_MGR_EXCEPTION_PRINT("Getting the cookie is failed. error_code = %d", *error_code);
178                 return false;
179         }
180
181         if (!alarm_manager_call_alarm_create_sync((AlarmManager*)context.proxy, context.pid,
182                         g_quark_to_string(context.quark_app_service_name),
183                         g_quark_to_string(context.quark_app_service_name_mod),
184                                                     alarm_info->start.year,
185                                                     alarm_info->start.month,
186                                                     alarm_info->start.day,
187                                                     alarm_info->start.hour,
188                                                     alarm_info->start.min,
189                                                     alarm_info->start.sec,
190                                                     alarm_info->end.year,
191                                                     alarm_info->end.month,
192                                                     alarm_info->end.day,
193                                                     alarm_info->mode.u_interval.day_of_week,
194                                                     alarm_info->mode.repeat,
195                                                     alarm_info->alarm_type,
196                                                     alarm_info->reserved_info,
197                                                     dst_service_name, dst_service_name_mod, e_cookie,
198                                                     alarm_id, &return_code,
199                                                     NULL, &error)) {
200                 /* g_dbus_proxy_call_sync error error */
201                 /* error_code should be set */
202                 ALARM_MGR_EXCEPTION_PRINT(
203                 "alarm_manager_call_alarm_create_sync()failed. alarm_id[%d], return_code[%d]", alarm_id, return_code);
204                 ALARM_MGR_EXCEPTION_PRINT("error->message is %s", error->message);
205                 if (error_code) {
206                         *error_code = ERR_ALARM_SYSTEM_FAIL;
207                 }
208                 g_free(e_cookie);
209                 return false;
210         }
211
212         g_free(e_cookie);
213
214         if (return_code != 0) {
215                 if (error_code) {
216                         *error_code = return_code;
217                 }
218                 return false;
219         }
220
221         return true;
222 }
223
224 bool _send_alarm_create_periodic(alarm_context_t context, int interval, int is_ref,
225                         int method, alarm_id_t *alarm_id, int *error_code)
226 {
227         GError *error = NULL;
228         int return_code = 0;
229         char *e_cookie = NULL;
230
231         if (g_quark_to_string(context.quark_app_service_name) == NULL) {
232                 ALARM_MGR_EXCEPTION_PRINT("Invalid arg. Provide valid destination or call alarmmgr_init()\n");
233                 if (error_code) {
234                         *error_code = ERR_ALARM_INVALID_PARAM;
235                 }
236                 return false;
237         }
238
239         e_cookie = __get_cookie(error_code);
240         if (e_cookie == NULL) {
241                 ALARM_MGR_EXCEPTION_PRINT("Getting the cookie is failed. error_code = %d", *error_code);
242                 return false;
243         }
244
245         if (!alarm_manager_call_alarm_create_periodic_sync((AlarmManager*)context.proxy,
246                         g_quark_to_string(context.quark_app_service_name),
247                         g_quark_to_string(context.quark_app_service_name_mod),
248                         interval, is_ref, method,
249                         e_cookie,
250                     alarm_id, &return_code, NULL, &error)) {
251                 ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_create_periodic_sync()failed. alarm_id[%d], return_code[%d]",
252                         alarm_id, return_code);
253                 ALARM_MGR_EXCEPTION_PRINT("error->message is %s", error->message);
254                 if (error_code) {
255                         *error_code = ERR_ALARM_SYSTEM_FAIL;
256                 }
257                 g_free(e_cookie);
258                 return false;
259         }
260
261         g_free(e_cookie);
262
263         if (return_code != 0) {
264                 if (error_code) {
265                         *error_code = return_code;
266                 }
267                 return false;
268         }
269
270         return true;
271 }
272
273 bundle *_send_alarm_get_appsvc_info(alarm_context_t context, alarm_id_t alarm_id, int *error_code)
274 {
275         GError *error = NULL;
276         int return_code = 0;
277         bundle *b = NULL;
278         char *e_cookie = NULL;
279         gchar *b_data = NULL;
280         int len = 0;
281
282         e_cookie = __get_cookie(error_code);
283         if (e_cookie == NULL) {
284                 ALARM_MGR_EXCEPTION_PRINT("Getting the cookie is failed. error_code = %d", *error_code);
285                 return false;
286         }
287
288         if (!alarm_manager_call_alarm_get_appsvc_info_sync
289             ((AlarmManager*)context.proxy, context.pid, alarm_id, e_cookie, &b_data, &return_code, NULL, &error)) {
290                 /* g_dbus_proxy_call_sync error */
291                 /*error_code should be set */
292                 ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_get_appsvc_info_sync() failed. alarm_id[%d], return_code[%d].", alarm_id, return_code);
293
294                 if (error_code) {
295                         *error_code = ERR_ALARM_SYSTEM_FAIL;
296                 }
297
298                 g_free(e_cookie);
299
300                 if (b_data) {
301                         g_free(b_data);
302                 }
303
304                 return NULL;
305         }
306
307         if (return_code != 0) {
308                 if (error_code) {
309                         *error_code = return_code;
310                 }
311         } else {
312                 b = bundle_decode((bundle_raw *)b_data, strlen(b_data));
313         }
314
315         g_free(e_cookie);
316
317         if (b_data) {
318                 g_free(b_data);
319         }
320
321         return b;
322 }
323
324
325 bool _send_alarm_set_rtc_time(alarm_context_t context, alarm_date_t *time, int *error_code){
326
327         GError *error = NULL;
328         char *e_cookie = NULL;
329
330         e_cookie = __get_cookie(error_code);
331         if (e_cookie == NULL) {
332                 ALARM_MGR_EXCEPTION_PRINT("Getting the cookie is failed. error_code = %d", *error_code);
333                 return false;
334         }
335
336         if (!alarm_manager_call_alarm_set_rtc_time_sync
337             ((AlarmManager*)context.proxy, context.pid,
338                 time->year, time->month, time->day,
339                  time->hour, time->min, time->sec,
340                   e_cookie, NULL, NULL, &error)) {
341                 /* g_dbus_proxy_call_sync error */
342                 /*error_code should be set */
343                 if (error_code) {
344                         *error_code = ERR_ALARM_SYSTEM_FAIL;
345                 }
346
347                 g_free(e_cookie);
348                 return false;
349         }
350
351         g_free(e_cookie);
352
353         return true;
354 }
355
356 bool _send_alarm_delete(alarm_context_t context, alarm_id_t alarm_id, int *error_code)
357 {
358         GError *error = NULL;
359         int return_code = 0;
360         char *e_cookie = NULL;
361
362         e_cookie = __get_cookie(error_code);
363         if (e_cookie == NULL) {
364                 ALARM_MGR_EXCEPTION_PRINT("Getting the cookie is failed. error_code = %d", *error_code);
365                 return false;
366         }
367
368         if (!alarm_manager_call_alarm_delete_sync
369             ((AlarmManager*)context.proxy, context.pid, alarm_id, e_cookie, &return_code, NULL, &error)) {
370                 /* g_dbus_proxy_call_sync error */
371                 /*error_code should be set */
372                 ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_delete_sync() failed. alarm_id[%d], return_code[%d]", alarm_id, return_code);
373                 if (error_code) {
374                         *error_code = ERR_ALARM_SYSTEM_FAIL;
375                 }
376
377                 g_free(e_cookie);
378                 return false;
379         }
380
381         g_free(e_cookie);
382
383         if (return_code != 0) {
384                 if (error_code) {
385                         *error_code = return_code;
386                 }
387                 return false;
388         }
389
390         return true;
391 }
392
393 bool _send_alarm_delete_all(alarm_context_t context, int *error_code)
394 {
395         GError *error = NULL;
396         int return_code = 0;
397         char *e_cookie = NULL;
398
399         e_cookie = __get_cookie(error_code);
400         if (e_cookie == NULL) {
401                 ALARM_MGR_EXCEPTION_PRINT("Getting the cookie is failed. error_code = %d", *error_code);
402                 return false;
403         }
404
405         if (!alarm_manager_call_alarm_delete_all_sync
406             ((AlarmManager*)context.proxy, context.pid, e_cookie, &return_code, NULL, &error)) {
407                 /* g_dbus_proxy_call_sync error */
408                 /*error_code should be set */
409                 ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_delete_all_sync() failed. return_code[%d]", return_code);
410                 if (error_code) {
411                         *error_code = ERR_ALARM_SYSTEM_FAIL;
412                 }
413
414                 g_free(e_cookie);
415                 return false;
416         }
417
418         g_free(e_cookie);
419
420         if (return_code != 0) {
421                 if (error_code) {
422                         *error_code = return_code;
423                 }
424                 return false;
425         }
426
427         return true;
428 }
429
430 bool _send_alarm_get_list_of_ids(alarm_context_t context, int maxnum_of_ids,
431                                  alarm_id_t *alarm_id, int *num_of_ids,
432                                  int *error_code)
433 {
434         GError *error = NULL;
435         GVariant *alarm_array = NULL;
436         int return_code = 0;
437         int i = 0;
438
439         if (!alarm_manager_call_alarm_get_list_of_ids_sync((AlarmManager*)context.proxy,
440                              context.pid, maxnum_of_ids, &alarm_array,
441                              num_of_ids, &return_code, NULL, &error)) {
442                 /* g_dbus_proxy_call_sync error */
443                 /*error_code should be set */
444                 ALARM_MGR_EXCEPTION_PRINT(
445                 "alarm_manager_call_alarm_get_list_of_ids_sync() failed by dbus. alarm_id[%d], return_code[%d]\n", alarm_id, return_code);
446                 if (error_code) {
447                         *error_code = ERR_ALARM_SYSTEM_FAIL;
448                 }
449
450                 return false;
451         }
452
453         if (return_code != 0) {
454                 if (error_code) {
455                         *error_code = return_code;
456                 }
457                 return false;
458         }
459         else
460         {
461                 GVariantIter *iter = NULL;
462                 gint i = 0;
463                 g_variant_get (alarm_array, "ai", &iter);
464                 while (g_variant_iter_loop (iter, "i", &alarm_id[i]))
465                 {
466                         ALARM_MGR_LOG_PRINT("alarm_id (%d)", alarm_id[i]);
467                         i++;
468                 }
469                 g_variant_iter_free (iter);
470                 *num_of_ids = i;
471                 g_variant_unref(alarm_array);
472         }
473
474         return true;
475 }
476
477 bool _send_alarm_get_number_of_ids(alarm_context_t context, int *num_of_ids,
478                                    int *error_code)
479 {
480         GError *error = NULL;
481         gint return_code = 0;
482         char *e_cookie = NULL;
483
484         e_cookie = __get_cookie(error_code);
485         if (e_cookie == NULL) {
486                 ALARM_MGR_EXCEPTION_PRINT("Getting the cookie is failed. error_code = %d", *error_code);
487                 return false;
488         }
489
490         if (!alarm_manager_call_alarm_get_number_of_ids_sync((AlarmManager*)context.proxy, context.pid, e_cookie, num_of_ids, &return_code, NULL, &error)) {
491                 /* g_dbus_proxy_call_sync error */
492                 /* error_code should be set */
493                 ALARM_MGR_EXCEPTION_PRINT(
494                 "alarm_manager_call_alarm_get_number_of_ids_sync() failed by dbus. return_code[%d], return_code[%s].",
495                 return_code, error->message);
496
497                 if (error_code) {
498                         *error_code = ERR_ALARM_SYSTEM_FAIL;
499                 }
500                 return false;
501         }
502
503         if (return_code != 0) {
504                 if (error_code) {
505                         *error_code = return_code;
506                 }
507                 return false;
508         }
509
510         return true;
511 }
512
513 bool _send_alarm_get_info(alarm_context_t context, alarm_id_t alarm_id,
514                           alarm_info_t *alarm_info, int *error_code)
515 {
516         GError *error = NULL;
517         int return_code = 0;
518         char *e_cookie = NULL;
519
520         e_cookie = __get_cookie(error_code);
521         if (e_cookie == NULL) {
522                 ALARM_MGR_EXCEPTION_PRINT("Getting the cookie is failed. error_code = %d", *error_code);
523                 return false;
524         }
525
526         if (!alarm_manager_call_alarm_get_info_sync((AlarmManager*)context.proxy,
527                 context.pid, alarm_id, e_cookie, &alarm_info->start.year,
528                 &alarm_info->start.month, &alarm_info->start.day,
529                 &alarm_info->start.hour, &alarm_info->start.min,
530                 &alarm_info->start.sec, &alarm_info->end.year,
531                 &alarm_info->end.month, &alarm_info->end.day,
532                 &alarm_info->mode.u_interval.day_of_week,
533                 (gint *)&alarm_info->mode.repeat,
534                 &alarm_info->alarm_type, &alarm_info->reserved_info, &return_code, NULL, &error)) {
535                 /* g_dbus_proxy_call_sync error */
536                 /* error_code should be set */
537                 ALARM_MGR_EXCEPTION_PRINT(
538                 "alarm_manager_call_alarm_get_info_sync() failed by dbus. alarm_id[%d], return_code[%d]\n", alarm_id, return_code);
539                 if (error_code) {
540                         *error_code = ERR_ALARM_SYSTEM_FAIL;
541                 }
542                 g_free(e_cookie);
543                 return false;
544         }
545
546         g_free(e_cookie);
547
548         if (return_code != 0) {
549                 if (error_code) {
550                         *error_code = return_code;
551                 }
552                 return false;
553         }
554
555         return true;
556 }
557
558 bool _send_alarm_get_next_duetime(alarm_context_t context,
559                                  alarm_id_t alarm_id, time_t* duetime,
560                                  int *error_code)
561 {
562         GError *error = NULL;
563         int return_code = 0;
564         char *e_cookie = NULL;
565
566         e_cookie = __get_cookie(error_code);
567         if (e_cookie == NULL) {
568                 ALARM_MGR_EXCEPTION_PRINT("Getting the cookie is failed. error_code = %d", *error_code);
569                 return false;
570         }
571
572         if (!alarm_manager_call_alarm_get_next_duetime_sync((AlarmManager*)context.proxy,
573                              context.pid, alarm_id, e_cookie, duetime, &return_code, NULL, &error)) {
574                 /*g_dbus_proxy_call_sync error */
575                 /*error_code should be set */
576                 ALARM_MGR_EXCEPTION_PRINT(
577                 "alarm_manager_call_alarm_get_next_duetime_sync() failed by dbus. alarm_id[%d], return_code[%d]\n", alarm_id, return_code);
578                 if (error_code) {
579                         *error_code = ERR_ALARM_SYSTEM_FAIL;
580                 }
581                 g_free(e_cookie);
582                 return false;
583         }
584
585         g_free(e_cookie);
586
587         if (return_code != 0) {
588                 if (error_code) {
589                         *error_code = return_code;
590                 }
591                 return false;
592         }
593
594         return true;
595 }
596
597 bool _send_alarm_get_all_info(alarm_context_t context, char ** db_path, int *error_code)
598 {
599         GError *error = NULL;
600         int return_code = 0;
601         char *e_cookie = NULL;
602
603         e_cookie = __get_cookie(error_code);
604         if (e_cookie == NULL) {
605                 ALARM_MGR_EXCEPTION_PRINT("Getting the cookie is failed. error_code = %d", *error_code);
606                 return false;
607         }
608
609         if (!alarm_manager_call_alarm_get_all_info_sync((AlarmManager*)context.proxy, context.pid, e_cookie, db_path, &return_code, NULL, &error)) {
610                 /*g_dbus_proxy_call_sync error */
611                 /*error_code should be set */
612                 ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_get_all_info_sync() failed by dbus. return_code[%d][%s]", return_code, error->message);
613                 if (error_code) {
614                         *error_code = ERR_ALARM_SYSTEM_FAIL;
615                 }
616                 g_free(e_cookie);
617                 return false;
618         }
619
620         g_free(e_cookie);
621
622         if (return_code != ALARMMGR_RESULT_SUCCESS) {
623                 if (error_code) {
624                         *error_code = return_code;
625                 }
626                 return false;
627         }
628
629         return true;
630 }
631
632 bool _send_alarm_set_time(alarm_context_t context, int new_time, int *error_code)
633 {
634         GError *error = NULL;
635         int return_code = 0;
636
637         if (!alarm_manager_call_alarm_set_time_sync((AlarmManager*)context.proxy, new_time, &return_code, NULL, &error)) {
638                 /*g_dbus_proxy_call_sync error */
639                 /*error_code should be set */
640                 ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_set_time_sync() failed by dbus. return_code[%d][%s]", return_code, error->message);
641                 if (error_code) {
642                         *error_code = ERR_ALARM_SYSTEM_FAIL;
643                 }
644                 return false;
645         }
646
647         if (return_code != ALARMMGR_RESULT_SUCCESS) {
648                 if (error_code) {
649                         *error_code = return_code;
650                 }
651                 return false;
652         }
653
654         return true;
655 }
656
657 bool _send_alarm_set_timezone(alarm_context_t context, char *tzpath_str, int *error_code)
658 {
659         GError *error = NULL;
660         int return_code = 0;
661
662         if (!alarm_manager_call_alarm_set_timezone_sync((AlarmManager*)context.proxy, tzpath_str, &return_code, NULL, &error)) {
663                 /*g_dbus_proxy_call_sync error */
664                 /*error_code should be set */
665                 ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_set_timezone_sync() failed by dbus. return_code[%d][%s]", return_code, error->message);
666                 if (error_code) {
667                         *error_code = ERR_ALARM_SYSTEM_FAIL;
668                 }
669                 return false;
670         }
671
672         if (return_code != ALARMMGR_RESULT_SUCCESS) {
673                 if (error_code) {
674                         *error_code = return_code;
675                 }
676                 return false;
677         }
678
679         return true;
680 }