Reimplement inferRestrictedCapability without new exposed API

Method inferRestrictedCapability() was moved from frameworks/base
to libs/net and it is using an API NetworkCapabilities.getCapabilities()
which is a new exposed API in S. However, the change of moving the
method will downstream to the branches without the new exposed API.
Thus, reimplement this method without new exposed API.

(cherry-picked from ag/14029492)
Bug: 178777253
Bug: 130869457
Test: NetworkStaticLibTests
Merged-In: Ib88fe2b831e968513f221443ed62a09c02150882
Change-Id: Ib88fe2b831e968513f221443ed62a09c02150882
1 file changed
tree: eb41aeee95a073a7a6af732a5cbc0b3fb90c3ad2
  1. staticlibs/