This was added to the TorClient.dispose() JNI pathway because that native coded did not require access to JNIEnv or JClass. However, it turns out that this annotation was only added in Android 8 for system usage 0, and was not CTS-tested public API until Android 14. For whatever reason, in API 27 (Android 8.1) the native method symbol can't be found, but in API 28 and above it can be.
The performance cost of regular JNI is no longer necessary to worry about given that we now keep a TorClient around long-term as part of SdkSynchronizer, so instead of doing anything complex to preserve it on API 28+ we just remove the @CriticalNative annotation and adjust the native method's signature to take (and ignore) the extra arguments.
[^1]: Code often looks different when reviewing the diff in a browser, making it easier to spot potential bugs.
[^2]: While we aim for automated testing of the SDK, some aspects require manual testing. If you had to manually test
something during development of this pull request, write those steps down.
[^3]: _While we are not looking for perfect coverage, the tool can point out potential cases that have been missed. Code coverage can be generated with: ./gradlew check for Kotlin modules and ./gradlew connectedCheck -PIS_ANDROID_INSTRUMENTATION_TEST_COVERAGE_ENABLED=true for Android modules._
[^4]: Having your code up to date and squashed will make it easier for others to review. Use best judgement when squashing commits, as some changes (such as refactoring) might be easier to review as a separate commit.
[^5]: In addition to a first pass using the code review guidelines, do a second pass using your best judgement and experience which may identify additional questions or comments. Research shows that code review is most effective when done in multiple passes, where reviewers look for different things through each pass.
[^6]: While the CI server runs the demo app to look for build failures or crashes, humans running the demo app are
more likely to notice unexpected log messages, UI inconsistencies, or bad output data. Perform this step last, after verifying the code changes are safe to run locally.
This was added to the
TorClient.dispose()
JNI pathway because that native coded did not require access toJNIEnv
orJClass
. However, it turns out that this annotation was only added in Android 8 for system usage 0, and was not CTS-tested public API until Android 14. For whatever reason, in API 27 (Android 8.1) the native method symbol can't be found, but in API 28 and above it can be.The performance cost of regular JNI is no longer necessary to worry about given that we now keep a
TorClient
around long-term as part ofSdkSynchronizer
, so instead of doing anything complex to preserve it on API 28+ we just remove the@CriticalNative
annotation and adjust the native method's signature to take (and ignore) the extra arguments.Closes Electric-Coin-Company/zcash-android-wallet-sdk#1587.
Author
Reviewer
[^1]: Code often looks different when reviewing the diff in a browser, making it easier to spot potential bugs. [^2]: While we aim for automated testing of the SDK, some aspects require manual testing. If you had to manually test something during development of this pull request, write those steps down. [^3]: _While we are not looking for perfect coverage, the tool can point out potential cases that have been missed. Code coverage can be generated with:
./gradlew check
for Kotlin modules and./gradlew connectedCheck -PIS_ANDROID_INSTRUMENTATION_TEST_COVERAGE_ENABLED=true
for Android modules._ [^4]: Having your code up to date and squashed will make it easier for others to review. Use best judgement when squashing commits, as some changes (such as refactoring) might be easier to review as a separate commit. [^5]: In addition to a first pass using the code review guidelines, do a second pass using your best judgement and experience which may identify additional questions or comments. Research shows that code review is most effective when done in multiple passes, where reviewers look for different things through each pass. [^6]: While the CI server runs the demo app to look for build failures or crashes, humans running the demo app are more likely to notice unexpected log messages, UI inconsistencies, or bad output data. Perform this step last, after verifying the code changes are safe to run locally.