Commit Graph

2046 Commits

Author SHA1 Message Date
Treehugger Robot
c6a61f9eee Merge changes I0faeda20,I726e74f5
* changes:
  Add 5G NSA to collapsed RAT types list
  Add getAllCollapsedRatTypes to NetworkTemplate
2020-08-20 03:44:07 +00:00
junyulai
fd139892de Add 5G NSA to collapsed RAT types list
Currently, getAllCollapsedRatTypes is used to retrieve
all RAT types which will be recorded into NetworkStatsService.
However, there is a missing part that 5G NSA virtual RAT type
is not added into this list. This makes callers such as statsd
do not aware of 5G NSA RAT type and missed to collect data
usage of it.

Test: atest NetworkStatsSubscriptionsMonitorTest#test5g
Test: adb shell cmd stats pull-source 10082
Test: ./out/host/linux-x86/bin/statsd_testdrive 10082
Test: atest UidAtomTests#testMobileBytesTransfer \
      UidAtomTests#testMobileBytesTransferByFgBg \
      UidAtomTests#testDataUsageBytesTransfer
Bug: 163021464
Change-Id: I0faeda20f0506a48ac1131b234c5fc40d95dfbe0
Merged-In: I0faeda20f0506a48ac1131b234c5fc40d95dfbe0
(cherry-picked from ag/12355984)
2020-08-12 10:12:48 +00:00
junyulai
199f353a9e Add getAllCollapsedRatTypes to NetworkTemplate
This is a partial cherry-pick of ag/10293594

Test: TH
Bug: 129082217

Merged-In: I726e74f5c63a6ed456cb13ea259b58c7a33bec76
Change-Id: I726e74f5c63a6ed456cb13ea259b58c7a33bec76
2020-08-12 18:01:13 +08:00
Chiachang Wang
2fea4a758b Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code
for reference.

Bug: 161896447
Test: m ; atest FrameworkNetTests
Change-Id: Ib6b4c9526992c31e05e82be80e2b9b86bc0b57ef
2020-08-12 12:23:59 +08:00
Peter Wang
b6ff6f6c2c Merge "[Telephony Mainline] Rename getActiveAndHiddenSubscriptionIdList and guard with permission" 2020-07-31 08:43:44 +00:00
Chiachang Wang
ae5caa0013 Merge "Update language to comply with Android's inclusive language guidance" 2020-07-30 02:49:44 +00:00
Chiachang Wang
893335012c Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code
for reference.

Test: m ; atest TetheringTests
Bug: 161896447
Change-Id: Idc58697c72fb00896bee00185fefc50c1a24dd35
2020-07-29 12:05:04 +08:00
Junyu Lai
0e0b61e92e Merge "Gracefully handle integer overflows." 2020-07-29 01:19:07 +00:00
Chiachang Wang
2ad3ca40cb Merge "Update language to comply with Android's inclusive language guidance" 2020-07-28 10:51:53 +00:00
Chiachang Wang
06defe000d Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code
for reference.

Bug: 161896447
Test: m
Change-Id: I6c3c03c0c2d1302af6d5245486823c13a3432900
2020-07-28 15:36:30 +08:00
Pavan Kumar M
fc5b6cb326 Gracefully handle integer overflows.
Avoid recording negative data by doing integer-based
math as much as possible, but switch to double-based
math if we detect that we'd end up causing an overflow.

Test :

    - Builds, Boots
    - High data throughput scenarios
    - NetworkStatsHistoryTest, NetworkStatsCollectionTest,
      NetworkStatsTest

