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
|
/*
* aul
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
*
* 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.
*
*/
#ifndef __AUL_H__
#define __AUL_H__
#include <errno.h>
#include <bundle.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @mainpage
*
* This is new version of Application Utility Library
*
* Almost function's input param is application package name(APN).\n
* APN is application package name which is set by developer.\n
* In case of in-house application, prefix is org.tizen.\n
* It is different from debian package name.\n
*
* - Debian Package Name : Name which is managed by package manager
* - Application Package Name : Name which is used by AUL
* - Execution Path : real program executable path
*/
/**
* @open
* @ingroup APPLICATION_FRAMEWORK
* @defgroup aul Application Utility Library
* @{
*/
/**
* @file aul.h
* @brief Application Utility Library header
*
* Patched by Knhoon Baik <knhoon.baik@samsung.com>
* Patched by Youmin Ha <youmin.ha@samsung.com>
*/
/**
* @addtogroup aul
* @{
*/
/**
* @brief Return values in AUL.
*/
typedef enum _aul_return_val {
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
};
/** @} */
/**
* @defgroup aul_launch Primitive APIs to launch/resume/terminate application
* @ingroup aul
* @brief
* APIs to launch/resume/terminate application
* - Launch application based on application package name
* - Resume application based on application package name
* - Resume application based on pid (required root or inhouse permisssion)
* - Terminate application base on pid (required root or inhouse permission)
*
* AUL internal information
* - AUL grant pid, gid to launched application for security
* - AUL send RESET/RESUME/TERM event for running application in case of single instance
* - AUL set application enviroment based on desktop entry
* - AUL support single instance / multi instance
* - AUL support application data exchange format (bundle)
*/
/**
* @addtogroup aul_launch
* @{
*/
typedef enum _aul_type{
AUL_START,
AUL_RESUME,
AUL_TERMINATE,
AUL_TERMINATE_BGAPP,
AUL_PAUSE,
}aul_type;
/** 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 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 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__"
/**
* @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.
* @post
* None
* @see
* None
* @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
* None
*/
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.
* @post
* None
* @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.
*/
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.
*/
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
*
* @pre
* None
* @post
* None
* @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
* None
*/
int aul_launch_app(const char *appid, bundle *kb);
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
*
* @pre
* None
* @post
* None
* @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.
*/
int aul_open_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
* @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
*
* @pre
* None
* @post
* None
* @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.
*/
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 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
* @pre
* None
* @post
* None
* @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
* None
*/
int aul_resume_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
* @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
*
* @pre
* None
* @post
* None
* @see
* None
* @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
*/
int aul_terminate_pid(int pid);
int aul_terminate_bgapp_pid(int pid);
int aul_terminate_pid_without_restart(int pid);
int aul_terminate_pid_async(int pid);
/** @} */
/**
* @defgroup aul_info Helper APIs to get running application information
* @ingroup aul
* @brief
* API to get running application information (state, executable path, ..)
* - get application package name from pid
* - get application running state
* - get application list of runnning applications
*/
/**
* @addtogroup aul_info
* @{
*/
/**
*@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;
} 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.
*
* @pre
* None
* @post
* None
* @see
* None
* @code
* #include <aul.h>
*
* int is_running_browser_app()
* {
* return aul_app_is_running("org.tizen.browser");
* }
*
* @endcode
* @remark
* None
*
*/
int aul_app_is_running(const char *appid);
/**
* @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
* This API give you running applications which has SLP desktop file.
* @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] 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
*
* @pre
* None
* @post
* None
* @see
* None
* @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
*/
int aul_app_get_running_app_info(aul_app_info_iter_fn iter_fn, void *data);
/**
* @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
* @pre
* None
* @post
* None
* @see
* None
* @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
* None
*/
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
* @pre
* None
* @post
* None
* @see
* None
* @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
* None
*/
int aul_app_get_pkgid_bypid(int pid, char *pkgid, 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
* @return 0 if success, negative value(<0) if fail
* @retval AUL_R_OK - success
* @retval AUL_R_ERROR - no such a appid
* @pre
* None
* @post
* None
* @see
* None
* @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
* None
*/
int aul_app_get_appid_bypid(int pid, char *appid, int len);
/** @} */
/**
* @defgroup aul_mime High-level APIs to launch default application based on mime type
* @ingroup aul
* @brief
* AUL High-level APIs based on mime type
*
* These APIs provide two functionality\n
*
* -# To launch default application to open a file based on its MIME type \n
* For example, you can launch the default video player to open .mp4 files
* or launch the default browser to open HTML files \n
* -# To launch default application to process given content \n
* For example, you can launch the default e-mail application to process
* "nice@samsung.com" e-mail address.
*/
/**
* @addtogroup aul_mime
* @{
*/
/**
* @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
*
* @pre
* None
* @post
* None
* @see
* None
* @code
* #include <aul.h>
*
* int view_image_file(char *filename)
* {
* aul_open_file(filename);
* }
*
* @endcode
* @remark
* None
*
*/
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
*
* @pre
* None
* @post
* None
* @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
* None
*/
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
*
* @pre
* None
* @post
* None
* @see
* None
* @code
* #include <aul.h>
*
* int view_url(char *url)
* {
* aul_open_content(url);
* }
*
* @endcode
* @remark
* None
*
*/
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
*
* @pre
* None
* @post
* None
* @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
* None
*
*/
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
*
* @pre
* None
* @post
* None
* @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
* None
*/
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
*
* @pre
* None
* @post
* None
* @see
* None
* @code
* #include <aul.h>
*
* void get_mimetype()
* {
* char mimetype[255];
* aul_get_mime_from_file("image.jpg",mimetype,sizeof(mimetype));
* }
*
* @endcode
* @remark
* None
*/
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
*
* @pre
* None
* @post
* None
* @see
* None
* @code
* #include <aul.h>
*
* void get_mimetype()
* {
* char mimetype[255];
* aul_get_mime_from_content("http://www.samsung.com",mimetype,sizeof(mimetype));
* }
*
* @endcode
* @remark
* None
*/
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)
*
* @pre
* None
* @post
* None
* @see
* None
* @code
* #include <aul.h>
*
* void get_mime_icon()
* {
* char icon[255];
* aul_get_mime_icon("text/html",icon,sizeof(icon));
* }
*
* @endcode
* @remark
* None
*/
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)
*
* @pre
* None
* @post
* None
* @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.
*
*/
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)
*
* @pre
* None
* @post
* None
* @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
* None
*/
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
* None
*
*/
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
* None
*
*/
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
*
* @pre
* None
* @post
* None
* @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
* None
*
*/
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
*
* @pre
* None
* @post
* None
* @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
* None
*
*/
int aul_listen_app_launch_signal(int (*func) (int, void *), void *data);
int aul_listen_booting_done_signal(int (*func) (int, void *), void *data);
int aul_listen_cooldown_signal(int (*func) (const char *, void *), void *data);
int aul_listen_app_status_signal(int (*func) (int, int, void *), void *data);
const char *aul_get_app_external_root_path(void);
const char *aul_get_app_root_path(void);
const char *aul_get_app_data_path(void);
const char *aul_get_app_cache_path(void);
const char *aul_get_app_resource_path(void);
const char *aul_get_app_tep_resource_path(void);
const char *aul_get_app_shared_data_path(void);
const char *aul_get_app_shared_resource_path(void);
const char *aul_get_app_shared_trusted_path(void);
const char *aul_get_app_external_data_path(void);
const char *aul_get_app_external_cache_path(void);
const char *aul_get_app_external_shared_data_path(void);
const char *aul_get_app_specific_path(void);
const char *aul_get_app_external_specific_path(void);
int aul_get_app_shared_data_path_by_appid(const char *app_id, char **path);
int aul_get_app_shared_resource_path_by_appid(const char *app_id, char **path);
int aul_get_app_shared_trusted_path_by_appid(const char *app_id, char **path);
int aul_get_app_external_shared_data_path_by_appid(const char *app_id, char **path);
int aul_get_usr_app_shared_data_path_by_appid(const char *app_id, char **path, uid_t uid);
int aul_get_usr_app_shared_resource_path_by_appid(const char *app_id, char **path, uid_t uid);
int aul_get_usr_app_shared_trusted_path_by_appid(const char *app_id, char **path, uid_t uid);
int aul_get_usr_app_external_shared_data_path_by_appid(const char *app_id, char **path, uid_t uid);
typedef int (*subapp_fn)(void *data);
int aul_set_subapp(subapp_fn cb, void *data);
int aul_subapp_terminate_request_pid(int pid);
int aul_is_subapp(void);
int aul_kill_pid(int pid);
int aul_add_caller_cb(int pid, void (*caller_cb) (int, void *), void *data);
int aul_remove_caller_cb(int pid);
int aul_invoke_caller_cb(int pid);
int aul_update_freezer_status(int pid, const char* type);
int aul_send_app_launch_request_signal(int pid, const char* appid, const char* pkgid, const char* type);
int aul_send_app_resume_request_signal(int pid, const char* appid, const char* pkgid, const char *type);
int aul_send_app_terminate_request_signal(int pid, const char* appid, const char* pkgid, const char *type);
int aul_send_app_status_change_signal(int pid, const char* appid, const char* pkgid, const char* status, const char *type);
int aul_send_app_terminated_signal(int pid);
int aul_send_app_group_signal(int owner_pid, int child_pid, const char *child_pkgid);
/**
* @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_CREATED
* @retval STATUS_FOCUS
* @retval STATUS_VISIBLE
* @retval STATUS_BG
* @retval STATUS_DYING
* @retval STATUS_HOME
* @retval STATUS_NORESTART
* @see
* aul_status_update
* @pre
* None
* @post
* None
* @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_FOCUS) {
* 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
* None
*/
int aul_app_get_status_bypid(int pid);
/**
* @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
* @pre
* None
* @post
* None
* @code
* #include <aul.h>
*
* int status_changed(int status, void *data)
* {
* if (status == STATUS_FOCUS)
* printf("%d has focus\n", getpid());
*
* if (status == STATUS_VISIBLE)
* printf("%d resume\n", getpid());
*
* if (status == STATUS_BG0
* printf("%d pause\n", getpid());
* }
*
* void listen_app_status()
* {
* aul_add_status_local_cb(status_changed, NULL);
* }
* @endcode
* @remark
* None
*
*/
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
*
* @pre
* None
* @post
* None
* @see
* aul_add_status_local_cb
* @code
* #include <aul.h>
*
* int status_changed(int status, void *data)
* {
* if (status == STATUS_FOCUS)
* printf("%d has focus\n", getpid());
*
* if (status == STATUS_VISIBLE)
* printf("%d resume\n", getpid());
*
* if (status == STATUS_BG0
* 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
* None
*
*/
int aul_remove_status_local_cb(int (*func) (int, void *), void *data);
int aul_invoke_status_local_cb(int status);
typedef int (*data_control_provider_handler_fn) (bundle *b, int request_id, void *data);
int aul_set_data_control_provider_cb(data_control_provider_handler_fn handler);
int aul_unset_data_control_provider_cb(void);
int aul_pause_app(const char *appid);
int aul_pause_pid(int pid);
int aul_reload_appinfo(void);
int aul_status_update(int status);
int aul_running_list_update(char *appid, char *app_path, char *pid);
void aul_app_group_add(int leader_pid, int pid, int wid);
void aul_app_group_remove(int pid);
void aul_app_group_attach_window(int parent_wid, int child_wid);
void aul_app_group_detach_window(int child_wid);
int aul_app_group_get_window(int pid);
void aul_app_group_get_leader_pids(int *cnt, int **pids);
void aul_app_group_get_group_pids(int leader_pid, int *cnt, int **pids);
int aul_app_group_get_leader_pid(int pid);
int aul_app_group_clear_top(void);
int aul_app_group_is_top(void);
int aul_request_data_control_socket_pair(bundle *b, int *fd);
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* __AUL_H__ */
/* vi: set ts=8 sts=8 sw=8: */
|