1# Only trigger if persist.debug.trigger_watchdog.apex is non-empty.
2on boot && property:persist.debug.trigger_watchdog.apex=*
3    setprop debug.trigger_watchdog.status start
4    exec -- /system/bin/log -t TriggerWatchdog "Starting trigger_watchdog"
5    exec_background u:r:su:s0 -- /system/bin/sh /system/bin/trigger_watchdog.sh
6
7# Only trigger if persist.debug.trigger_reboot_after_activation is non-empty.
8on boot && property:debug.trigger_reboot_once_after_activation=1 && property:persist.debug.trigger_reboot_after_activation=*
9    setprop debug.trigger_watchdog.status start
10    exec -- /system/bin/log -t TriggerWatchdog "Rebooting once after activation"
11    exec_background u:r:su:s0 -- /system/bin/sh /system/bin/trigger_reboot.sh
12
13on boot && property:persist.debug.trigger_reboot_twice_after_activation=1 && property:persist.debug.trigger_reboot_after_activation=*
14    setprop debug.trigger_watchdog.status start
15    exec -- /system/bin/log -t TriggerWatchdog "Checking checkpointing revert"
16    exec_background u:r:su:s0 -- /system/bin/sh /system/bin/trigger_reboot.sh
17
18on boot && property:persist.debug.trigger_updatable_crashing_for_testing=1
19    # Mock the fact that a service was crashing.
20    setprop sys.init.updatable_crashing_process_name test_process
21    setprop sys.init.updatable_crashing 1
22
23on boot && property:test.apex_revert_test_force_reboot=1
24    exec_start rebooting_service
25
26# Simulate a situation when userspace reboot fails to remount userdata. Since triggers in
27# rootdir/init.rc are guaranteed to be executed before ones in other .rc files, by the time this is
28# executed init already executed `on userspace-reboot-fs-remount` trigger in rootdir/init.rc,
29# meaning that /system/bin/vdc checkpoint markBootAttempt was already called.
30on userspace-reboot-fs-remount && property:test.apex_userspace_reboot_simulate_remount_failed=1
31    exec_start rebooting_service
32
33# Simulate a situation when userspace reboot fails during a shutdown sequence. This is a very crude
34# simulation, better one would be to actually start a service that ignores SIGKILL.
35on userspace-reboot-requested && property:test.apex_userspace_reboot_simulate_shutdown_failed=1
36    exec_start rebooting_service
37
38service rebooting_service /system/bin/false
39    reboot_on_failure reboot,apex-revert-test
40    disabled
41