46

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 :)

Saman Sattari
  • 3,322
  • 6
  • 30
  • 46

2 Answers2

32

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)

Caqtus
  • 489
  • 4
  • 4
11

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!/

Gürol Canbek
  • 1,096
  • 1
  • 14
  • 20
  • Do you know how to use it? – android developer Aug 30 '15 at 22:34
  • 2
    GET_TASKS was a 'normal' permission which can be requested by 3rd party applications. However, REAL_GET_TASKS's protection level is signature or system which cannot be requested by 3rd party applications. – Gürol Canbek Sep 01 '15 at 12:56
  • I think it is about the certificate that is used to sign the application not about the user credentials. This may be helpful: Acquire “signature” permissionlevel on Android on [link](http://stackoverflow.com/questions/18297986/acquire-signature-permissionlevel-on-android) – Gürol Canbek Sep 16 '15 at 18:32
  • You mean "adb shell pm grant" command? It won't help, as this permission is already granted, just that it won't do the same as previous versions of Android. It will only show you apps that your current app has launched. – android developer Sep 16 '15 at 20:28
  • 1
    Kudos for providing the commit, very interesting – HenriqueMS Aug 11 '17 at 09:38
  • Permission is only granted to system apps – jujka Jun 06 '19 at 16:38