@UnsupportedAppUsage 注解描述了什么
What does @UnsupportedAppUsage annotation depict
我正在构建一个具有系统权限的企业应用程序,它需要使用来自 BluetoothAdapter class setScanMode 的功能。这是一个隐藏的API,仅适用于系统签名的apks,现在这个函数上面有@UnsupportedAppUsage,谁能帮我理解这个注释。
如果我们去 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 做出贡献的人的警告,而不是你需要担心太多的事情。
以上注释来源描述正确。我现在在我的 Pie 代码中遇到了一个异常,而以前没有。我通过 TextView.class 中的某些字段设置光标处理程序颜色,这些字段现在不受支持,并导致在我无法在 Pie 中设置句柄颜色时发生异常。
这不仅仅是一个警告。
我正在构建一个具有系统权限的企业应用程序,它需要使用来自 BluetoothAdapter class setScanMode 的功能。这是一个隐藏的API,仅适用于系统签名的apks,现在这个函数上面有@UnsupportedAppUsage,谁能帮我理解这个注释。
如果我们去 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 做出贡献的人的警告,而不是你需要担心太多的事情。
以上注释来源描述正确。我现在在我的 Pie 代码中遇到了一个异常,而以前没有。我通过 TextView.class 中的某些字段设置光标处理程序颜色,这些字段现在不受支持,并导致在我无法在 Pie 中设置句柄颜色时发生异常。 这不仅仅是一个警告。