Is it safe to use @SuppressLint(“RestrictedApi”) with AndroidX libraries?

You're correct: this is not safe. The only guarantee is that they won't break the behavior that other AndroidX libraries. 
This is especially true for symbols that restrict to a single library or a library group that requires all libraries within the group to be pinned to the same version, as there is no need to maintain compatibility with different versions of other AndroidX libraries.
I guess that the development team wanted to hide such restricted code from the API users. Probably due to changes in the future or because the code is intended to work as internal functionality

 This is exactly correct. Symbols marked with @RestrictTo are not considered public API and may change behavior or signature arbitrarily between releases.

No comments:

Powered by Blogger.