Android 最近在其 SDK 源代码中引入了@SystemApi.似乎与之前的 @hide 注释效果相同,因为它们也被从 SDK jar 类中剥离.
Android introduced @SystemApi in its SDK source code recently. Seems like same in effect as the @hide annotation before, since they also got stripped from SDK jar classes.
应用程序是否有可能以不同于旧的@hide API 的方式调用它们.
Is there any chance an app can call them in ways different from the old @hide APIs.
/**
* Indicates an API is exposed for use by bundled system applications.
* <p>
* These APIs are not guaranteed to remain consistent release-to-release,
* and are not for use by apps linking against the Android SDK.
* </p><p>
* This annotation should only appear on API that is already marked <pre>@hide</pre>.
* </p>
*
* @hide
*/
带有@SystemApi 注释的方法是带有@hide 的方法的子集.这显然是内部团队(可能也是合作伙伴)的一个指标,这些方法是实际的 API,尽管不是针对公共开发人员.
Methods annotated with @SystemApi are a subset of ones with @hide. It's apparently an indicator for internal teams (perhaps also partners) that these methods are actual APIs, although not for public developers.
因此,@SystemApi 方法将比 @hide 方法更稳定,将来可以随时更改,无需任何兼容性考虑,并且任何 OEM 都可以随意更改它们.
As a result, @SystemApi methods will be more stable than @hide ones, which could be changed at any time in the future without any compatibility consideration, and also any OEM is allowed to change them at their own will.
如果您尝试通过反射调用内部 API,请始终优先使用 @SystemApi 方法以实现更好的未来兼容性.
If you are trying to invoke internal APIs via reflection, always prefer @SystemApi methods for better future compatibility.
这篇关于新的@SystemApi 注解是什么意思,和@hide 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!