title: Android device shutdown - want "ShutdownThread->shutdown()"not "su reboot -p"
body: <p>Several questions about shutting down a rooted android device have answers saying you should run "reboot -p" within an "su" shell.  However, <a href="https://stackoverflow.com/questions/9598522/android-root-poweroff/9600769">this answer</a> says that reboot is quite low-and-dirty and doesn't do sufficient tidying up before pulling the plug.  Instead it recommends using <code>android.internal.app.ShutdownThread.shutdown()</code>. Looking at <a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.3_r1/com/android/internal/app/ShutdownThread.java#ShutdownThread.shutdown%28android.content.Context,boolean%29" rel="nofollow noreferrer">the code</a> I can see that this does a whole bunch of housekeeping stuff that I'd like to have, and it also has a handy "confirm" parameter that appears to let you shut down without asking for confirmation, which is nice.</p>
  
  <p>My question is this - what properties does an app have to have in order to call <code>ShutdownThread.shutdown()</code>?  Does is require a particular permission that can be set if the device is rooted, or does it have to be signed using the firmware key, or something else entirely?</p>