Commit Graph

2023 Commits

Author SHA1 Message Date
Aaron Huang
e436804466 Dynamically enable/disable watch for RAT type changes
Add ContentObserver to observe the status of
NETSTATS_COMBINE_SUBTYPE_ENABLED to determine that
NetworkStatsSubscriptionsMonitor start or stop
monitoring data usage per RAT type changes.

Bug: 154080515
Test: atest NetworkStatsServiceTest#testDynamicWatchForNetworkRatTypeChanges
Change-Id: I272d589633c9186b45753228b05aa0b40b7c7b89
2020-06-17 17:09:10 +09:00
Treehugger Robot
fc00838335 Merge changes I289d935f,I0121a4ac am: 8366a33efa
Change-Id: I7c413c9e1f2efc3aba55453c6b98bf682f3d4116
2020-05-28 10:55:48 +00:00
Treehugger Robot
8366a33efa Merge changes I289d935f,I0121a4ac
* changes:
  NetworkStats: apply464xlatAdjustments - don't remove CLAT_UID
  NetworkStats: apply464xlatAdjustments - remove useBpfStats parameter.
2020-05-28 10:34:01 +00:00
Maciej Żenczykowski
394c0003a1 Merge changes Ie73ba058,I4393afcb,Ifebd946e,Ib12ee882,Ia171b779 am: 8eb57183e9
Change-Id: I7b9ae6590c67f89b023417e511fa823b79ad53b1
2020-05-28 09:18:16 +00:00
Maciej Żenczykowski
8eb57183e9 Merge changes Ie73ba058,I4393afcb,Ifebd946e,Ib12ee882,Ia171b779
* changes:
  fix com.android.server.net.NetworkStatsFactoryTest#testDoubleClatAccounting100MBDownload
  fix com.android.server.net.NetworkStatsFactoryTest#testDoubleClatAccounting
  fix com.android.server.net.NetworkStatsFactoryTest#testDoubleClatAccountingSimple
  fix android.net.NetworkStatsTest#testApply464xlatAdjustments
  NetworkStats - no need for xt_qtaguid clat bw fixups
2020-05-28 09:04:42 +00:00
Maciej Żenczykowski
e454f35a39 NetworkStats: apply464xlatAdjustments - don't remove CLAT_UID
This should no longer be needed after all the cleanups.

Test: atest NetworkStatsTest NetworkStatsFactoryTest
Bug: 150738490
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I289d935f84b616ed857ef4c5a7427d57c282d00c
2020-05-28 01:47:30 -07:00
Maciej Żenczykowski
bfaed04795 NetworkStats: apply464xlatAdjustments - remove useBpfStats parameter.
Test: atest NetworkStatsTest NetworkStatsFactoryTest
Bug: 150738490
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0121a4ac7ee824adc5930bab786d550b2f00b05b
2020-05-28 01:33:25 -07:00
Maciej Żenczykowski
28aed515f0 NetworkStats - no need for xt_qtaguid clat bw fixups
This is due to the previous addition of the ip6tables raw PREROUTING
drop rules for incoming ipv6 clat traffic pre-translation to ipv4.

Since we no longer double account, we no longer need these fixups.

Test: atest bpf_module_test clatd_test libbpf_android_test libnetdbpf_test
  netd_integration_test netd_unit_test netdutils_test
Bug: 150738490
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia171b7797cdc99367064d0649bf1293c71579941
2020-05-28 00:26:17 -07:00
Maciej Żenczykowski
f9c7d0b463 Merge "NetworkStatsService - xt_qtaguid non-ebpf - account stacked interface stats" am: 3febc2c0d0
Change-Id: I66ee156163937fd9dad330a51f73c09eb0fe76b6
2020-05-28 00:58:07 +00:00
Maciej Żenczykowski
3febc2c0d0 Merge "NetworkStatsService - xt_qtaguid non-ebpf - account stacked interface stats" 2020-05-28 00:42:17 +00:00
Maciej Żenczykowski
7e81d01799 NetworkStatsService - xt_qtaguid non-ebpf - account stacked interface stats
Test: atest bpf_module_test clatd_test libbpf_android_test libnetdbpf_test
  netd_integration_test netd_unit_test netdutils_test
