abd reboot from Ubuntu has following steps:
1) adbd sets android property "sys.powerctl" to "reboot"/"reboot recovery" or any supported value
2) this is picked by Android inside container, and Android shuts down in controlled way
3) on Ubuntu side we have Upstart job /etc/init/android-tools-adbd-reboot-watcher.conf
which is waiting for Android property "sys.powerctl" change, when value "reboot*" is detected, it waits for 1 second to give Android time to finish shut down, and then it executes "/sbin/reboot -f <optional value>" to reboot Ubuntu.
As Chunsang mentioned, calling adb reboot twice, will result in error, as Android is shut down and adbd fails to even change value of Android property "sys.powerctl" and returns error "reboot failed: %d".
Considering Chunsang's findings we have first 2 steps working.
For third step there could be 2 reasons for reboot not working:
- upstart job is not picking android property change
this could be caused, either by Android side (upstart-property-watcher is not working) or upstart is broken and does not parse property changes correctly.
We can have race between UpstartPropertyWatcher signalling to upstart and Android shutting down. upstart-property-watcher logs to logcat with tag "UpstartPropertyWatcher", so we should be able to see "sys.powerctl" change in logs, if it's missing then we have race condition on Android side.
Otherwise we can add trace to /etc/init/android-tools-adbd-reboot-watcher.conf to see if signal is received by upstart script.
- /sbin/reboot -f does not work
- this could be easily tested by running /sbin/reboot -f from shell manually
Either way, this is very upstart related, so so considering we are moving to systemd, we might give this bug lover priority unless easy fix......
abd reboot from Ubuntu has following steps: android- tools-adbd- reboot- watcher. conf
1) adbd sets android property "sys.powerctl" to "reboot"/"reboot recovery" or any supported value
2) this is picked by Android inside container, and Android shuts down in controlled way
3) on Ubuntu side we have Upstart job /etc/init/
which is waiting for Android property "sys.powerctl" change, when value "reboot*" is detected, it waits for 1 second to give Android time to finish shut down, and then it executes "/sbin/reboot -f <optional value>" to reboot Ubuntu.
As Chunsang mentioned, calling adb reboot twice, will result in error, as Android is shut down and adbd fails to even change value of Android property "sys.powerctl" and returns error "reboot failed: %d".
Considering Chunsang's findings we have first 2 steps working. property- watcher is not working) or upstart is broken and does not parse property changes correctly. Watcher signalling to upstart and Android shutting down. upstart- property- watcher logs to logcat with tag "UpstartPropert yWatcher" , so we should be able to see "sys.powerctl" change in logs, if it's missing then we have race condition on Android side. android- tools-adbd- reboot- watcher. conf to see if signal is received by upstart script.
For third step there could be 2 reasons for reboot not working:
- upstart job is not picking android property change
this could be caused, either by Android side (upstart-
We can have race between UpstartProperty
Otherwise we can add trace to /etc/init/
- /sbin/reboot -f does not work
- this could be easily tested by running /sbin/reboot -f from shell manually
Either way, this is very upstart related, so so considering we are moving to systemd, we might give this bug lover priority unless easy fix......