summaryrefslogtreecommitdiff
path: root/include/aul.h
blob: b0041b4f64502693f27e44a3736b4b2fa6529720 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
/*
 *  aul
 *
 * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#pragma once

#include <errno.h>
#include <bundle.h>
#include <sys/types.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Return values in AUL.
 */
typedef enum _aul_return_val {
	AUL_R_ENOENT = -15,		/**< App directory entry error */
	AUL_R_EREJECTED = -14,		/**< App disable for mode */
	AUL_R_ENOAPP = -13,		/**< Failed to find app ID or pkg ID */
	AUL_R_EHIDDENFORGUEST = -11,	/**< App hidden for guest mode */
	AUL_R_ENOLAUNCHPAD = -10,	/**< no launchpad */
	AUL_R_ETERMINATING = -9,	/**< application terminating */
	AUL_R_EILLACC = -8,		/**< Illegal Access */
	AUL_R_LOCAL = -7,		/**< Launch by himself */
	AUL_R_ETIMEOUT = -6,		/**< Timeout */
	AUL_R_ECANCELED = -5,		/**< Operation canceled */
	AUL_R_EINVAL = -4,		/**< Invalid argument */
	AUL_R_ECOMM = -3,		/**< Comunication Error */
	AUL_R_ENOINIT = -2,		/**< AUL handler NOT initialized */
	AUL_R_ERROR = -1,		/**< General error */
	AUL_R_OK = 0			/**< General success */
} aul_return_val;

enum app_status {
	STATUS_LAUNCHING,
	STATUS_CREATED,
	STATUS_FOCUS,
	STATUS_VISIBLE,
	STATUS_BG,
	STATUS_DYING,
	STATUS_HOME,
	STATUS_NORESTART,
	STATUS_SERVICE,
	STATUS_TERMINATE,
};

typedef enum _aul_type {
	AUL_START,
	AUL_RESUME,
	AUL_TERMINATE,
	AUL_TERMINATE_BGAPP,
	AUL_PAUSE,
	AUL_WAKE,
	AUL_SUSPEND,
	AUL_WIDGET_CONTENT,
	AUL_UPDATE_REQUESTED,
} aul_type;

typedef enum aul_widget_lifecycle_event {
	AUL_WIDGET_LIFE_CYCLE_EVENT_APP_DEAD = 0,
	AUL_WIDGET_LIFE_CYCLE_EVENT_CREATE  = 1,    /**< The widget is created */
	AUL_WIDGET_LIFE_CYCLE_EVENT_DESTROY = 2,    /**< The widget is destroyed */
	AUL_WIDGET_LIFE_CYCLE_EVENT_PAUSE   = 3,    /**< The widget is paused */
	AUL_WIDGET_LIFE_CYCLE_EVENT_RESUME  = 4    /**< The widget is resumed */
} aul_widget_lifecycle_event_e;

typedef enum aul_widget_instance_event {
	AUL_WIDGET_INSTANCE_EVENT_CREATE = 0,
	AUL_WIDGET_INSTANCE_EVENT_DESTROY = 1,
	AUL_WIDGET_INSTANCE_EVENT_TERMINATE = 2,
	AUL_WIDGET_INSTANCE_EVENT_PAUSE = 3,
	AUL_WIDGET_INSTANCE_EVENT_RESUME = 4,
	AUL_WIDGET_INSTANCE_EVENT_UPDATE = 5,
	AUL_WIDGET_INSTANCE_EVENT_PERIOD_CHANGED = 6,
	AUL_WIDGET_INSTANCE_EVENT_SIZE_CHANGED = 7,
	AUL_WIDGET_INSTANCE_EVENT_EXTRA_UPDATED = 8,
	AUL_WIDGET_INSTANCE_EVENT_FAULT = 9,
	AUL_WIDGET_INSTANCE_EVENT_APP_RESTART_REQUEST = 10,
	AUL_WIDGET_INSTANCE_EVENT_CREATE_ABORTED = 11
} aul_widget_instance_event_e;

/** AUL public key - To check caller's secuirty */
#define AUL_K_CALLER_PID	"__AUL_CALLER_PID__"
/** AUL public key - To check callee's secuirty */
#define AUL_K_CALLEE_PID	"__AUL_CALLEE_PID__"
/** AUL public key - added for multiuser mode */
#define AUL_K_CALLER_UID	"__AUL_CALLER_UID__"
/** AUL public key - added for multiuser mode */
#define AUL_K_CALLEE_UID	"__AUL_CALLEE_UID__"
/** AUL public key - added for multiuser mode */
#define AUL_K_TARGET_UID	"__AUL_TARGET_UID__"
/** AUL public key - To check caller's secuirty */
#define AUL_K_CALLER_APPID	"__AUL_CALLER_APPID__"
/** AUL public key - To check caller's secuirty */
#define AUL_K_CALLEE_APPID	"__AUL_CALLEE_APPID__"
/** AUL public key - To find argv0 */
#define AUL_K_ARGV0		"__AUL_ARGV0__"
/** AUL public key - To measure launching time */
#define AUL_K_STARTTIME		"__AUL_STARTTIME__"
/** AUL public key - To support launching based on mime type */
#define AUL_K_MIME_TYPE		"__AUL_MIME_TYPE__"
/** AUL public key - To support launching based on mime type */
#define AUL_K_UNALIASED_MIME_TYPE		"__AUL_UNALIASED_MIME_TYPE__"
/** AUL public key - To support launching based on mime type */
#define AUL_K_MIME_CONTENT	"__AUL_MIME_CONTENT__"
/** AUL public key - To support launching based on service */
#define AUL_K_SERVICE_NAME		"__AUL_SERVICE_NAME__"
/** AUL public key - To force launch app selector instead of lauchingn default app */
#define AUL_K_FORCE_LAUNCH_APP_SELECTOR	"__AUL_FORCE_LAUNCH_APP_SELECTOR__"
/** AUL public key - To support debug argument */
#define AUL_K_DEBUG	"__AUL_DEBUG__"
/** AUL public key - To support SDK */
#define AUL_K_SDK	"__AUL_SDK__"
/** AUL public key - To support Media key */
#define AUL_K_MULTI_KEY	"__AUL_MULTI_KEY__"
/** AUL public key - To support Media key */
#define AUL_K_MULTI_KEY_EVENT	"__AUL_MULTI_KEY_EVENT__"
/** AUL public bundle value */
#define AUL_K_PRIVACY_APPID		"__AUL_PRIVACY_APPID__"
/** AUL public bundle value - To support Media key*/
#define AUL_V_KEY_PRESSED	"__AUL_KEY_PRESSED__"
/** AUL public bundle value - To support Media key*/
#define AUL_V_KEY_RELEASED	"__AUL_KEY_RELEASED__"
/** AUL public key - To support rua stat */
#define AUL_SVC_K_RUA_STAT_CALLER "__K_RUA_STAT_CALLER__"
#define AUL_SVC_K_RUA_STAT_TAG    "__K_RUA_STAT_TAG__"
/** AUL public key - To support rua delete */
#define AUL_K_RUA_PKGNAME "__K_RUA_PKGNAME"
/** AUL public key - To support rua delete */
#define AUL_K_RUA_APPPATH "__K_RUA_APPPATH"
/** AUL public key - To support rua add */
#define AUL_K_RUA_ARG "__K_RUA_ARG"
/** AUL public key - To support rua add */
#define AUL_K_RUA_TIME "__K_RUA_TIME"
/** AUL public bundle value */
#define AUL_K_RUA_INSTANCE_ID "__K_RUA_INSTANCE_ID"
/** AUL public bundle value */
#define AUL_K_RUA_INSTANCE_NAME "__K_RUA_INSTANCE_NAME"
/** AUL public bundle value */
#define AUL_K_RUA_ICON "__K_RUA_ICON"
/** AUL public bundle value */
#define AUL_K_RUA_URI "__K_RUA_URI"

/** AUL internal private key */
#define AUL_K_PKG_NAME		"__AUL_PKG_NAME__"
/** AUL internal private key */
#define AUL_K_WAIT_RESULT	"__AUL_WAIT_RESULT__"
/** AUL internal private key */
#define AUL_K_SEND_RESULT	"__AUL_SEND_RESULT__"
/** AUL internal private key */
#define AUL_K_TASK_MANAGE	"__AUL_TASK_MANAGE__"
/** AUL internal private key */
#define AUL_K_APP_TYPE		"__AUL_APP_TYPE__"
/** AUL internal private key - To check original caller's identity */
#define AUL_K_ORG_CALLER_PID	"__AUL_ORG_CALLER_PID__"
/** AUL internal private key - To check forwarded callee app's pid */
#define AUL_K_FWD_CALLEE_PID	"__AUL_FWD_CALLEE_PID__"
/** AUL internal private key */
#define AUL_K_NO_CANCEL        "__AUL_NO_CANCEL__"
/** AUL internal private key */
#define AUL_K_EXEC		"__AUL_EXEC__"
/** AUL internal private key */
#define AUL_K_MULTIPLE		"__AUL_MULTIPLE__"
/** AUL internal private key */
#define AUL_K_PACKAGETYPE	"__AUL_PACKAGETYPE__"
/** AUL internal private key */
#define AUL_K_HWACC		"__AUL_HWACC__"
/** AUL internal private key */
#define AUL_K_APPID		"__AUL_APPID__"
/** AUL internal private key */
#define AUL_K_PID		"__AUL_PID__"
/** AUL internal private key */
#define AUL_K_WID		"__AUL_WID__"
/** AUL internal private key */
#define AUL_K_LEADER_PID	"__AUL_LEADER_PID__"
/** AUL internal private key - To support data control */
#define AUL_K_DATA_CONTROL_TYPE   "__AUL_DATA_CONTROL_TYPE__"
/** AUL internal private key */
#define AUL_K_PKGID		"__AUL_PKGID_"
/** AUL internal private key */
#define AUL_K_INTERNAL_POOL "__AUL_INTERNAL_POOL__"
/** AUL internal private key */
#define AUL_TEP_PATH		"_AUL_TEP_PATH_"
/** AUL internal private key */
#define AUL_K_COMP_TYPE		"__AUL_COMP_TYPE__"
/** AUL internal private key */
#define AUL_K_LOADER_ID		"__AUL_LOADER_ID__"
/** AUL internal private key */
#define AUL_K_LOADER_PATH	"__AUL_LOADER_PATH__"
/** AUL internal private key */
#define AUL_K_LOADER_EXTRA	"__AUL_LOADER_EXTRA__"
/** AUL internal private key */
#define AUL_K_LOADER_NAME	"__AUL_LOADER_NAME__"
/** AUL internal private key */
#define AUL_K_WAYLAND_DISPLAY	"__AUL_WAYLAND_DISPLAY__"
/** AUL internal private key */
#define AUL_K_WAYLAND_WORKING_DIR "__AUL_WAYLAND_WORKING_DIR__"
/** AUL internal private key */
#define AUL_K_COM_SENDER_PID	"__AUL_COM_SENDER_PID__"
/** AUL internal private key */
#define AUL_K_COM_ENDPOINT	"__AUL_COM_ENDPOINT__"
/** AUL internal private key */
#define AUL_K_COM_PRIVILEGE	"__AUL_COM_PRIVILEGE__"
/** AUL internal private key */
#define AUL_K_COM_PROPAGATE	"__AUL_COM_PROPAGATE__"
/** AUL internal private key */
#define AUL_K_COM_FILTER	"__AUL_COM_FILTER__"
/** AUL internal private key */
#define AUL_K_COM_RESULT	"__AUL_COM_RESULT__"
/** AUL internal private key */
#define AUL_K_ROOT_PATH		"__AUL_ROOT_PATH__"
/** AUL internal private key */
#define AUL_K_SEQ_NUM		"__AUL_SEQ_NUM__"
/** AUL internal private key */
#define AUL_K_API_VERSION	"__AUL_API_VERSION__"
/** AUL internal private key */
#define AUL_K_ALLOWED_BG	"__AUL_ALLOWED_BG__"
/** AUL internal private key */
#define AUL_K_OWNER_PID		"__AUL_OWNER_PID__"
/** AUL internal private key */
#define AUL_K_CHILD_PID		"__AUL_CHILD_PID__"
/** AUL internal private key */
#define AUL_K_WIDGET_VIEWER	"__AUL_WIDGET_VIEWER__"
/** AUL internal private key */
#define AUL_K_WIDGET_ID		"__AUL_WIDGET_ID__"
/** AUL internal private key */
#define AUL_K_WIDGET_INSTANCE_ID	"__AUL_WIDGET_INSTANCE_ID__"
/** AUL internal private key */
#define AUL_K_WIDGET_STATUS		"__AUL_WIDGET_STATUS__"
/** AUL internal private key */
#define AUL_K_WIDGET_CONTENT_INFO	"__AUL_WIDGET_CONTENT_INFO__"
/** AUL internal private key */
#define AUL_K_TARGET_PID	"__AUL_TARGET_PID__"
/** AUL internal private key */
#define AUL_K_ALIAS_APPID	"__AUL_ALIAS_APPID__"
/** AUL internal private key */
#define AUL_K_ORG_APPID		"__AUL_ORG_APPID__"
/** AUL internal private key */
#define AUL_K_STATUS		"__AUL_STATUS__"
/** AUL internal private key */
#define AUL_K_IS_SUBAPP		"__AUL_IS_SUBAPP__"
/** AUL internal private key */
#define AUL_K_INSTANCE_ID	"__AUL_INSTANCE_ID__"
/** AUL internal private key */
#define AUL_K_ORG_CALLER_UID	"__AUL_ORG_CALLER_UID__"
/** AUL internal private key */
#define AUL_K_CHECKSUM		"__AUL_CHECKSUM__"
/** AUL internal private key */
#define AUL_K_PRIVATE		"__AUL_PRIVATE__"
/** AUL internal private key */
#define AUL_K_SCREEN_TYPE	"__AUL_SCREEN_TYPE__"
/** AUL internal private key */
#define AUL_K_VIEWER_REF	"__AUL_VIEWER_REF__"
/** AUL internal private key */
#define AUL_K_PARENT_APPID	"__AUL_PARENT_APPID__"
/** AUL internal private key */
#define AUL_K_CHILD_APPID	"__AUL_CHILD_APPID__"
/** AUL internal private key */
#define AUL_K_WIDGET_FAULT	"__AUL_WIDGET_FAULT__"


