2 ms·
> [W]ith Android P we're starting a gradual process to restrict access to selected non-SDK interfaces, asking developers -- including app teams inside Google --
by saagarjha 9y ago
> [W]ith Android P we're starting a gradual process to restrict access to selected non-SDK interfaces, asking developers -- including app teams inside Google -- to use the public equivalents instead. In cases where there is no public equivalent for your use-case, please let us know -- we want to make sure that this process is as smooth as possible for developers, so we'll use your feedback to ensure the initial rollout only affects APIs where developers can easily migrate to public alternatives.
What's the situation with private API use on Android? What can you do with private API? Will you be rejected from the Play Store if you use it?
- Karliss 9y agoAcording to https://android-developers.googleblog.com/2018/02/improving-stability-by-reducing-usage.html https://android-developers.googleblog.com/2018/02/improving-... it will simply not be possible to access API you are not supposed to touch. Trying it will result in NoSuchFieldException/NoSuchMethodException.
- saagarjha 9y ago> Starting in the next release of Android, some non-SDK methods and fields will be restricted so that you cannot access them -- either directly, via reflection, or JNI. If you try, you can see errors such as NoSuchFieldException or NoSuchMethodException. Yes, how is this done? Using SecurityManager or something similar?
- pjmlp 9y agoI guess so. For NDK they are using a similar process. Any attempt to use on-device libraries not part of the official NDK APIs will terminate the application.
- kllrnohj 9y agoIn the runtime itself: https://android-review.googlesource.com/c/platform/art/+/580003/10 https://android-review.googlesource.com/c/platform/art/+/580... CL is abandoned but it appears to have just be split up into smaller changes, so that should still give a good idea of the approach being used.