Skip to content

Minor: interstitial double-show guard missing, resetToDefaults inconsistency, builder onAdDismissed false positives #36

Description

@i2hammad

Found in code audit. Small remaining items, bundled.

Details

  1. No isDisplayingAd guard in AdManager.showAd() (AdManager.kt:1194-1295, getAnyAvailableAd() 1178-1192): showAd() checks only isReady(). While an ad from the legacy mInterstitialAd fallback is on screen, isReady() is still true, so a second showInterstitialIfReady() retrieves the same InterstitialAd and calls show() again; the failure callback then sets isDisplayingAd = false and nulls state while the first showing is in progress, firing the second caller's onNextAction() prematurely. Note mInterstitialAd is mirrored on every pool load (line 433) and pool removal does not clear the mirror.
  2. AdManageKitConfig.resetToDefaults() restores maxCacheMemoryMB = 50 while the declared default is 200 (line 423 vs 502) — calling reset silently quarters the native-ad cache budget versus a fresh process.
  3. InterstitialAdBuilder maps onNextAction() directly to onAdDismissedCallback (lines 451-454): onNextAction() fires on every skip/failure/timeout path (premium user, no fill, interval skip), so .onAdDismissed reports "ad watched" false positives. Related: .force() has no effect unless minInterval() is also set (line 433 is the only read of forceShow), contradicting its documentation.
  4. Retry closures retain Activity contexts (AdManager.kt:330-337, 458-465, 579-586): retry lambdas capture the caller's context/callback and are held by AdRetryManager's handler for up to maxRetryDelay.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions