Repository navigation
Fix documentation errors in Android.Security.Keystore and Android.Security.Net.Config (R116, pass 3) - #1995
Conversation
…(R116) - Throwable-derived exception constructors: transfer controls release only. - KeyStorePurpose.AgreeKey and KeyStoreSecurityLevel.UnknownSecure: use crefs. - KeyProtection.Builder.SetMgf1Digests: Set.of rejects a null array. - NetworkSecurityConfig.DomainEncryptionMode: replace raw Class#member text. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for this documentation-only update to API descriptions and links.
No open issues 🎉
What changed in this PR
This documentation-only PR corrects API descriptions and links in Android.Security.Keystore and Android.Security.Net.Config, continuing the R116 pass-3 cleanup. It does not change runtime behavior.
Changes:
- Corrects JNI reference-release wording for eight Throwable-derived exceptions, consistent with #1972.
- Replaces three raw Java references with managed API links.
- Documents that
SetMgf1Digestsrejects null, based on the pinned implementation despite conflicting upstream annotations.
| File | Description |
|---|---|
| docs/xml/Android.Security.Net.Config/NetworkSecurityConfig.xml | Links to the managed domain-encryption query. |
| docs/xml/Android.Security.Keystore/UserPresenceUnavailableException.xml | Corrects JNI reference-release wording. |
| docs/xml/Android.Security.Keystore/UserNotAuthenticatedException.xml | Corrects JNI reference-release wording. |
| docs/xml/Android.Security.Keystore/StrongBoxUnavailableException.xml | Corrects JNI reference-release wording. |
| docs/xml/Android.Security.Keystore/SecureKeyImportUnavailableException.xml | Corrects JNI reference-release wording. |
| docs/xml/Android.Security.Keystore/KeyStoreSecurityLevel.xml | Links to TrustedEnvironment. |
| docs/xml/Android.Security.Keystore/KeyStorePurpose.xml | Links to the managed KeyAgreement.Init overload. |
| docs/xml/Android.Security.Keystore/KeyProtection+Builder.xml | Changes mgf1Digests documentation to disallow null. |
| docs/xml/Android.Security.Keystore/KeyPermanentlyInvalidatedException.xml | Corrects JNI reference-release wording. |
| docs/xml/Android.Security.Keystore/KeyNotYetValidException.xml | Corrects JNI reference-release wording. |
| docs/xml/Android.Security.Keystore/KeyExpiredException.xml | Corrects JNI reference-release wording. |
| docs/xml/Android.Security.Keystore/BackendBusyException.xml | Corrects JNI reference-release wording. |
Review effort: Balanced
|
@dalexsoto review |
|
In response to @jonathanpeppers's request: I still need to check the edited constructor remarks about the incoming JNI reference ( |
dalexsoto
left a comment
There was a problem hiding this comment.
I reviewed all 12 changed members at 34a270e against the current target 81f1249 (merge base aae7c2c). The 7 commits merged into the target since then don't touch these files or the cref targets.
transferon the 8 Throwable-derived(IntPtr, JniHandleOwnership)constructors: matches the current runtime.Throwable.SetHandle(dotnet/android@9bc18c75 and release/10.0.1xx, Throwable.cs:99-110) copies the reference withJniObjectReferenceOptions.Copyand passestransferonly toJNIEnv.DeleteRef, so the old 'whether the peer is registered' text was wrong for these types. This is the wording accepted in #1972.- Non-blocking note: these constructor docs are shared with the net-android-34.0 and 35.0 views (all 8 DocIds are listed in both FrameworksIndex files). On .NET 9 (API 35),
Throwable.SetHandlegoes throughAndroidValueManager.AddPeer, which keeps aTransferGlobalRefhandle without copying it and honorsDoNotRegister(release/9.0.1xx AndroidRuntime.cs:686-709). So the sentence isn't exact on those older views. #1972 already settled on documenting the current managed pin, so I'm not blocking on this. If you want the series to be exact on every view, wording that also covers adopting the reference would do it. SetMgf1Digests: 'cannot be null' is correct for API 35+ because a null array reachesSet.of(mgf1Digests), which throws. The@Nullableconflict is disclosed in the description.- The three new crefs (
KeyAgreement.Init(IKey),KeyStoreSecurityLevel.TrustedEnvironment,NetworkSecurityPolicy.GetDomainEncryptionMode(string)) resolve to existing, matching members.
No blocking issues found.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
34a270e25338195f235af3f076ab27d27ff0e7a2↑ All changed XML parses;
git diff --checkis clean; gemini-4-argon review found no issues.↓ SetMgf1Digests fix contradicts the @nullable annotation (implementation evidence used).
Pass-3 review item R116: 25 files in
Android.Security.KeystoreandAndroid.Security.Net.Config. Pinned sources: AOSPsource-37.2_r01, dotnet/android@9bc18c75.Fixes (12 channels)
transferparam on 8 Throwable-derived exceptions (BackendBusy, KeyExpired, KeyNotYetValid, KeyPermanentlyInvalidated, SecureKeyImportUnavailable, StrongBoxUnavailable, UserNotAuthenticated, UserPresenceUnavailable). The old text said thattransfercontrols peer registration. That is true only forJava.Lang.Object.Throwablecopies the reference and usestransferonly to release it (Throwable.cs:99-110). Wording as in Fix documentation errors in Android.Health.Connect (R093, pass 3) #1972. KeyInfo, KeyProperties and WrappedKeyEntry are Object-derived, so their text stays as it is.javax.crypto.KeyAgreement#init(java.security.Key)text to a cref toKeyAgreement.Init(IKey)(KeyProperties.java:115).SECURITY_LEVEL_TRUSTED_ENVIRONMENTtext to a cref toKeyStoreSecurityLevel.TrustedEnvironment(KeyProperties.java:869{@link}).Set.of(mgf1Digests)(KeyProtection.java:802) throws NullPointerException for a null array. A C#nullarray goes to Java as JNI null.NetworkSecurityPolicy#getDomainEncryptionMode(String)text to a cref (API 37, not obsolete).Uncertain / conflicts
@Nullableannotation (KeyProtection.java:801) and the 37.2 reference say that null is permitted, but the r01 implementation throws. I fixed the text because the implementation decides behavior. I did not check r02.Follow-ups (not changed)
KeyGenerator.generateKey(), but the throw is inKeyPairGenerator.generateKeyPair.Checks
git diff --checkis clean.