/**
 * @brief	This is callback function for aul_launch_init
 * @param[in]	type    event's type received from system
 * @param[in]	b	In case of RESET events, bundle which is received from peer
 * @param[in]	data	user-supplied data
 */
typedef int (*aul_handler_fn)(aul_type type, bundle *b, void *data);

/**
 * @par Description:
 *	This API install your AUL handler and setup AUL internal connection.
 * @par Purpose:
 *      AUL receive START(RESET), RESUME, TERMINATE events from system.\n
 *      This API use to handle the events. \n
 * @par Typical use case:
 *	In general, you need not use this API.
 *      If you use AppCore, you should NOT use this API.
 *      AppCore will set default aul_handler.
 *
 * @param[in]	handler		aul main callback handler function
 * @param[in]	data		user-supplied data for start_handler
 * @return	0 if success, negative value(<0) if fail\n
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ECANCELD	- aul handler was installed already by others
 * @retval	AUL_R_ECOMM	- error to create internal ipc
 * @retval	AUL_R_ERROR	- error to attach glib main loop
 *
 * @warning	If you use AppCore, you should NOT use this API.\n
 *		You need glib main loop.\n
 * @pre
 *	you must have aul handler to use this API.
 *	aul_luanch_init register aul handler.
 * @code
 * #include <aul.h>
 * #include <bundle.h>
 *
 * static int aul_handler(aul_type type, bundle *kb,void *data)
 * {
 *	switch(type)
 *      {
 *	        case AUL_START:
 *			// process RESET event
 *	                break;
 *		case AUL_RESUME:
 *	                // process RESUME event
 *		        break;
 *	        case AUL_TERMINATE:
 *		        // preocess TERMINATE event
 *	                break;
 *      }
 *      return 0;
 * }
 *
 * static GMainLoop *mainloop = NULL;
 *
 * int main(int argc, char **argv)
 * {
 *      aul_launch_init(aul_handler,NULL);
 *      aul_launch_argv_handler(argc, argv);
 *
 *      mainloop = g_main_loop_new(NULL, FALSE);
 *      g_main_loop_run(mainloop);
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
*/
int aul_launch_init(aul_handler_fn handler, void *data);

/**
 * @par Description:
 *	This API create internal RESET events with given argc, argv \n
 * @par Purpose:
 *      This API's purpose is to generate reset event.
 *      If you want to generate local RESET events with argument vector format, use this API
 * @par Typical use case:
 *	In general, you need not use this API.
 *	AppCore use this API to create internal reset event.
 *
 * @param[in]	argc	# of args
 * @param[in]	argv	list of arg strings
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ENOINIT	- aul handler was NOT yet installed
 * @retval	AUL_R_ECANCLED	- error to create internal bundle with given argc,argv.
 * @retval	AUL_R_ERROR	- general error
 *
 * @pre
 *	you must have aul handler to use this API.
 *	aul_luanch_init register aul handler.
 * @see
 *	aul_launch_init
 * @code
 * #include <aul.h>
 * #include <bundle.h>
 *
 * int send_local_reset_event()
 * {
 *	int argc=3;
 *	char* argv[4];
 *	argv[0] = "local.app";
 *	argv[1] = "event_type";
 *	argv[2] = "my_reset";
 *	argv[3] = NULL;
 *	aul_launch_argv_handler(argc,argv);
 * }
 *
 * @endcode
 * @remark
 *	If you use AppCore, you NEED NOT use this API.
 *	This API is only available in User Session.
*/
int aul_launch_argv_handler(int argc, char **argv);

/**
 * @par Description:
 *	This API creates internal RESET events with given bundle \n
 * @par Purpose:
 *  This API's purpose is to generate reset event.
 *  If you want to generate local RESET events with argument vector format, first use
 *  bundle_import_from_argv to create a bundle from the argument vector and then use this API
 *  Eventually, this API will replace aul_launch_argv_handler().
 * @par Typical use case:
 *	In general, you need not use this API.
 *	AppCore use this API to create internal reset event.
 *
 * @param[in]	b	bundle
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ENOINIT	- aul handler was NOT yet installed
 * @retval	AUL_R_ERROR	- general error
 *
 * @pre
 *	you must have aul handler to use this API.
 *	aul_luanch_init register aul handler.
 * @post
 *	None
 * @see
 *	aul_launch_init, bundle_import_from_argv
 * @code
 * #include <aul.h>
 * #include <bundle.h>
 *
 * int send_local_reset_event()
 * {
 *  bundle* b;
 *	int argc=3;
 *	char* argv[4];
 *	argv[0] = "local.app";
 *	argv[1] = "event_type";
 *	argv[2] = "my_reset";
 *	argv[3] = NULL;
 *
 *	b = bundle_import_from_argv(argc,argv);
 *	aul_launch_local(b);
 * }
 *
 * @endcode
 * @remark
 *      If you use AppCore, you NEED NOT to use this API.
 *	This API is only available in User Session.
*/
int aul_launch_local(bundle *b);

/**
 * @par Description:
 *	This API launches application with the given bundle.
 *  If the application is not running or a multiple-instance one, this API launches with the given bundle.
 *	If the application is running, this API sends a RESET event to the App.
 *	While the application is running, if the application cannot receive the RESET event,
 *	this API returns a general error(AUL_R_ERROR).\n
 * @par Purpose:
 *      This API is for caller.
 *      This API's purpose is to launch/reset application with given bundle.
 * @par Typical use case:
 *	If you know the target application's pkgname and bundle types,
 *	you can use this API to launch/reset the application.
 *
 * @param[in]	pkgname		package name to be run as callee
 * @param[in]	kb		bundle to be passed to callee
 * @return	callee's pid if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invaild package name
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error
 *
 * @see
 *	aul_open_app
 * @code
 * #include <aul.h>
 * #include <bundle.h>
 *
 * int launch_inhouse_contact_app()
 * {
 *	bundle *b;
 *	b = bundle_create();
 *	bundle_add(b,"type","SIM");
 *	aul_launch_app("org.tizen.contact",b);
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
 */
int aul_launch_app(const char *appid, bundle *kb);

/**
 * @par Description:
 *	This API launches application with the given bundle.
 *  If the application is not running or a multiple-instance one, this API launches with the given bundle.
 *	If the application is running, this API sends a RESET event to the App.
 *	While the application is running, if the application cannot receive the RESET event,
 *	this API returns a general error(AUL_R_ERROR).\n
 * @par Purpose:
 *      This API is for caller.
 *      This API's purpose is to launch/reset application with given bundle.
 * @par Typical use case:
 *	If you know the target application's pkgname and bundle types,
 *	you can use this API to launch/reset the application.
 *
 * @param[in]	pkgname		package name to be run as callee
 * @param[in]	kb		bundle to be passed to callee
 * @param[in]	uid		User ID to launch
 * @return	callee's pid if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invaild package name
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error
 *
 * @see
 *	aul_open_app
 * @remark
 *	This API is also available in System Session.
 */
int aul_launch_app_for_uid(const char *appid, bundle *kb, uid_t uid);

/**
 * @par Description:
 *  This API launches application, as menu screen launches the app.
 *  Thus, if the applocation is running, this API sends a RESUME event to the app.
 *  If the application is not running, this API launches the app.
 *  While the application is running, if the application cannot receive the RESUME event,
 *  AUL tries to raise the application's default window.
 *
 * @par Purpose:
 *      This API is for caller.
 *      This API's purpose is to resume/launch application
 * @par Typical use case:
 *	If you only want to show application with previous state or default state, Use this API.
 *
 * @param[in]	pkgname		package name to be resume as callee
 * @return	callee's pid if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invaild package name
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error
 *
 * @see
 *	aul_launch_app, aul_app_is_running, aul_resume_pid
 * @code
 * #include <aul.h>
 * #include <bundle.h>
 *
 * int open_inhouse_contact_app()
 * {
 *	if(aul_app_is_running("org.tizen.contact"))
 *		aul_open_app("org.tizen.contact");
 * }
 *
 * @endcode
 * @remark
 *	If you don't want to launch the app,
 *	you should check app's running state with aul_app_is_running.
 *	This API will launch the application if the application is not running.
 *	This API is only available in User Session.
*/
int aul_open_app(const char *appid);

