Force only system uid can set uids allowed on restricted networks

- Check whether calling UID/PID is system_server.
- For CTS test, enforce NETWORK_SETTINGS permission otherwise if
  it's a debug build.

Bug: 175199465
Test: atest FrameworksNetTests
Test: atest ConnectivityManagerTest#testUidsAllowedOnRestrictedNetworks
Ignore-AOSP-First: Need cherry-pick
Change-Id: I175a831671d3e52460d28203b09f6c0dda56b61c
2 files changed