Bug: 119527458
Change-Id: I55d4aa649bea3ae201ad513074ff2b71cb918dad
2020-07-28 11:36:49 +05:30
Aaron Huang
28ced6a6ca Merge "Remove ProxyInfo(String) and update callers to use ProxyInfo(Uri)" 2020-07-17 05:40:31 +00:00
Treehugger Robot
e36ce3a88b Merge "Attribute data usage to virtual RAT type for 5G non-standalone mode" 2020-07-16 11:43:51 +00:00
junyulai
3e1d718c12 Attribute data usage to virtual RAT type for 5G non-standalone mode
Test: atest NetworkStatsSubscriptionsMonitorTest#test5g
Bug: 160727498
Change-Id: I8753e68140c0993773017c9a49bd8a666a364071
Merged-In: I8753e68140c0993773017c9a49bd8a666a364071
(cherry-picked from ag/12167624)
2020-07-16 18:22:09 +08:00
Peter Wang
171598cb7c [Telephony Mainline] Rename getActiveAndHiddenSubscriptionIdList and
guard with permission

Bug: 150878235
Fix: 150878235
Test: Build
Change-Id: I7f3b1f5170e032336d9b39b322c49e2b92573586
Merged-In: I7f3b1f5170e032336d9b39b322c49e2b92573586
2020-07-16 02:01:06 -07:00
Junyu Lai
491d1837e9 Revert "Attribute data usage to 5G for 5G non-standalone mode"
This reverts commit 7e5b9894a4.

Reason for revert: Revert and wait for the design is settled down.

Change-Id: I10fdfc37d6456678de1886698cd6ad08bf8aa810
2020-07-10 03:43:19 +00:00
junyulai
7e5b9894a4 Attribute data usage to 5G for 5G non-standalone mode
Test: atest NetworkStatsSubscriptionsMonitorTest#test5g
Bug: 160727498

Change-Id: I563df14500caeb3602b381479afaf5163ad8e6a1
2020-07-09 16:56:54 +08:00
Aaron Huang
59fc483921 Remove ProxyInfo(String) and update callers to use ProxyInfo(Uri)
Update all callers to use ProxyInfo(Uri) and remove ProxyInfo(String).

Bug: 160557668
Test: build pass
      atest FrameworksNetTests

Change-Id: I4c980764c8839c48acf03208bb68cd53eb910121
2020-07-06 11:59:27 +00:00
Robin Lee
d8c0131468 ITetheredInterfaceCallback is a oneway interface
This is sent from the system server, and the system server doesn't like
being blocked by apps.

Change-Id: I603be3038831974baf1dc392ff0d062e9db91b63
Test: atest CtsTetheringTest
Bug: 160389275
2020-07-02 17:59:28 +02:00
Aaron Huang
72b4ffad5c Merge "Address comments from aosp/1298476" 2020-06-18 10:18:57 +00:00
Aaron Huang
cf854996a6 Address comments from aosp/1298476
This patch addresses the followings,
- Pass Looper to NetworkStatsSubscriptionsMonitor constructor
- Replace Looper with TestLooper in unit test
- Assert fail if result of condition check is not expected.

Bug: 154080205
Test: atest FrameworksNetTests:com.android.server.net.NetworkStatsServiceTest
      atest FrameworksNetTests:com.android.server.net.NetworkStatsSubscriptionsMonitorTest
Change-Id: Ibcaba2b38af80cc0ec9a4e428a3b3a1538bc4325
2020-06-18 15:05:19 +08:00
Aaron Huang
04baaeb973 Merge "Dynamically enable/disable watch for RAT type changes" 2020-06-18 03:51:51 +00:00
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
Aaron Huang
86bb429959 Add unit test for NetworkStatsSubscriptionsMonitor
Bug: 154080205
Test: atest FrameworksNetTests:com.android.server.net.NetworkStatsSubscriptionsMonitorTest
(copy from ag/11788484 but getActiveAndHiddenSubscriptionIdList() since it's renamed
in internal)
Change-Id: Ia162f36efe96d90b2f6f70190d9fa855bba34484
Merged-In: I4ef3f1ab2e5ea1322133edd80db3ccd0022e9c91
2020-06-15 07:05:19 +00: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