Bug: 150738490
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I297fcad0a83bd8c32c0fa6c6a77d83b42cd8c428
2020-05-27 23:26:26 +00:00
Treehugger Robot
23289b2670 Merge "Use CopyOnWriteArrayList to store list of NetworkStatsProviderCb" am: 9aa60f31da
Change-Id: I51dfa3882e33db89d40b9e912d5178096c724de6
2020-05-12 10:12:56 +00:00
Treehugger Robot
9aa60f31da Merge "Use CopyOnWriteArrayList to store list of NetworkStatsProviderCb" 2020-05-12 09:51:35 +00:00
Lucas Lin
5ecaf8f36b Merge "Broadcast ACTION_NETWORK_STATS_UPDATED in NetworkStatsHandler" am: 61fbce1bde
Change-Id: I8996b46bbd71ddc27ef313e3d9d329faf56ac580
2020-05-07 09:21:25 +00:00
lucaslin
3648f0a35d Broadcast ACTION_NETWORK_STATS_UPDATED in NetworkStatsHandler
There is a corner case which may cause the deadlock:
When NetworkStatsService tried to broadcast the intent,
NetworkStatsService was waiting for a lock which was hold by
ActivityManagerService. In the same time, ActivityManagerService
was waiting for ActiveService#startServiceInnerLocked() to get a
lock which was hold by ConnectivityService. ConnectivityService
was waiting for a lock which was hold by BatteryStatsImpl.
BatteryStatsImpl was waiting for a lock which was hold by
NetworkStatsService, and the lock was locked by
NetworkStatsService when NetworkStatsService tried to broadcast
the intent.

To prevent deadlock when broadcasting the intent in
performPollLocked(), move the intent broadcasting from
performPollLocked() to NetworkStatsHandler.

Bug: 150418178
Bug: 155155473
Test: 1. Create the second user and see if the device will
         do factory reset or not.
      2. Factory reset manually and see if there is a deadlock.
Change-Id: Icf88d3e7a38562ab15187f6c71bc8fb0486d37c0
2020-05-07 08:49:39 +00:00
Treehugger Robot
b4451fba20 Merge "[SM10] Adopt helper class to monitor RAT type change per sub" am: f4a8f1f21e
Change-Id: Ifadf4ad62820c6cbf536a3984b1cf4a0b78cbc31
2020-05-05 11:32:31 +00:00
junyulai
53c97ec4cf [SM10] Adopt helper class to monitor RAT type change per sub
Test: atest NetworkStatsServiceTest
Bug: 146415925
Change-Id: I45c3aa9046b316c8cd0943543d620a22e4afefd1
Merged-In: I45c3aa9046b316c8cd0943543d620a22e4afefd1
(cherry picked from commit ab1eb887a6)
2020-05-05 18:37:29 +08:00
junyulai
a6880d0037 Use CopyOnWriteArrayList to store list of NetworkStatsProviderCb
In NetworkStatsService, mStatsLock will be held when
iterating through the provider list. This is to protect the list
from concurrent broadcast that triggered by
NetworkPolicyManagerService. This is not good since the binder
call is oneway, it does not make sense to block every
access to the providers.

This change also remove unuse variable and reduce verbose log.

Test: atest FrameworksNetTests TetheringTests
Bug: 150418178
Change-Id: If74e9f2ea597a0d5ae4668c3358bc687f342bbb5
2020-04-30 05:57:44 +00:00
Chiachang Wang
fa9d473f26 Merge changes I3525edc3,I6e18915e am: c861b10841
Change-Id: Ie298cd37fdaa8d638298e8326c6f1db7a5d5b7b4
2020-04-29 09:08:45 +00:00
Chiachang Wang
87ba308377 Filter debug entries for each vpn
NetworkStats calculation needs to filter out debug entries to
prevent over counting. While NetworkStatsFactory migrates data
usage over a VPN to the TUN network, NetworkStatsFactory does
not filter out debug entries per vpn which will cause debug
entries left and cause exception.

Bug: 152678151
Test: atest com.android.server.net.NetworkStatsFactoryTest
      and verify no exception
Change-Id: I3525edc385b07858b48c7add2d331c4b5a2e84ad
2020-04-29 15:07:45 +08:00
Benedict Wong
ff540abc9f Merge "Use TransformRecord to get SPI instead of SpiRecord" am: ba714fa495
Change-Id: If9d23537009ea1359d7dc198ba4662c85f8f4b0c
2020-04-24 23:12:27 +00:00
Benedict Wong
ba714fa495 Merge "Use TransformRecord to get SPI instead of SpiRecord" 2020-04-24 22:32:41 +00:00
Automerger Merge Worker
5a316e581e Merge "Merge "[SM09] Add helper class to monitor RAT type change per sub" am: 64ccb88948 am: 57aa3c8c94" into qt-qpr1-dev-plus-aosp 2020-04-09 11:06:06 +00:00
Treehugger Robot
49e6672c9b Merge "[SM09] Add helper class to monitor RAT type change per sub" am: 64ccb88948 am: 57aa3c8c94
Change-Id: I182886d7fd1e9dad96c43c339bda7acf1c749397
2020-04-09 11:05:45 +00:00
Treehugger Robot
e8bbe6d329 Merge "[SM09] Add helper class to monitor RAT type change per sub" am: 64ccb88948 am: 57aa3c8c94
Change-Id: Ic269c912268a9c8cd6a4fc9f9e3f2a28a54d88be
2020-04-09 10:23:17 +00:00
Treehugger Robot
57aa3c8c94 Merge "[SM09] Add helper class to monitor RAT type change per sub" am: 64ccb88948
Change-Id: I27acccfe6e8c892090a979dd3c2f96970627fdac
2020-04-09 08:21:21 +00:00
junyulai
af1b5c3f4f [SM09] Add helper class to monitor RAT type change per sub
In current design, Rat type change in NSS is only for default
subscription. This is only correct for single sim project.
However, it does not correct for multi-sim scenarios such as
CBRS or DSDS, given that all data usage will be attributed
to the Rat type of default sub.

Thus, add a helper class to monitor subscription change event,
and register/unregister dynamically for Rat type change for
every subscription.

Note that unit test of the helper class will be addressed
in follow-up patch.

Test: m -j
Bug: 146415925
Change-Id: I0055f6b55c209a073ce997fc7a144477f9db7069
Merged-In: I0055f6b55c209a073ce997fc7a144477f9db7069
(cherry picked from ag/10977156 and fixed conflict)
2020-04-09 07:11:17 +00:00
Junyu Lai
c5c5992227 Merge changes from topic "sp26-networkstats-cts" am: 4d4ddc78cf am: d9074a21fc
Change-Id: Icd22765bf76b3b37935928169722afed65469105
2020-04-02 02:41:02 +00:00
junyulai
aa5c856269 [SP26.2] add a method in NetworkStats that removes empty entries am: 5d9bc0c75e am: ba57ab6eb9
Change-Id: I99eef67c05afb7d6432d5dbf32494d2f5b56b1a5
2020-04-02 02:41:00 +00:00
Junyu Lai
d9074a21fc Merge changes from topic "sp26-networkstats-cts" am: 4d4ddc78cf
Change-Id: I124f0def6fdaad8f1726df23edc87b6aa7856586
2020-04-02 02:21:26 +00:00
junyulai
ba57ab6eb9 [SP26.2] add a method in NetworkStats that removes empty entries am: 5d9bc0c75e
Change-Id: Ieee0896672625f3bab9ec02a5efa495a9d1f001b
2020-04-02 02:21:20 +00:00
Junyu Lai
4d4ddc78cf Merge changes from topic "sp26-networkstats-cts"
* changes:
  [SP26] add CTS for NetworkStats
  [SP26.2] add a method in NetworkStats that removes empty entries
2020-04-02 02:00:59 +00:00
junyulai
5d9bc0c75e [SP26.2] add a method in NetworkStats that removes empty entries
In current design, entries with zeros are preserved after
addition/subtraction. These entries are not very useful
and lead to difficulty of verifying the result of
addition/subtraction.

However, change the behavior in the original NetworkStats
is considered risky in current stage.

Thus, this change provide a function that could remove these
empty entries in tests.

