Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

目前有两个机型是5.0以上的系统,但是监听的所有Activity都是emmagee的,无法监听对应应用。 #49

Closed
smallerdawn opened this issue Oct 22, 2015 · 1 comment

Comments

@smallerdawn
Copy link

GT-I9508 5.0.1
HTC D816v 5.0.2
上面两个系统,监听到的Activity都是com.netease.qa.emmagee.activity.MainPageActivity
无法兼容我需要的应用的内存cpu数据等,想请求下什么原因呢?(操作红米1 4.2.2系统的是可以获取app的信息的)

@andrewleo
Copy link
Member

原因是在android 5.0.1版本以上,google出于安全性考虑,不允许第三方应用获取当前运行的进程了,而为了保持向下兼容,这个方法会返回第三方应用的进程信息,官方对getRunningTasks的注释如下:

public List<ActivityManager.RunningTaskInfo> getRunningTasks (int maxNum)

Added in API level 1
This method was deprecated in API level 21.
As of LOLLIPOP, this method is no longer available to third party applications: the introduction of document-centric recents means it can leak person information to the caller. 
For backwards compatibility, it will still retu rn a small subset of its data: 
at least the caller's own tasks, and possibly some other tasks such as home that are known to not be sensitive.

官方说明:http://developer.android.com/intl/zh-cn/reference/android/app/ActivityManager.html#getRunningTasks(int)

我们会尝试是否可以找到其他方式获取,不过并不乐观。因为google正在逐渐废除之前的一些不太安全的方法,不止是getRunningTasks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants