简体   繁体   English

如何在有 root 权限的手机上使用 android.permission.SHUTDOWN?

[英]How can I use android.permission.SHUTDOWN on a rooted phone?

How can I send Intent to shutdown the phone if I have a rooted phone?如果我有一个根电话,我如何发送意图来关闭手机? I put the app in system/app but this was not good enough.我把应用程序放在系统/应用程序中,但这还不够好。 What more do I have to do?我还需要做什么?

It says in docs about public static final String ACTION_SHUTDOWN :它在关于public static final String ACTION_SHUTDOWN文档中说:
This is a protected intent that can only be sent by the system.这是一个受保护的意图,只能由系统发送。

What does it mean only sent by the system?只由系统发送是什么意思? If I get my app to get correct UID, can I do it then?如果我让我的应用程序获得正确的 UID,那么我可以这样做吗? Or can it absolutely never be done even on a rooted phone?或者即使在有root权限的手机上也绝对无法完成?

The Android source in GrepCode suggests that before Android 4.0 this was a signature-only permission, but is now signature or system. GrepCode 中的 Android 源表明,在 Android 4.0 之前,这是一个仅签名权限,但现在是签名或系统。 This means that you either have to be signed with the key that was used to sign the platform (usually OEM apps only) or be in the /system/app folder.这意味着您要么必须使用用于签署平台的密钥(通常仅限 OEM 应用程序)进行签名,要么位于 /system/app 文件夹中。 In more recent versions of Android this folder is /system/priv-app to allow vendors to distribute built-in applications with different levels of trust.在更新的 Android 版本中,此文件夹是 /system/priv-app,以允许供应商分发具有不同信任级别的内置应用程序。

您可以以 root 身份运行 adb shell 命令来关闭设备。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果我在Android上检测到植根电话,如何禁用Activesync? - How can I disable Activesync if I detect a rooted phone on Android? 如何将文件从根目录复制到无根android手机的另一个目录中? - How can i copy a file from a rooted directory to another directory in a non rooted android phone prorammatically? 如何在已扎根的android手机上以编程方式停止系统服务? - How can I stop a system service programmatically on a rooted android phone? 具有getevent的扎根android手机上的权限被拒绝 - Permission denied on rooted android phone with getevent 如何以编程方式关闭Android 4.0 rooted Device - How to Shutdown Android 4.0 rooted Device programatically 如何手动将GPS数据发送到Android手机上的“位置管理器”(已root) - How can I manually send GPS data to Location Manager on my android phone(rooted) android.permission.ANSWER_PHONE_CALLS 如何使用? 用于自动应答 - android.permission.ANSWER_PHONE_CALLS How I can use? for auto answer 安卓手机截图 - Android rooted phone screenshots 如何获得根电话的NFCEE_ADMIN权限? - How to obtain NFCEE_ADMIN permission on rooted phone? 在有根 Android 设备上,如何打开 &lt; 1024 的端口? - On a rooted Android device, how can I open a port < 1024?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM