@UnsupportedAppUsage 注释描述了什么 [英] What does @UnsupportedAppUsage annotation depict

查看:49
本文介绍了@UnsupportedAppUsage 注释描述了什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个具有系统权限的企业应用程序,它需要使用 BluetoothAdapter 类 setScanMode 中的函数.这是一个隐藏的 API,只适用于系统签名的 apk,现在这个函数上面有@UnsupportedAppUsage,谁能帮我理解这个注释.

I am building an Enterprise app which has system permission and it requires to use a function from BluetoothAdapter class setScanMode. This is a hidden API which is only available for system signed apks, now this function has @UnsupportedAppUsage above it, can anyone help me understand this annotation.

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

推荐答案

如果我们去注解源:

/**
 * 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 做出贡献的人来说,这似乎更像是一个警告,而不是您需要过多担心的事情.

Basically, it means it's being used by apps, even though it's not technically part of the SDK, and thus isn't supported. It seems to be more of a warning for anyone contributing to AOSP rather than something you need to worry about too much.

这篇关于@UnsupportedAppUsage 注释描述了什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