Add restriction grace period for sensitive process-states
Apps recently used by the user in some process states may be more likely
to be brought to TOP again in the near future. For these states, we want
to grant longer grace period before shutting off network access.
Conversely, other process states that are cached or about to be cached
will get their network blocked more aggressively. As implemented the
intention of this grace period is to act as a debounce and is not meant
to grant functionality to apps in these states.
Note that NPMS will listen to the necessary process-state changes to
update the firewall rules sooner if needed, but vice-versa is not true.
This is done because (1) apps should only move to TOP_SLEEPING or
LAST_ACTIVITY from an unblocked state, and (2) processing of firewall
rules after short delay is likely to complete before any such change can
be processed by the service.
Flag: com.android.server.net.use_different_delays_for_background_chain
Test: atest CtsHostsideNetworkPolicyTests
Test: atest FrameworksServicesTests:NetworkPolicyManagerServiceTest
Bug: 323963467
Change-Id: I9a3627e04e7a43953a4053606e6b034925758f7a
3 files changed