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