/**
 * @par Description:
 *  This API launches application, as menu screen launches the app.
 *  Thus, if the applocation is running, this API sends a RESUME event to the app.
 *  If the application is not running, this API launches the app.
 *  While the application is running, if the application cannot receive the RESUME event,
 *  AUL tries to raise the application's default window.
 *
 * @par Purpose:
 *      This API is for caller.
 *      This API's purpose is to resume/launch application
 * @par Typical use case:
 *	If you only want to show application with previous state or default state, Use this API.
 *
 * @param[in]	pkgname		package name to be resume as callee
 * @param[in]	uid		User ID
 * @return	callee's pid if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invaild package name
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error
 *
 * @remark
 *	If you don't want to launch the app,
 *	you should check app's running state with aul_app_is_running.
 *	This API will launch the application if the application is not running.
 *	This API is only available to System user.
 */
int aul_open_app_for_uid(const char *appid, uid_t uid);

/**
 * @par Description:
 *	This API trigger to resume application
 * 	If the application is running, this API send a resume event to the App.
 *	If the application is not running, this API returns fail.
 *	Although the application is running, if the application cannot receive resume event,
 *	AUL try to raise the application's default windows.
 * @par Purpose:
 *      This API is for caller.
 *      This API's purpose is to send resume event.
 * @par Typical use case:
 *	If you only want to show application with previous state or default state, Use this API.
 *
 * @param[in]	pkgname		package name to be resume as callee
 * @return	callee's pid if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invaild package name
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error
 *
 * @see
 *	aul_launch_app, aul_app_is_running, aul_resume_pid
 * @deprecated
 *  This function will be deprecated. Use aul_open_add() instead.
 * @code
 * #include <aul.h>
 * #include <bundle.h>
 *
 * int resume_inhouse_contact_app()
 * {
 *	if(aul_app_is_running("org.tizen.contact"))
 *		aul_resume_app("org.tizen.contact");
 * }
 *
 * @endcode
 * @remark
 *	If you don't want to launch the app,
 *	you should check app's running state with aul_app_is_running.
 *	This API will launch the application if the application is not running.
 *	If you want to only resume without launching in multiple instance application model,
 *	you should use aul_resume_pid.
 *	This API is only available in User Session.
*/
int aul_resume_app(const char *appid);

/**
 * @par Description:
 *	This API trigger to resume application
 * 	If the application is running, this API send a resume event to the App.
 *	If the application is not running, this API returns fail.
 *	Although the application is running, if the application cannot receive resume event,
 *	AUL try to raise the application's default windows.
 * @par Purpose:
 *      This API is for caller.
 *      This API's purpose is to send resume event.
 * @par Typical use case:
 *	If you only want to show application with previous state or default state, Use this API.
 *
 * @param[in]	pkgname		package name to be resume as callee
 * @param[in]	uid		User ID
 * @return	callee's pid if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invaild package name
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error
 *
 * @remark
 *	If you don't want to launch the app,
 *	you should check app's running state with aul_app_is_running.
 *	This API will launch the application if the application is not running.
 *	If you want to only resume without launching in multiple instance application model,
 *	you should use aul_resume_pid.
 *	This API is only available to System user.
 */
int aul_resume_app_for_uid(const char *appid, uid_t uid);

/**
 * @par Description:
 *	This API trigger to resume application
 *	If the application is running, this API send a resume event to the App.
 *	If the application is not running, this API return AUL_R_ERROR.
 *	Although the application is running, if the application cannot receive resume event,
 *	AUL try to raise the application's default windows.
 * @par Purpose:
 *      This API is for caller.
 *      This API's purpose is to send resume event.
 * @par Typical use case:
 *	In multiple application model, If you want to only resume specific application, Use this API
 *
 * @param[in]	pid	application's pid to be resumed
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invaild pid
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error (include application is not running)
 * @warning	This API need to require root or inhouse permisssion \n
 *		If you have not the permission, this API return AUL_R_ERROR. \n
 * @see
 *	aul_launch_app
 * @code
 * #include <aul.h>
 * #include <bundle.h>
 *
 * int iterfunc(const aul_app_info *info, void *data)
 * {
 *	if(strcmp(info->pkg_name,"org.tizen.contact")==0)
 *		aul_resume_pid(info->pid);
 * }
 *
 * int iterate_running_apps()
 * {
 *      return aul_app_get_running_app_info(iterfunc,NULL);
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
*/
int aul_resume_pid(int pid);

/**
 * @par Description:
 *	This API trigger to resume application
 *	If the application is running, this API send a resume event to the App.
 *	If the application is not running, this API return AUL_R_ERROR.
 *	Although the application is running, if the application cannot receive resume event,
 *	AUL try to raise the application's default windows.
 * @par Purpose:
 *      This API is for caller.
 *      This API's purpose is to send resume event.
 * @par Typical use case:
 *	In multiple application model, If you want to only resume specific application, Use this API
 *
 * @param[in]	pid	application's pid to be resumed
 * @param[in]	uid	User ID
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invaild pid
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error (include application is not running)
 * @warning	This API need to require root or inhouse permisssion \n
 *		If you have not the permission, this API return AUL_R_ERROR. \n
 * @remark
 *	This API is only available to System user.
*/
int aul_resume_pid_for_uid(int pid, uid_t uid);

/**
 * @par Description:
 *	This API trigger to terminate application
 *
 *	If the application is running, this API send a terminate event to the App. \n
 *	If the app cannot receive the event, AUL kill forcely the application.\n
 * @par Purpose:
 *      This API's purpose is to kill application
 * @par Typical use case:
 *	In general, Application like Task Manager use this API.
 *
 *		This API need to require root or inhouse permisssion. \n
 *
 * @param[in]	pid	application's pid to be terminated
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invaild pid
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error
 * @warning	This API need to require root or inhouse permisssion. \n
 *
 * @code
 * #include <aul.h>
 * #include <bundle.h>
 *
 * int iterfunc(const aul_app_info *info, void *data)
 * {
 *	if(strcmp(info->pkg_name,"org.tizen.contact")==0)
 *		aul_terminate_pid(info->pid);
 * }
 *
 * int iterate_running_apps()
 * {
 *      return aul_app_get_running_app_info(iterfunc,NULL);
 * }
 *
 * @endcode
 * @remark
 *	If you have not the permission, this API return AUL_R_ERROR. \n
 *	This API is only available in User Session.
*/
int aul_terminate_pid(int pid);

/**
 * @par Description:
 *	This API trigger to terminate application
 *
 *	If the application is running, this API send a terminate event to the App. \n
 *	If the app cannot receive the event, AUL kill forcely the application.\n
 * @par Purpose:
 *      This API's purpose is to kill application
 * @par Typical use case:
 *	In general, Application like Task Manager use this API.
 *
 *		This API need to require root or inhouse permisssion. \n
 *
 * @param[in]	pid	application's pid to be terminated
 * @param[in]	uid	User ID
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invaild pid
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error
 * @warning	This API need to require root or inhouse permisssion. \n
 *
 * @remark
 *	If you have not the permission, this API return AUL_R_ERROR. \n
 *	This API is only available to System user.
 */
int aul_terminate_pid_for_uid(int pid, uid_t uid);

/**
 * @par Description:
 *	This API trigger to terminate application asynchronously
 *
 *	If the application is running, this API send a terminate event to the App. \n
 *	If the app cannot receive the event, AUL kill forcely the application.\n
 * @par Purpose:
 *      This API's purpose is to kill application
 * @par Typical use case:
 *	In general, Application like Task Manager use this API.
 *
 *		This API need to require root or inhouse permisssion. \n
 *
 * @param[in]	pid	application's pid to be terminated
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invaild pid
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error
 * @warning	This API need to require root or inhouse permisssion. \n
 * @remark
 *	If you have not the permission, this API return AUL_R_ERROR. \n
 *	This API is only available in User Session.
*/
int aul_terminate_pid_async(int pid);

/**
 * @par Description:
 *	This API trigger to terminate application asynchronously
 *
 *	If the application is running, this API send a terminate event to the App. \n
 *	If the app cannot receive the event, AUL kill forcely the application.\n
 * @par Purpose:
 *      This API's purpose is to kill application
 * @par Typical use case:
 *	In general, Application like Task Manager use this API.
 *
 *		This API need to require root or inhouse permisssion. \n
 *
 * @param[in]	pid	application's pid to be terminated
 * @param[in]	uid	User ID
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invaild pid
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error
 * @warning	This API need to require root or inhouse permisssion. \n
 * @remark
 *	If you have not the permission, this API return AUL_R_ERROR. \n
 *	This API is only available to System user.
 */
int aul_terminate_pid_async_for_uid(int pid, uid_t uid);

/**
 * @par Description:
 *	This API trigger to terminate application synchronously
 *
 *	If the application is running, this API sends a terminate event to the application. \n
 *	And then, this API waits until the application is terminated successfully. \n
 *	If the app cannot receive the event, AUL kill forcely the application. \n
 * @par Purpose:
 *      This API's purpose is to kill application
 * @par Typical use case:
 *	In general, Application like Task Manager use this API.
 *
 *		This API need to require root or platform level permisssion. \n
 *
 * @param[in]	pid	application's pid to be terminated
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invaild pid
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error
 * @warning	This API need to require root or platform level permisssion. \n
 * @remark
 *	If you have not the permission, this API return AUL_R_ERROR. \n
 *	This API is only available in User Session.
*/
int aul_terminate_pid_sync(int pid);

/**
 * @par Description:
 *	This API trigger to terminate application synchronously
 *
 *	If the application is running, this API send a terminate event to the application. \n
 *	And then, this API waits until the application is terminated successfully. \n
 *	If the app cannot receive the event, AUL kill forcely the application. \n
 * @par Purpose:
 *      This API's purpose is to kill application
 * @par Typical use case:
 *	In general, Application like Task Manager use this API.
 *
 *		This API need to require root or platform level permisssion. \n
 *
 * @param[in]	pid	application's pid to be terminated
 * @param[in]	uid	User ID
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invaild pid
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error
 * @warning	This API need to require root or platform level permisssion. \n
 * @remark
 *	If you have not the permission, this API return AUL_R_ERROR. \n
 *	This API is only available to System user.
 */
int aul_terminate_pid_sync_for_uid(int pid, uid_t uid);

/**
 *@brief Running application's information structure retrieved by AUL
 */
typedef struct _aul_app_info {
	int pid;		/**< app's pid if running*/
	char *pkg_name;		/**< application id */
	char *app_path;		/**< application excutable path */
	char *appid;
	char *pkgid;		/**< package id */
	int status;		/**< app's status */
	int is_sub_app;		/**< state whether sub app of app group */
	char *instance_id;
} aul_app_info;

/**
 * @brief iterator function running with aul_app_get_running_app_info
 * @param[out]	ainfo   aul_app_info retreived by aul_app_get_running_app_info
 * @param[out]	data	user-supplied data
*/
typedef int (*aul_app_info_iter_fn)(const aul_app_info *ainfo, void *data);

/**
 * @par Description:
 *	This API ask a application is running by application package name.
 * @par Purpose:
 *	To know whether some application is running or not, use this API
 * @par Typical use case:
 *	For example, If you want to know browser application running,
 *	you can check it by using this API.
 *
 * @param[in]	pkgname	application package name
 * @return	true / false
 * @retval	1	app_name is running now.
 * @retval	0	app_name is NOT running now.
 *
 * @code
 * #include <aul.h>
 *
 * int is_running_browser_app()
 * {
 *      return aul_app_is_running("org.tizen.browser");
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
 *
 */
int aul_app_is_running(const char *appid);

