Expose isUidNetworkingBlocked and isUidRestrictedOnMeteredNetworks
These methods are used by ConnectivityService for synchronous
calls such as getActiveNetworkInfo, isActiveNetworkMetered, etc.
These calls must call into NPMS and acquire the NPMS lock because
they are synchronous. They cannot use the stale copy of the
policy rules maintained by ConnectivityService, because if they
did, races like the following could occur:
1. App gets broadcast/callback/....
2. App calls isActiveNetworkMetered or other synchronous method.
3. ConnectivityService's copy of the rules is out of date, so the
call returns stale information that the UID is still blocked.
4. The app thinks it has no networking, and does not call the
synchronous method again until some other event occurs,
potentially much later.
Bug: 176289731
Test: passes existing tests in ConnectivityServiceTest
Change-Id: I4ad0ca60431fe3702be85332530b6e93728d55e7
Merged-In: I4ad0ca60431fe3702be85332530b6e93728d55e7
3 files changed