What does QUERY_ALL_PACKAGES permission do?

回眸只為那壹抹淺笑 提交于 2021-01-27 05:06:21

问题


Android R Preview 1 introduced a new permission called QUERY_ALL_PACKAGES. The documentation for the permission says the following:

Allows query of any normal app on the device, regardless of manifest declarations.

Has anyone worked out what this actually does?

I've tried running the following on the emulator image, and the permission had no effect on either of them:

  • packageManager.queryIntentActivities(intent, 0)
  • packageManager.getInstalledPackages(0)

回答1:


They cover this more now that DP2 is out.

Quoting myself:

While I haven't tested this aspect of R DP2 yet, it appears that your app now can't find out what other apps are installed, on a general basis. The cited example is queryIntentActivities(), but to make this really work you would need to seriously lobotomize PackageManager. You can whitelist certain packages and certain <intent-filter> structures to try to get by this for certain use cases. And, this is where the mysterious QUERY_ALL_PACKAGES permission seen in DP1 comes into play — this permission removes these new restrictions. Given the "look for Google Play to provide guidelines for apps that need this permission" caveat, it is safest to assume that if you try using it, eventually you will be banned from the Play Store by a bot.

So, you might want to re-try your experiments on DP2. I plan to do the same in the coming weeks.



来源:https://stackoverflow.com/questions/60679685/what-does-query-all-packages-permission-do

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!