Use pending uid state when calculating network blocked state.
Since uid state callbacks are handled asynchronously, it is
possible that the network gets restricted before the uid
state callback is handled. So, when checking if the uid is in
the foreground, also consider any pending uid callback info.
Fixes: 278453942
Fixes: 278661002
Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideConnOnActivityStartTest.java
Test: atest services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
Change-Id: Id5b6bd025731dc57952fef5e311d6efef310ff94
3 files changed