* changes:
Expose MATCH_PROXY as a module-lib API.
Add setPollForce to module API
Move networkstats JNI to connectivity module
[MS54.1] Move NetworkStats to updatable sources
[MS62.1] Start NetworkStatsService from the module
Updating EthernetNetworkUpdateRequest to use a builder for
creation and also changing to use IpConfiguration instead of
StaticIpConfiguration.
Bug: 220017952
Bug: 210487893
Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: I78b002c12cf927c075671b75f0fe0d7878443b56
When uid is removed, NetworkStatsService will iterate CookieTagMap and
delete the corresponded uid socketTag value. But not only
NetworkStatsService would detete CookieTagMap entries. There are other
threads may also delete CookieTagMap entries such as #unTagSocket in
bpfHandler and desctroy socket listener in TrafficController. System
server crash as NPE because the CookieTagMap entry it iterate just be
removed by other threads at the same time. This is just a simple fix to
prevent the crash. Will have follow up CL for formal fix.
Bug: 220084230
Test: m
Change-Id: I08cad87f537fb09499faf1ff5cfd443fcb8ce436
It is used by clockwork.
Test: m update-api
(cherry-picked from ag/16786203)
Change-Id: I5676f883141afca1511c425b7c36683a6c6bfb9f
Merged-In: I5676f883141afca1511c425b7c36683a6c6bfb9f
The API was test API in S, but this is not supported in module API
surfaces. Make it module API instead.
Bug: 197717846
Test: Tests already using this API
(cherry-picked from ag/16780943)
Change-Id: I9d44b761572f94b08b269478c4a0c20c1171343c
Merged-In: I9d44b761572f94b08b269478c4a0c20c1171343c
Reorganize networkstats JNI so it can be included in the connectivity
module.
Bug: 197717846
Test: m
Change-Id: I815ea379f3d9915041c80ac5e743ce62e05f4cf8
Merged-In: I815ea379f3d9915041c80ac5e743ce62e05f4cf8
This CL builds NetworkStats related code with the
connectivity module instead of platform.
This includes:
1. Add netstats.proto to the module.
2. Add lib dependencies for all callers.
3. Include several source files in platform and add jarjar rule
to it. Modify callers accordingly.
Test: TH
Bug: 197717846
Change-Id: I244693aebe1782d9e67502638ff8145c51462e1e
Merged-In: I244693aebe1782d9e67502638ff8145c51462e1e
NetworkStatsService is going to be moved into Connectivity mainlne
module and it will be not visible to SystemServiceResistry after
migration done. Thus:
1. Register service in NetworkStatsServiceInitialalizer, a separate
initializer is needed because the service needs to be created
before NetworkPolicyManagerService's initialization.
2. Call SystemReady at PHASE_ACTIVITY_MANAGER_READY phase where
it needs to be ready before StatsPullAtomService pulls at
PHASE_THIRD_PARTY_APPS_CAN_START.
3. Register manager in ConnectivityFrameworkInitializerTiramisu
instead of SystemServiceRegistery.
Test: atest FrameworksNetTests CtsNetTestCases NetworkUsageStatsTest
Bug: 204830222
(cherry-picked from ag/16688794)
Change-Id: I95020d816ed613ce3480a0720a5b71dcdc7fab72
Merged-In: I95020d816ed613ce3480a0720a5b71dcdc7fab72
This CL exposes EthernetManager APIs that settings and other
system components can use to modify and monitor Ethernet state.
The new APIs are similar to the existing @hide methods but
pass on more information and meet API guidelines:
1. Add an InterfaceStateListener interface, and
addInterfaceStateListener and removeInterfaceStateListener
methods that meet API guidelines (e.g., take Executor, take
SAM parameter last, etc.) This new listener passes interface
state (absent, up, down), role (client or server) and IP
configuration.
2. Implement the legacy Listener type as a subinterface of the
new interface. Hopefully existing callers should be able to
use it unchanged.
3. Expose setIncludeTestInterfaces as module-lib api instead of
TestApi, since modules cannot expose TestApi methods.
Bug: 210586283
Test: m
Test: atest EthernetServiceTests
Test: atest EthernetTetheringTest
Change-Id: I88240a546ab51d128ed83775499f2bcabab74db0
Merged-In: I88240a546ab51d128ed83775499f2bcabab74db0
Allows VCN and IKE unit tests to mock IpSecManager and thus stop
depending on the hidden APIs in the Connectivity module
(e.g. IpSecService binder interface). Otherwise, any changes on
these related hidden APIs will require topic changes across multiple
projects.
Bug: 217572993
Test: make update-api
Test: atest IpSecManagerTest, IpSecManagerTunnelTest
Change-Id: I29f3ac96f83b4271f29a7051d33ccf47a0dd6c57
Merged-In: I29f3ac96f83b4271f29a7051d33ccf47a0dd6c57
Add key / value structures for CookieTagMap, StatsMap, and UidStatsMap.
This will be used for deleteTagData.
Test: m
Change-Id: I955ae7f7745d4c5f37eccbad80cdb841ef55ff56
A common mistake when using service discovery is to mismanage networks,
expecting to find or be able to access services on networks that may not
be available yet, or may be stale/lost.
This new API allows clients to start service discovery with just a
NetworkRequest, letting NsdManager track networks and notify when
services are found/lost for each network.
Bug: 190249673
Test: atest NsdManagerTest
Change-Id: I12e799aa48fce2d1a35f708c5617386b1cc70f21
This adds a Network member to NsdServiceInfo, allowing discovered
services to report which network they were discovered on, and clients to
specify which network to resolve the service on. If clients use the
discovered NsdServiceInfo to resolve a service, it will be resolved on
the network where it was discovered instead of an unspecified network.
Also add a network parameter to a new overload of
NsdManager#discoverServices, so that clients can discover on specific
networks.
Bug: 190249673
Test: atest NsdManagerTest
Change-Id: Idc4bf9fde0f4b0328204a8cd2eedc12fffbbbdba
When discover two different host with same host name
from different network interface, specify on what
interface to getAddrInfo.
Bug: 203453164
Test: build & manual
Signed-off-by: hepengtao <hept.hept.hept@gmail.com>
Change-Id: Ifaccb7f3fac6b1dd789cc9ce7c8d964102754508
Renaming InternalNetwork* files and classes related to ethernet network
management to EthernetNetwork* as ethernet is the only trasnport these
particular files are used with.
Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: Ieb3915c032ef5fcd6b36eb09878119de7668bb4b
Update to InternalNetworkManagementException in order to allow all
members to be parcelable.
Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: I17f119a66face8a927546657490969aa3073c54b
Currently, socket tagging is implemented in the framework. The
Java code is in NetworkManagmentSocketTagger.java and the JNI is
in libandroid and loaded by the general framework JNI loader.
- Move the Java implementation to TrafficStats, which is the only
caller of NetworkManagmentSocketTagger. This simplifies the
code a bit because a number of methods can be deleted.
- Move the JNI code to a new JNI library in the APEX. The library
depends only on the NDK and statically links the NDK-only
version of libnativehelper. Its size is only 5k on ARM and 10k
on ARM64.
- Temporarily make the framework depend on this library until the
rest of the T connectivity code moves to the APEX.
Test: atest NetworkUsageStatsTest CtsNetTestCases:TrafficStatsTest
Change-Id: I050c7c515237f68b78d08987bc443f50a7949c06
Currently, NetworkStatsService deletes tag data by calling
NetworkManagementSocketTagger, which then calls into libcutils
"qtaguid" code. Instead, make NetworkStatsService call into
libcutils directly and delete the NetworkManagementSocketTagger
code.
In the future, this will make it easier for NetworkStatsService
to perform this operation by calling directly into BpfNetMaps.
Because the unit test does not yet have working JNI code, provide
an internal TagStatsDeleter interface that can be mocked out via
the Dependencies class. This is a bit ugly but it will be deleted
as soon as the code uses BpfNetMaps directly.
Delete NetworkManagementSocketTagger#setKernelCounterSet since it
was replaced in aosp/1958917.
Also remove unused includes and make formatting changes suggested
by clang-format.
Test: m
Test: atest NetworkStatsServiceTest
Test: atest NetworkUsageStatsTest
Test: atest TrafficStatsTest
Test: stats deleted when CtsUsageStatsTestCases completes and test APK is uninstalled
Change-Id: I62987000afc185199821580232bfb7668c8e301e
To make data usage as a mainline module, move getAllCollapsedRatTypes
to StatsPullAtomService since currently it is the only user. Also, the
method needs to call getCollapsedRatType, thus move getCollapsedRatType
to NetworkStatsManager and expose it as module API.
Bug: 210073043
Test: builds, FrameworksNetTests
Change-Id: Ibe41b50f173464694c21dd22841552bdb69a6a14
Move NETWORK_TYPE_5G_NSA to NetworkStatsManager. Also expose it as
module API so that it can be used out of module.
Bug: 210073043
Test: builds, FrameworksNetTests
Change-Id: I670c7e1405107bbe30b92fe1a8d81652c46de6d9
Currently NetworkStatsService call
NetworkManagementSocketTagger#setKernelCounterSet which would call into
netd to update UidCounterSet bpf map. This change let
NetworkStatsService get UidCounterSetMap and update it directly. After
this change, NetworkManagementSocketTagger#setKernelCounterSet could be
removed because NetworkStatsService is the only caller.
Test: dump UidCounterSetMap to ensure it still have value after removing
netd code.
Change-Id: I7ae14106ded4fa55122e93e76c3057052a2fa33e
This is used by NetworkPolicyManagerService to find
relevant networks of a given NetworkPolicy.
Test: TH
Bug: 204830222
Change-Id: I7176ab727bf208e0fd05ecb9c2bcb00cd3438031