GET_TASKS Permission Deprecated

2019-02-05 11:11发布

I have an security App (App Locker) that uses this permission:

android.permission.GET_TASKS

In android Lollipop this permission is deprecated and i want that my app works in +21 API.
Can anyone guide me how?

Thnx :)

2条回答
我命由我不由天
2楼-- · 2019-02-05 11:49

I saw a new permission REAL_GET_TASKS that is said to be used instead of GET_TASKS:

New version of GET_TASKS that apps can request, since GET_TASKS doesn't really give access to task information. We need this new one because there are many existing apps that use add libraries and such that have validation code to ensure the app has requested the GET_TASKS permission by seeing if it has been granted the permission... if it hasn't, it kills the app with a message about being upset. So we need to have it continue to look like the app is getting that permission, even though it will never be checked, and new privileged apps can now request this one for real access.

See the Android code difference at: https://android.googlesource.com/platform/frameworks/base/+/2d7576b%5E!/

查看更多
The star\"
3楼-- · 2019-02-05 11:59

There is reason why it is deprecated. The protection Level of android.permission.GET_TASKS has been elevated to signatureOrSystem. There is no easy and unharmful solution for that.

As of LOLLIPOP, this method is no longer available to third party applications: the introduction of document-centric recents means it can leak personal information to the caller. For backwards compatibility, it will still return a small subset of its data: at least the caller's own tasks (though see getAppTasks() for the correct supported way to retrieve that information), and possibly some other tasks such as home that are known to not be sensitive.

http://developer.android.com/reference/android/app/ActivityManager.html#getRecentTasks(int,%20int)

查看更多
登录 后发表回答