• Home
Name Date Size #Lines LOC

..--

Android.bpD03-May-2024813 2725

README.mdD03-May-20241.2 KiB4435

test_service.cppD03-May-20242.6 KiB7853

test_service.rcD03-May-2024178 87

README.md

1# Sample service for testing
2This is a sample service that can be used for testing init.
3
4## Design
5The service includes a `.rc` file that allows starting it from init.
6
7    service test_service /system/bin/test_service CapAmb 0000000000003000
8        class main
9        user system
10        group system
11        capabilities NET_ADMIN NET_RAW
12        disabled
13        oneshot
14
15The service accepts any even number of arguments on the command line
16(i.e. any number of pairs of arguments.)
17It will attempt to find the first element of each pair of arguments in
18`/proc/self/status`, and attempt to exactly match the second element of the pair
19to the relevant line of `proc/self/status`.
20
21### Example
22In the above case, the service will look for lines containing `CapAmb`:
23
24    cat /proc/self/status
25    ...
26    CapAmb:	0000000000003000
27
28And then attempt to exactly match the token after `:`, `0000000000003000`,
29with the command-line argument.
30If they match, the service exits successfully. If not, the service will exit
31with an error.
32
33## Usage
34	mmma -j <jobs> system/core/init/testservice
35	adb root
36	adb remount
37	adb sync
38	adb reboot
39	adb root
40	adb shell start test_service
41	adb logcat -b all -d | grep test_service
42
43Look for an exit status of 0.
44