/**
 * @par Description:
 *	This API ask a application is running by application package name.
 * @par Purpose:
 *	To know whether some application is running or not, use this API
 * @par Typical use case:
 *	For example, If you want to know browser application running,
 *	you can check it by using this API.
 *
 * @param[in]	pkgname	application package name
 * @param[in]	uid	User ID
 * @return	true / false
 * @retval	1	app_name is running now.
 * @retval	0	app_name is NOT running now.
 *
 * @endcode
 * @remark
 *	This API is only available to System User.
 */
int aul_app_is_running_for_uid(const char *appid, uid_t uid);

/**
 * @par Description:
 *	This API use to get running application list.
 *	This API call iter_fn with each aul_app_info of running apps when running application is found.
 * @par Purpose:
 *	If you want to get running application list, use this API
 * @par Typical use case:
 *	In general, this API is used by task manager appllication. (running application list viewer)
 *
 * @param[in]	iter_fn		iterator function
 * @param[in]	user_data	user-supplied data for iter_fn
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- internal error
 *
 * @code
 * #include <aul.h>
 *
 * int iterfunc(const aul_app_info* info, void* data)
 * {
 *	printf("\t==========================\n");
 *	printf("\t pkg_name: %s\n", info->appid);
 *	printf("\t app_path: %s\n", info->app_path);
 *	printf("\t running pid: %d\n", info->pid);
 *	printf("\t==========================\n");
 *	return 0;
 * }
 *
 * int iterate_running_apps()
 * {
 *      return aul_app_get_running_app_info(iterfunc,NULL);
 * }
 *
 * @endcode
 * @remark
 *	This API should use if you want to know running application which has desktop files.
 *	If you want to get all process list, you must iterate process information by using proc filesystem
 *	Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
 *	This API is only available in User Session.
 */
int aul_app_get_running_app_info(aul_app_info_iter_fn iter_fn, void *user_data);

/**
 * @par Description:
 *	This API use to get running application list.
 *	This API call iter_fn with each aul_app_info of running apps when running application is found.
 * @par Purpose:
 *	If you want to get running application list, use this API
 * @par Typical use case:
 *	In general, this API is used by task manager appllication. (running application list viewer)
 *
 * @param[in]	iter_fn		iterator function
 * @param[in]	user_data	user-supplied data for iter_fn
 * @param[in]	uid		User ID
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- internal error
 *
 * @remark
 *	This API should use if you want to know running application which has desktop files.
 *	If you want to get all process list, you must iterate process information by using proc filesystem
 *	Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
 *	This API is only available to System user.
 */
int aul_app_get_running_app_info_for_uid(aul_app_info_iter_fn iter_fn, void *user_data, uid_t uid);

/**
 * @par Description:
 *	This API use to get all running application list, including sub app.
 *	This API call iter_fn with each aul_app_info of running apps when running application is found.
 * @par Purpose:
 *	If you want to get all running application list, use this API
 * @par Typical use case:
 *	In general, this API is used by task manager application. (running application list viewer)
 *
 * @param[in]	iter_fn		iterator function
 * @param[in]	user_data	user-supplied data for iter_fn
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- internal error
 *
 * @code
 * #include <aul.h>
 *
 * int iterfunc_status(const aul_app_info *info, void *data)
 * {
 *	printf("\t==========================\n");
 *	printf("\t pid: %d\n", info->pid);
 *	printf("\t appid: %s\n", info->appid);
 *	printf("\t app_path: %s\n", info->app_path);
 *	printf("\t pkgid: %s\n", info->pkgid);
 *	printf("\t status: %d\n", info->status);
 *	printf("\t is_sub_app : %d\n", info->is_sub_app);
 *	printf("\t==========================\n");
 *	return 0;
 * }
 *
 * int iterate_running_apps()
 * {
 *      return aul_app_get_all_running_app_info(iterfunc_status,NULL);
 * }
 *
 * @endcode
 * @remark
 *	This API should use if you want to know running application which has desktop files.
 *	If you want to get all process list, you must iterate process information by using proc filesystem
 *	Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
 *	This API is only available in User Session.
 */
int aul_app_get_all_running_app_info(aul_app_info_iter_fn iter_fn, void *user_data);

/**
 * @par Description:
 *	This API use to get all running application list, including sub app.
 *	This API call iter_fn with each aul_app_info of running apps when running application is found.
 * @par Purpose:
 *	If you want to get all running application list, use this API
 * @par Typical use case:
 *	In general, this API is used by task manager application. (running application list viewer)
 *
 * @param[in]	iter_fn		iterator function
 * @param[in]	user_data	user-supplied data for iter_fn
 * @param[in]	uid		User ID
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- internal error
 *
 * @remark
 *	This API should use if you want to know running application which has desktop files.
 *	If you want to get all process list, you must iterate process information by using proc filesystem
 *	Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
 *	This API is only available to System user.
 */
int aul_app_get_all_running_app_info_for_uid(aul_app_info_iter_fn iter_fn, void *user_data, uid_t uid);

/**
 * @par Description:
 *	This API get application package name by pid
 * @par Purpose:
 *	If you want to get package name of running application, use this API
 * @par Typical use case:
 *	In general, You can use this API when you want to know caller's information.
 *
 * @param[in]	pid		given pid
 * @param[out]	pkgname		pkgname to be get
 * @param[in]	len		length of pkgname
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- no such a package name
 * @code
 * #include <aul.h>
 * #include <bundle.h>
 *
 * static int app_reset(bundle *b, void *data)
 * {
 *	int pid;
 * 	char appname[255];
 *
 * 	pid = atoi(bundle_get_val(b,AUL_K_CALLER_PID));
 *	aul_app_get_pkgname_bypid(pid, appname, sizeof(appname));
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
*/
int aul_app_get_pkgname_bypid(int pid, char *pkgname, int len);

/**
 * @par Description:
 *	This API get application pkgid by pid
 * @par Purpose:
 *	If you want to get pkgid of running application, use this API
 * @par Typical use case:
 *	In general, You can use this API when you want to know caller's information.
 *
 * @param[in]	pid		given pid
 * @param[out]	pkgid		package id
 * @param[in]	len		length of pkgid
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- no such a appid
 *
 * @code
 * #include <aul.h>
 * #include <bundle.h>
 *
 * static int app_reset(bundle *b, void *data)
 * {
 *	int pid;
 * 	char pkgid[255];
 *
 * 	pid = atoi(bundle_get_val(b, AUL_K_CALLER_PID));
 *	aul_app_get_pkgid_bypid(pid, pkgid, sizeof(pkgid));
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
*/
int aul_app_get_pkgid_bypid(int pid, char *pkgid, int len);

/**
 * @par Description:
 *	This API get application pkgid by pid
 * @par Purpose:
 *	If you want to get pkgid of running application, use this API
 * @par Typical use case:
 *	In general, You can use this API when you want to know caller's information.
 *
 * @param[in]	pid		given pid
 * @param[out]	pkgid		package id
 * @param[in]	len		length of pkgid
 * @param[in]	uid		User ID
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- no such a appid
 *
 * @remark
 *	This API is also available to System user.
*/
int aul_app_get_pkgid_bypid_for_uid(int pid, char *pkgid, int len, uid_t uid);

/**
 * @par Description:
 *	This API get application appid by pid
 * @par Purpose:
 *	If you want to get appid of running application, use this API
 * @par Typical use case:
 *	In general, You can use this API when you want to know caller's information.
 *
 * @param[in]	pid		given pid
 * @param[out]	appid		application id
 * @param[in]	len		length of pkgname
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- no such a appid
 * @code
 * #include <aul.h>
 * #include <bundle.h>
 *
 * static int app_reset(bundle *b, void *data)
 * {
 *	int pid;
 * 	char appid[255];
 *
 * 	pid = atoi(bundle_get_val(b,AUL_K_CALLER_PID));
 *	aul_app_get_appid_bypid(pid, appid, sizeof(appid));
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
*/
int aul_app_get_appid_bypid(int pid, char *appid, int len);

/**
 * @par Description:
 *	This API get application appid by pid
 * @par Purpose:
 *	If you want to get appid of running application, use this API
 * @par Typical use case:
 *	In general, You can use this API when you want to know caller's information.
 *
 * @param[in]	pid		given pid
 * @param[out]	appid		application id
 * @param[in]	len		length of pkgname
 * @param[in]	uid		User ID
 * @return	0 if success, negative value(<0) if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- no such a appid
 * @remark
 *	This API is also available to System user.
*/
int aul_app_get_appid_bypid_for_uid(int pid, char *appid, int len, uid_t uid);

/**
 * @par Description:
 *	This API launch application associated with given filename
 * @par Purpose:
 *      This API is for caller.
 *	This API launch application based on mime type.
 *	This API find mime_type associated with file name,
 *	and then find default app associated with found mime_type
 *	and then launch the app with filename argument.
 * @par Typical use case:
 *	You can launch application to process given filename.
 *	That is, Even if you don't know the specific application's pkgname,
 *	you can launch the applicaiton processing given filename .
 *	For example, If you want to process image file, you can simply launch image viewer.
 *	At that time, you can use this APIs like aul_open_file("myimage.jpg");
 *
 * @param[in]	filename	filename
 * @return	callee's pid or 0 if success, negative value if fail\n
 *              (when no found default app, return 0)
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invalid argument(filename)
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error
 *
 * @code
 * #include <aul.h>
 *
 * int view_image_file(char *filename)
 * {
 *      aul_open_file(filename);
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
 *
 */
int aul_open_file(const char* filename);

/**
 * @par Description:
 *	This API launch application associated with given specific mimetype
 * @par Purpose:
 *      This API is for caller.
 *	This API launch application based on mime type like aul_open_file API.
 *	But, This API don't find mime_type associated with file name.
 *	This API use mimetype given by user. By using given mimetype, find default application.
 *	and then launch the app with filename argument.
 * @par Typical use case:
 *	Some files cannot extract exact mimetype automatically.
 *	For example, To know mime type of files with DRM lock, first we should unlock DRM file.
 *	In this case, You can use this API.
 *	First, unlock DRM file, and extract mimetype from unlock file by using aul_get_mime_from_file,
 *	and then, use this API with DRM file and extracted mime type.
 *
 * @param[in]	filename	filename
 * @param[in]	mimetype	specific mimetype
 * @return	callee's pid or 0 if success, negative value if fail\n
 *              (when no found default app, return 0)
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invalid argument(filename,mimetype)
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error
 *
 * @see
 *	aul_open_file, aul_get_mime_from_file
 * @code
 * #include <aul.h>
 *
 * int view_drm_image_file(char *drm_filename)
 * {
 *	char* mimetype;
 *	// you must implement this function
 *	mimetype = get_mimetype_from_drmfile(drm_filename);
 *
 *      aul_open_file_with_mimetype(drm_filename,mimetype);
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
 */
int aul_open_file_with_mimetype(const char *filename, const char *mimetype);

