HalDeviceManager: Allow replacement of requestor worksource

There are cases where the worksource associated for an iface changes
post creation.
For ex:
a) New app starts using aware, original requesting app has stopped using
aware (or was killed). HalDeviceManager should now have the new app's
context for prioritization decisions.
b) Scan only mode STA iface starts with the lowest priority (since it is
not considered explicit user action). When the user toggles wifi on, we
then need to change the worksource in place (same STA iface, but role
changes in ActiveModeWarden) to ensure that the STA iface now has higher
priority.

Use this new mechanism to fix the issue reported in b/170076208 more
cleanly (lower priority scan only mode request will not bring down user
triggered SAP on legacy devices).

Also, added MAINLINE_NETWORK_STACK in the list of priviliged permissions
(since tethering module uses that permission).

PS: Will add a follow up CL for plumbing this dynamic requesting app
change info from aware service/p2p service to HalDeviceManager.

Bug: 170076208
Bug: 162344695
Test: atest com.android.server.wifi
Test: Verified scenario above on both new Pixel devices (STA + AP
supported) and legacy Pixel devices (STA + AP not supported).

Change-Id: I053ad541c7d687a0bb7ed8af41ff4b2ad1ce4e16
15 files changed
tree: cac37e981a84ee53f707736f59d0a8b1e438bf66
  1. apex/
  2. service/
  3. metrics_pdd_hook.py
  4. PREUPLOAD.cfg