init: reboot: Kick off RebootMonitorThread() upon sys.shutdown.requested
The ShutdownThread in Android performs a shutdown/reboot roughly like this: 1. In beginShutdownSequence(), create a dialog from which the user can't escape telling the user that the system is shutting down (or rebooting). 2. Fork off a thread, which doesn't seem to have any sort of watchdog watching to see if it hangs. 3. In the thread, notify a bunch of things about the shutdown. Some of what it does is supposed to timeout after ~10 seconds but it's unclear if every action that might be slow or might hang has a timeout. 4. Call into the `init` process to actually perform the shutdown. While activities in the thread that are expected to be long-running do have timeouts, there is no overall watchdog making sure that something in the thread doesn't unexpectedly hang and leave the user with the shutdown dialog up but no way out. There _is_ a watchdog thread created once we get into the `init` process but since init doesn't know about the reboot until step #4 there is a bunch of stuff that's not covered. Make the watchdog cover everything by kicking `init`'s watchdog off earlier. This can be done by noting that early in the ShutdownThread it sets a property "sys.shutdown.requested". The `init` process can note a set of this property and kick the watchdog off earlier. Bug: 409835922 Test: With ag/32996886, various shutdown types trigger proper watchdog Change-Id: Ie161224360e108040805ebe7a33ced64b408befd
Loading
Please register or sign in to comment