Never interact with "phone" while holding locks.

We've seen devices where heavy communication between "system_server"
and the "phone" process can exhuast Binder threads, especially when
calling while holding locks.  To mitigate this, we now interact with
the "phone" process before acquiring any locks.

Update our internal data structures either when we see a connectivity
change, or when SubscriptionManager tells us something changed.

Fix bug in resolveSubscriptionPlan() that always picked the 0'th
SubscriptionPlan instead of looking for the currently active plan;
we now use the same logic for both NSS and NPMS.

Bug: 77908520, 77154412
Test: atest com.android.server.NetworkPolicyManagerServiceTest
Test: atest com.android.server.net.NetworkStatsServiceTest
Change-Id: I177d3fa6cddc78d745b35a9ede12451d458b892c
3 files changed