Remove build warning message
[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   auto dl_closer = [](void* ptr) {
363     dlclose(ptr);
364   };
365
366   std::unique_ptr<void, decltype(dl_closer)> handle_auto(handle, dl_closer);
367   auto* func = reinterpret_cast<AulServiceForeachUsrAliasInfoFunc>(
368       dlsym(handle, kAulServiceForeachUsrAliasInfo));
369   if (func == nullptr) {
370     _E("dlsym() is failed. error(%s)", dlerror());
371     return AUL_SVC_RET_ERROR;
372   }
373
374   AliasInfo info(alias_appid);
375   int ret = func(
376       [](const char* alias_appid, const char* appid, void* user_data) -> bool {
377         auto* info = static_cast<AliasInfo*>(user_data);
378         if (info->alias_appid_ == alias_appid) {
379           info->appid_ = appid;
380           return false;
381         }
382
383         return true;
384       }, uid, &info);
385   if (ret != 0) {
386     _E("%s() is failed. error(%d)", kAulServiceForeachUsrAliasInfo, ret);
387     return AUL_SVC_RET_ERROR;
388   }
389
390   if (info.appid_.empty())
391     return AUL_SVC_RET_ERROR;
392
393   *app_id = strdup(info.appid_.c_str());
394   if (*app_id == nullptr) {
395     _E("strdup() is failed");
396     return AUL_SVC_RET_ENOMEM;
397   }
398
399   return AUL_SVC_RET_OK;
400 }
401
402 }  // namespace
403
404 extern "C" API int aul_svc_set_operation(bundle* b, const char* operation) {
405   if (b == nullptr) {
406     _E("Invalid parameter");
407     return AUL_SVC_RET_EINVAL;
408   }
409
410   return ::SetBundle(b, AUL_SVC_K_OPERATION, operation);
411 }
412
413 extern "C" API int aul_svc_set_uri(bundle* b, const char* uri) {
414   if (b == nullptr) {
415     _E("Invalid parameter");
416     return AUL_SVC_RET_EINVAL;
417   }
418
419   return ::SetBundle(b, AUL_SVC_K_URI, uri);
420 }
421
422 extern "C" API int aul_svc_set_mime(bundle* b, const char* mime) {
423   if (b == nullptr) {
424     _E("Invalid parameter");
425     return AUL_SVC_RET_EINVAL;
426   }
427
428   return ::SetBundle(b, AUL_SVC_K_MIME, mime);
429 }
430
431 extern "C" API int aul_svc_add_data(bundle* b, const char* key,
432     const char* value) {
433   if (b == nullptr || key == nullptr)
434     return AUL_SVC_RET_EINVAL;
435
436   return ::SetBundle(b, key, value);
437 }
438
439 extern "C" API int aul_svc_add_data_array(bundle* b, const char* key,
440     const char** value, int len) {
441   if (b == nullptr || key == nullptr)
442     return AUL_SVC_RET_EINVAL;
443
444   return ::SetBundleArray(b, key, value, len);
445 }
446
447 extern "C" API int aul_svc_set_pkgname(bundle* b, const char* pkg_name) {
448   if (b == nullptr) {
449     _E("Invalid parameter");
450     return AUL_SVC_RET_EINVAL;
451   }
452
453   return ::SetBundle(b, AUL_SVC_K_PKG_NAME, pkg_name);
454 }
455
456 extern "C" API int aul_svc_set_appid(bundle* b, const char* appid) {
457   if (b == nullptr || appid == nullptr) {
458     _E("Invalid parameter");
459     return AUL_SVC_RET_EINVAL;
460   }
461
462   std::string alias_id = ::GetAliasAppId(appid);
463   if (!alias_id.empty())
464     appid = alias_id.c_str();
465
466   return ::SetBundle(b, AUL_SVC_K_PKG_NAME, appid);
467 }
468
469 extern "C" API int aul_svc_set_category(bundle* b, const char* category) {
470   if (b == nullptr) {
471     _E("Invalid parameter");
472     return AUL_SVC_RET_EINVAL;
473   }
474
475   return ::SetBundle(b, AUL_SVC_K_CATEGORY, category);
476 }
477
478 extern "C" API int aul_svc_set_launch_mode(bundle* b, const char* mode) {
479   if (b == nullptr) {
480     _E("Invalid parameter");
481     return AUL_SVC_RET_EINVAL;
482   }
483
484   return ::SetBundle(b, AUL_SVC_K_LAUNCH_MODE, mode);
485 }
486
487 extern "C" API int aul_svc_resolve(bundle* b, uid_t uid, char*** appid_array,
488     unsigned int* len) {
489   return aul_svc_get_appid_array(b, uid, appid_array, len);
490 }
491
492 extern "C" API int aul_svc_run_service(bundle* b, int request_code,
493     aul_svc_res_fn cbfunc, void* data) {
494   return aul_svc_run_service_for_uid(b, request_code, cbfunc, data, getuid());
495 }
496
497 extern "C" API int aul_svc_run_service_for_uid(bundle* b, int request_code,
498   aul_svc_res_fn cbfunc, void* data, uid_t uid) {
499   CbInfo* cb_info = nullptr;
500   if (cbfunc) {
501     cb_info = new (std::nothrow) CbInfo(request_code, cbfunc, nullptr, data);
502     if (cb_info == nullptr)
503       LOGE("Out of memory");
504   }
505
506   std::tuple<aul_svc_res_fn, void*> param { cbfunc, data };
507   int ret = ::SendLaunchRequest<::SendLaunchRequestCb, ::CbInfo*>(
508       [](const std::string& appid, bundle* request, uid_t uid,
509           CbInfo* cb_info) -> int {
510         int ret;
511         if (cb_info) {
512           ret = aul_launch_app_with_result_for_uid(appid.c_str(), request,
513               LaunchWithResultCb, cb_info, uid);
514          } else {
515           ret = aul_launch_app_for_uid(appid.c_str(), request, uid);
516         }
517
518         return ret;
519       }, b, uid, cb_info);
520   if (ret < 0) {
521     if (cb_info)
522       delete cb_info;
523
524     ret = AulErrorConvert(ret);
525   }
526
527   return ret;
528 }
529
530 extern "C" API int aul_svc_get_list(bundle* b, aul_svc_info_iter_fn iter_fn,
531     void* data) {
532   return aul_svc_get_list_for_uid(b, iter_fn, data, getuid());
533 }
534
535 extern "C" API int aul_svc_get_list_for_uid(bundle* b,
536     aul_svc_info_iter_fn iter_fn, void* data, uid_t uid) {
537   if (b == nullptr || iter_fn == nullptr) {
538     _E("Invalid parameter");
539     return AUL_SVC_RET_EINVAL;
540   }
541
542   char** appid_array = nullptr;
543   unsigned int len = 0;
544   int ret = aul_svc_get_appid_array(b, uid, &appid_array, &len);
545   if (ret != AUL_SVC_RET_OK)
546     return ret;
547
548   if (len == 0) {
549     _E("Failed to find associated application");
550     aul_svc_free_appid_array(appid_array, len);
551     return AUL_SVC_RET_ENOMATCH;
552   }
553
554   for (unsigned int i = 0; i < len; ++i) {
555     SECURE_LOGD("APPID: %s", appid_array[i]);
556     if (iter_fn(appid_array[i], data) != 0)
557       break;
558   }
559
560   aul_svc_free_appid_array(appid_array, len);
561   return AUL_SVC_RET_OK;
562 }
563
564 extern "C" API int aul_svc_get_all_defapps(aul_svc_info_iter_fn iter_fn,
565     void* data) {
566   return aul_svc_get_all_defapps_for_uid(iter_fn, data, getuid());
567 }
568
569 extern "C" API int aul_svc_get_all_defapps_for_uid(aul_svc_info_iter_fn iter_fn,
570     void* data, uid_t uid) {
571   if (iter_fn == nullptr) {
572     _E("Invalid parameter");
573     return AUL_SVC_RET_EINVAL;
574   }
575
576   bundle* response;
577   tizen_base::Bundle request;
578   int ret = ::SendAndReceive(APP_GET_APP_CONTROL_DEFAULT_APPS, uid,
579       request.GetHandle(), &response);
580   if (ret != AUL_SVC_RET_OK)
581     return ret;
582
583   tizen_base::Bundle res(response, false, true);
584   auto appid_array = res.GetStringArray(AUL_K_APPID_LIST);
585   for (auto& appid : appid_array) {
586     if (iter_fn(appid.c_str(), data) != 0)
587       break;
588   }
589
590   return AUL_SVC_RET_OK;
591 }
592
593 extern "C" API const char* aul_svc_get_operation(bundle* b) {
594   return bundle_get_val(b, AUL_SVC_K_OPERATION);
595 }
596
597 extern "C" API const char* aul_svc_get_uri(bundle* b) {
598   return bundle_get_val(b, AUL_SVC_K_URI);
599 }
600
601 extern "C" API const char* aul_svc_get_mime(bundle* b) {
602   return bundle_get_val(b, AUL_SVC_K_MIME);
603 }
604
605 extern "C" API const char* aul_svc_get_data(bundle* b, const char* key) {
606   return bundle_get_val(b, key);
607 }
608
609 extern "C" API const char** aul_svc_get_data_array(bundle* b, const char* key,
610     int* len) {
611   return bundle_get_str_array(b, key, len);
612 }
613
614 extern "C" API const char* aul_svc_get_pkgname(bundle* b) {
615   return bundle_get_val(b, AUL_SVC_K_PKG_NAME);
616 }
617
618 extern "C" API const char* aul_svc_get_appid(bundle* b) {
619   return bundle_get_val(b, AUL_SVC_K_PKG_NAME);
620 }
621
622 extern "C" API const char* aul_svc_get_category(bundle* b) {
623   return bundle_get_val(b, AUL_SVC_K_CATEGORY);
624 }
625
626 extern "C" API const char* aul_svc_get_launch_mode(bundle* b) {
627   return bundle_get_val(b, AUL_SVC_K_LAUNCH_MODE);
628 }
629
630 extern "C" API int aul_svc_create_result_bundle(bundle* inb, bundle** outb) {
631   if (inb == nullptr || outb == nullptr) {
632     _E("Invalid parameter");
633     return AUL_SVC_RET_EINVAL;
634   }
635
636   int ret = aul_create_result_bundle(inb, outb);
637   if (ret != AUL_R_OK)
638     return AulErrorConvert(ret);
639
640   return AUL_SVC_RET_OK;
641 }
642
643 extern "C" API int aul_svc_send_result(bundle* b, aul_svc_result_val result) {
644   if (b == nullptr) {
645     _E("Invalid parameter");
646     return AUL_SVC_RET_EINVAL;
647   }
648
649   int ret = ::SetBundle(b, AUL_SVC_K_RES_VAL, std::to_string(result).c_str());
650   if (ret < 0)
651     return AUL_SVC_RET_ERROR;
652
653   if (result == AUL_SVC_RES_CANCEL)
654     ret = aul_send_result(b, 1);
655   else
656     ret = aul_send_result(b, 0);
657
658   bundle_del(b, AUL_SVC_K_RES_VAL);
659   return ret;
660 }
661
662 extern "C" API int aul_svc_data_is_array(bundle* b, const char* key) {
663   int type = bundle_get_type(b, key);
664   if (type <= 0)
665     return 0;
666
667   if (type & BUNDLE_TYPE_ARRAY)
668     return 1;
669
670   return 0;
671 }
672
673 extern "C" API int aul_svc_allow_transient_app(bundle* b, int wid) {
674   if (b == nullptr) {
675     _E("Invalid parameter");
676     return AUL_SVC_RET_EINVAL;
677   }
678
679   return ::SetBundle(b, AUL_SVC_K_WIN_ID, std::to_string(wid).c_str());
680 }
681
682 extern "C" API int aul_svc_request_transient_app(bundle* b, int callee_wid,
683     aul_svc_host_res_fn cbfunc, void* data) {
684   return 0;
685 }
686
687 extern "C" API int aul_svc_subapp_terminate_request_pid(int pid) {
688   int cpid = getpid();
689   int lcnt;
690   int* lpids = nullptr;
691   aul_app_group_get_leader_pids(&lcnt, &lpids);
692   for (int i = 0; i < lcnt; ++i) {
693     if (lpids[i] == cpid) {
694       int cnt;
695       int* pids = nullptr;
696       aul_app_group_get_group_pids(cpid, &cnt, &pids);
697       if (cnt == 0) {
698         free(lpids);
699         if (pids)
700           free(pids);
701
702         return aul_subapp_terminate_request_pid(pid);
703       }
704
705       if (pids != nullptr)
706         free(pids);
707       break;
708     }
709   }
710
711   if (lpids != nullptr)
712     free(lpids);
713
714   return aul_app_group_clear_top();
715 }
716
717 extern "C" API int aul_send_service_result(bundle* b) {
718   return aul_send_result(b, 0);
719 }
720
721 extern "C" API int aul_svc_subscribe_launch_result(bundle* b,
722     const char* result) {
723   if (b == nullptr) {
724     _E("Invalid parameter");
725     return AUL_SVC_RET_EINVAL;
726   }
727
728   return ::SetBundle(b, result, "1");
729 }
730
731 extern "C" API int aul_svc_set_loader_id(bundle* b, int loader_id) {
732   if (b == nullptr || loader_id <= 0) {
733     _E("Invalid parameter");
734     return AUL_SVC_RET_EINVAL;
735   }
736
737   return ::SetBundle(b, AUL_K_LOADER_ID, std::to_string(loader_id).c_str());
738 }
739
740 extern "C" API int aul_svc_set_loader_name(bundle* b, const char* loader_name) {
741   if (b == nullptr || loader_name == nullptr) {
742     _E("Invalid parameter");
743     return AUL_SVC_RET_EINVAL;
744   }
745
746   return ::SetBundle(b, AUL_K_LOADER_NAME, loader_name);
747 }
748
749 extern "C" API int aul_svc_set_background_launch(bundle* b, int enabled) {
750   if (b == nullptr) {
751     _E("Invalid parameter");
752     return AUL_SVC_RET_EINVAL;
753   }
754
755   return ::SetBundle(b, AUL_SVC_K_BG_LAUNCH, enabled ? "enable" : nullptr);
756 }
757
758 extern "C" API int aul_svc_get_appid_by_alias_appid(const char* alias_appid,
759     char** appid) {
760   return aul_svc_get_appid_by_alias_appid_for_uid(alias_appid, appid, getuid());
761 }
762
763 extern "C" API int aul_svc_get_appid_by_alias_appid_for_uid(
764     const char* alias_appid, char** appid, uid_t uid) {
765   if (alias_appid == nullptr || appid == nullptr) {
766     _E("Invalid parameter");
767     return AUL_SVC_RET_EINVAL;
768   }
769
770   if (!IsAmdReady())
771     return GetAppIdByAliasAppIdFromDB(alias_appid, appid, uid);
772
773   bundle* response;
774   tizen_base::Bundle request;
775   request.Add(AUL_K_ALIAS_APPID, alias_appid);
776   int ret = ::SendAndReceive(APP_GET_APPID_BY_ALIAS_APPID, uid,
777       request.GetHandle(), &response);
778   if (ret != AUL_SVC_RET_OK)
779     return ret;
780
781   tizen_base::Bundle res(response, false, true);
782   auto val = res.GetString(AUL_K_APPID);
783   if (val.empty())
784     return AUL_SVC_RET_ERROR;
785
786   *appid = strdup(val.c_str());
787   if (*appid == nullptr) {
788     _E("Out of memory");
789     return AUL_SVC_RET_ENOMEM;
790   }
791
792   return AUL_SVC_RET_OK;
793 }
794
795 extern "C" API const char *aul_svc_get_instance_id(bundle* b) {
796   return bundle_get_val(b, AUL_K_INSTANCE_ID);
797 }
798
799 extern "C" API int aul_svc_set_instance_id(bundle* b, const char* instance_id) {
800   if (b == nullptr) {
801     _E("Invalid parameter");
802     return AUL_SVC_RET_EINVAL;
803   }
804
805   return ::SetBundle(b, AUL_K_INSTANCE_ID, instance_id);
806 }
807
808 extern "C" API int aul_svc_run_service_async(bundle* b, int request_code,
809     aul_svc_res_fn cbfunc, void* data) {
810   return aul_svc_run_service_async_for_uid(b, request_code, cbfunc, data,
811       getuid());
812 }
813
814 extern "C" API int aul_svc_run_service_async_for_uid(bundle* b,
815     int request_code, aul_svc_res_fn cbfunc, void* data, uid_t uid) {
816   CbInfo* cb_info = nullptr;
817   if (cbfunc)
818     cb_info = new (std::nothrow) CbInfo(request_code, cbfunc, nullptr, data);
819
820   int ret = ::SendLaunchRequest<::SendLaunchRequestCb, ::CbInfo*>(
821       [](const std::string& appid, bundle* request, uid_t uid,
822           CbInfo* info) -> int {
823         if (info) {
824           return aul_launch_app_with_result_async_for_uid(appid.c_str(),
825               request, LaunchWithResultCb, info, uid);
826         }
827
828         return aul_launch_app_async_for_uid(appid.c_str(), request, uid);
829       }, b, uid, cb_info);
830   if (ret < 0) {
831     if (cb_info)
832       delete cb_info;
833
834     ret = AulErrorConvert(ret);
835   }
836
837   return ret;
838 }
839
840 extern "C" API int aul_svc_send_launch_request(bundle* b, int request_code,
841     aul_svc_res_fn cbfunc, aul_svc_err_cb err_cb, void* user_data) {
842   return aul_svc_send_launch_request_for_uid(b, request_code,
843       cbfunc, err_cb, user_data, getuid());
844 }
845
846 extern "C" API int aul_svc_send_launch_request_for_uid(bundle* b,
847     int request_code, aul_svc_res_fn cbfunc, aul_svc_err_cb err_cb,
848     void* user_data, uid_t uid) {
849   if (b == nullptr || err_cb == nullptr) {
850     _E("Invalid parameter");
851     return AUL_SVC_RET_EINVAL;
852   }
853
854   CbInfo* cb_info = new (std::nothrow) CbInfo(request_code, cbfunc, err_cb,
855       user_data);
856   if (cb_info == nullptr)
857     _E("Out of memory");
858
859   int ret = ::SendLaunchRequest<::SendLaunchRequestCb, ::CbInfo*>(
860       [](const std::string& appid, bundle* request, uid_t uid,
861         CbInfo* info) -> int {
862         return aul_send_launch_request_for_uid(appid.c_str(), request, uid,
863             info->res_fn_ ? ::LaunchWithResultCb : nullptr, ::ErrorCb, info);
864       }, b, uid, cb_info);
865   if (ret < 0) {
866     delete cb_info;
867     ret = ::AulErrorConvert(ret);
868   }
869
870   return ret;
871 }
872
873 extern "C" API int aul_svc_send_launch_request_sync_for_uid(bundle* b,
874     int request_code, bundle** res_b, aul_svc_result_val* res, uid_t uid) {
875   if (b == nullptr || res_b == nullptr || res == nullptr) {
876     _E("Invalid parameter");
877     return AUL_SVC_RET_EINVAL;
878   }
879
880   int ret = ::SendLaunchRequest<::SendLaunchRequestSyncCb, bundle**>(
881       [](const std::string& appid, bundle* request, uid_t uid,
882           bundle** response) -> int {
883         return aul_send_launch_request_sync_for_uid(appid.c_str(), request,
884             uid, response);
885       }, b, uid, res_b);
886   if (ret > 0) {
887     auto* val = bundle_get_val(*res_b, AUL_SVC_K_RES_VAL);
888     *res = static_cast<aul_svc_result_val>(
889         (val == nullptr) ? AUL_SVC_RES_NOT_OK : atoi(val));
890   } else {
891     ret = ::AulErrorConvert(ret);
892     *res = AUL_SVC_RES_CANCEL;
893   }
894
895   return ret;
896 }
897
898 extern "C" API int aul_svc_info_create(bundle* b, aul_svc_info_h* h) {
899   if (b == nullptr || h == nullptr) {
900     _E("Invalid parameter");
901     return AUL_SVC_RET_EINVAL;
902   }
903
904   aul::ResolveInfo* resolve_info = nullptr;
905   try {
906     tizen_base::Bundle kb(b, false, false);
907     resolve_info = aul::ResolveInfo::Manager::Create(kb);
908   } catch (aul::Exception& e) {
909     return AUL_SVC_RET_ERROR;
910   }
911
912   *h = static_cast<aul_svc_info_h>(resolve_info);
913   return AUL_SVC_RET_OK;
914 }
915
916 extern "C" API int aul_svc_info_get_operation(aul_svc_info_h h,
917     char** operation) {
918   if (h == nullptr || operation == nullptr) {
919     _E("Invalid parameter");
920     return AUL_SVC_RET_EINVAL;
921   }
922
923   auto* info = static_cast<aul::ResolveInfo*>(h);
924   auto& value = info->GetOperation();
925   *operation = strdup(value.empty() ? "NULL" : value.c_str());
926   if (*operation == nullptr) {
927     _E("Failed to duplicate operation");
928     return AUL_SVC_RET_ERROR;
929   }
930
931   return AUL_SVC_RET_OK;
932 }
933
934 extern "C" API int aul_svc_info_get_uri(aul_svc_info_h h, char** uri) {
935   if (h == nullptr || uri == nullptr) {
936     _E("Invalid parameter");
937     return AUL_SVC_RET_EINVAL;
938   }
939
940   auto* info = static_cast<aul::ResolveInfo*>(h);
941   auto& value = info->GetUri();
942   *uri = strdup(value.empty() ? "NULL" : value.c_str());
943   if (*uri == nullptr) {
944     _E("Failed to duplicate URI");
945     return AUL_SVC_RET_ERROR;
946   }
947
948   return AUL_SVC_RET_OK;
949 }
950
951 extern "C" API int aul_svc_info_get_uri_scheme(aul_svc_info_h h,
952     char** uri_scheme) {
953   if (h == nullptr || uri_scheme == nullptr) {
954     _E("Invalid parameter");
955     return AUL_SVC_RET_EINVAL;
956   }
957
958   auto* info = static_cast<aul::ResolveInfo*>(h);
959   auto& value = info->GetScheme();
960   *uri_scheme = strdup(value.empty() ? "NULL" : value.c_str());
961   if (*uri_scheme == nullptr) {
962     _E("Failed to duplicate URI scheme");
963     return AUL_SVC_RET_ERROR;
964   }
965
966   return AUL_SVC_RET_OK;
967 }
968
969 extern "C" API int aul_svc_info_get_uri_host(aul_svc_info_h h,
970     char** uri_host) {
971   if (h == nullptr || uri_host == nullptr) {
972     _E("Invalid parameter");
973     return AUL_SVC_RET_EINVAL;
974   }
975
976   auto* info = static_cast<aul::ResolveInfo*>(h);
977   auto& value = info->GetHost();
978   *uri_host = strdup(value.empty() ? "NULL" : value.c_str());
979   if (*uri_host == nullptr) {
980     _E("Failed to duplicate URI host");
981     return AUL_SVC_RET_ERROR;
982   }
983
984   return AUL_SVC_RET_OK;
985 }
986
987 extern "C" API int aul_svc_info_get_mime(aul_svc_info_h h, char** mime) {
988   if (h == nullptr || mime == nullptr) {
989     _E("Invalid parameter");
990     return AUL_SVC_RET_EINVAL;
991   }
992
993   auto* info = static_cast<aul::ResolveInfo*>(h);
994   auto& value = info->GetMime();
995   *mime = strdup(value.empty() ? "NULL" : value.c_str());
996   if (*mime == nullptr) {
997     _E("Failed to duplicate MIME-Type");
998     return AUL_SVC_RET_ERROR;
999   }
1000
1001   return AUL_SVC_RET_OK;
1002 }
1003
1004 extern "C" API int aul_svc_info_get_mime_type(aul_svc_info_h h,
1005     char** mime_type) {
1006   if (h == nullptr || mime_type == nullptr) {
1007     _E("Invalid parameter");
1008     return AUL_SVC_RET_EINVAL;
1009   }
1010
1011   auto* info = static_cast<aul::ResolveInfo*>(h);
1012   auto& value = info->GetMType();
1013   *mime_type = strdup(value.empty() ? "NULL" : value.c_str());
1014   if (*mime_type == nullptr) {
1015     _E("Failed to duplicate the type of MIME-Type");
1016     return AUL_SVC_RET_ERROR;
1017   }
1018
1019   return AUL_SVC_RET_OK;
1020 }
1021
1022 extern "C" API int aul_svc_info_get_mime_subtype(aul_svc_info_h h,
1023     char** mime_subtype) {
1024   if (h == nullptr || mime_subtype == nullptr) {
1025     _E("Invalid parameter");
1026     return AUL_SVC_RET_EINVAL;
1027   }
1028
1029   auto* info = static_cast<aul::ResolveInfo*>(h);
1030   auto& value = info->GetSType();
1031   *mime_subtype = strdup(value.empty() ? "NULL" : value.c_str());
1032   if (*mime_subtype == nullptr) {
1033     _E("Failed to duplicate the subtype of MIME-Type");
1034     return AUL_SVC_RET_ERROR;
1035   }
1036
1037   return AUL_SVC_RET_OK;
1038 }
1039
1040 extern "C" API int aul_svc_info_destroy(aul_svc_info_h h) {
1041   if (h == nullptr) {
1042     _E("Invalid parameter");
1043     return AUL_SVC_RET_EINVAL;
1044   }
1045
1046   auto* info = static_cast<aul::ResolveInfo*>(h);
1047   delete info;
1048   return AUL_SVC_RET_OK;
1049 }
1050
1051 extern "C" API int aul_svc_set_caller_instance_id(bundle* b,
1052     const char* instance_id) {
1053   if (b == nullptr) {
1054     _E("Invalid parameter");
1055     return AUL_SVC_RET_EINVAL;
1056   }
1057
1058   return ::SetBundle(b, AUL_K_CALLER_INSTANCE_ID, instance_id);
1059 }
1060
1061 extern "C" API int aul_svc_set_comp_id(bundle* b, const char* comp_id) {
1062   if (b == nullptr) {
1063     _E("Invalid parameter");
1064     return AUL_SVC_RET_EINVAL;
1065   }
1066
1067   return ::SetBundle(b, AUL_K_COMPONENT_ID, comp_id);
1068 }
1069
1070 extern "C" API const char *aul_svc_get_comp_id(bundle* b) {
1071   return bundle_get_val(b, AUL_K_COMPONENT_ID);
1072 }
1073
1074 extern "C" API int aul_svc_subapp_terminate_request(bundle* b, int pid) {
1075   if (b == nullptr || pid < 0) {
1076     _E("Invalid parameter");
1077     return AUL_SVC_RET_EINVAL;
1078   }
1079
1080   const char* inst_id = bundle_get_val(b, AUL_K_INSTANCE_ID);
1081   if (inst_id == nullptr) {
1082     _E("Invalid parameter");
1083     return AUL_SVC_RET_EINVAL;
1084   }
1085
1086   char buf[512] = { 0, };
1087   const char* caller_inst_id = bundle_get_val(b, AUL_K_CALLER_INSTANCE_ID);
1088   if (caller_inst_id == nullptr) {
1089     int ret = aul_app_get_instance_id_bypid(getpid(), buf, sizeof(buf));
1090     if (ret != AUL_R_OK) {
1091       _E("aul_app_get_instance_id_bypid() is failed. error(%d)", ret);
1092       return AUL_SVC_RET_ERROR;
1093     }
1094
1095     caller_inst_id = buf;
1096   }
1097
1098   int cnt = 0;
1099   aul_app_group_foreach_group_info(caller_inst_id,
1100       [](aul_app_group_info_h info, void* data) {
1101       int* count = static_cast<int*>(data);
1102       (*count)++;
1103       }, static_cast<void*>(&cnt));
1104   if (cnt == 0)
1105     return aul_subapp_terminate_request(inst_id, pid);
1106
1107   return aul_app_group_clear_top();
1108 }
1109
1110 extern "C" API int aul_svc_send_resume_request(bundle* b, int request_code,
1111     aul_svc_err_cb err_cb, void *user_data) {
1112   return aul_svc_send_resume_request_for_uid(b, request_code, err_cb, user_data,
1113       getuid());
1114 }
1115
1116 extern "C" API int aul_svc_send_resume_request_for_uid(bundle* b,
1117     int request_code, aul_svc_err_cb err_cb, void* user_data, uid_t uid) {
1118   if (b == nullptr || err_cb == nullptr) {
1119     _E("Invalid parameter");
1120     return AUL_SVC_RET_EINVAL;
1121   }
1122
1123   auto* cb_info = new (std::nothrow) CbInfo(request_code, nullptr, err_cb,
1124       user_data);
1125   if (cb_info == nullptr)
1126     _E("Out of memory");
1127
1128   int ret = ::SendLaunchRequest<::SendLaunchRequestCb, ::CbInfo*>(
1129       [](const std::string& appid, bundle* request, uid_t uid,
1130           CbInfo* info) -> int {
1131         return aul_send_resume_request_for_uid(appid.c_str(), request, uid,
1132             ErrorCb, info);
1133       }, b, uid, cb_info);
1134   if (ret < 0) {
1135     delete cb_info;
1136     ret = ::AulErrorConvert(ret);
1137   }
1138
1139   return ret;
1140 }
1141
1142 extern "C" API int aul_svc_get_appid_array(bundle* b, uid_t uid,
1143     char*** appid_array, unsigned int* len) {
1144   if (b == nullptr || appid_array == nullptr || len == nullptr) {
1145     _E("Invalid parameter");
1146     return AUL_SVC_RET_EINVAL;
1147   }
1148
1149   bundle_del(b, AUL_K_APPID);
1150   bundle_add(b, AUL_K_APPID, "@UNKNOWN");
1151
1152   bundle* response;
1153   int ret = ::SendAndReceive(APP_GET_APPID_LIST, uid, b, &response);
1154   if (ret != AUL_SVC_RET_OK)
1155     return ret;
1156
1157   tizen_base::Bundle res(response, false, true);
1158   auto str = res.GetString(AUL_SVC_K_URI_R_INFO);
1159   if (!str.empty())
1160     ::SetBundle(b, AUL_SVC_K_URI_R_INFO, str.c_str());
1161
1162   auto str_arr = res.GetStringArray(AUL_K_APPID_LIST);
1163   if (str_arr.empty()) {
1164     _E("Failed to get appid list");
1165     return AUL_SVC_RET_ERROR;
1166   }
1167
1168   *appid_array = reinterpret_cast<char**>(
1169       calloc(str_arr.size(), sizeof(char*)));
1170   if (*appid_array == nullptr) {
1171     _E("Out of memory");
1172     return AUL_SVC_RET_ENOMEM;
1173   }
1174
1175   *len = str_arr.size();
1176
1177   int i = 0;
1178   for (auto& appid : str_arr)
1179     (*appid_array)[i++] = strdup(appid.c_str());
1180
1181   return AUL_SVC_RET_OK;
1182 }
1183
1184 extern "C" API void aul_svc_free_appid_array(char** appid_array,
1185     unsigned int len) {
1186   if (appid_array == nullptr)
1187     return;
1188
1189   for (unsigned int i = 0; i < len; ++i)
1190     free(appid_array[i]);
1191
1192   free(appid_array);
1193 }
1194
1195 extern "C" API int aul_svc_set_defapp(const char* op, const char* mime_type,
1196     const char* uri, const char* defapp) {
1197   DEPRECATION_WARNING();
1198   return AUL_SVC_RET_OK;
1199 }
1200
1201 extern "C" API int aul_svc_set_defapp_for_uid(const char* op,
1202     const char* mime_type, const char* uri, const char* defapp, uid_t uid) {
1203   DEPRECATION_WARNING();
1204   return AUL_SVC_RET_OK;
1205 }
1206
1207 extern "C" API int aul_svc_unset_defapp(const char* defapp) {
1208   DEPRECATION_WARNING();
1209   return AUL_SVC_RET_OK;
1210 }
1211
1212 extern "C" API int aul_svc_unset_defapp_for_uid(const char* defapp, uid_t uid) {
1213   DEPRECATION_WARNING();
1214   return AUL_SVC_RET_OK;
1215 }
1216
1217 extern "C" API int aul_svc_unset_all_defapps(void) {
1218   DEPRECATION_WARNING();
1219   return AUL_SVC_RET_OK;
1220 }
1221
1222 extern "C" API int aul_svc_unset_all_defapps_for_uid(uid_t uid) {
1223   DEPRECATION_WARNING();
1224   return AUL_SVC_RET_OK;
1225 }
1226
1227 extern "C" API int aul_svc_is_defapp(const char* pkg_name) {
1228   DEPRECATION_WARNING();
1229   return AUL_SVC_RET_OK;
1230 }
1231
1232 extern "C" API int aul_svc_is_defapp_for_uid(const char* pkg_name, uid_t uid) {
1233   DEPRECATION_WARNING();
1234   return AUL_SVC_RET_OK;
1235 }
1236
1237 extern "C" API int aul_svc_set_alias_appid(const char* alias_appid,
1238     const char* appid) {
1239   DEPRECATION_WARNING();
1240   return AUL_SVC_RET_OK;
1241 }
1242
1243 extern "C" API int aul_svc_set_alias_appid_for_uid(const char* alias_appid,
1244     const char* appid, uid_t uid) {
1245   DEPRECATION_WARNING();
1246   return AUL_SVC_RET_OK;
1247 }
1248
1249 extern "C" API int aul_svc_unset_alias_appid(const char* alias_appid) {
1250   DEPRECATION_WARNING();
1251   return AUL_SVC_RET_OK;
1252 }
1253
1254 extern "C" API int aul_svc_unset_alias_appid_for_uid(const char* alias_appid,
1255     uid_t uid) {
1256   DEPRECATION_WARNING();
1257   return AUL_SVC_RET_OK;
1258 }
1259
1260 extern "C" API int aul_svc_foreach_alias_info(
1261     void (*callback)(const char *, const char *, void *),
1262     void* user_data) {
1263   DEPRECATION_WARNING();
1264   return AUL_SVC_RET_OK;
1265 }
1266
1267 extern "C" API int aul_svc_foreach_alias_info_for_uid(
1268     void (*callback)(const char *, const char *, void *),
1269     uid_t uid, void* user_data) {
1270   DEPRECATION_WARNING();
1271   return AUL_SVC_RET_OK;
1272 }
1273
1274 extern "C" API int aul_svc_enable_alias_info(const char* appid) {
1275   DEPRECATION_WARNING();
1276   return AUL_SVC_RET_OK;
1277 }
1278
1279 extern "C" API int aul_svc_enable_alias_info_for_uid(const char* appid,
1280     uid_t uid) {
1281   DEPRECATION_WARNING();
1282   return AUL_SVC_RET_OK;
1283 }
1284
1285 extern "C" API int aul_svc_disable_alias_info(const char* appid) {
1286   DEPRECATION_WARNING();
1287   return AUL_SVC_RET_OK;
1288 }
1289
1290 extern "C" API int aul_svc_disable_alias_info_for_uid(const char* appid,
1291     uid_t uid) {
1292   DEPRECATION_WARNING();
1293   return AUL_SVC_RET_OK;
1294 }
1295
1296 extern "C" API int aul_svc_foreach_alias_info_by_appid(
1297     int (*callback)(const char *, const char *, void *),
1298     const char* appid, void* user_data) {
1299   DEPRECATION_WARNING();
1300   return AUL_SVC_RET_OK;
1301 }
1302
1303 extern "C" API int aul_svc_foreach_alias_info_by_appid_for_uid(
1304     int (*callback)(const char *, const char *, void *),
1305     const char* appid, uid_t uid, void* user_data) {
1306   DEPRECATION_WARNING();
1307   return AUL_SVC_RET_OK;
1308 }
1309
1310 extern "C" API int aul_svc_foreach_allowed_info(
1311     int (*callback)(const char *, const char *, void *),
1312     void* user_data) {
1313   DEPRECATION_WARNING();
1314   return AUL_SVC_RET_OK;
1315 }
1316
1317 extern "C" API int aul_svc_foreach_allowed_info_for_uid(
1318     int (*callback)(const char *, const char *, void *),
1319     uid_t uid, void* user_data) {
1320   DEPRECATION_WARNING();
1321   return AUL_SVC_RET_OK;
1322 }
1323
1324 extern "C" API int aul_svc_foreach_allowed_info_by_appid(
1325     int (*callback)(const char *, const char *, void *),
1326     const char* appid, void* user_data) {
1327   DEPRECATION_WARNING();
1328   return AUL_SVC_RET_OK;
1329 }
1330
1331 extern "C" API int aul_svc_foreach_allowed_info_by_appid_for_uid(
1332     int (*callback)(const char *, const char *, void *),
1333     const char* appid, uid_t uid, void* user_data) {
1334   DEPRECATION_WARNING();
1335   return AUL_SVC_RET_OK;
1336 }