Add TestNetworkStackService to NetworkStack

TestNetworkStackService allows (test) applications to bind to the
NetworkStack using NETWORK_SETTINGS permissions (instead of
MAINLINE_NETWORK_STACK), only on debuggable builds.

On such builds, also allow applications to perform binder calls to the
NetworkStack if their UID/PID was allowed by root. Such applications
must also have NETWORK_SETTINGS permissions when they are being
allowed: typically they will obtain it via adoptShellPermissionIdentity.

Effectively, this patch allows tests to communicate with the
NetworkStack binder interface if they have root access, can use
shell permissions, and the device has a debuggable build. This could be
used on userdebug devices, or on devices booting with the debug ramdisk.

Bug: 160541918
Test: m; prototype tests based on this change
Change-Id: I0453e309037fad52aed6cab9b4cf39110eeacf61
8 files changed