Commit Graph

279 Commits

Author SHA1 Message Date
Mark Chien
f113431a52 Merge "Replace INetd#trafficSwapActiveStatsMap with ConnectivityManager API" 2022-01-25 03:34:14 +00:00
Junyu Lai
ce13cf7c32 Merge "[MS67.1] Expose registerUsageCallback with template" 2022-01-25 01:23:45 +00:00
Maciej Żenczykowski
895797cc3a Merge "Monitor interface added and update bpf interface map" 2022-01-24 19:05:27 +00:00
Junyu Lai
5bfd449261 Merge changes I54c2258c,I47b2d3ac
* changes:
  [MS38] Remove android.os.HandlerExecutor dependencies
  [MS58] Expose Apis which will be used by data migration utility
2022-01-24 14:08:56 +00:00
junyulai
9d3e717016 [MS68.1] Register usage callback from NetworkPolicyManagerService
Use usage callback to replace the need of intent receiver.

Test: atest TrafficStatsTest NetworkUsageStatsTest FrameworksNetTests
Bug: 204830222
Change-Id: I40967c2b6c86d25c7db93e6d3a4908b72ed76154
2022-01-24 21:07:04 +08:00
junyulai
b6c77f026f [MS67.1] Expose registerUsageCallback with template
Test: atest FrameworksNetTests
Bug: 204830222
Change-Id: I643e2d96144210852fc8916ec9c483f2b207a48b
2022-01-24 19:38:06 +08:00
junyulai
f58ca3b88b [MS38] Remove android.os.HandlerExecutor dependencies
Mainline module can't use internal HandlerExecutor, so inline
the implementation instead.

Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 204830222
Change-Id: I54c2258cb3cee5fb862409441de293d6fed6b32c
2022-01-24 15:53:42 +08:00
Xiao Ma
2730f2ea2d Replace the NetdService usage in the EthernetService.
Ethernet service related files are going to be moved into Connectivity
module. NetdService won't be visible to EthernetService. Use asInterface
to get the Netd service instead.

Bug: 210586283
Test: m
Change-Id: I3bf504cd947f74bf5830659915483fe5331ac9eb
2022-01-24 07:53:34 +00:00
Xiao Ma
e3da3eb78b Move Ethernet related files to f/b/packages/ConnectivityT.
ethernet-service is going to be moved into Connectivity mainline module.
Notice that below sources are also only used in the ethernet framework
during compiling the filegroup: framework-connectivity-ethernet-sources.
Move them from f/b to f/b/packages/ConnectivityT as well.

Ethernet framework only related files:
    - IInternalNetworkManagementListener.aidl
    - InternalNetworkManagementException.java
    - InternalNetworkManagementException.aidl
    - InternalNetworkUpdateRequest.java
    - InternalNetworkUpdateRequest.aidl

Ethernet service only related files:
    - DelayedDiskWrite.java(IpConfigStore imports this class)

Bug: 210586283
Test: build pass
      atest FrameworksNetTests
      atest EthernetServiceTests
Change-Id: I1ec2d1d182c04f3f2acc9b757d5061ca749a4a3c
2022-01-24 04:15:14 +00:00
Ken Chen
cc764a13fa Correct typos in libnetworkstats
Fix Typo-Lints in I23aad26d487b4d99e24ffecf79eeef3f8eea664b

Bug: N/A
Test: m
Change-Id: Id9df0a279e7aad048f2c0d7be66dec40e5a8ae8a
2022-01-24 11:54:04 +08:00
Ken Chen
f426b2b287 Rename libnetdbpf to libnetworkstats
Two reason for renaming:
1. Avoid module name collision in sc-mainline-prod branch.
2. The libnetdbpf was misnamed before.

Bug: 202086915
Test: atest libnetworkstats_test FrameworksNetTests
      ConnectivityCoverageTests FrameworksNetSmokeTests
      CtsAppOpsTestCases