/**
 * @par Description:
 *	This API launch application associated with content like "http://www.samsung.com"
 * @par Purpose:
 *      This API is for caller.
 *	This API launch application based on mime type.
 *	This API find mime_type associated with content,
 *	and then find default app associated with found mime_type,
 *	and then launch the app with content argument.
 * @par Typical use case:
 *	You can launch application to process given content.
 *	That is, Even if you don't know the specific application's pkgname,
 *	you can launch the applicaiton processing given content.
 *	For example, If you want to process URL "http://www.samsung.com",
 *	you can simply launch browser.
 *	At that time, you can use this APIs like aul_open_content("http://www.samsung.com");
 *
 * @param[in]   content		content
 * @return	callee's pid or 0 if success, negative value if fail\n
 *              (when no found default app, return 0)
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invalid argument(content)
 * @retval	AUL_R_ECOM	- internal AUL IPC error
 * @retval	AUL_R_ERROR	- general error or no found mimetype
 *
 * @code
 * #include <aul.h>
 *
 * int view_url(char *url)
 * {
 *      aul_open_content(url);
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
 *
 */
int aul_open_content(const char* content);

/**
 * @par Description:
 *	 This API get the default application(appid) associated with MIME type
 * @par Purpose:
 *	This API use to get default application associteted with mimetype
 *	In general, Setting Application need this API.
 * @par Typical use case:
 *	Setting Application show mapping of default application / mimetype
 *
 * @param[in]	mimetype	a mime type
 * @param[out]	defapp		a application appid of the app
 * @param[in]	len		length of defapp
 * @return	0 if success, negative value if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invalid argument(mimetype)
 * @retval	AUL_R_ERROR	- general error or no found mimetype
 *
 * @see
 *	aul_set_defapp_with_mime
 * @code
 * #include <aul.h>
 *
 * void get_text_html_defapp()
 * {
 *	char appname[255];
 *	aul_get_defapp_from_mime("text/html",appname,sizeof(appname));
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
 *
 */
int aul_get_defapp_from_mime(const char *mimetype, char *defapp, int len);

/**
 * @par Description:
 *	 This API set the default application(appid) associated with MIME type
 * @par Purpose:
 *	This API use to change default application associteted with mimetype
 *	In general, Setting Application or Installer need this API.
 * @par Typical use case:
 *	Default Application associated with mimetype can be changed by Setting Application or installer
 *	So, application to process specific mimetype can be substituted.
 *
 * @param[in]	mimetype	a mime type
 * @param[in]	defapp		a application appid of the app to be set
 * @return	0 if success, negative value if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invalid argument(mimetype)
 * @retval	AUL_R_ERROR	- general error
 *
 * @see
 *	aul_get_defapp_from_mime
 * @code
 * #include <aul.h>
 *
 * void set_text_html_defapp()
 * {
 *	aul_set_defapp_with_mime("text/html","org.tizen.browser");
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
*/
int aul_set_defapp_with_mime(const char *mimetype, const char *defapp);

/**
 * @par Description:
 *	This API get the mimetype associated with filename
 * @par Purpose:
 *	This API use to get mimetype associteted with given filename
 *	In general, This API use when you want to know only mimetype given filename.
 * @par Typical use case:
 *	For example, In trasfering data through bluetooth,
 *	additional information like mimetype should be added.
 *	In such situation, You can get mimetype by using this API.
 *
 * @param[in]	filename	file name
 * @param[out]	mimetype	a mime type
 * @param[in]	len		length of mimetype
 * @return	0 if success, negative value if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invalid argument(filename)
 * @retval	AUL_R_ERROR	- general error
 *
 * @code
 * #include <aul.h>
 *
 * void get_mimetype()
 * {
 *	char mimetype[255];
 *	aul_get_mime_from_file("image.jpg",mimetype,sizeof(mimetype));
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
 */
int aul_get_mime_from_file(const char *filename, char *mimetype, int len);

/**
 * @par Description:
 *	This API get the mimetype associated with given content
 * @par Purpose:
 *	This API use to get mimetype associteted with given content
 *	In general, This API use when you want to know only mimetype given content
 * @par Typical use case:
 *	For example, In trasfering data through bluetooth,
 *	additional information like mimetype should be added.
 *	In such situation, You can get mimetype by using this API.
 *
 * @param[in]	content		content string like "011-0000-0000"
 * @param[out]	mimetype	a mime type
 * @param[in]	len		length of mimetype
 * @return	0 if success, negative value if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invalid argument(content)
 * @retval	AUL_R_ERROR	- general error
 *
 * @code
 * #include <aul.h>
 *
 * void get_mimetype()
 * {
 *	char mimetype[255];
 *	aul_get_mime_from_content("http://www.samsung.com",mimetype,sizeof(mimetype));
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
*/
int aul_get_mime_from_content(const char *content, char *mimetype, int len);

/**
 * @par Description:
 *	This API get the icon's name associated with given mimetype
 * @par Purpose:
 *	This API use to get icon's name associteted with given mimetype
 * @par Typical use case:
 *	If you want to show mimetype's icon, use this API.
 *
 * @param[in]	mimetype	a mime type
 * @param[out]	iconname	icon's name
 * @param[in]	len		length of iconname
 * @return	0 if success, negative value if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invalid argument(content)
 * @retval	AUL_R_ERROR	- general error (no such mime type)
 *
 * @code
 * #include <aul.h>
 *
 * void get_mime_icon()
 * {
 *	char icon[255];
 *	aul_get_mime_icon("text/html",icon,sizeof(icon));
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
 */
int aul_get_mime_icon(const char *mimetype, char *iconname, int len);

/**
 * @par Description:
 *	This API get the extensions associated with given mimetype
 * @par Purpose:
 *	This API use to get extensions associteted with given mimetype
 * @par Typical use case:
 *	In general, user is not familiar with mimetype(text/html),
 *	user is familiar with extenstions(*.html, *.htm)
 *	So, To show mimetype information to user, use this API
 *
 * @param[in]	mimetype	a mime type
 * @param[out]	extlist		extentions (ex> mpeg,mpg,mpe)
 * @param[in]	len		length of extlist
 * @return	0 if success, negative value if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invalid argument(mimetype)
 * @retval	AUL_R_ERROR	- general error (no mimetype or no extenstion)
 *
 * @see
 *	aul_get_mime_description
 * @code
 * #include <aul.h>
 *
 * void get_extension()
 * {
 *	char extlist[255];
 *	aul_get_mime_extension("text/html",extlist,sizeof(extlist));
 * }
 *
 * @endcode
 * @remark
 *	Some mimetype don't have extension.
 *	In that case, You can use aul_get_mime_description.
 *	This API is only available in User Session.
*/
int aul_get_mime_extension(const char *mimetype, char *extlist, int len);

/**
 * @par Description:
 *	This API get the description associated with given mimetype
 * @par Purpose:
 *	This API use to get description associteted with given mimetype
 * @par Typical use case:
 *	In general, user is not familiar with mimetype(text/html),
 *	user is familiar with well-knowing information like extenstions(*.html, *.htm)
 *	But, some mimetype don't have extenstion.
 *	At that time,to show mimetype information to user, use this API
 *
 * @param[in]	mimetype	a mime type
 * @param[out]	desc		description (ex> Call client)
 * @param[in]	len		length of desc
 * @return	0 if success, negative value if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_EINVAL	- invalid argument(mimetype)
 * @retval	AUL_R_ERROR	- general error (no mimetype or no descrition)
 *
 * @see
 *	aul_get_mime_extension
 * @code
 * #include <aul.h>
 *
 * void get_information_from_mime()
 * {
 *	char info[255];
 *	if(aul_get_mime_extension("text/html",info,sizeof(info))<0){
 *		aul_get_mime_description("text/html",info,sizeof(info));
 *	}
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
 */
int aul_get_mime_description(const char *mimetype, char *desc, int len);

/**
 * @par Description:
 *	This API create service result bundle based on bundle received in reset event.
 * @par Purpose:
 *	This API use to create result bundle to send it to caller.
 * @par Typical use case:
 *	This API is for callee which provide application service.\n
 *      To send result to caller, You must create result bundle. \n
 *      Callee(application providing the service) can send result by using this API and aul_send_service_result.
 *
 * @param[in]   inb             bundle received in reset event
 * @param[out]  outb            bundle to use for returning result
 * @return      0 if success, negative value(<0) if fail
 * @retval      AUL_R_OK        - success
 * @retval      AUL_R_EINVAL    - inb is not bundle created by aul_open_service
 * @retval      AUL_R_ERROR     - general error
 *
 * @pre
 *	To create result bundle, You need received original bundle.
 *	The original bundle can get from app_reset handler.
 * @post
 *	None
 * @see
 *	aul_send_service_result
 * @code
 * #include <aul.h>
 * #include <bundle.h>
 *
 * int app_reset(bundle *b, void *data)
 * {
 *      ad->recved_bundle = bundle_dup(b);
 * }
 *
 * int click_ok()
 * {
 *      bundle* res_bundle;
 *      aul_create_result_bundle(ad->recved_bundle,&res_bundle);
 *      bundle_add(res_bundle, "result", "1");
 *      aul_send_service_result(res_bundle);
 * }
 * @endcode
 * @remark
 *	This API is only available in User Session.
 *
 */
int aul_create_result_bundle(bundle *inb, bundle **outb);

/**
 * @par Description:
 *	This API send service result to caller with bundle
 * @par Purpose:
 *	This API is used to send result bundle to caller.
 * @par Typical use case:
 *	This API is for callee which provide application service.\n
 *      To send result to caller, You can use this API after creating result bundle. \n
 *      Callee(application to provide service) can send result by using this API and aul_create_result_bundle.
 *
 * @param[in]   b      Result data in bundle format
 * @return      0 if success, negative value(<0) if fail
 * @retval      AUL_R_OK        - success
 * @retval      AUL_R_EINVAL    - invalid result bundle
 * @retval      AUL_R_ECOMM     - internal AUL IPC error
 * @retval      AUL_R_ERROR     - general error
 *
 * @pre
 *	To send result bundle, You must create result bundle.
 *      see aul_create_result_bundle
 * @post
 *	None
 * @see
 *	aul_create_result_bundle
 * @code
 * #include <aul.h>
 * #include <bundle.h>
 *
 * int app_reset(bundle *b, void *data)
 * {
 *      ad->recved_bundle = bundle_dup(b);
 * }
 *
 * int click_ok()
 * {
 *      bundle* res_bundle;
 *      aul_create_result_bundle(ad->recved_bundle,&res_bundle);
 *      bundle_add(res_bundle, "result", "1");
 *      aul_send_service_result(res_bundle);
 * }
 * @endcode
 * @remark
 *	This API is only available in User Session.
 *
 */
int aul_send_service_result(bundle *b);

/**
 * @par Description:
 *	This API sets callback fuction that will be called when applications die.
 * @par Purpose:
 *	This API's purpose is to listen the application dead event.
 *	In general, task manager Application need this API.
 *
 * @param[in]	func		callback function
 * @param[in]	data		user data
 * @return	0 if success, negative value if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- general error
 *
 * @see
 *	aul_listen_app_launch_signal
 * @code
 * #include <aul.h>
 *
 * int app_dead_handler(int pid, void *data)
 * {
 * 	printf("===> %s : %d\n", __FUNCTION__, pid);
 * 	return 0;
 * }
 *
 * void dead_listen()
 * {
 *	aul_listen_app_dead_signal(app_dead_handler, NULL);
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
 *
 */
int aul_listen_app_dead_signal(int (*func) (int, void *), void *data);

