AndroidP 限制访问Hidden API 相关信息

Android9.0开始,谷歌启用限制非SDK API的访问,包括hide方法和类,以及通过反射机制访问等。

这些变更行为提交可参考:

https://android-review.googlesource.com/q/owner:dbrazdil%2540google.com

Joined:  Nov 25, 2014
 

关于设置模块可以访问 hide方法的解释及方案:

Settings is what we call a"bundled" app, which means that it is part of the OS and is alwaysbuilt against a specific version of the framework. Regular apps are"unbundled". They are supposed to work against all versions of theframework (all Android releases, all OEM tweaks), which is why we started torestrict their access to the framework's implementation details that are notguaranteed to stay the same across the ecosystem.

What exactly are you trying to do? If youare building the entire OS and want to add your own bundled app like Settings,you can add its package name to this file [1]. Note that this will only work ifthe app is installed in /system.

If you're building an unbundled app, pleasefile a request at [2] with a list of methods that you are trying to access butcurrently can't. We will make sure they continue to work in P and can start adiscussion on whether they should become public API. Note, however, that we nowconsider access to hidden APIs deprecated and unbundled apps will see stricterrestrictions with every new release of Android.

If you need more info on this, check out[3], or don't hesitate to contact me again.

[1] https://android.googlesource.com/platform/frameworks/base/+/master/data/etc/hiddenapi-package-whitelist.xml 

[2] https://issuetracker.google.com/issues/new?component=328403&template=1027267

[3] https://developer.android.com/preview/restrictions-non-sdk-interfaces


猜你喜欢

转载自blog.csdn.net/snail201211/article/details/80528387
今日推荐