Fix aul_svc_get_appid_by_alias_appid_for_uid() function
[platform/core/appfw/aul-1.git] / src / aul_svc.cc
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <bundle.h>
18 #include <bundle_cpp.h>
19 #include <bundle_internal.h>
20 #include <dlfcn.h>
21 #include <glib.h>
22 #include <iniparser.h>
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26 #include <string.h>
27 #include <sys/stat.h>
28 #include <sys/types.h>
29
30 #include <atomic>
31 #include <memory>
32 #include <string>
33 #include <vector>
34
35 #include "aul/app_control/resolve_info.hh"
36 #include "include/aul.h"
37 #include "include/aul_app_group.h"
38 #include "include/aul_error.h"
39 #include "include/aul_sock.h"
40 #include "include/aul_svc.h"
41 #include "include/aul_svc_internal.h"
42 #include "src/aul_api.h"
43 #include "src/aul_svc_priv_key.h"
44 #include "src/aul_util.h"
45 #include "src/launch.h"
46
47 #undef MAX_MIME_STR_SIZE
48 #define MAX_MIME_STR_SIZE 256
49
50 #undef MAX_SCHEME_STR_SIZE
51 #define MAX_SCHEME_STR_SIZE 256
52
53 #undef MAX_HOST_STR_SIZE
54 #define MAX_HOST_STR_SIZE 256
55
56 #undef DEPRECATION_WARNING
57 #define DEPRECATION_WARNING() do {                                             \
58     dlog_print(DLOG_WARN, LOG_TAG,                                             \
59         "DEPRECATION WARNING: %s() is deprecated and "                         \
60         "will be removed from next release.", __FUNCTION__);                   \
61 } while (0)
62
63 namespace {
64
65 constexpr const char kPathAmdReady[] = "/run/.amd_ready";
66 constexpr const char kPathLibAulServer[] = "/usr/lib/libaul-server.so.0";
67 constexpr const char kAulServiceForeachUsrAliasInfo[] =
68     "aul_service_foreach_usr_alias_info";
69
70 class CbInfo {
71  public:
72   CbInfo(int request_code, aul_svc_res_fn res_fn,
73       aul_svc_err_cb err_cb, void* user_data)
74       : request_code_(request_code),
75         res_fn_(res_fn),
76         err_cb_(err_cb),
77         user_data_(user_data) {
78   }
79
80   int request_code_;
81   aul_svc_res_fn res_fn_;
82   aul_svc_err_cb err_cb_;
83   void* user_data_;
84 };
85
86 class AliasInfo {
87  public:
88   AliasInfo(std::string alias_appid)
89       : alias_appid_(std::move(alias_appid)) {
90   }
91
92   std::string alias_appid_;
93   std::string appid_;
94 };
95
96 int SetBundle(bundle* b, const char* key, const char* value) {
97   if (bundle_get_type(b, key) != BUNDLE_TYPE_NONE) {
98     if (bundle_del(b, key) != BUNDLE_ERROR_NONE)
99       return AUL_SVC_RET_ERROR;
100   }
101
102   if (value == nullptr)
103     return AUL_SVC_RET_EINVAL;
104
105   if (bundle_add(b, key, value) != BUNDLE_ERROR_NONE)
106     return AUL_SVC_RET_ERROR;
107
108   SECURE_LOGD("key(%s), value(%s)", key, value);
109   return AUL_SVC_RET_OK;
110 }
111
112 int SetBundleArray(bundle* b, const char* key, const char** value,
113     int len) {
114   int is_array = aul_svc_data_is_array(b, key);
115   if (is_array) {
116     if (bundle_del(b, key) != BUNDLE_ERROR_NONE)
117       return AUL_SVC_RET_ERROR;
118   }
119
120   if (value == nullptr)
121     return AUL_SVC_RET_EINVAL;
122
123   if (bundle_add_str_array(b, key, value, len) != BUNDLE_ERROR_NONE)
124     return AUL_SVC_RET_ERROR;
125
126   SECURE_LOGD("key(%s), length(%d)", key, len);
127   return AUL_SVC_RET_OK;
128 }
129
130 std::string GetAliasAppId(const char* appid) {
131   dictionary* dic = iniparser_load("/usr/share/appsvc/alias.ini");
132   if (dic == nullptr)
133     return {};
134
135   auto dic_ptr = std::unique_ptr<dictionary, decltype(iniparser_freedict)*>(
136       dic, iniparser_freedict);
137
138   std::string key = std::string("Alias:") + appid;
139   const char* value = iniparser_getstring(dic, key.c_str(), nullptr);
140   SECURE_LOGD("appid(%s), alias_id(%s)", appid, value);
141   if (value == nullptr)
142     return {};
143
144   return std::string(value);
145 }
146
147 bool IsSpecialApp(const char* appid) {
148   if (!strcmp(appid, APP_SELECTOR) || !strcmp(appid, SHARE_PANEL))
149     return true;
150
151   return false;
152 }
153
154 bool IsSpecialOperation(const char* operation) {
155   if (operation == nullptr)
156     return false;
157
158   int ret = strcmp(operation,
159       "http://tizen.org/appcontrol/operation/guide_privacy_setting");
160   if (ret == 0)
161     return true;
162
163   return false;
164 }
165
166 std::string GetAppId(bundle* request) {
167   const char* appid = aul_svc_get_pkgname(request);
168   if (appid == nullptr) {
169     if (aul_svc_get_operation(request) == nullptr) {
170       _E("Invalid request");
171       return {};
172     }
173
174     appid = "@UNKNOWN";
175   }
176
177   int ret = bundle_get_type(request, AUL_SVC_K_SELECTOR_EXTRA_LIST);
178   if (ret != BUNDLE_TYPE_NONE) {
179     if (appid == nullptr || !strcmp(appid, "@UNKNOWN"))
180       appid = APP_SELECTOR;
181   }
182
183   ret = bundle_get_type(request, AUL_K_FORCE_LAUNCH_APP_SELECTOR);
184   if (ret != BUNDLE_TYPE_NONE)
185     appid = APP_SELECTOR;
186
187   return std::string(appid);
188 }
189
190 void SetLaunchData(bundle* request, const std::string& appid) {
191   const char* operation = aul_svc_get_operation(request);
192   if (operation == nullptr)
193     aul_svc_set_operation(request, AUL_SVC_OPERATION_DEFAULT);
194
195   if (IsSpecialApp(appid.c_str()) || IsSpecialOperation(operation)) {
196     SetBundle(request, AUL_SVC_K_CAN_BE_LEADER, "true");
197     SetBundle(request, AUL_SVC_K_REROUTE, "true");
198     SetBundle(request, AUL_SVC_K_RECYCLE, "true");
199   }
200
201   const char* launch_mode = aul_svc_get_launch_mode(request);
202   if (launch_mode && !strcmp(launch_mode, "group")) {
203     int ret = bundle_get_type(request, AUL_K_INSTANCE_ID);
204     if (ret != BUNDLE_TYPE_NONE)
205       aul_set_instance_info(appid.c_str(), request);
206   }
207 }
208
209 int AulErrorConvert(int res) {
210   switch (res) {
211   case AUL_R_EILLACC:
212     return AUL_SVC_RET_EILLACC;
213   case AUL_R_EINVAL:
214     return AUL_SVC_RET_EINVAL;
215   case AUL_R_ETERMINATING:
216     return AUL_SVC_RET_ETERMINATING;
217   case AUL_R_EREJECTED:
218     return AUL_SVC_RET_EREJECTED;
219   case AUL_R_ENOAPP:
220     return AUL_SVC_RET_ENOMATCH;
221   case AUL_R_ECANCELED:
222     return AUL_SVC_RET_ECANCELED;
223   default:
224     return AUL_SVC_RET_ELAUNCH;
225   }
226 }
227
228 void LaunchWithResultCb(bundle* b, int is_cancel, void* data) {
229   int res;
230   if (is_cancel) {
231     res = AUL_SVC_RES_CANCEL;
232   } else {
233     const char* val = bundle_get_val(b, AUL_SVC_K_RES_VAL);
234     res = (val == nullptr) ? AUL_SVC_RES_NOT_OK : atoi(val);
235   }
236
237   bundle_del(b, AUL_SVC_K_RES_VAL);
238   auto* cb_info = static_cast<CbInfo*>(data);
239   if (cb_info == nullptr) {
240     _E("Invalid parameter");
241     return;
242   }
243
244   if (cb_info->res_fn_) {
245     cb_info->res_fn_(b, cb_info->request_code_,
246         static_cast<aul_svc_result_val>(res), cb_info->user_data_);
247     cb_info->res_fn_ = nullptr;
248   }
249
250   if (cb_info->err_cb_ != nullptr)
251     return;
252
253   delete cb_info;
254 }
255
256 void ErrorCb(int error, void* data) {
257   if (error < 0)
258     error = AulErrorConvert(error);
259
260   auto* cb_info = static_cast<CbInfo*>(data);
261   if (cb_info == nullptr) {
262     _E("Invalid parameter");
263     return;
264   }
265
266   if (cb_info->err_cb_) {
267     cb_info->err_cb_(cb_info->request_code_, error, cb_info->user_data_);
268     cb_info->err_cb_ = nullptr;
269   }
270
271   if (cb_info->res_fn_)
272     return;
273
274   delete cb_info;
275 }
276
277 using SendLaunchRequestCb =
278     int (*)(const std::string&, bundle*, uid_t, CbInfo*);
279 using SendLaunchRequestSyncCb =
280     int (*)(const std::string&, bundle*, uid_t, bundle**);
281
282 template <typename T, typename A>
283 int SendLaunchRequest(T cb, bundle* request, uid_t uid, A arg) {
284   if (request == nullptr) {
285     _E("Invalid parameter");
286     return AUL_SVC_RET_EINVAL;
287   }
288
289   std::string appid = GetAppId(request);
290   if (appid.empty()) {
291     _E("GetAppId() is failed");
292     return AUL_SVC_RET_EINVAL;
293   }
294
295   SetLaunchData(request, appid);
296   return cb(appid, request, uid, arg);
297 }
298
299 int SendAndReceive(int cmd, uid_t uid, bundle* request, bundle** response) {
300   int fd = aul_sock_send_bundle(AUL_UTIL_PID, uid, cmd, request,
301       AUL_SOCK_ASYNC);
302   if (fd < 0)
303     return AUL_SVC_RET_ERROR;
304
305   app_pkt_t* pkt = nullptr;
306   int ret = aul_sock_recv_reply_pkt(fd, &pkt);
307   if (ret < 0) {
308     _E("Failed to receive reply packet. error(%d)", ret);
309     return AUL_SVC_RET_ERROR;
310   }
311
312   auto ptr = std::unique_ptr<app_pkt_t, decltype(std::free)*>(pkt, std::free);
313   if (pkt->cmd != APP_GET_INFO_OK && pkt->cmd != cmd) {
314     if (pkt->cmd == APP_GET_INFO_ERROR)
315       return AUL_SVC_RET_ERROR;
316
317     return AulErrorConvert(aul_error_convert(pkt->cmd));
318   }
319
320   bundle* b = nullptr;
321   if (pkt->opt & AUL_SOCK_BUNDLE) {
322     b = bundle_decode(pkt->data, pkt->len);
323     if (b == nullptr) {
324       _E("bundle_decode() is failed");
325       return AUL_SVC_RET_ENOMEM;
326     }
327   } else {
328     _E("Invalid packet");
329     return AUL_SVC_RET_ERROR;
330   }
331
332   *response = b;
333   return AUL_SVC_RET_OK;
334 }
335
336 std::atomic<bool> amd_ready { false };
337 bool IsAmdReady() {
338   if (amd_ready)
339     return amd_ready;
340
341   if (access(kPathAmdReady, F_OK) == 0) {
342     amd_ready.exchange(true);
343     return amd_ready;
344   }
345
346   return false;
347 }
348
349 using AulServiceAliasInfoCb =
350     bool (*)(const char*, const char*, void*);
351 using AulServiceForeachUsrAliasInfoFunc =
352     int (*)(AulServiceAliasInfoCb, uid_t, void*);
353
354 int GetAppIdByAliasAppIdFromDB(const char* alias_appid, char** app_id,
355     uid_t uid) {
356   void* handle = dlopen(kPathLibAulServer, RTLD_LAZY | RTLD_GLOBAL);
357   if (handle == nullptr) {
358     _E("dlopen() is failed. path(%s), error(%s)", kPathLibAulServer, dlerror());
359     return AUL_SVC_RET_ERROR;
360   }
361
362   std::unique_ptr<void, decltype(dlclose)*> handle_auto(handle, dlclose);
363   auto* func = reinterpret_cast<AulServiceForeachUsrAliasInfoFunc>(
364       dlsym(handle, kAulServiceForeachUsrAliasInfo));
365   if (func == nullptr) {
366     _E("dlsym() is failed. error(%s)", dlerror());
367     return AUL_SVC_RET_ERROR;
368   }
369
370   AliasInfo info(alias_appid);
371   int ret = func(
372       [](const char* alias_appid, const char* appid, void* user_data) -> bool {
373         auto* info = static_cast<AliasInfo*>(user_data);
374         if (info->alias_appid_ == alias_appid) {
375           info->appid_ = appid;
376           return false;
377         }
378
379         return true;
380       }, uid, &info);
381   if (ret != 0) {
382     _E("%s() is failed. error(%d)", kAulServiceForeachUsrAliasInfo, ret);
383     return AUL_SVC_RET_ERROR;
384   }
385
386   if (info.appid_.empty())
387     return AUL_SVC_RET_ERROR;
388
389   *app_id = strdup(info.appid_.c_str());
390   if (*app_id == nullptr) {
391     _E("strdup() is failed");
392     return AUL_SVC_RET_ENOMEM;
393   }
394
395   return AUL_SVC_RET_OK;
396 }
397
398 }  // namespace
399
400 extern "C" API int aul_svc_set_operation(bundle* b, const char* operation) {
401   if (b == nullptr) {
402     _E("Invalid parameter");
403     return AUL_SVC_RET_EINVAL;
404   }
405
406   return ::SetBundle(b, AUL_SVC_K_OPERATION, operation);
407 }
408
409 extern "C" API int aul_svc_set_uri(bundle* b, const char* uri) {
410   if (b == nullptr) {
411     _E("Invalid parameter");
412     return AUL_SVC_RET_EINVAL;
413   }
414
415   return ::SetBundle(b, AUL_SVC_K_URI, uri);
416 }
417
418 extern "C" API int aul_svc_set_mime(bundle* b, const char* mime) {
419   if (b == nullptr) {
420     _E("Invalid parameter");
421     return AUL_SVC_RET_EINVAL;
422   }
423
424   return ::SetBundle(b, AUL_SVC_K_MIME, mime);
425 }
426
427 extern "C" API int aul_svc_add_data(bundle* b, const char* key,
428     const char* value) {
429   if (b == nullptr || key == nullptr)
430     return AUL_SVC_RET_EINVAL;
431
432   return ::SetBundle(b, key, value);
433 }
434
435 extern "C" API int aul_svc_add_data_array(bundle* b, const char* key,
436     const char** value, int len) {
437   if (b == nullptr || key == nullptr)
438     return AUL_SVC_RET_EINVAL;
439
440   return ::SetBundleArray(b, key, value, len);
441 }
442
443 extern "C" API int aul_svc_set_pkgname(bundle* b, const char* pkg_name) {
444   if (b == nullptr) {
445     _E("Invalid parameter");
446     return AUL_SVC_RET_EINVAL;
447   }
448
449   return ::SetBundle(b, AUL_SVC_K_PKG_NAME, pkg_name);
450 }
451
452 extern "C" API int aul_svc_set_appid(bundle* b, const char* appid) {
453   if (b == nullptr || appid == nullptr) {
454     _E("Invalid parameter");
455     return AUL_SVC_RET_EINVAL;
456   }
457
458   std::string alias_id = ::GetAliasAppId(appid);
459   if (!alias_id.empty())
460     appid = alias_id.c_str();
461
462   return ::SetBundle(b, AUL_SVC_K_PKG_NAME, appid);
463 }
464
465 extern "C" API int aul_svc_set_category(bundle* b, const char* category) {
466   if (b == nullptr) {
467     _E("Invalid parameter");
468     return AUL_SVC_RET_EINVAL;
469   }
470
471   return ::SetBundle(b, AUL_SVC_K_CATEGORY, category);
472 }
473
474 extern "C" API int aul_svc_set_launch_mode(bundle* b, const char* mode) {
475   if (b == nullptr) {
476     _E("Invalid parameter");
477     return AUL_SVC_RET_EINVAL;
478   }
479
480   return ::SetBundle(b, AUL_SVC_K_LAUNCH_MODE, mode);
481 }
482
483 extern "C" API int aul_svc_resolve(bundle* b, uid_t uid, char*** appid_array,
484     unsigned int* len) {
485   return aul_svc_get_appid_array(b, uid, appid_array, len);
486 }
487
488 extern "C" API int aul_svc_run_service(bundle* b, int request_code,
489     aul_svc_res_fn cbfunc, void* data) {
490   return aul_svc_run_service_for_uid(b, request_code, cbfunc, data, getuid());
491 }
492
493 extern "C" API int aul_svc_run_service_for_uid(bundle* b, int request_code,
494   aul_svc_res_fn cbfunc, void* data, uid_t uid) {
495   CbInfo* cb_info = nullptr;
496   if (cbfunc) {
497     cb_info = new (std::nothrow) CbInfo(request_code, cbfunc, nullptr, data);
498     if (cb_info == nullptr)
499       LOGE("Out of memory");
500   }
501
502   std::tuple<aul_svc_res_fn, void*> param { cbfunc, data };
503   int ret = ::SendLaunchRequest<::SendLaunchRequestCb, ::CbInfo*>(
504       [](const std::string& appid, bundle* request, uid_t uid,
505           CbInfo* cb_info) -> int {
506         int ret;
507         if (cb_info) {
508           ret = aul_launch_app_with_result_for_uid(appid.c_str(), request,
509               LaunchWithResultCb, cb_info, uid);
510          } else {
511           ret = aul_launch_app_for_uid(appid.c_str(), request, uid);
512         }
513
514         return ret;
515       }, b, uid, cb_info);
516   if (ret < 0) {
517     if (cb_info)
518       delete cb_info;
519
520     ret = AulErrorConvert(ret);
521   }
522
523   return ret;
524 }
525
526 extern "C" API int aul_svc_get_list(bundle* b, aul_svc_info_iter_fn iter_fn,
527     void* data) {
528   return aul_svc_get_list_for_uid(b, iter_fn, data, getuid());
529 }
530
531 extern "C" API int aul_svc_get_list_for_uid(bundle* b,
532     aul_svc_info_iter_fn iter_fn, void* data, uid_t uid) {
533   if (b == nullptr || iter_fn == nullptr) {
534     _E("Invalid parameter");
535     return AUL_SVC_RET_EINVAL;
536   }
537
538   char** appid_array = nullptr;
539   unsigned int len = 0;
540   int ret = aul_svc_get_appid_array(b, uid, &appid_array, &len);
541   if (ret != AUL_SVC_RET_OK)
542     return ret;
543
544   if (len == 0) {
545     _E("Failed to find associated application");
546     aul_svc_free_appid_array(appid_array, len);
547     return AUL_SVC_RET_ENOMATCH;
548   }
549
550   for (unsigned int i = 0; i < len; ++i) {
551     SECURE_LOGD("APPID: %s", appid_array[i]);
552     if (iter_fn(appid_array[i], data) != 0)
553       break;
554   }
555
556   aul_svc_free_appid_array(appid_array, len);
557   return AUL_SVC_RET_OK;
558 }
559
560 extern "C" API int aul_svc_get_all_defapps(aul_svc_info_iter_fn iter_fn,
561     void* data) {
562   return aul_svc_get_all_defapps_for_uid(iter_fn, data, getuid());
563 }
564
565 extern "C" API int aul_svc_get_all_defapps_for_uid(aul_svc_info_iter_fn iter_fn,
566     void* data, uid_t uid) {
567   if (iter_fn == nullptr) {
568     _E("Invalid parameter");
569     return AUL_SVC_RET_EINVAL;
570   }
571
572   bundle* response;
573   tizen_base::Bundle request;
574   int ret = ::SendAndReceive(APP_GET_APP_CONTROL_DEFAULT_APPS, uid,
575       request.GetHandle(), &response);
576   if (ret != AUL_SVC_RET_OK)
577     return ret;
578
579   tizen_base::Bundle res(response, false, true);
580   auto appid_array = res.GetStringArray(AUL_K_APPID_LIST);
581   for (auto& appid : appid_array) {
582     if (iter_fn(appid.c_str(), data) != 0)
583       break;
584   }
585
586   return AUL_SVC_RET_OK;
587 }
588
589 extern "C" API const char* aul_svc_get_operation(bundle* b) {
590   return bundle_get_val(b, AUL_SVC_K_OPERATION);
591 }
592
593 extern "C" API const char* aul_svc_get_uri(bundle* b) {
594   return bundle_get_val(b, AUL_SVC_K_URI);
595 }
596
597 extern "C" API const char* aul_svc_get_mime(bundle* b) {
598   return bundle_get_val(b, AUL_SVC_K_MIME);
599 }
600
601 extern "C" API const char* aul_svc_get_data(bundle* b, const char* key) {
602   return bundle_get_val(b, key);
603 }
604
605 extern "C" API const char** aul_svc_get_data_array(bundle* b, const char* key,
606     int* len) {
607   return bundle_get_str_array(b, key, len);
608 }
609
610 extern "C" API const char* aul_svc_get_pkgname(bundle* b) {
611   return bundle_get_val(b, AUL_SVC_K_PKG_NAME);
612 }
613
614 extern "C" API const char* aul_svc_get_appid(bundle* b) {
615   return bundle_get_val(b, AUL_SVC_K_PKG_NAME);
616 }
617
618 extern "C" API const char* aul_svc_get_category(bundle* b) {
619   return bundle_get_val(b, AUL_SVC_K_CATEGORY);
620 }
621
622 extern "C" API const char* aul_svc_get_launch_mode(bundle* b) {
623   return bundle_get_val(b, AUL_SVC_K_LAUNCH_MODE);
624 }
625
626 extern "C" API int aul_svc_create_result_bundle(bundle* inb, bundle** outb) {
627   if (inb == nullptr || outb == nullptr) {
628     _E("Invalid parameter");
629     return AUL_SVC_RET_EINVAL;
630   }
631
632   int ret = aul_create_result_bundle(inb, outb);
633   if (ret != AUL_R_OK)
634     return AulErrorConvert(ret);
635
636   return AUL_SVC_RET_OK;
637 }
638
639 extern "C" API int aul_svc_send_result(bundle* b, aul_svc_result_val result) {
640   if (b == nullptr) {
641     _E("Invalid parameter");
642     return AUL_SVC_RET_EINVAL;
643   }
644
645   int ret = ::SetBundle(b, AUL_SVC_K_RES_VAL, std::to_string(result).c_str());
646   if (ret < 0)
647     return AUL_SVC_RET_ERROR;
648
649   if (result == AUL_SVC_RES_CANCEL)
650     ret = aul_send_result(b, 1);
651   else
652     ret = aul_send_result(b, 0);
653
654   bundle_del(b, AUL_SVC_K_RES_VAL);
655   return ret;
656 }
657
658 extern "C" API int aul_svc_data_is_array(bundle* b, const char* key) {
659   int type = bundle_get_type(b, key);
660   if (type <= 0)
661     return 0;
662
663   if (type & BUNDLE_TYPE_ARRAY)
664     return 1;
665
666   return 0;
667 }
668
669 extern "C" API int aul_svc_allow_transient_app(bundle* b, int wid) {
670   if (b == nullptr) {
671     _E("Invalid parameter");
672     return AUL_SVC_RET_EINVAL;
673   }
674
675   return ::SetBundle(b, AUL_SVC_K_WIN_ID, std::to_string(wid).c_str());
676 }
677
678 extern "C" API int aul_svc_request_transient_app(bundle* b, int callee_wid,
679     aul_svc_host_res_fn cbfunc, void* data) {
680   return 0;
681 }
682
683 extern "C" API int aul_svc_subapp_terminate_request_pid(int pid) {
684   int cpid = getpid();
685   int lcnt;
686   int* lpids = nullptr;
687   aul_app_group_get_leader_pids(&lcnt, &lpids);
688   for (int i = 0; i < lcnt; ++i) {
689     if (lpids[i] == cpid) {
690       int cnt;
691       int* pids = nullptr;
692       aul_app_group_get_group_pids(cpid, &cnt, &pids);
693       if (cnt == 0) {
694         free(lpids);
695         if (pids)
696           free(pids);
697
698         return aul_subapp_terminate_request_pid(pid);
699       }
700
701       if (pids != nullptr)
702         free(pids);
703       break;
704     }
705   }
706
707   if (lpids != nullptr)
708     free(lpids);
709
710   return aul_app_group_clear_top();
711 }
712
713 extern "C" API int aul_send_service_result(bundle* b) {
714   return aul_send_result(b, 0);
715 }
716
717 extern "C" API int aul_svc_subscribe_launch_result(bundle* b,
718     const char* result) {
719   if (b == nullptr) {
720     _E("Invalid parameter");
721     return AUL_SVC_RET_EINVAL;
722   }
723
724   return ::SetBundle(b, result, "1");
725 }
726
727 extern "C" API int aul_svc_set_loader_id(bundle* b, int loader_id) {
728   if (b == nullptr || loader_id <= 0) {
729     _E("Invalid parameter");
730     return AUL_SVC_RET_EINVAL;
731   }
732
733   return ::SetBundle(b, AUL_K_LOADER_ID, std::to_string(loader_id).c_str());
734 }
735
736 extern "C" API int aul_svc_set_loader_name(bundle* b, const char* loader_name) {
737   if (b == nullptr || loader_name == nullptr) {
738     _E("Invalid parameter");
739     return AUL_SVC_RET_EINVAL;
740   }
741
742   return ::SetBundle(b, AUL_K_LOADER_NAME, loader_name);
743 }
744
745 extern "C" API int aul_svc_set_background_launch(bundle* b, int enabled) {
746   if (b == nullptr) {
747     _E("Invalid parameter");
748     return AUL_SVC_RET_EINVAL;
749   }
750
751   return ::SetBundle(b, AUL_SVC_K_BG_LAUNCH, enabled ? "enable" : nullptr);
752 }
753
754 extern "C" API int aul_svc_get_appid_by_alias_appid(const char* alias_appid,
755     char** appid) {
756   return aul_svc_get_appid_by_alias_appid_for_uid(alias_appid, appid, getuid());
757 }
758
759 extern "C" API int aul_svc_get_appid_by_alias_appid_for_uid(
760     const char* alias_appid, char** appid, uid_t uid) {
761   if (alias_appid == nullptr || appid == nullptr) {
762     _E("Invalid parameter");
763     return AUL_SVC_RET_EINVAL;
764   }
765
766   if (!IsAmdReady())
767     return GetAppIdByAliasAppIdFromDB(alias_appid, appid, uid);
768
769   bundle* response;
770   tizen_base::Bundle request;
771   request.Add(AUL_K_ALIAS_APPID, alias_appid);
772   int ret = ::SendAndReceive(APP_GET_APPID_BY_ALIAS_APPID, uid,
773       request.GetHandle(), &response);
774   if (ret != AUL_SVC_RET_OK)
775     return ret;
776
777   tizen_base::Bundle res(response, false, true);
778   auto val = res.GetString(AUL_K_APPID);
779   if (val.empty())
780     return AUL_SVC_RET_ERROR;
781
782   *appid = strdup(val.c_str());
783   if (*appid == nullptr) {
784     _E("Out of memory");
785     return AUL_SVC_RET_ENOMEM;
786   }
787
788   return AUL_SVC_RET_OK;
789 }
790
791 extern "C" API const char *aul_svc_get_instance_id(bundle* b) {
792   return bundle_get_val(b, AUL_K_INSTANCE_ID);
793 }
794
795 extern "C" API int aul_svc_set_instance_id(bundle* b, const char* instance_id) {
796   if (b == nullptr) {
797     _E("Invalid parameter");
798     return AUL_SVC_RET_EINVAL;
799   }
800
801   return ::SetBundle(b, AUL_K_INSTANCE_ID, instance_id);
802 }
803
804 extern "C" API int aul_svc_run_service_async(bundle* b, int request_code,
805     aul_svc_res_fn cbfunc, void* data) {
806   return aul_svc_run_service_async_for_uid(b, request_code, cbfunc, data,
807       getuid());
808 }
809
810 extern "C" API int aul_svc_run_service_async_for_uid(bundle* b,
811     int request_code, aul_svc_res_fn cbfunc, void* data, uid_t uid) {
812   CbInfo* cb_info = nullptr;
813   if (cbfunc)
814     cb_info = new (std::nothrow) CbInfo(request_code, cbfunc, nullptr, data);
815
816   int ret = ::SendLaunchRequest<::SendLaunchRequestCb, ::CbInfo*>(
817       [](const std::string& appid, bundle* request, uid_t uid,
818           CbInfo* info) -> int {
819         if (info) {
820           return aul_launch_app_with_result_async_for_uid(appid.c_str(),
821               request, LaunchWithResultCb, info, uid);
822         }
823
824         return aul_launch_app_async_for_uid(appid.c_str(), request, uid);
825       }, b, uid, cb_info);
826   if (ret < 0) {
827     if (cb_info)
828       delete cb_info;
829
830     ret = AulErrorConvert(ret);
831   }
832
833   return ret;
834 }
835
836 extern "C" API int aul_svc_send_launch_request(bundle* b, int request_code,
837     aul_svc_res_fn cbfunc, aul_svc_err_cb err_cb, void* user_data) {
838   return aul_svc_send_launch_request_for_uid(b, request_code,
839       cbfunc, err_cb, user_data, getuid());
840 }
841
842 extern "C" API int aul_svc_send_launch_request_for_uid(bundle* b,
843     int request_code, aul_svc_res_fn cbfunc, aul_svc_err_cb err_cb,
844     void* user_data, uid_t uid) {
845   if (b == nullptr || err_cb == nullptr) {
846     _E("Invalid parameter");
847     return AUL_SVC_RET_EINVAL;
848   }
849
850   CbInfo* cb_info = new (std::nothrow) CbInfo(request_code, cbfunc, err_cb,
851       user_data);
852   if (cb_info == nullptr)
853     _E("Out of memory");
854
855   int ret = ::SendLaunchRequest<::SendLaunchRequestCb, ::CbInfo*>(
856       [](const std::string& appid, bundle* request, uid_t uid,
857         CbInfo* info) -> int {
858         return aul_send_launch_request_for_uid(appid.c_str(), request, uid,
859             info->res_fn_ ? ::LaunchWithResultCb : nullptr, ::ErrorCb, info);
860       }, b, uid, cb_info);
861   if (ret < 0) {
862     delete cb_info;
863     ret = ::AulErrorConvert(ret);
864   }
865
866   return ret;
867 }
868
869 extern "C" API int aul_svc_send_launch_request_sync_for_uid(bundle* b,
870     int request_code, bundle** res_b, aul_svc_result_val* res, uid_t uid) {
871   if (b == nullptr || res_b == nullptr || res == nullptr) {
872     _E("Invalid parameter");
873     return AUL_SVC_RET_EINVAL;
874   }
875
876   int ret = ::SendLaunchRequest<::SendLaunchRequestSyncCb, bundle**>(
877       [](const std::string& appid, bundle* request, uid_t uid,
878           bundle** response) -> int {
879         return aul_send_launch_request_sync_for_uid(appid.c_str(), request,
880             uid, response);
881       }, b, uid, res_b);
882   if (ret > 0) {
883     auto* val = bundle_get_val(*res_b, AUL_SVC_K_RES_VAL);
884     *res = static_cast<aul_svc_result_val>(
885         (val == nullptr) ? AUL_SVC_RES_NOT_OK : atoi(val));
886   } else {
887     ret = ::AulErrorConvert(ret);
888     *res = AUL_SVC_RES_CANCEL;
889   }
890
891   return ret;
892 }
893
894 extern "C" API int aul_svc_info_create(bundle* b, aul_svc_info_h* h) {
895   if (b == nullptr || h == nullptr) {
896     _E("Invalid parameter");
897     return AUL_SVC_RET_EINVAL;
898   }
899
900   aul::ResolveInfo* resolve_info = nullptr;
901   try {
902     tizen_base::Bundle kb(b, false, false);
903     resolve_info = aul::ResolveInfo::Manager::Create(kb);
904   } catch (aul::Exception& e) {
905     return AUL_SVC_RET_ERROR;
906   }
907
908   *h = static_cast<aul_svc_info_h>(resolve_info);
909   return AUL_SVC_RET_OK;
910 }
911
912 extern "C" API int aul_svc_info_get_operation(aul_svc_info_h h,
913     char** operation) {
914   if (h == nullptr || operation == nullptr) {
915     _E("Invalid parameter");
916     return AUL_SVC_RET_EINVAL;
917   }
918
919   auto* info = static_cast<aul::ResolveInfo*>(h);
920   auto& value = info->GetOperation();
921   *operation = strdup(value.empty() ? "NULL" : value.c_str());
922   if (*operation == nullptr) {
923     _E("Failed to duplicate operation");
924     return AUL_SVC_RET_ERROR;
925   }
926
927   return AUL_SVC_RET_OK;
928 }
929
930 extern "C" API int aul_svc_info_get_uri(aul_svc_info_h h, char** uri) {
931   if (h == nullptr || uri == nullptr) {
932     _E("Invalid parameter");
933     return AUL_SVC_RET_EINVAL;
934   }
935
936   auto* info = static_cast<aul::ResolveInfo*>(h);
937   auto& value = info->GetUri();
938   *uri = strdup(value.empty() ? "NULL" : value.c_str());
939   if (*uri == nullptr) {
940     _E("Failed to duplicate URI");
941     return AUL_SVC_RET_ERROR;
942   }
943
944   return AUL_SVC_RET_OK;
945 }
946
947 extern "C" API int aul_svc_info_get_uri_scheme(aul_svc_info_h h,
948     char** uri_scheme) {
949   if (h == nullptr || uri_scheme == nullptr) {
950     _E("Invalid parameter");
951     return AUL_SVC_RET_EINVAL;
952   }
953
954   auto* info = static_cast<aul::ResolveInfo*>(h);
955   auto& value = info->GetScheme();
956   *uri_scheme = strdup(value.empty() ? "NULL" : value.c_str());
957   if (*uri_scheme == nullptr) {
958     _E("Failed to duplicate URI scheme");
959     return AUL_SVC_RET_ERROR;
960   }
961
962   return AUL_SVC_RET_OK;
963 }
964
965 extern "C" API int aul_svc_info_get_uri_host(aul_svc_info_h h,
966     char** uri_host) {
967   if (h == nullptr || uri_host == nullptr) {
968     _E("Invalid parameter");
969     return AUL_SVC_RET_EINVAL;
970   }
971
972   auto* info = static_cast<aul::ResolveInfo*>(h);
973   auto& value = info->GetHost();
974   *uri_host = strdup(value.empty() ? "NULL" : value.c_str());
975   if (*uri_host == nullptr) {
976     _E("Failed to duplicate URI host");
977     return AUL_SVC_RET_ERROR;
978   }
979
980   return AUL_SVC_RET_OK;
981 }
982
983 extern "C" API int aul_svc_info_get_mime(aul_svc_info_h h, char** mime) {
984   if (h == nullptr || mime == nullptr) {
985     _E("Invalid parameter");
986     return AUL_SVC_RET_EINVAL;
987   }
988
989   auto* info = static_cast<aul::ResolveInfo*>(h);
990   auto& value = info->GetMime();
991   *mime = strdup(value.empty() ? "NULL" : value.c_str());
992   if (*mime == nullptr) {
993     _E("Failed to duplicate MIME-Type");
994     return AUL_SVC_RET_ERROR;
995   }
996
997   return AUL_SVC_RET_OK;
998 }
999
1000 extern "C" API int aul_svc_info_get_mime_type(aul_svc_info_h h,
1001     char** mime_type) {
1002   if (h == nullptr || mime_type == nullptr) {
1003     _E("Invalid parameter");
1004     return AUL_SVC_RET_EINVAL;
1005   }
1006
1007   auto* info = static_cast<aul::ResolveInfo*>(h);
1008   auto& value = info->GetMType();
1009   *mime_type = strdup(value.empty() ? "NULL" : value.c_str());
1010   if (*mime_type == nullptr) {
1011     _E("Failed to duplicate the type of MIME-Type");
1012     return AUL_SVC_RET_ERROR;
1013   }
1014
1015   return AUL_SVC_RET_OK;
1016 }
1017
1018 extern "C" API int aul_svc_info_get_mime_subtype(aul_svc_info_h h,
1019     char** mime_subtype) {
1020   if (h == nullptr || mime_subtype == nullptr) {
1021     _E("Invalid parameter");
1022     return AUL_SVC_RET_EINVAL;
1023   }
1024
1025   auto* info = static_cast<aul::ResolveInfo*>(h);
1026   auto& value = info->GetSType();
1027   *mime_subtype = strdup(value.empty() ? "NULL" : value.c_str());
1028   if (*mime_subtype == nullptr) {
1029     _E("Failed to duplicate the subtype of MIME-Type");
1030     return AUL_SVC_RET_ERROR;
1031   }
1032
1033   return AUL_SVC_RET_OK;
1034 }
1035
1036 extern "C" API int aul_svc_info_destroy(aul_svc_info_h h) {
1037   if (h == nullptr) {
1038     _E("Invalid parameter");
1039     return AUL_SVC_RET_EINVAL;
1040   }
1041
1042   auto* info = static_cast<aul::ResolveInfo*>(h);
1043   delete info;
1044   return AUL_SVC_RET_OK;
1045 }
1046
1047 extern "C" API int aul_svc_set_caller_instance_id(bundle* b,
1048     const char* instance_id) {
1049   if (b == nullptr) {
1050     _E("Invalid parameter");
1051     return AUL_SVC_RET_EINVAL;
1052   }
1053
1054   return ::SetBundle(b, AUL_K_CALLER_INSTANCE_ID, instance_id);
1055 }
1056
1057 extern "C" API int aul_svc_set_comp_id(bundle* b, const char* comp_id) {
1058   if (b == nullptr) {
1059     _E("Invalid parameter");
1060     return AUL_SVC_RET_EINVAL;
1061   }
1062
1063   return ::SetBundle(b, AUL_K_COMPONENT_ID, comp_id);
1064 }
1065
1066 extern "C" API const char *aul_svc_get_comp_id(bundle* b) {
1067   return bundle_get_val(b, AUL_K_COMPONENT_ID);
1068 }
1069
1070 extern "C" API int aul_svc_subapp_terminate_request(bundle* b, int pid) {
1071   if (b == nullptr || pid < 0) {
1072     _E("Invalid parameter");
1073     return AUL_SVC_RET_EINVAL;
1074   }
1075
1076   const char* inst_id = bundle_get_val(b, AUL_K_INSTANCE_ID);
1077   if (inst_id == nullptr) {
1078     _E("Invalid parameter");
1079     return AUL_SVC_RET_EINVAL;
1080   }
1081
1082   char buf[512] = { 0, };
1083   const char* caller_inst_id = bundle_get_val(b, AUL_K_CALLER_INSTANCE_ID);
1084   if (caller_inst_id == nullptr) {
1085     int ret = aul_app_get_instance_id_bypid(getpid(), buf, sizeof(buf));
1086     if (ret != AUL_R_OK) {
1087       _E("aul_app_get_instance_id_bypid() is failed. error(%d)", ret);
1088       return AUL_SVC_RET_ERROR;
1089     }
1090
1091     caller_inst_id = buf;
1092   }
1093
1094   int cnt = 0;
1095   aul_app_group_foreach_group_info(caller_inst_id,
1096       [](aul_app_group_info_h info, void* data) {
1097       int* count = static_cast<int*>(data);
1098       (*count)++;
1099       }, static_cast<void*>(&cnt));
1100   if (cnt == 0)
1101     return aul_subapp_terminate_request(inst_id, pid);
1102
1103   return aul_app_group_clear_top();
1104 }
1105
1106 extern "C" API int aul_svc_send_resume_request(bundle* b, int request_code,
1107     aul_svc_err_cb err_cb, void *user_data) {
1108   return aul_svc_send_resume_request_for_uid(b, request_code, err_cb, user_data,
1109       getuid());
1110 }
1111
1112 extern "C" API int aul_svc_send_resume_request_for_uid(bundle* b,
1113     int request_code, aul_svc_err_cb err_cb, void* user_data, uid_t uid) {
1114   if (b == nullptr || err_cb == nullptr) {
1115     _E("Invalid parameter");
1116     return AUL_SVC_RET_EINVAL;
1117   }
1118
1119   auto* cb_info = new (std::nothrow) CbInfo(request_code, nullptr, err_cb,
1120       user_data);
1121   if (cb_info == nullptr)
1122     _E("Out of memory");
1123
1124   int ret = ::SendLaunchRequest<::SendLaunchRequestCb, ::CbInfo*>(
1125       [](const std::string& appid, bundle* request, uid_t uid,
1126           CbInfo* info) -> int {
1127         return aul_send_resume_request_for_uid(appid.c_str(), request, uid,
1128             ErrorCb, info);
1129       }, b, uid, cb_info);
1130   if (ret < 0) {
1131     delete cb_info;
1132     ret = ::AulErrorConvert(ret);
1133   }
1134
1135   return ret;
1136 }
1137
1138 extern "C" API int aul_svc_get_appid_array(bundle* b, uid_t uid,
1139     char*** appid_array, unsigned int* len) {
1140   if (b == nullptr || appid_array == nullptr || len == nullptr) {
1141     _E("Invalid parameter");
1142     return AUL_SVC_RET_EINVAL;
1143   }
1144
1145   bundle_del(b, AUL_K_APPID);
1146   bundle_add(b, AUL_K_APPID, "@UNKNOWN");
1147
1148   bundle* response;
1149   int ret = ::SendAndReceive(APP_GET_APPID_LIST, uid, b, &response);
1150   if (ret != AUL_SVC_RET_OK)
1151     return ret;
1152
1153   tizen_base::Bundle res(response, false, true);
1154   auto str = res.GetString(AUL_SVC_K_URI_R_INFO);
1155   if (!str.empty())
1156     ::SetBundle(b, AUL_SVC_K_URI_R_INFO, str.c_str());
1157
1158   auto str_arr = res.GetStringArray(AUL_K_APPID_LIST);
1159   if (str_arr.empty()) {
1160     _E("Failed to get appid list");
1161     return AUL_SVC_RET_ERROR;
1162   }
1163
1164   *appid_array = reinterpret_cast<char**>(
1165       calloc(str_arr.size(), sizeof(char*)));
1166   if (*appid_array == nullptr) {
1167     _E("Out of memory");
1168     return AUL_SVC_RET_ENOMEM;
1169   }
1170
1171   *len = str_arr.size();
1172
1173   int i = 0;
1174   for (auto& appid : str_arr)
1175     (*appid_array)[i++] = strdup(appid.c_str());
1176
1177   return AUL_SVC_RET_OK;
1178 }
1179
1180 extern "C" API void aul_svc_free_appid_array(char** appid_array,
1181     unsigned int len) {
1182   if (appid_array == nullptr)
1183     return;
1184
1185   for (unsigned int i = 0; i < len; ++i)
1186     free(appid_array[i]);
1187
1188   free(appid_array);
1189 }
1190
1191 extern "C" API int aul_svc_set_defapp(const char* op, const char* mime_type,
1192     const char* uri, const char* defapp) {
1193   DEPRECATION_WARNING();
1194   return AUL_SVC_RET_OK;
1195 }
1196
1197 extern "C" API int aul_svc_set_defapp_for_uid(const char* op,
1198     const char* mime_type, const char* uri, const char* defapp, uid_t uid) {
1199   DEPRECATION_WARNING();
1200   return AUL_SVC_RET_OK;
1201 }
1202
1203 extern "C" API int aul_svc_unset_defapp(const char* defapp) {
1204   DEPRECATION_WARNING();
1205   return AUL_SVC_RET_OK;
1206 }
1207
1208 extern "C" API int aul_svc_unset_defapp_for_uid(const char* defapp, uid_t uid) {
1209   DEPRECATION_WARNING();
1210   return AUL_SVC_RET_OK;
1211 }
1212
1213 extern "C" API int aul_svc_unset_all_defapps(void) {
1214   DEPRECATION_WARNING();
1215   return AUL_SVC_RET_OK;
1216 }
1217
1218 extern "C" API int aul_svc_unset_all_defapps_for_uid(uid_t uid) {
1219   DEPRECATION_WARNING();
1220   return AUL_SVC_RET_OK;
1221 }
1222
1223 extern "C" API int aul_svc_is_defapp(const char* pkg_name) {
1224   DEPRECATION_WARNING();
1225   return AUL_SVC_RET_OK;
1226 }
1227
1228 extern "C" API int aul_svc_is_defapp_for_uid(const char* pkg_name, uid_t uid) {
1229   DEPRECATION_WARNING();
1230   return AUL_SVC_RET_OK;
1231 }
1232
1233 extern "C" API int aul_svc_set_alias_appid(const char* alias_appid,
1234     const char* appid) {
1235   DEPRECATION_WARNING();
1236   return AUL_SVC_RET_OK;
1237 }
1238
1239 extern "C" API int aul_svc_set_alias_appid_for_uid(const char* alias_appid,
1240     const char* appid, uid_t uid) {
1241   DEPRECATION_WARNING();
1242   return AUL_SVC_RET_OK;
1243 }
1244
1245 extern "C" API int aul_svc_unset_alias_appid(const char* alias_appid) {
1246   DEPRECATION_WARNING();
1247   return AUL_SVC_RET_OK;
1248 }
1249
1250 extern "C" API int aul_svc_unset_alias_appid_for_uid(const char* alias_appid,
1251     uid_t uid) {
1252   DEPRECATION_WARNING();
1253   return AUL_SVC_RET_OK;
1254 }
1255
1256 extern "C" API int aul_svc_foreach_alias_info(
1257     void (*callback)(const char *, const char *, void *),
1258     void* user_data) {
1259   DEPRECATION_WARNING();
1260   return AUL_SVC_RET_OK;
1261 }
1262
1263 extern "C" API int aul_svc_foreach_alias_info_for_uid(
1264     void (*callback)(const char *, const char *, void *),
1265     uid_t uid, void* user_data) {
1266   DEPRECATION_WARNING();
1267   return AUL_SVC_RET_OK;
1268 }
1269
1270 extern "C" API int aul_svc_enable_alias_info(const char* appid) {
1271   DEPRECATION_WARNING();
1272   return AUL_SVC_RET_OK;
1273 }
1274
1275 extern "C" API int aul_svc_enable_alias_info_for_uid(const char* appid,
1276     uid_t uid) {
1277   DEPRECATION_WARNING();
1278   return AUL_SVC_RET_OK;
1279 }
1280
1281 extern "C" API int aul_svc_disable_alias_info(const char* appid) {
1282   DEPRECATION_WARNING();
1283   return AUL_SVC_RET_OK;
1284 }
1285
1286 extern "C" API int aul_svc_disable_alias_info_for_uid(const char* appid,
1287     uid_t uid) {
1288   DEPRECATION_WARNING();
1289   return AUL_SVC_RET_OK;
1290 }
1291
1292 extern "C" API int aul_svc_foreach_alias_info_by_appid(
1293     int (*callback)(const char *, const char *, void *),
1294     const char* appid, void* user_data) {
1295   DEPRECATION_WARNING();
1296   return AUL_SVC_RET_OK;
1297 }
1298
1299 extern "C" API int aul_svc_foreach_alias_info_by_appid_for_uid(
1300     int (*callback)(const char *, const char *, void *),
1301     const char* appid, uid_t uid, void* user_data) {
1302   DEPRECATION_WARNING();
1303   return AUL_SVC_RET_OK;
1304 }
1305
1306 extern "C" API int aul_svc_foreach_allowed_info(
1307     int (*callback)(const char *, const char *, void *),
1308     void* user_data) {
1309   DEPRECATION_WARNING();
1310   return AUL_SVC_RET_OK;
1311 }
1312
1313 extern "C" API int aul_svc_foreach_allowed_info_for_uid(
1314     int (*callback)(const char *, const char *, void *),
1315     uid_t uid, void* user_data) {
1316   DEPRECATION_WARNING();
1317   return AUL_SVC_RET_OK;
1318 }
1319
1320 extern "C" API int aul_svc_foreach_allowed_info_by_appid(
1321     int (*callback)(const char *, const char *, void *),
1322     const char* appid, void* user_data) {
1323   DEPRECATION_WARNING();
1324   return AUL_SVC_RET_OK;
1325 }
1326
1327 extern "C" API int aul_svc_foreach_allowed_info_by_appid_for_uid(
1328     int (*callback)(const char *, const char *, void *),
1329     const char* appid, uid_t uid, void* user_data) {
1330   DEPRECATION_WARNING();
1331   return AUL_SVC_RET_OK;
1332 }