/**
 * @par Description:
 *	This API sets callback fuction that will be called when applications are launched.
 * @par Purpose:
 *	This API's purpose is to listen the application launching event.
 *	In general, task manager Application need this API.
 *
 * @param[in]	func		callback function
 * @param[in]	data		user data
 * @return	0 if success, negative value if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- general error
 *
 * @see
 *	aul_listen_app_dead_signal
 * @code
 * #include <aul.h>
 *
 * int app_launch_handler(int pid, void *data)
 * {
 * 	printf("===> %s : %d\n", __FUNCTION__, pid);
 * 	return 0;
 * }
 *
 * void dead_listen()
 * {
 *	aul_listen_app_launch_signal(app_launch_handler, NULL);
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
 *
 */
int aul_listen_app_launch_signal(int (*func) (int, void *), void *data);

/**
 * @par Description:
 *	This API sets callback fuction that will be called when applications are launched.
 * @par Purpose:
 *	This API's purpose is to listen the application launching event.
 *	In general, task manager Application need this API.
 *
 * @param[in]	func		callback function
 * @param[in]	data		user data
 * @return	0 if success, negative value if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- general error
 *
 * @see
 *	aul_listen_app_dead_signal
 * @code
 * #include <aul.h>
 *
 * int app_launch_handler(int pid, const char *app_id, void *data)
 * {
 * 	printf("===> %s : %d, %s\n", __FUNCTION__, pid, app_id);
 * 	return 0;
 * }
 *
 * void dead_listen()
 * {
 *	aul_listen_app_launch_signal(app_launch_handler, NULL);
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
 *
 */
int aul_listen_app_launch_signal_v2(int (*func) (int, const char *, void *), void *data);

/**
 * @par Description:
 *	This API gets status of specified application process id.
 * @par Purpose:
 *	This API's purpose is to get the application's status.
 *
 * @param[in]	pid	pid of application
 * @return	0 or greater if success, nagative value if fail
 * @retval	STATUS_LAUNCHING
 * @retval	STATUS_VISIBLE
 * @retval	STATUS_BG
 * @retval	STATUS_DYING
 * @retval	STATUS_NORESTART
 * @see
 *	aul_status_update
 * @code
 * #include <aul.h>
 *
 * int iterfunc(const aul_app_info *info, void *data)
 * {
 *	int status;
 *	status = aul_app_get_status_bypid(info->pid);
 *	if (status == STATUS_VISIBLE) {
 *		printf("%s has focus", info->app_id);
 *		(int *)data = info->pid;
 *		return -1;
 *	}
 *	return 0;
 * }
 *
 * int find_focus_app_pid()
 * {
 *	int pid = 0;
 *	aul_app_get_running_app_info(iterfunc, &pid);
 *	return pid;
 * }
 * @endcode
 * @remark
 *	This API is only available in User Session.
 */
int aul_app_get_status_bypid(int pid);

/**
 * @par Description:
 *	This API gets status of specified application process id.
 * @par Purpose:
 *	This API's purpose is to get the application's status.
 *
 * @param[in]	pid	pid of application
 * @param[in]	uid	User ID
 * @return	0 or greater if success, nagative value if fail
 * @retval	STATUS_LAUNCHING
 * @retval	STATUS_VISIBLE
 * @retval	STATUS_BG
 * @retval	STATUS_DYING
 * @retval	STATUS_NORESTART
 *
 * @remark
 *	This API is only available to System user.
 */
int aul_app_get_status_bypid_for_uid(int pid, uid_t uid);

/**
 * @par Description:
 *	This API gets the status of specified application id.
 * @par Purpose:
 *	This API's purpose is to get the status of the application.
 *
 * @param[in]	appid	application ID
 * @return	0 or greater if success, nagative value if fail
 * @retval	STATUS_LAUNCHING
 * @retval	STATUS_FOCUS
 * @retval	STATUS_VISIBLE
 * @retval	STATUS_BG
 * @retval	STATUS_DYING
 * @retval	STATUS_NORESTART
 * @see
 *	aul_status_update
 * @code
 * #include <aul.h>
 *
 * int func(void)
 * {
 *	int status;
 *
 *	status = aul_app_get_status("org.tizen.helloworld");
 *	if (status == STATUS_FOCUS)
 *		printf("org.tizen.helloworld has focus");
 *
 *	return 0;
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
 */
int aul_app_get_status(const char *appid);

/**
 * @par Description:
 *	This API gets the status of specified application id.
 * @par Purpose:
 *	This API's purpose is to get the status of the application
 *
 * @param[in]	appid	application ID
 * @param[in]	uid	User ID
 * @return	0 or greater if success, nagative value if fail
 * @retval	STATUS_LAUNCHING
 * @retval	STATUS_FOCUS
 * @retval	STATUS_VISIBLE
 * @retval	STATUS_BG
 * @retval	STATUS_DYING
 * @retval	STATUS_NORESTART
 *
 * @remark
 *	This API is only available to System user.
 */
int aul_app_get_status_for_uid(const char *appid, uid_t uid);

/**
 * @par Description
 * 	This API sets callback function that on application status changed.
 * @par Purpose:
 *	This API's purpose is to listen the application's status changed within
 *	the caller process. In general, a library that required to release resource on
 *	application's status may use this API.
 *
 * @param[in]	func	callback function
 * @param[in]	data	user data
 * @return	0 if success, negative value if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- general error
 * @see
 *	aul_remove_status_local_cb
 * @code
 * #include <aul.h>
 *
 * int status_changed(int status, void *data)
 * {
 *	if (status == STATUS_VISIBLE)
 *		printf("%d resume\n", getpid());
 *
 *	if (status == STATUS_BG)
 *		printf("%d pause\n", getpid());
 * }
 *
 * void listen_app_status()
 * {
 *	aul_add_status_local_cb(status_changed, NULL);
 * }
 * @endcode
 * @remark
 *	This API is only available in User Session.
 *
 */
int aul_add_status_local_cb(int (*func) (int, void *), void *data);

/**
 * @par Description
 * 	This API unsets callback function that on application status changed.
 * @par Purpose:
 *	This API's purpose is to remove callback that added by
 *	aul_add_status_local_cb.
 *
 * @param[in]	func	callback function
 * @param[in]	data	user data
 * @return	0 if success, negative value if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- general error
 *
 * @see
 *	aul_add_status_local_cb
 * @code
 * #include <aul.h>
 *
 * int status_changed(int status, void *data)
 * {
 *	if (status == STATUS_VISIBLE)
 *		printf("%d resume\n", getpid());
 *
 *	if (status == STATUS_BG)
 *		printf("%d pause\n", getpid());
 * }
 *
 * void listen_app_status()
 * {
 *	aul_add_status_local_cb(status_changed, NULL);
 * }
 *
 * void ignore_app_status()
 * {
 *	aul_remove_status_local_cb(status_changed, NULL);
 * }
 *
 * @endcode
 * @remark
 *	This API is only available in User Session.
 *
 */
int aul_remove_status_local_cb(int (*func) (int, void *), void *data);

/*
 * This API is only for appfw internally.
 */
int aul_set_process_group(int parent_pid, int child_pid);

/*
 * This API is only for Appfw internally.
 */
int aul_terminate_bgapp_pid(int pid);

/*
 * This API is only for Appfw internally.
 */
int aul_terminate_pid_without_restart(int pid);

/*
 * This API is only for Appfw internally.
 */
int aul_terminate_pid_sync_without_restart(int pid);

/*
 * This API is only for Appfw internally.
 */
int aul_terminate_pid_sync_without_restart_for_uid(int pid, uid_t uid);

/*
 * This API is only for Appfw internally.
 */
const char *aul_get_app_external_root_path(void);

/*
 * This API is only for Appfw internally.
 */
const char *aul_get_app_root_path(void);

/*
 * This API is only for Appfw internally.
 */
const char *aul_get_app_data_path(void);

/*
 * This API is only for Appfw internally.
 */
const char *aul_get_app_cache_path(void);

/*
 * This API is only for Appfw internally.
 */
const char *aul_get_app_resource_path(void);

/*
 * This API is only for Appfw internally.
 */
const char *aul_get_app_tep_resource_path(void);

/*
 * This API is only for Appfw internally.
 */
int aul_get_app_shared_data_path(char **path);

/*
 * This API is only for Appfw internally.
 */
const char *aul_get_app_shared_resource_path(void);

/*
 * This API is only for Appfw internally.
 */
const char *aul_get_app_shared_trusted_path(void);

/*
 * This API is only for Appfw internally.
 */
const char *aul_get_app_external_data_path(void);

/*
 * This API is only for Appfw internally.
 */
const char *aul_get_app_external_cache_path(void);

/*
 * This API is only for Appfw internally.
 */
const char *aul_get_app_external_shared_data_path(void);

/*
 * This API is only for Appfw internally.
 */
const char *aul_get_app_specific_path(void);

/*
 * This API is only for Appfw internally.
 */
int aul_get_app_shared_data_path_by_appid(const char *app_id, char **path);

/*
 * This API is only for Appfw internally.
 */
int aul_get_app_shared_resource_path_by_appid(const char *app_id, char **path);

/*
 * This API is only for Appfw internally.
 */
int aul_get_app_shared_trusted_path_by_appid(const char *app_id, char **path);

/*
 * This API is only for Appfw internally.
 */
int aul_get_app_external_shared_data_path_by_appid(const char *app_id, char **path);

/*
 * This API is only for Appfw internally.
 */
int aul_get_usr_app_shared_data_path_by_appid(const char *app_id, char **path, uid_t uid);

/*
 * This API is only for Appfw internally.
 */
int aul_get_usr_app_shared_resource_path_by_appid(const char *app_id, char **path, uid_t uid);

/*
 * This API is only for Appfw internally.
 */
int aul_get_usr_app_shared_trusted_path_by_appid(const char *app_id, char **path, uid_t uid);

/*
 * This API is only for Appfw internally.
 */
int aul_get_usr_app_external_shared_data_path_by_appid(const char *app_id, char **path, uid_t uid);

/*
 * This type is only for Appfw internally.
 */
typedef int (*subapp_fn)(void *data);

/*
 * This API is only for Appfw internally.
 */
int aul_set_subapp(subapp_fn cb, void *data);

/*
 * This API is only for Appfw internally.
 */
int aul_subapp_terminate_request_pid(int pid);

/*
 * This API is only for Appfw internally.
 */
int aul_is_subapp(void);

/*
 * This API is only for Appfw internally.
 */
int aul_kill_pid(int pid);

/*
 * This API is only for Appfw internally.
 */
int aul_add_caller_cb(int pid,  void (*caller_cb) (int, void *), void *data);

/*
 * This API is only for Appfw internally.
 */
int aul_remove_caller_cb(int pid, void *data);

/*
 * This API is only for Appfw internally.
 */
int aul_invoke_caller_cb(void *data);

/*
 * This API is only for Appfw internally.
 */
void aul_set_preinit_window(void *evas_object);

/*
 * This API is only for Appfw internally.
 */
void* aul_get_preinit_window(const char *win_name);

/*
 * This API is only for Appfw internally.
 */
void aul_set_preinit_background(void *evas_object);

/*
 * This API is only for Appfw internally.
 */
void* aul_get_preinit_background(void);

/*
 * This API is only for Appfw internally.
 */
void aul_set_preinit_conformant(void *evas_object);

/*
 * This API is only for Appfw internally.
 */
void* aul_get_preinit_conformant(void);

/*
 * This API is only for Appfw internally.
 */
void aul_set_preinit_appid(const char *appid);

/*
 * This API is only for Appfw internally.
 */
void aul_set_preinit_pkgid(const char *pkgid);

/*
 * This API is only for Appfw internally.
 */
void aul_set_preinit_root_path(const char *root_path);

