Only delay releasing network activity assertion when the application is foreground and is doing loads in a view that is not visible. This is the case r204716 was trying to fix. Limiting the fix to only this use case will limit the risk of unwanted side effects.
Created attachment 286726 [details] Patch
Gavin is not convinced this is worth the complexity.