android - @UnsupportedAppUsage 注解描述了什么

标签 android annotations android-source

我正在构建一个具有系统权限的企业应用程序,它需要使用 BluetoothAdapter 类 setScanMode 中的一个函数。这是一个隐藏的API,仅适用于系统签名的apks,现在这个函数上面有@UnsupportedAppUsage,任何人都可以帮助我理解这个注释。

https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/bluetooth/BluetoothAdapter.java

最佳答案

如果我们转到 annotation source :

/**
 * Indicates that a class member, that is not part of the SDK, is used by apps.
 * Since the member is not part of the SDK, such use is not supported.
 *
 * <p>This annotation acts as a heads up that changing a given method or field
 * may affect apps, potentially breaking them when the next Android version is
 * released. In some cases, for members that are heavily used, this annotation
 * may imply restrictions on changes to the member.
 *
 * <p>This annotation also results in access to the member being permitted by the
 * runtime, with a warning being generated in debug builds.
 *
 * <p>For more details, see go/UnsupportedAppUsage.
 *
 * {@hide}
 */

基本上,这意味着它正在被应用程序使用,即使它在技术上不是 SDK 的一部分,因此不受支持。这似乎更像是对任何为 AOSP 做出贡献的人的警告,而不是你需要担心太多的事情。

关于android - @UnsupportedAppUsage 注解描述了什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52499754/

相关文章:

android - 为什么不显示android通知文本?

安卓 setOnTouchListener

android - 在 AOSP 中添加预构建的 Apk 会崩溃

android - 如何将系统服务添加到 Android Framework

java - 修改自定义注解的参数值

android - 如何使用 RRO 框架调整系统应用自定义颜色?

java - Android - 以编程方式创建一行图标?

android - 如何使用 Android SimpleCursorAdapter 合并两个或多个列

java - 带注解的代码风格

annotations - @OpenAPIDefinition 放在哪里?