Change-Id: I87fcf4b1a9d58780a45743a9aa91b9b936e54266
2022-01-24 11:53:59 +08:00
Ken Chen
f2bb7b1ae8 Copy libnetdbpf from system/net to tethering module
This is a clean copy (that can't build). Modifications will be in
followed commits.

Bug: 202086915
Test: $ diff -r
      packages/modules/Connectivity/service-t/native/libs/libnetdbpf/
      system/netd/libnetdbpf/
      (no different)
No-Typo-Check: Clean move
Change-Id: I23aad26d487b4d99e24ffecf79eeef3f8eea664b
2022-01-24 06:14:38 +08:00
markchien
e1825f1789 Monitor interface added and update bpf interface map
Have BpfInterfaceMapUpdater to update bpf interface map: adding
the interface and index mapping to bpf interface map when interface
added.

Bug: 215095957
Test: atest FrameworkNetTests

Change-Id: I2189a50c4869cfc0c33fc6f0228f40ee9f3ac1d4
2022-01-21 23:34:57 +08:00
markchien
e337d9e995 Replace INetd#trafficSwapActiveStatsMap with ConnectivityManager API
INetd#trafficSwapActiveStatsMap is deprecated and the implementaion is
moved into tethering (connectivity) mainline module. A new
ConnectivityManager API swapActiveStatsMap is temprary exposed for
NetworkStatsFactory. Once NetworkStatsFactory move into tethering
module, swapActiveStatsMap API would be removed and NetworkStatsFactory
should could call the implemeneted inside the module directly. This
should happen before T sdk finalization.

Bug: 209935649
Test: atest NetworkStatsFactoryTest
Change-Id: I6685fe513511e7af9fa6521601891c66d1297da0
2022-01-21 19:24:08 +08:00
Junyu Lai
8ab6b706c0 Merge changes from topic "ms65-identity"
* changes:
  [MS65.1] Add NetworkIdentity#Builder
  [MS46] Remove INetworkStatsSession usage from NetworkCycleDataLoader
2022-01-21 09:36:08 +00:00
lifr
2b7135e794 [DU03-1]Remove INetworkStatsService from BatteryStatsImpl
Expose systemapi NetworkStats.getDetailedUidStats for use by
BatteryStats.

BatteryStatsImpl is using INetworkStatsService APIs, which
cannot be accessed after moving into the mainline module. So, replace
and remove those hidden API usages.

Bug: 210066922
Test: atest BatteryStatsImplTest WifiPowerCalculatorTest
            MobileRadioPowerCalculatorTest NetworkStatsServiceTest
CTS-Coverage-Bug: 213437796
Change-Id: I40d713923278f4654d67bb4d12155cea85c10447
2022-01-21 13:52:41 +08:00
Junyu Lai
4d2d23b527 Merge changes from topic "ms57-migrationapi"
* changes:
  [MS57.1] Prepare APIs for data migration utility
  [MS45] Expose SystemApis to query summary and history with template
2022-01-21 04:26:57 +00:00
Frank Li
37c0e499dc Merge "[DU05]Remove the android.provider.Settings.Global in NetworkStatsService" 2022-01-21 03:03:51 +00:00
Junyu Lai
838e533772 [MS65.1] Add NetworkIdentity#Builder
Test: atest NetworkIdentityTest#testBuilder
Bug: 204830222

Change-Id: Ifdb6482a54fb1e6999c82647d2710cb833c78d02
2022-01-20 17:12:14 +00:00
Junyu Lai
62febc13a3 [MS57.1] Prepare APIs for data migration utility
This includes:
1. Move PREFIX_* constants to NetworkStatsManager to expose
   in later changes.
2. Rename networkId to wifiNetworkKey.
3. Rename subType to ratType.
4. Replace SUBTYPE_COMBINED with NETWORK_TYPE_ALL
5. Fix lint errors when exposing system api.

Test: TH
Bug: 204830222
Change-Id: I2b7c34958bc59c3225c96f12abba008b83101585
2022-01-20 13:10:36 +00:00
Junyu Lai
30308aacd8 [MS41.1] Prepare for APIs for querying usage with template
This CL includes:
1. Prepare for queryDetailsForDevice which allows callers
   to query history of networks that matches the given template.
2. Prepare for queryDetailsForUidTagState, which allows
   callers to query history uid stats with the given template,
   uid and other conditions.
3. Enforce fine location permission if the caller is querying
   data usage with a template which contains wifi network keys.

Test: atest NetworkStatsServiceTest NetworkStatsManagerTest
Bug: 204830222
Bug: 200768422
Change-Id: I6783d6bfd6e075e0b3ec8a3c91836377f1d71c7a
2022-01-20 13:03:35 +00:00
Frank
dcec9ad4c3 [DU05]Remove the android.provider.Settings.Global in NetworkStatsService
Replace android.provider.Settings.Global methods that return the default
value and hardcoding them inside the methods.

Bug: 213329727
Test: atest NetworkStatsServiceTest
Change-Id: I51d686222f983c8deb71d4b32f9e443e87a5e53e
2022-01-20 16:45:13 +08:00
Chalard Jean
6339ef0b4e Replace runWithScissors with a custom implementation.
This is not any better than the previous code though...
But it should behave the same.

Test: FrameworksNetTests
Change-Id: Ia3d379681cb0f17dd5f86062b7cfe84f1547fadb
2022-01-20 16:22:33 +09:00
Paul Hu
0e3adda802 Merge "Split out the nsd API surface and use framework-connectivity-tiramisu" 2022-01-20 03:02:56 +00:00
paulhu
66f61acfec Split out the nsd API surface and use framework-connectivity-tiramisu
- Split out nsd APIs and hidden APIs to Connectivity module.
- Keep the all files in f/b/packages/Connectivity-T and add
  framework-connectivity-tiramisu library on p/m/Connectivity.
  Then make framework to use this module library.
- Remove NsdService from SystemServer which will register from
  ConnectivityServiceInitializer

Bug: 206893064
Test: m online-sdk-dev-docs
Test: atest FrameworksNetTests CtsNetTestCases
CTS-Coverage-Bug: 207804007
Merged-In: I72c7de124b9cc53f2263bd452ecd5f39e88e485b
Change-Id: I72c7de124b9cc53f2263bd452ecd5f39e88e485b
2022-01-19 18:47:45 +08:00
Junyu Lai
54eb405c64 Merge changes I16418791,I210f5ddc
* changes:
  [MS37.1] Expose APIs which is used by NPMS
  [MS55] Remove INetworkStats dependency from DataIdleTest
2022-01-19 07:08:15 +00:00
Junyu Lai
6fbf3ee9f5 [MS37.1] Expose APIs which is used by NPMS
Test: TH
Bug: 204830222
CTS-Coverage-Bug: 213124616
Change-Id: I16418791246b12fc3da7348ed36b58274e20db54
2022-01-19 07:07:34 +00:00
lifr
fe576952ea [DU04-1]Remove NetworkPolicyManagerInternal from NetworkStatsService
Expose system APIs for use by NetworkStatsService.

Bug: 211843446
Test: atest NetworkStatsServiceTest NetworkPolicyManagerTest
            NetworkPolicyManagerServiceTest
Change-Id: I56a066b7f4b4c2c8fefdd185c2e50de63b1e2629
2022-01-18 03:16:51 +08:00
Junyu Lai
dbc0da139c Merge changes If51b6676,Ia6863a70,I802d2316
* changes:
  [MS37] Replace NetworkStatsManagerInternal usages in NPMS
  [MS36] Remove unused getNetwork[Total|Uid]Bytes
  [MS35] Remove getNetwork[Total|Uid]Bytes dependencies from NPMS
2022-01-17 08:15:14 +00:00
Frank Li
23be6c9ec0 Merge "[DU04]Remove NetworkPolicyManagerInternal from NetworkStatsService" 2022-01-15 23:14:16 +00:00
Junyu Lai
6e782c7ad3 [MS37] Replace NetworkStatsManagerInternal usages in NPMS
This is done by:
1. Add NetworkStatsManagerInternal APIs directly from
   NetworkStatsManager, these APIs are needed by NPMS.
2. Replace all usages with these APIs.
3. Delete NetworkStatsManagerInternal implementation.

Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 204830222
CTS-Coverage-Bug: 213124616
Change-Id: If51b6676915e3a0a8a9f95221d735306911442fc
2022-01-15 08:34:35 +00:00
Junyu Lai
fa347d6719 [MS36] Remove unused getNetwork[Total|Uid]Bytes
Since the usages are all removed, clean up the
unused code accordingly.

Test: TH
Bug: 204830222
Change-Id: Ia6863a7098632580b411bd79550754e511ea2543
2022-01-15 08:34:35 +00:00
Junyu Lai
40fad8193c [MS43] Remove EventLogTags depdendency
Inline functions and copy constants to the service.

Test: TH
Bug: 204830222
Change-Id: Idf5c8ff7c7fec39530269b3c6b24475407198fbc
2022-01-15 08:16:25 +00:00
lifr
23aebe33af [DU04]Remove NetworkPolicyManagerInternal from NetworkStatsService
NetworkStatsService is using NetworkPolicyManagerInternal APIs, which
cannot be accessed after moving into the mainline module. So, replace
and remove those hidden API usages.

Bug: 211843446
Test: atest NetworkStatsServiceTest NetworkPolicyManagerTest
            NetworkPolicyManagerServiceTest
Change-Id: I0f3f02d1dc014967fab27ffcf37dd1918dbef5e0
2022-01-15 14:06:31 +08:00
Junyu Lai
6c83653cbb Merge "[MS44.1] Add API to query tagged UID summary" 2022-01-13 11:25:15 +00:00
Pavan Kumar M
b63e7aebee Synchronize the IpClient events
If the ipClient is stopped before handling the events in
Handler thread, ethernet network factory might end up
creating a network agent for a network which is already
cleared.

This change fixes the issue by handling the events only
if ipClient is initialized.

Tests:

  Builds, Boots, EthernetNetworkFactoryTest.
  Ethernet related test scenarios

Bug: 207057937
Change-Id: If7ff7abf5f0dcdb0e94de0502bfdf981f9f20298
2022-01-13 11:52:06 +05:30
Frank Li
df5586619e Merge "[DU01]Remove INetworkManagementService from NetworkStatsService" 2022-01-13 05:45:42 +00:00
Junyu Lai
f577b2248b [MS44.1] Add API to query tagged UID summary
Query tagged UID summary is currently needed by
StatsPullAtomService to collect tagged traffic statistics.
Add an Api via NetworkStatsManager to support this
functionality.

Test: atest NetworkStatsManagerTest
Bug: 204830222
Change-Id: Iaa54482a8109b56e66e829c5bec5a8a8f466641a
2022-01-13 01:01:46 +00:00
lifr
d686e2dd2d [DU03]Remove INetworkStatsService from BatteryStatsImpl
BatteryStatsImpl is using INetworkStatsService APIs, which
cannot be accessed after moving into the mainline module. So, replace
and remove those hidden API usages.

Bug: 210066922
Test: atest BatteryStatsImplTest WifiPowerCalculatorTest
            MobileRadioPowerCalculatorTest
CTS-Coverage-Bug: 213437796

  (cherry-picked from ag/16548638)

Change-Id: I584897ff8ba303c717a9df3756c9f6778c1cfb10
Merged-In: I584897ff8ba303c717a9df3756c9f6778c1cfb10
2022-01-12 07:28:55 +00:00
James Mattis
7f0823c15f Implementation of Eth Service updateConfiguration
EthernetServiceImpl#updateConfiguration API implementation to allow
for dynamically updating the network capability or ip configuration of
an ethernet based interface.

Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: Idd3b7875a24643d245d0f4bb6f2f4c459898116e
2022-01-11 19:13:26 -08:00
Junyu Lai
4537656b25 [MS42.1] Replace PhoneStateListener with DisplayInfoListener
Several methods and constants are hidden in PhoneStateListener
and ServiceState to track Radio Access Technology(RAT) types.
Replace them with public API instead.

Test: atest NetworkStatsSubscriptionsMonitorTest
Fix: 213021103
Change-Id: I588398da7f2b031910a8350a7d84405ff101232d
2022-01-10 11:43:17 +00:00
lifr
1a9a70085e [DU01]Remove INetworkManagementService from NetworkStatsService
NetworkStatsService is using INetworkManagementService APIs, which
cannot be accessed after moving into the mainline module. So, replace
and remove those hidden API usages.

Bug: 209738761
Test: atest NetworkStatsServiceTest
Change-Id: I5740f6d8a54e9a06c6dbb93203cb4c954383c3c8
2022-01-08 01:27:35 +08:00
Junyu Lai
c3dde6605f [MS39.1] Remove the looper from NetworkStatsSubscriptionMonitor
OnSubscriptionsChangedListenerHandler(Looper looper) is
hidden, there is no way to pass a looper to it in the test.
This change partially revert aosp/1340040 to fix hidden
API dependency. And will use a different approach to address
this problem in later stages.

Test: atest NetworkStatsSubscriptionMonitorTest
Bug: 204830222
Bug: 213280079
Change-Id: I429be3578d599de9a5a3f78b02387c20744b37d3
2022-01-07 12:55:02 +00:00
Junyu Lai
e57289e936 Merge "[MS32.1] Remove TetheringManager#ACTION_TETHER_STATE_CHANGED usage" 2022-01-06 13:57:12 +00:00
Junyu Lai
230a6388a8 Merge changes from topics "ms34-tm", "ms40-clock"
* changes:
  [MS09] Expose NetworkTemplate APIs which are needed by NetworkPolicy
  [MS34.1] Replace TelephonyManager#getSubscriberId(subId) with public API
  [MS40.1] Remove Clock dependencies from NetworkStatsService
  [MS27] Expose noteUntaggedSocket SystemApi
2022-01-06 13:56:39 +00:00
Aaron Huang
b01254f350 Remove ParcelFileDescriptor hidden API usage from IpSecService
IpSec service is going to be a part of Connectivity mainline module
and ParcelFileDescriptor(FileDescriptor) is a hidden API that cannot
be used by mainline module.

Therefore, use ParcelFileDescriptor.dup(FileDescriptor) to get a
ParcelFileDescriptor instead.

Bug: 204153604
Test: FrameworksNetTests
Change-Id: I0ccabdfc5060f4b635e9a7009a67fbd5d32002fd
2022-01-06 19:16:43 +08:00
Junyu Lai
9ecf4b77ec [MS32.1] Remove TetheringManager#ACTION_TETHER_STATE_CHANGED usage
Replace intent receiver with callback listener.

Test: atest com.android.server.net.NetworkStatsServiceTest
Bug: 204830222
Change-Id: I585b2bb471b59cbca3cce1c01ce527dff87f42da
2022-01-06 09:22:53 +00:00
Junyu Lai
b2f359cc56 [MS34.1] Replace TelephonyManager#getSubscriberId(subId) with public API
Test: atest com.android.server.net.NetworkStatsSubscriptionsMonitorTest
Bug: 204830222
Change-Id: I57aa4470aea1715217fa7d74f2c9067b096d1bae
2022-01-06 09:22:52 +00:00
Junyu Lai
42312c48cc [MS40.1] Remove Clock dependencies from NetworkStatsService
This includes:
1. Re-implement the BestClock in the static library.
2. Expose SystemClock#currentNetworkTimeClock as public Api

Test: TH
Bug: 204830222
CTS-Coverage-Bug: 213393821
Exempt-From-Owner-Approval: 1. Owner approved the change with
  explicitly granted submission after adderessing the
  straight-forward comment. 2. Owner is OOO for 3 months.
Change-Id: I08c0162a7101cc6184f3eca3d4a59211183fb843
2022-01-06 08:49:59 +00:00
James Mattis
cfa7a08bcf Replacing IIpClient with Manager in ethNetFactory
Replacing IIpClient with IpClientManager to reduce code duplication,
increase readability and maintainability as well as making
EthernetNetworkFactory easier to unit test.

Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: I283653171c0cc47ad94a67d6dbd65b924cdf1ada
2022-01-05 16:12:16 -08:00