Test: atest FrameworksNetTests
Bug: 152827872
Bug: 150644692
Change-Id: I40a76935d55712b8083ee1e17e137a8a4ef5e029
2020-04-01 16:46:08 +08:00
Daulet Zhanguzin
b87f6cd89c Merge "Replace com.android.internal.util.Preconditions.checkNotNull with java.util.Objects.requireNonNull" am: f8098ddadf am: 35045271d1
Change-Id: I024e79fc24b8962ff6bd10e4b7c7fc4ad13cbf27
2020-03-27 12:27:58 +00:00
Daulet Zhanguzin
35045271d1 Merge "Replace com.android.internal.util.Preconditions.checkNotNull with java.util.Objects.requireNonNull" am: f8098ddadf
Change-Id: I9f9ba24036e19f568942466c866c7be23112c10a
2020-03-27 12:07:53 +00:00
Daulet Zhanguzin
a12c44da4d Replace com.android.internal.util.Preconditions.checkNotNull with
java.util.Objects.requireNonNull

Bug: 126528330
Bug: 149348618

Test: Treehugger
Change-Id: Idb1b6ba41af3b52f3376b1157259af3c30328c4e
Merged-In: Idb1b6ba41af3b52f3376b1157259af3c30328c4e
2020-03-26 12:44:56 +00:00
Benedict Wong
0fe6df858e Merge "Automatically set IPsec tunnel interface as up" am: 1f1da2083a am: 1e6fcb32b1
Change-Id: Iea78d37e17961a755194e42a85fe7ab92c20c4fb
2020-03-25 05:01:42 +00:00
Benedict Wong
1e6fcb32b1 Merge "Automatically set IPsec tunnel interface as up" am: 1f1da2083a
Change-Id: I068814590192decaf353cdd8c46cc7f65badc746
2020-03-25 04:35:03 +00:00
Benedict Wong
1f1da2083a Merge "Automatically set IPsec tunnel interface as up" 2020-03-25 04:18:50 +00:00
Benedict Wong
4142c4359b Merge "Relax IPsec resource count restrictions." am: cae8b10659 am: 40cc67b7eb
Change-Id: Iac00f8db5358a3e3ecec848eafd25649bc33028c
2020-03-25 00:07:51 +00:00
Benedict Wong
40cc67b7eb Merge "Relax IPsec resource count restrictions." am: cae8b10659
Change-Id: I18314d4d512ca3d63440ce1287cc651b7dc44231
2020-03-24 23:47:24 +00:00
Benedict Wong
cae8b10659 Merge "Relax IPsec resource count restrictions." 2020-03-24 23:31:37 +00:00
Xin Li
1859ce035a DO NOT MERGE - Merge qt-qpr1-dev-plus-aosp@6304901 into stage-aosp-master am: 7b8a4a253f
Change-Id: Ief9788fe26220b3f31d99c46a38aa6992e41d56e
2020-03-20 18:32:31 +00:00
Xin Li
7b8a4a253f DO NOT MERGE - Merge qt-qpr1-dev-plus-aosp@6304901 into stage-aosp-master
Bug: 151763422
Change-Id: I62d3293f617f630d3d2a3d5f67b764bf272769bf
2020-03-19 10:10:35 -07:00
Lorenzo Colitti
1543b82a6d Merge "Make Ethernet interfaces more testable." am: e7ff9d5e6d am: 6b37362b14
Change-Id: I4b262fb9cf66a7e1f859e03c7df0fd337658c376
2020-03-19 11:47:03 +00:00
Lorenzo Colitti
6b37362b14 Merge "Make Ethernet interfaces more testable." am: e7ff9d5e6d
Change-Id: I456acb05d548b3d0281e500cfd91d888441d7f94
2020-03-19 11:30:33 +00:00
Lorenzo Colitti
e7ff9d5e6d Merge "Make Ethernet interfaces more testable." 2020-03-19 11:12:09 +00:00
junyulai
3815d37747 [SM07] Make combine subtype configurable from Settings am: 3faf37539a am: b072165901
Change-Id: I65470e2ce4aae26308a395ce1e5465ac27914f60
2020-03-19 09:40:53 +00:00
junyulai
b8fc0b631d [SM05] Enable record mobile network stats by collapsed rat type am: 0a59b1e599 am: ab08ed986a
Change-Id: Ie23c2131349412d9dae04db122d7b3d14047b87f
2020-03-19 09:40:51 +00:00
junyulai
b58185d835 [SM04] Support fetching data with NetworkTemplate with subType am: 97ea6b222d am: 2f3c57ee95
Change-Id: Ib47b320e467daed3c8fb746ed99dd34657d1799b
2020-03-19 09:40:48 +00:00