Several questions about shutting down a rooted android device have answers saying you should run "reboot -p" within an "su" shell. However, this answer says that reboot is quite low-and-dirty and doesn't do sufficient tidying up before pulling the plug. Instead it recommends using android.internal.app.ShutdownThread.shutdown()
. Looking at the code 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.
关于关闭一个有根的android设备的几个问题,有答案说你应该在一个“su”shell中运行“重启-p”。然而,这个回答说,重启是相当低和肮脏的,在拔插头之前没有做足够的整理。相反,它推荐使用android.internal.app.ShutdownThread.shutdown()。看看代码,我可以看到这是一大堆我想要做的整理工作,而且它还有一个方便的“确认”参数,它可以让你在不需要确认的情况下关闭,这很好。
My question is this - what properties does an app have to have in order to call ShutdownThread.shutdown()
? 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?
我的问题是,应用程序必须具备哪些属性才能调用ShutdownThread.shutdown()?是否需要一个特定的权限,如果设备是根的,或者必须使用固件密钥或其他完全的东西来签名?
1 个解决方案
#1
2
Shutting down the device requires you to hold android.permission.SHUTDOWN
which is only available to system applications, or applications signed with the platform certificate.
关闭设备需要你持有android.permission。只可用于系统应用程序的关闭,或与平台证书签署的应用程序。
#1
2
Shutting down the device requires you to hold android.permission.SHUTDOWN
which is only available to system applications, or applications signed with the platform certificate.
关闭设备需要你持有android.permission。只可用于系统应用程序的关闭,或与平台证书签署的应用程序。