xref: /aosp_15_r20/system/apex/tests/testdata/trigger_reboot.sh (revision 33f3758387333dbd2962d7edbd98681940d895da)
1*33f37583SAndroid Build Coastguard Worker# To trigger a reboot on install of version 300000000 of
2*33f37583SAndroid Build Coastguard Worker# the com.android.tzdata apex:
3*33f37583SAndroid Build Coastguard Worker# $ adb shell setprop persist.debug.trigger_reboot_after_activation [email protected]
4*33f37583SAndroid Build Coastguard Workeractive_apex=/data/apex/active/`/system/bin/getprop persist.debug.trigger_reboot_after_activation`
5*33f37583SAndroid Build Coastguard Workerif [[ $active_apex == *.apex ]]
6*33f37583SAndroid Build Coastguard Workerthen
7*33f37583SAndroid Build Coastguard Worker    while :
8*33f37583SAndroid Build Coastguard Worker    do
9*33f37583SAndroid Build Coastguard Worker        if [ -a $active_apex ]
10*33f37583SAndroid Build Coastguard Worker        then
11*33f37583SAndroid Build Coastguard Worker            /system/bin/log -t TriggerWatchdog "Detected presence of $active_apex"
12*33f37583SAndroid Build Coastguard Worker            /system/bin/setprop sys.powerctl reboot
13*33f37583SAndroid Build Coastguard Worker        fi
14*33f37583SAndroid Build Coastguard Worker    done
15*33f37583SAndroid Build Coastguard Workerfi