/*
 * This API is only for Appfw internally.
 */
const char *aul_get_preinit_root_path(void);

/*
 * This API is only for Appfw internally.
 */
int aul_update_freezer_status(int pid, const char* type);

/*
 * This API is only for Appfw internally.
 */
int aul_send_app_launch_request_signal(int pid, const char* appid, const char* pkgid, const char* type);

/*
 * This API is only for Appfw internally.
 */
int aul_send_app_resume_request_signal(int pid, const char* appid, const char* pkgid, const char *type);

/*
 * This API is only for Appfw internally.
 */
int aul_send_app_terminate_request_signal(int pid, const char* appid, const char* pkgid, const char *type);

/*
 * This API is only for Appfw internally.
 */
int aul_send_app_status_change_signal(int pid, const char* appid, const char* pkgid, const char* status, const char *type);

/*
 * This API is only for Appfw internally.
 */
int aul_send_app_terminated_signal(int pid);

/*
 * This API is only for Appfw internally.
 */
int aul_send_app_group_signal(int owner_pid, int child_pid, const char *child_pkgid);

/*
 * This API is only for Appfw internally.
 */
int aul_invoke_status_local_cb(int status);

/*
 * This type is only for Appfw internally.
 */
typedef int (*data_control_provider_handler_fn) (bundle *b, int request_id, void *data);

/*
 * This API is only for Appfw internally.
 */
int aul_set_data_control_provider_cb(data_control_provider_handler_fn handler);

/*
 * This API is only for Appfw internally.
 */
int aul_unset_data_control_provider_cb(void);

/*
 * This API is only for Appfw internally.
 */
int aul_pause_app(const char *appid);

/*
 * This API is only for Appfw internally.
 */
int aul_pause_app_for_uid(const char *appid, uid_t uid);

/*
 * This API is only for Appfw internally.
 */
int aul_pause_pid(int pid);

/*
 * This API is only for Appfw internally.
 */
int aul_pause_pid_for_uid(int pid, uid_t uid);

/*
 * This API is only for Appfw internally.
 */
int aul_reload_appinfo(void);

/*
 * This API is only for Appfw internally.
 */
int aul_status_update(int status);

/*
 * This API is only for Appfw internally.
 */
int aul_running_list_update(char *appid, char *app_path, char *pid);

/*
 * This API is only for Appfw internally.
 */
int aul_app_group_get_window(int pid);

/*
 * This API is only for Appfw internally.
 */
int aul_app_group_set_window(int wid);

/*
 * This API is only for Appfw internally.
 */
void aul_app_group_get_leader_pids(int *cnt, int **pids);

/*
 * This API is only for Appfw internally.
 */
void aul_app_group_get_group_pids(int leader_pid, int *cnt, int **pids);

/*
 * This API is only for Appfw internally.
 */
int aul_app_group_get_leader_pid(int pid);

/*
 * This API is only for Appfw internally.
 */
int aul_app_group_clear_top(void);

/*
 * This API is only for Appfw internally.
 */
int aul_app_group_is_top(void);

/*
 * This API is only for Appfw internally.
 */
int aul_app_group_get_fg_flag(int pid);

/*
 * This API is only for Appfw internally.
 */
void aul_app_group_lower(int *exit);

/*
 * This API is only for Appfw internally.
 */
void aul_app_group_get_idle_pids(int *cnt, int **pids);

/**
 * @par Description:
 *	This API puts some app below the caller app
 * @par Purpose:
 *      This API's purpose is to reorder window stack limitedly.
 *
 * @param[in]	below_appid	The appid to be reordered below the caller app
 * @return	0 success, negative value(<0) if fail
 *
 * @remark
 *	below_appid should be main app which have been launched before.
 *	This API is only available in User Session.
*/
int aul_app_group_activate_below(const char *below_appid);

/**
 * @par Description:
 *	This API puts some app above the caller app
 * @par Purpose:
 *      This API's purpose is to reorder window stack limitedly.
 *
 * @param[in]	above_appid	The appid to be reordered above the caller app
 * @return	0 if success, negative value(<0) if fail
 *
 * @remark
 *	above_appid should be main app which have been launched before.
 *	This API is only available in User Session.
*/
int aul_app_group_activate_above(const char *above_appid);

/*
 * This API is only for Appfw internally.
 */
int aul_request_data_control_socket_pair(bundle *b, int *fd);
/*
 * This API is only for Appfw internally.
 */
int aul_request_message_port_socket_pair(int *fd);
/*
 * This API is only for Appfw internally.
 */
int aul_listen_booting_done_signal(int (*func) (int, void *), void *data);

/*
 * This API is only for Appfw internally.
 */
int aul_listen_cooldown_signal(int (*func) (const char *, void *), void *data);

/**
 * @par Description:
 *	This API registers a callback function that will be called when the
 *	status of the application is changed.
 * @par Purpose:
 *	This API is for monitoring the status of all applications.
 *
 * @param[in]	func		callback function
 * @param[in]	data		user data
 * @return	0 if success, negative value if fail
 * @retval	AUL_R_OK	- success
 * @retval	AUL_R_ERROR	- general error
 *
 * @code
 * #include <aul.h>
 *
 * int app_status_handler(int pid, int status, void *data)
 * {
 *	const char *app_status;
 *
 *	switch (status) {
 *	case 0:
 *		app_status = "STATUS_LAUNCHING";
 *		break;
 *	case 3:
 *		app_status = "STATUS_VISIBLE";
 *		break;
 *	case 4:
 *		app_status = "STATUS_BACKGROUND";
 *		break;
 *	case 5:
 *		app_status = "STATUS_FOCUS";
 *		break;
 *	default:
 *		app_status = "STATUS_UNKNOWN";
 *	}
 *
 *	printf("pid: %d, status: %s", pid, status);
 *	return 0;
 * }
 *
 * int main(int argc, char **argv)
 * {
 *	int ret;
 *
 *	ret = aul_listen_app_status_signal(app_status_handler, NULL);
 *	if (ret != AUL_R_OK) {
 *		printf("Failed to add status handler");
 *		return -1;
 *	}
 *
 *	...
 *
 *	return 0;
 * }
 * @endcode
 */
int aul_listen_app_status_signal(int (*func)(int, int, void *), void *data);

/*
 * This API is only for Appfw internally.
 */
int aul_check_tep_mount(const char *tep_path);

/*
 * This API is only for Appfw internally.
 */
int aul_is_tep_mount_dbus_done(const char *tep_string);

/*
 * This API is only for Appfw internally.
 */
int aul_forward_app(const char *appid, bundle *kb);

/**
 * @par Description:
 *	This API create custom launchpad-loader
 * @par Purpose:
 *      This API's purpose is to make a slot for custom loader.
 *      Once it is made, added loader will make a candidate process to use.
 *
 * @param[in]	loader_path	The file name of the custom loader binary including full path
 * @param[in]	extra		A bundle to be passed to the custom loader
 * @return	Loader ID if success, negative value(<0) if fail
 *
 * @remark
 *	This API is only for Appfw internally.
 *	This API is only available in User Session.
*/
int aul_add_loader(const char *loader_path, bundle *extra);

/**
 * @par Description:
 *	This API create custom launchpad-loader
 * @par Purpose:
 *      This API's purpose is to make a slot for custom loader.
 *      Once it is made, added loader will make a candidate process to use.
 *
 * @param[in]	loader_path	The file name of the custom loader binary including full path
 * @param[in]	extra		A bundle to be passed to the custom loader
 * @param[in]	uid		User ID
 * @return	Loader ID if success, negative value(<0) if fail
 *
 * @remark
 *	This API is only for Appfw internally.
 *	This API is only available to System user.
*/
int aul_add_loader_for_uid(const char *loader_path, bundle *extra, uid_t uid);


/**
 * @par Description:
 *	This API destroy custom launchpad-loader
 * @par Purpose:
 *      This API's purpose is to remove a slot for custom loader.
 *      Once it is removed, the prepared process will be removed as well.
 *
 * @param[in]	loader_id	Loader ID
 * @return	0 if success, negative value(<0) if fail
 *
 * @remark
 *	This API is only for Appfw internally.
 *	This API is only available in User Session.
*/
int aul_remove_loader(int loader_id);

/**
 * @par Description:
 *	This API destroy custom launchpad-loader
 * @par Purpose:
 *      This API's purpose is to remove a slot for custom loader.
 *      Once it is removed, the prepared process will be removed as well.
 *
 * @param[in]	loader_id	Loader ID
 * @param[in]	uid		User ID
 * @return	0 if success, negative value(<0) if fail
 *
 * @remark
 *	This API is only for Appfw internally.
 *	This API is only available to System user.
*/
int aul_remove_loader_for_uid(int loader_id, uid_t uid);

/**
 * @par Description
 *	This API gets specified application process id.
 * @par Purpose:
 *	The purpose of this API is to get the pid of specified application.
 *
 * @param[in]	appid	application name
 * @return	callee's pid if success, negative value(<0) if fail
 *
 * @remark
 *	This API is only available in User Session.
 */
int aul_app_get_pid(const char *appid);

/**
 * @par Description
 *	This API gets specified application process id.
 * @par Purpose:
 *	The purpose of this API is to get the pid of specified application.
 *
 * @param[in]	appid	application name
 * @param[in]	uid	User ID
 * @return	callee's pid if success, negative value(<0) if fail
 *
 * @remark
 *	This API is only available to System user.
 */
int aul_app_get_pid_for_uid(const char *appid, uid_t uid);

/**
 * @par Description:
 * This function update rua stat.
 *
 * @param[in] b Bundle object contains caller and tag information.
 * @param[in] uid Target uid
 *
 * @return 0 if success, negative value(<0) if fail
 * @see None
 * @remarks This API is only for Appfw internally.
 *
 * @par Sample code:
 * @code
#include <aul.h>

...
{
    int r;
    bundle *b = bundle_create();
    bundle_add_str(b, AUL_SVC_K_RUA_STAT_CALLER, caller);
    bundle_add_str(b, AUL_SVC_K_RUA_STAT_TAG, tag);

    r = aul_update_rua_stat_for_uid(b);
}

 * @endcode
 **/
int aul_update_rua_stat_for_uid(bundle *b, uid_t uid);

/**
 * @par Description:
 * This function add rua history.
 *
 * @param[in] b Bundle object Target Package name or app path.
 * @param[in] uid Target uid
 *
 * @return 0 if success, negative value(<0) if fail
 * @see None
 * @remarks This API is only for Appfw internally.
 *
 * @par Sample code:
 * @code
#include <aul.h>

...
{
    int r;
    bundle *b = bundle_create();
    if (pkg_name)
	bundle_add_str(b, AUL_K_RUA_PKGNAME, pkg_name);
    else if (app_path)
	bundle_add_str(b, AUL_K_RUA_APPPATH, app_path);

    r = aul_add_rua_history_for_uid(b);
}

 * @endcode
 **/
int aul_add_rua_history_for_uid(bundle *b, uid_t uid);

/**
 * @par Description:
 * This function delete rua history.
 *
 * @param[in] b Bundle object Target Package name. If NULL or has no value, delete all rua history.
 * @param[in] uid Target uid
 *
 * @return 0 if success, negative value(<0) if fail
 * @see None
 * @remarks This API is only for Appfw internally.
 *
 * @par Sample code:
 * @code
#include <aul.h>

...
{
    int r;
    bundle *b = NULL;
    if (pkg_name) {
	b = bundle_create();
	bundle_add_str(b, AUL_K_RUA_PKGNAME, pkg_name);
    }
    r = aul_delete_rua_history_for_uid(b, getuid());
}

 * @endcode
 **/
