我正在构建一个企业应用程序,它具有系统权限,并且需要使用BluetoothAdapter类的setScanMode函数。这是一个隐藏的API,仅适用于系统签名的apk,现在这个函数上面有@UnsupportedAppUsage注释,请问有谁可以帮助我理解这个注释。
我正在构建一个企业应用程序,它具有系统权限,并且需要使用BluetoothAdapter类的setScanMode函数。这是一个隐藏的API,仅适用于系统签名的apk,现在这个函数上面有@UnsupportedAppUsage注释,请问有谁可以帮助我理解这个注释。
如果我们前往注释源代码:
/**
* 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做贡献的人的警告,而不是你需要过多担心的事情。
以上注释来源的描述是正确的。我现在的代码中出现了一个异常,而之前却没有。我正在通过TextView.class中的一些字段设置光标处理程序的颜色,这些字段现在不被支持,并导致异常发生,在Pie上我不能设置句柄颜色,这不仅仅是一个警告。