Log why the consent flow hid the ad banner - #516
Merged
Conversation
Both UMP callbacks discarded their FormError and just called hideGoogleAds(), so a banner that never appears looks identical to one that was never requested. The ump sdk itself only logs an unspecific "Error making request.", which leaves nothing to go on. Report the error code and message through CrashManager instead, plus canRequestAds() for the case where the form succeeded but consent was withheld. Both callbacks only run while ads are enabled, which is also the only path that assigns crashManager, so there is no new null path. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DZqXBhXZsAp84ABwR5f3ff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Generated with Claude Code
Why
While checking that the ad banner still works after the package rename, the banner failed to appear and there was no way to tell why from the app's own logs.
Both UMP callbacks in
AdManagerdiscard theirFormErrorand just callhideGoogleAds(), so "consent failed" and "ads were never requested" look identical from outside. The UMP SDK only logs an unspecificError making request.of its own. Diagnosing it needed a temporary patch, a rebuild and a reinstall.What
Report the error code and message through
CrashManagerin both callbacks, pluscanRequestAds()for the case where the form itself succeeded but consent was withheld. A smalldescribe(FormError)helper keeps the two call sites readable.Both callbacks only run while ads are enabled, which is also the only path that assigns
crashManager, so this adds no new null path.CrashManageris logcat-only (tagODR) since the Firebase integration was removed, so nothing leaves the device.Testing
Verified on a physical Pixel 9 Pro running the Lite debug flavor.
The banner itself works. Consent form loads,
canRequestAds=true,onAdLoadedfires and a real ad renders inad_container. So the rename toapp.opendocument.droiddid not break AdMob — the identity is tied toapplicationId, which is unchanged.Happy path stays quiet. No new lines under the
ODRtag on a successful load.Failure path produces the intended line. Reproduced by clearing the cached UMP consent state and launching with the screen off, so the device dozes and the request times out:
That is the whole point of the change — previously this same run logged nothing at all from the app, and the banner just silently stayed hidden.
spotlessCheckandassembleLiteDebugpass.Worth knowing for anyone testing this: once consent info is cached,
requestConsentInfoUpdatesucceeds from cache even with no network, so the error path cannot be reproduced without clearingshared_prefs/__GOOGLE_FUNDING_CHOICE_SDK_INTERNAL__.xmlfirst.