int aul_delete_rua_history_for_uid(bundle *b, uid_t uid);


/**
 * @par Description:
 * This function sets the default application(application id) associated with operatioin, uri and mime-type.
 *
 * @param[in] b Bundle object Target application id and operation, uri and mime-type.
 *
 * @return 0 if success, negative value(<0) if fail
 * @see None
 * @remarks This API is only for Appfw internally.
 *
 * @par Sample code:
 * @code
#include <aul.h>
#include <aul_svc.h>

...
{
    int r;
    bundle *b = bundle_create();

    const char *appid = "org.tizen.test";
    const char *operation = "test_operation";
    const char *mime_type = "test_mime";
    const char *uri = "test_uri";

    aul_svc_set_operation(b, operation);
    aul_svc_set_mime(b, mime_type);
    aul_svc_set_uri(b, uri);

    aul_svc_set_appid(b, appid)

    r = aul_set_default_app_by_operation(b);
}

 * @endcode
 **/
int aul_set_default_app_by_operation(bundle *b);

/**
 * @par Description:
 * This API unset the default application(application id) associated with operation, uri and mime-type.
 *
 * @param[in] app_id    The ID of the application
 *
 * @return 0 if success, negative value(<0) if fail
 *
 * @pre None.
 * @post None.
 * @see None.
 * @remarks None.
 *
 * @par Sample code:
 * @code
#include <aul.h>

...
{
    aul_unset_default_app_by_operation("org.tizen.test");
}
 * @endcode
 *
 */
int aul_unset_default_app_by_operation(const char *app_id);

/**
 * @par Description:
 *      Sends the launch request asynchronously.
 *
 * @param[in]	appid		The application ID
 * @param[in]	kb		The Bundle data
 * @return      a pid of the callee on success,
 *              otherwise a negative error value
 * @retval	AUL_R_OK	- Successful
 * @retval	AUL_R_EINVAL	- Invalid parameter
 * @retval	AUL_R_ECOM	- Internal AUL IPC error
 * @retval	AUL_R_ERROR	- General error
 *
 * @remark
 *	This API is only available in User Session.
 *	This API doesn't check whether the callee application is executed successfully.
 *	If the caller application is equal to the callee application, this API can return AUL_R_OK.
 */
int aul_launch_app_async(const char *appid, bundle *kb);

/**
 * @par Description:
 *	Sends the launch request asynchronously.
 *
 * @param[in]	appid		The application ID
 * @param[in]	kb		The Bundle data
 * @param[in]	uid		User ID
 * @return      a pid of the callee on success,
 *              otherwise a negative error value
 * @retval	AUL_R_OK	- Successful
 * @retval	AUL_R_EINVAL	- Invalid parameter
 * @retval	AUL_R_ECOM	- Internal AUL IPC error
 * @retval	AUL_R_ERROR	- General error
 *
 * @remark
 *	This API is only available to System user.
 *	This API doesn't check whether the callee application is executed successfully.
 *	If the caller application is equal to the callee application, this API can return AUL_R_OK.
 */
int aul_launch_app_async_for_uid(const char *appid, bundle *kb, uid_t uid);

/**
 * @par Description:
 * This API request launchpad to make candidate processes.
 *
 * @return 0 if success, negative value(<0) if fail
 *
 * @remark
 *	This API is only available in User Session.
 */
int aul_prepare_candidate_process(void);

/*
 * This API is only for Appfw internally.
 */
int aul_widget_instance_add(const char *widget_id, const char *instance_id);

/*
 * This API is only for Appfw internally.
 */
int aul_widget_instance_del(const char *widget_id, const char *instance_id);

/*
 * This API is only for Appfw internally.
 */
typedef void (*aul_widget_instance_foreach_cb)(const char *instance_id, void *data);

/*
 * This API is only for Appfw internally.
 */
int aul_widget_instance_foreach(const char *widget_id, aul_widget_instance_foreach_cb cb, void *data);

/*
 * This API is only for Appfw internally.
 */
int aul_widget_instance_update(const char *widget_id, const char *instance_id, bundle *b);

/*
 * This API is only for Appfw internally.
 */
int aul_widget_instance_count(const char *widget_id);

/**
 * @par Description:
 *	This API gets the last caller process id of specified application process id.
 * @par Purpose:
 *	This API's purpose is to get the application's last caller process id.
 *
 * @param[in]	pid	pid of application
 * @return	caller pid if success, nagative value if fail
 *
 * @remark
 *	This API is only available in User Session.
 */
int aul_app_get_last_caller_pid(int pid);

/**
 * @par Description:
 *	This API gets the last caller process id of specified application process id.
 * @par Purpose:
 *	This API's purpose is to get the last caller process id of the application.
 *
 * @param[in]	pid	pid of application
 * @param[in]   uid     User ID
 * @return	caller pid if success, nagative value if fail
 *
 * @remark
 *	This API is only available in System users.
 */
int aul_app_get_last_caller_pid_for_uid(int pid, uid_t uid);

/**
 * @par Description:
 *      This API trigger to resume application asynchronously.
 *      If the application is running, this API send a resume event to the App.
 *      If the application is not running, this API return AUL_R_ERROR.
 *      Although the application is running, if the application cannot receive resume event,
 *      AUL try to raise the application's default windows.
 * @par Purpose:
 *      This API is for caller.
 *      This API's purpose is to send resume event.
 * @par Typical use case:
 *      In multiple application model, If you want to only resume specific application, Use this API
 *
 * @param[in]   pid     application's pid to be resumed
 * @return      0 if success, negative value(<0) if fail
 * @retval      AUL_R_OK        - success
 * @retval      AUL_R_EINVAL    - invaild pid
 * @retval      AUL_R_ECOM      - internal AUL IPC error
 * @retval      AUL_R_ERROR     - general error (include application is not running)
 * @warning     This API need to require root or inhouse permisssion \n
 *              If you have not the permission, this API return AUL_R_ERROR. \n
 * @remark
 *      This API is only available to User Session.
 */
int aul_resume_pid_async(int pid);

/**
 * @par Description:
 *      This API trigger to resume application asynchronously.
 *      If the application is running, this API send a resume event to the App.
 *      If the application is not running, this API return AUL_R_ERROR.
 *      Although the application is running, if the application cannot receive resume event,
 *      AUL try to raise the application's default windows.
 * @par Purpose:
 *      This API is for caller.
 *      This API's purpose is to send resume event.
 * @par Typical use case:
 *      In multiple application model, If you want to only resume specific application, Use this API
 *
 * @param[in]   pid     application's pid to be resumed
 * @param[in]   uid     User ID
 * @return      0 if success, negative value(<0) if fail
 * @retval      AUL_R_OK        - success
 * @retval      AUL_R_EINVAL    - invaild pid
 * @retval      AUL_R_ECOM      - internal AUL IPC error
 * @retval      AUL_R_ERROR     - general error (include application is not running)
 * @warning     This API need to require root or inhouse permisssion \n
 *              If you have not the permission, this API return AUL_R_ERROR. \n
 * @remark
 *      This API is only available to System user.
 */
int aul_resume_pid_async_for_uid(int pid, uid_t uid);

/**
 * @par Description:
 *	This API set the alias appid.
 *	The alias appid is only available for the aul_svc_set_appid() API.
 *	If the appid is not available, this API returns an error.
 *
 * @privlevel platform
 * @privilege %http://tizen.org/privilege/systemsettings.admin
 * @param[in]	alias_appid	an alias application ID
 * @param[in]	appid		an application ID
 * @return	0 if success, negative value(<0) if fail
 *
 * @remark
 *	This API is only available to User Session.
 */
int aul_set_alias_appid(const char *alias_appid, const char *appid);

/**
 * @par Description:
 *	This API unset the alias appid.
 *
 * @privlevel platform
 * @privilege %http://tizen.org/privilege/systemsettings.admin
 * @param[in]	alias_appid	an alias application ID
 * @return	0 if success, negative value(<0) if fail
 *
 * @remark
 *	This API is only available to User Session.
 */
int aul_unset_alias_appid(const char *alias_appid);

/**
 * @par Description:
 *	This API activates the alias information based on the given appid.
 *
 * @privlevel platform
 * @privilege %http://tizen.org/privilege/systemsettings.admin
 * @param[in]	appid	an application ID
 * @return	0 if success, negative value(<0) if fail
 *
 * @remark
 *	This API is only available to User Session.
 */
int aul_enable_alias_info(const char *appid);

/**
 * @par Description:
 *	This API deactivates the alias information based on the given appid.
 *
 * @privlebel platform
 * @privilege %http://tizen.org/privilege/systemsettings.admin
 * @param[in]	appid	an application ID
 * @return	0 if success, negative value(<0) if fail
 *
 * @remark
 *	This API is only available to User Session.
 */
int aul_disable_alias_info(const char *appid);

/**
 * This API is only for Appfw internally.
 */
typedef int (*app_status_cb)(aul_app_info *info, int ctx_status, void *data);

/**
 * This API is only for Appfw internally.
 */
typedef struct status_listen_s *status_listen_h;

/**
 * @par Description:
 *      Registers a callback function to be invoked when the application change status.
 *
 * @param[in]   appid           The application ID to get status
 * @param[in]   callback        The callback function to register
 * @param[in]   data            The user data to be passed to the callback function
 * @param[out]  handle          The status listen handle
 * @return      @c 0 on success,
 *		otherwise a negative error value
 */
int aul_listen_app_status(const char *appid, app_status_cb callback,
		void *data, status_listen_h *handle);
int aul_listen_app_status_for_uid(const char *appid, app_status_cb callback,
		void *data, status_listen_h *handle, uid_t uid);

/*
 * This API is only for Appfw internally.
 */
int aul_widget_instance_get_content(const char *widget_id, const char *instance_id, char **content);

/**
 * @par Description:
 *      Gets running application instance info
 *      This API calls the iter_fn with the aul_app_info when running app instance info is found.
 *
 * @param[in]   iter_fn         iterative function
 * @param[in]   user_data       User data
 * @return      0 if success, negative value(<0) if fail
 * @retval      AUL_R_OK        Successful
 * @retval      AUL_R_ERROR     General error
 * @retval      AUL_R_EINVAL    Invalid parameter
 */
int aul_app_get_running_app_instance_info(aul_app_info_iter_fn iter_fn,
		void *user_data);
int aul_app_get_running_app_instance_info_for_uid(aul_app_info_iter_fn iter_fn,
		void *user_data, uid_t uid);

/*
 * This API is only for Appfw internally.
 */
int aul_app_get_instance_id_bypid(int pid, char *instance_id, int len);
int aul_app_get_instance_id_bypid_for_uid(int pid, char *instance_id,
		int len, uid_t uid);

/*
 * This API is only for Appfw internally.
 */
int aul_resume_app_by_instance_id(const char *appid, const char *instance_id);
int aul_resume_app_by_instance_id_for_uid(const char *appid,
		const char *instance_id, uid_t uid);

/**
 * This API is only for Appfw internally.
 */
int aul_ignore_app_status(status_listen_h handle);

/**
 * This API is only for Appfw internally.
 */
int aul_widget_notify_exit(void);

#ifdef __cplusplus
	}
#endif