Skip to content

Fix documentation errors in Android.App.Usage, Android.App.VoiceInteractions, Android.App.Wallpaper (R102, pass 3) - #1981

Merged
jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-review-app-usage-voice-wallpaper-docs
Nov 28, 2026
Merged

jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-review-app-usage-voice-wallpaper-docs

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: d196e98530fd38450b75ba46df955da83f67126c

Dimension Assessment Rationale
Change confidence 9/10 ↑ Six text-only edits in five XML files; all files parse; git diff --check is clean.
↑ Rubber-duck review (gemini-4-argon) confirmed all three fix types against pinned and AOSP sources.
↓ Copilot review is pending.
Diagnosis confidence 9/10 ↑ Each fix cites the implementation that contradicts the old text (Object.cs, JNIEnv.cs, AOSP 12.1 and 13 tags).
Evidence fit 9/10 ↑ The old text makes a claim that the cited code does not do; no runtime reproduction needed for doc text.

Scope

Pass-3 review item R102: 45 XML files in docs/xml/Android.App.Usage, docs/xml/Android.App.VoiceInteractions, docs/xml/Android.App.Wallpaper, and the three namespace files. Only text that changed since 86f7744a1 (AI-authored) was reviewed and edited. Pinned sources: AOSP source-37.2_r02 (r01 extract used only where it matches r02), and dotnet/android@9bc18c75 for generator and runtime behavior.

Fixes

  1. transfer parameter on Object-derived constructors (NetworkStats.Bucket, NetworkStatsManager, NetworkStatsManager.UsageCallback, StorageStatsManager).
    Old: "Specifies whether ownership of the JNI reference transfers to this instance."
    New: "Specifies how the runtime handles the JNI reference, including its release and peer registration."
    Evidence: dotnet/android@9bc18c75 Object.cs:110-118 (SetHandle constructs the peer with Copy, then calls JNIEnv.DeleteRef(value, transfer)) and JNIEnv.cs:360-393 (transfer selects DoNotRegister and deletion of the incoming reference). Same wording as Fix documentation errors in Android.App.PermissionUI (R060, pass 3) #1941. None of these types derives from Java.Lang.Throwable.

  2. NetworkStatsManager.RegisterUsageCallback handler parameter.
    Old: "to dispatch callback events through, otherwise if null it uses the calling thread."
    New: "The handler to dispatch callback events through. If null, on API level 32 and lower the callback runs on the looper of the thread that calls this method; starting with API level 33, the callback runs directly on the Binder thread that delivers the notification."
    Evidence: android-12.1.0_r27 NetworkStatsManager.java uses Looper.myLooper() when handler == null. android-13.0.0_r1 and source-37.2 NetworkStatsManager.java:1104-1118 use handler == null ? r -> r.run() : r -> handler.post(r), and UsageCallbackWrapper.onThresholdReached (Binder stub) calls mExecutor.execute. The upstream @param handler text "uses the calling thread" is wrong for API 33+.

  3. UsageEvents.GetNextEvent exception.
    Old: the IllegalArgumentException was documented for all API levels.
    New: "Starting with API level 33, if eventOut is null."
    Evidence: android-12.1.0_r27 UsageEvents.getNextEvent has no null check. android-13.0.0_r1 and source-37.2 UsageEvents.java:855-858 throw IllegalArgumentException("Given eventOut must not be null").

Out-of-scope finding (not edited; text is not AI-changed)

The remarks of UsageStatsManager.QueryUsageStats, QueryConfigurations, QueryEventStats and QueryEvents say "if the device is not unlocked (Android R+), then null will be returned". The client code returns an empty result, not null: UsageStatsManager.java:520-526 and 553-559 and 599-605 return an empty list, and 634-640 returns sEmptyResults. This sentence predates 86f7744a1, so this PR does not change it.

Uncertain findings

None.

Checks

  • All five changed XML files parse.
  • git diff --check: clean.
  • No new To be added placeholders.
  • No edits to index.xml, _filter.xml or FrameworksIndex.
  • Rubber-duck review with gemini-4-argon: no issues.

Ledger

655 of 655 AI-changed channels have a row with a numeric pinned source line: 649 correct, 6 fixed, 0 uncertain.

- Correct the transfer parameter text in four Object-derived constructors.
- Correct the NetworkStatsManager.RegisterUsageCallback handler text.
- Start the UsageEvents.GetNextEvent null-argument exception at API 33.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 28, 2026 13:14
@jonathanpeppers
jonathanpeppers enabled auto-merge (squash) November 28, 2026 13:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the documentation corrections to JNI reference handling and API-version-specific behavior.

No open issues 🎉

What changed in this PR

This documentation-only PR corrects JNI reference handling and API-version-specific behavior in the Android.App.Usage bindings. It makes no runtime code changes.

Changes:

  • Clarifies JNI reference release and peer registration in four constructor parameters.
  • Documents callback threading differences before and after API level 33.
  • Limits the documented null-argument exception for GetNextEvent to API level 33 and later.
File Description
docs/​xml/​Android.App.Usage/​UsageEvents.xml Qualifies the null-argument exception by API level.
docs/​xml/​Android.App.Usage/​StorageStatsManager.xml Clarifies constructor JNI reference handling.
docs/​xml/​Android.App.Usage/​NetworkStatsManager+UsageCallback.xml Clarifies constructor JNI reference handling.
docs/​xml/​Android.App.Usage/​NetworkStatsManager.xml Corrects JNI reference handling and callback threading documentation.
docs/​xml/​Android.App.Usage/​NetworkStats+Bucket.xml Clarifies constructor JNI reference handling.

Review effort: Balanced

@jonathanpeppers

Copy link
Copy Markdown
Member Author

@dalexsoto review

@dalexsoto

Copy link
Copy Markdown
Member

In response to @jonathanpeppers's request: The remaining checks are the API 32/33 implementation boundary for the null handler in NetworkStatsManager.RegisterUsageCallback, the API 33 null-argument exception in UsageEvents.GetNextEvent, and the four JNI transfer descriptions against the pinned runtime. I have read the requested changes and discussion, but have not yet independently read those platform implementation paths or finished the generated-binding checks. No upstream fetch failure occurred in this pass. These are reviewer coverage gaps, not defects identified in the PR; the exact checks remain queued.

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all five documentation changes and the relevant JNI reference ownership, usage-event null handling, and API 32/33 callback-threading boundary. The revised wording matches the inspected implementation and version-boundary evidence; no blocking issues found.

@jonathanpeppers
jonathanpeppers merged commit 5c18bd9 into main Nov 28, 2026
4 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-review-app-usage-voice-wallpaper-docs branch November 28, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants