Commit Graph

3459 Commits

Author SHA1 Message Date
Frank
9d749d5128 [DU09-0]Adding the NetworkStatsCollection Builder
The purpose is provide NetworkStatsCollection.Builder as
public API for adding the stats {@link NetworkStatsHistory}

Bug: 215862801
Test: atest NetworkStatsCollectionTest
Change-Id: I65ad589473cbb7785cbe8297f793ce9f18a55c35
2022-01-25 18:46:01 +08:00
Junyu Lai
82a33b8e64 [MS69.1] Fix TrafficStats.init crashs for supplemental process
Supplemental apps has limited capabilities and service discovery
is restricted. Hence, calling TrafficStats.init would result in
crash.

This change includes:
1. Print log instead of crashing process when running into
   any unexpected cases.

Test: atest SupplementalProcessManagerTests
Bug: 216062904
Change-Id: I7f827ccc485c997745779053b5936a6cb30e8219
2022-01-25 09:59:38 +00:00
Mark Chien
121c4fc872 Merge "Replace INetd#trafficSwapActiveStatsMap with ConnectivityManager API" 2022-01-25 03:34:14 +00:00
Junyu Lai
a88cab0f1f Merge "[MS67.1] Expose registerUsageCallback with template" 2022-01-25 01:23:45 +00:00
Junyu Lai
914ef6bb34 Merge "[MS61] Remove NetworkManagementSocketTagger#install dependency" 2022-01-25 00:48:23 +00:00
Maciej Żenczykowski
8036c626b2 Merge "Monitor interface added and update bpf interface map" 2022-01-24 19:05:27 +00:00
Junyu Lai
546ae74ab9 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
f6487fb3c1 [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
Xiao Ma
84b61cfcda Merge "Move Ethernet related files to f/b/packages/ConnectivityT." 2022-01-24 12:50:39 +00:00
Aaron Huang
9db383cf1d Use public resouce in android.R package
Use public resource since IpSec is planed to be moved into
Connectivity mainline module.

Bug: 204153604
Test: build
Change-Id: I0aafef6b9b08307c3aebce597a2dd24925c6b09a
Merged-In: I0aafef6b9b08307c3aebce597a2dd24925c6b09a
2022-01-24 11:41:35 +00:00
junyulai
18a2105afa [MS67.1] Expose registerUsageCallback with template
Test: atest FrameworksNetTests
Bug: 204830222
Change-Id: I643e2d96144210852fc8916ec9c483f2b207a48b
2022-01-24 19:38:06 +08:00
junyulai
c28dd15332 [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
Junyu Lai
0bb493e12e [MS58] Expose Apis which will be used by data migration utility
This includes:
1. NetworkIdentity
2. NetworkIdentitySet
3. NetworkStatsHistory

NetworkStatsCollection Apis will be exposed in a separate CL.

Test: TH
Bug: 204830222
Change-Id: I47b2d3ac3b86cb4e6879afaae34326ca3c050ffa
2022-01-24 15:44:27 +08:00
Xiao Ma
ed76c1b8ea 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
Junyu Lai
c0d66230ea [MS56.1] Add NetworkStatsHistory#Builder
NetworkStatsHistory will need to be exposed and constructed
from the data migration tool in the follow-up changes.
Add a Builder class to prevent from exposing internal array
structures.

Test: atest NetworkStatsHistoryTest#testBuilder
Bug: 204830222
Change-Id: I5f8ea1c825d601de0aac8623034ef896999fc1a0
2022-01-23 16:47:44 +08:00
Junyu Lai
4489b71b9a [MS65.3] Address comments at aosp/1954383
This change also remove dependencies from
NetworkPolicyManagerService.

Test: atest NetworkIdentityTest#testBuilder \
      NetworkPolicyManagerServiceTest
Bug: 204830222
Change-Id: Ib1ec1968746d88165cbf5421d4ba30a00f4b678f
2022-01-23 16:47:36 +08:00
Les Lee
ba94e7b531 Merge "wifi data usage: Update calling API name" 2022-01-23 00:30:51 +00:00
Les Lee
103f53789d wifi data usage: Update calling API name
Bug: 213387087
Test: atest -c FrameworksWifiApiTests
Test: atest -c NetworkPolicyManagerServiceTest
Merged-In: I02d7f57de1acfd7b03be0a3e1c957ec1e1c5b4d4
Change-Id: I02d7f57de1acfd7b03be0a3e1c957ec1e1c5b4d4
2022-01-23 00:06:00 +08:00
Junyu Lai
8efe3482f3 [MS61] Remove NetworkManagementSocketTagger#install dependency
Expose TrafficStats#attachSocketTagger and use it instead.

Test: atest TrafficStatsTest
Bug: 204830222
CTS-Coverage-Bug: 214979748
Change-Id: I1748d349b499053ad08bd62202325fa759ad8da5
2022-01-22 13:51:55 +08:00
Junyu Lai
6f39e805a1 [MS66] Initialize TrafficStats with context
TrafficStats has static methods created in API level 8 that need
access to NetworkStatsManager but doesn't take a context.
Previously this was achieved by using ServiceManager, but
with TrafficStats moving to the connectivity module, this
is no longer possible.

Instead, make sure TrafficStats has an appropriate context by
the time any client code can call the relevant methods.
• In app code, this achieved by passing the application
  context from ActivityThread#handleBindApplication, before any
  app code can run.
• In the system server, this is achieved by passing the context
  right after creating service.

Test: atest TrafficStatsTest CtsWebkitTestCases
Bug: 204830222

Change-Id: I251bb8a4431ad12ff61929879ef1363cf06b9244
2022-01-22 01:01:49 +08:00
markchien
debfc4015b 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
9703eb291c 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
6dcaf9dee4 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
02eb422cb4 [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
717c22831a 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
b45f4fb06d Merge "[DU05]Remove the android.provider.Settings.Global in NetworkStatsService" 2022-01-21 03:03:51 +00:00
Junyu Lai
86377eba46 [MS65.1] Add NetworkIdentity#Builder
Test: atest NetworkIdentityTest#testBuilder
Bug: 204830222

Change-Id: Ifdb6482a54fb1e6999c82647d2710cb833c78d02
2022-01-20 17:12:14 +00:00
Junyu Lai
a8dc50de05 [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
84316eb4b6 [MS45] Expose SystemApis to query summary and history with template
This includes:
1. queryDetailsForDevice: get history of network stats that
   matches the given template.
2. querySummaryForDevice: similar to the above one, but the
   result is aggregated over time.
3. queryDetailsForUidTagState: get history of uid stats that
   matches the given template, uid, tag and other conditions.
4. querySummary: similar to the above one, but the
   result is aggregated over time.
5. queryTaggedSummary: similar to the above one, but only
   return tagged data.

Test: TH
Bug: 204830222
Change-Id: Ic18010822a33e340b954e9c53dc515f3b6224d6d
2022-01-20 13:03:39 +00:00
Junyu Lai
bb459aeaba [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
878641336d [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
Aaron Huang
589a43475c Merge "Have NetworkStats implements iterable" 2022-01-20 04:09:00 +00:00
Paul Hu
64f906a06a Merge "Split out the nsd API surface and use framework-connectivity-tiramisu" 2022-01-20 03:02:56 +00:00
Treehugger Robot
57c4d95609 Merge "[MS64] Remove subscriberId and NetworkId in proto" 2022-01-20 02:32:59 +00:00
Junyu Lai
504e9b3587 [MS64] Remove subscriberId and NetworkId in proto
netstats.proto is about to move into mainline module.
And it can no longer see privacy.proto definition.
Thus, this change remove PII data that is not very useful
when debugging and any reference to privacy.proto.

Test: adb bugreport and check output at transponder
Bug: 204830222
Change-Id: I755530f356d2c16b336d62785c4c17c557f792db
2022-01-19 16:08:40 +00:00
paulhu
172aa68e5d 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
Treehugger Robot
714ef48d78 Merge "Remove ServiceManager usage from IpSecTransform" 2022-01-19 07:59:56 +00:00
Aaron Huang
1cad2ea651 Have NetworkStats implements iterable
Make NetworkStats be iterable and expose iterator as system API
which is better than expose size() and getValues().
This API could be used by the caller who needs to get entry
from NetworkStats.

Bug: 210073043
CTS-Coverage-Bug: 215061403
Test: build, TH
Change-Id: I6cb4c8f63d7067133f2722b2be7e16b4098a697d
2022-01-19 15:54:17 +08:00
Junyu Lai
a079336270 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
ba8efd5c84 [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
Frank Li
c629b3f8c6 Merge "[DU04-1]Remove NetworkPolicyManagerInternal from NetworkStatsService" 2022-01-19 05:32:05 +00:00
Xiao Ma
bb27ba3b11 Merge "Fix the Preconditions dependency in EthernetNetworkSpecifier." 2022-01-19 03:23:17 +00:00
Treehugger Robot
3a57e69dfe Merge "[MS63.1] Remove TrafficStats.TAG_SYSTEM_DOWNLOAD dependency" 2022-01-18 13:04:35 +00:00
Xiao Ma
55b39355dd Fix the Preconditions dependency in EthernetNetworkSpecifier.
Ethernet service related files are going to be moved into Connectivity
module. Replace the Preconditions class in the EthernetNetworkSpecifier,
either add modules-utils-preconditions static lib dependency to fix it,
however, notice that will result in the duplicate class import when
moving ethernet stuff to p/m/Connectivity.

Bug: 210586283
Test: atest FrameworksNetTests EthernetServiceTests
Change-Id: I6163699be4126ef1b95dfb87ec9a6aba2c01195a
2022-01-18 04:50:41 +00:00
Junyu Lai
2d34f3e729 [MS63.1] Remove TrafficStats.TAG_SYSTEM_DOWNLOAD dependency
Replace with system Api.

Test: TH
Bug: 204830222
CTS-Coverage-Bug: 215043101
Change-Id: Ic14b26d2862f6fe8bee18fe0c9eaf183052452ee
2022-01-18 02:54:27 +00:00
lifr
69e220ccd8 [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
Treehugger Robot
703b9219a6 Merge "[MS30] Remove ServiceManager#getService dependency" 2022-01-17 15:28:46 +00:00
Junyu Lai
d3cb2bae4f [MS30] Remove ServiceManager#getService dependency
Since TrafficStats is moving into the mainline module,
ServiceManager#getService can no longer be accessed.

This change use reflection to access getService, since
there is no offical way to get the service binder,
and TrafficStats is a static utility that doesn't have
the context to invoke Context#getSystemService.

This change also fixes minor lint errors.

Test: atest CtsNetTestCases:TrafficStatsTest
Bug: 204830222
Change-Id: I5caec42a71431b39f747fc791b8511d92e5cf7cc
2022-01-17 13:54:06 +00:00
Aaron Huang
b939b68df8 Merge "Add getter for the fields of NetworkStats.Entry" 2022-01-17 09:31:55 +00:00
Junyu Lai
ada2a7fb3a 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