ActivityManager.forceStopPackage()从任务管理器 [英] ActivityManager.forceStopPackage() from Task Manager

查看:244
本文介绍了ActivityManager.forceStopPackage()从任务管理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次在这里发帖。我不知道这是否是正确的地方要问这个问题,但我似乎并没有找到其他更合适的地方。这里是反正我的问题。

This is my first time posting here. I'm not sure if this is the right place to ask this question, but I don't seem to find other more appropriate places. Here's my question anyways.

据我所知,API ActivityManager.forceStopPackage()是一个内部的,并且只能从系统进程调用。但是,它让我为难了内置的任务管理器应用程序(带包名 com.motorola.PerformanceManager )在我的摩托罗拉Atrix 电话可以直接把它没有被系统进程。有两件事情是我核实。

I understand that the API ActivityManager.forceStopPackage() is an internal one and can be called only from system process. However, it puzzles me that the built-in Task Manager app (with package name com.motorola.PerformanceManager) on my motorola atrix phone can directly call it without being a system process. There are two things that I verified.

首先,这是由 PS 非系统进程的命令:

First, it is non-system process from ps command:

app_64 13681 1379 170788 29820 ffffffff 00000000 S com.motorola.PerformanceManager

第二,它确实要求从ODEX文件中的 ActivityManager.forceStopPackage() API(反编译成smali,然后进入DEX,然后到Java)。从smali code,它已经很清楚,它调用这个API。

Second, it indeed calls the ActivityManager.forceStopPackage() API from its odex file (decompiled into smali, then into dex, and then into java). From the smali code, it is already clear that it calls this API.

我还检查了的Andr​​oidManifest.xml 文件,它没有什么特别,似乎我(论坛误识别的内容,URL和prevents我可以发布他们)。

I also checked its AndroidManifest.xml file which seems nothing special to me (the forum mistakenly recognizes the content as URLs and prevents me from posting them).

清单文件不包含 android.permission.FORCE_STOP_PACKAGES 许可,这应该是一个系统中的一个。非系统应用程序仍然会得到许可拒绝错误即使有这样的权限。我尝试使用反射来访问这个API与 android.permission.FORCE_STOP_PACKAGES 权限,但仍然得到了运行时错误。

The manifest file does include the android.permission.FORCE_STOP_PACKAGES permission which is supposed to be a system one. A non-system app will still get permission denial error even with this permission. I tried using reflection to access this API with android.permission.FORCE_STOP_PACKAGES permission but still get the runtime error.

现在,怎样才能内置的任务管理器应用程序调用内部API不会是一个系统的过程。 一种可能性是,该应用与同一平台私钥签署。但是,我不知道我怎么可以验证。此外,它仍然应该是与在清单文件附加描述一个系统过程

Now, how can the built-in Task Manager app call the internal API without being a system process. One possibility is that the app is signed with the same platform private key. However, I'm not sure how I can verify that. Further, it is still supposed to be a system process with additional descriptions in the manifest file.

希望有人能回答我的问题。谢谢你。

Hope someone can answer my question. Thanks.

推荐答案

在android.permission.FORCE_STOP_PACKAGES权限由平台签名保护。

The "android.permission.FORCE_STOP_PACKAGES" permission is protected by the platform signature.

如果您有Android源$ C ​​$ C再检查权限的声明:

If you have Android source code then check the declaration of the permission:

/frameworks/base/core/res/AndroidManifest.xml

/frameworks/base/core/res/AndroidManifest.xml

...
    <permission android:name="android.permission.FORCE_STOP_PACKAGES"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:protectionLevel="signature"
...

您可以看到它的保护级别是签名,然后检查SDK文档中的解释:

You can see its protection level is signature, then check the SDK documentation for the explaination:

安卓的ProtectionLevel

"android:protectionLevel"

<一个href="http://developer.android.com/guide/topics/manifest/permission-element.html#plevel">http://developer.android.com/guide/topics/manifest/permission-element.html#plevel

签名......一个权限,该系统只授予如果发出请求的应用程序与同一证书作为申报许可的应用程序签名。如果证书匹配,系统自动授予的权限,并且不通知用户或请求针对用户的明确同意

"signature...A permission that the system grants only if the requesting application is signed with the same certificate as the application that declared the permission. If the certificates match, the system automatically grants the permission without notifying the user or asking for the user's explicit approval"

许可由框架清晰度是由平台签名签名的声明,所以想要使用许可申请也应具有相同签名的签名。

The permission is declared by the framework-res which is signed by the platform signature, so the application that wants to use the permission shall also be signed with the same signature.

/frameworks/base/core/res/Android.mk

/frameworks/base/core/res/Android.mk

...
     LOCAL_PACKAGE_NAME := framework-res
     LOCAL_CERTIFICATE := platform
...

问候

紫藤陈

这篇关于ActivityManager.forceStopPackage()从任务管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