Commit Graph

2120 Commits

Author SHA1 Message Date
android-build-team Robot
3b3529b5f4 Snap for 6314400 from 975130e08acdfb708338c99f92e45dd52b793afb to rvc-release
Change-Id: I9395826c82efad441bd953a3c757b4c9f0da081b
2020-03-20 02:08:32 +00:00
Lorenzo Colitti
8723291cee Make Ethernet interfaces more testable.
This CL adds a setIncludeTestInterfaces method to EthernetManager
that, when called, causes the Ethernet service to recognize and
manage test interfaces created by TestNetworkManager.

Bug: 150644681
Test: Tested by EthernetTetheringTest in same topic
Change-Id: I86eef7a93267f800dbfc8eafd307effa76a344ca
Merged-In: I86eef7a93267f800dbfc8eafd307effa76a344ca
(cherry picked from commit 3410fb0aa92bbd4f9d7dc031e89f6f528ff34245)
2020-03-19 12:30:39 +00:00
junyulai
1e30781571 [SM07] Make combine subtype configurable from Settings
Note that enabling/disabling would not take effect until device
reboot. This will be addressed in follow-up patch.

Test: 1. atest NetworkStatsServieTest SettingsBackupTest
      2. adb shell settings put global netstats_combine_subtype_enabled 1|0
Bug: 146415925

Change-Id: Ic94da540afa479ed18f1b6fbda4ae3216c37476b
Merged-In: Ic94da540afa479ed18f1b6fbda4ae3216c37476b
(cherry picked from commit c4f77ac90bf2e48a655ad19b162fe74a23bf3fb0)
2020-03-19 01:40:55 +00:00
junyulai
dddf7d0a9a [SM05] Enable record mobile network stats by collapsed rat type
Switch on the recording in device side. Metrics will be
collected in follow-up patches which can be independently
enabled/disabled.

This change also fix the fail in NetworkStatsCollectionTest
which caused by enabling this feature, where the rounding
problem happened when records are distributed into smaller
buckets and categorized into more NetworkIdentity.

Test: atest FrameworksNetTests
Bug: 129082217
Change-Id: If330e85330a4ff713dd420c98d42fa741eabd90a
Merged-In: If330e85330a4ff713dd420c98d42fa741eabd90a
(cherry picked from commit 2d4fa2c0fae8c2d79a25093d9f732a33c2f91dd4)
2020-03-18 08:08:01 +00:00
junyulai
00d94e3335 [SM04] Support fetching data with NetworkTemplate with subType
Add a NetworkTemplate build function that allows user to specify
subType. NetworkStats corresponding to the same group would
be retrieved.

Test: atest FrameworksNetTests
Bug: 129082217

Change-Id: Ie2d229be0b6bd239f799989c070475c73a096d71
Merged-In: Ie2d229be0b6bd239f799989c070475c73a096d71
(cherry picked from commit e19045cc4ab1f2cd133ce5dc0c3a38e3275417ad)
2020-03-18 08:07:12 +00:00
junyulai
825f0828ac [SM02] Support record mobile network stats by collapsed rat type
Previously network stats could be recorded by different rat type.
However, the feature was disabled by ag/173504 since rat type
frequently flapping between HSPA+ and UMTS.

Given that this feature might be useful for collecting metrics,
re-implement it based on current architecture and reduce the
overhead introduced by frequently flapping by:
  1. only react when rat type changes between 2G/3G/4G/5G.
  2. reduce the number of records by only recording a subset
     of rat type that represented for a given network class.
  3. enforce 1 second rate limit if flapping too much.

Note that the feature is still disabled but will be enabled
in follow-up patches.

Test: manual test
Bug: 129082217
Change-Id: Ic6b2f10f2c8b082820e0662eb9cee70d70d28cd6
Merged-In: Ic6b2f10f2c8b082820e0662eb9cee70d70d28cd6
(cherry picked from commit 15ab452e7e3f00289fbedbdb86c512ad560dda7e)
2020-03-18 07:59:44 +00:00
android-build-team Robot
b506297680 Snap for 6305839 from 099628bfe626a770516a319d6e056065ee89dac8 to rvc-release
Change-Id: I47ab1b00b2d3da5651e9387b761b2a406675594a
2020-03-18 02:01:54 +00:00
junyulai
544bc807a4 [SP25] Rename functions that add Entry conditionally
Currently, in NetworkStats, there are many methods to manipulate
the records. However, some methods are similar and ambiguous,
such as addEntry, addValues, setValues, addIfaceValues,
combineValues and combineAllValues.

Thus, properly grouping and renaming methods are necessary.
In this change, for methods that add one record conditionally,
name them addEntry.
  addValues -> addEntry

Test: atest FrameworksNetTests ImsPhoneCallTrackerTest TetheringTests
Fix: 148895143
Change-Id: I9495a198cf247e6c79100f7ac1edcea370b071de
2020-03-17 14:59:59 +00:00
junyulai
02a6340ca0 [SP24] Rename functions that add Entry unconditionally
Currently, in NetworkStats, there are many methods to manipulate
the records. However, some methods are similar and ambiguous,
such as addEntry, addValues, setValues, addIfaceValues,
combineValues and combineAllValues.

Thus, properly grouping and renaming methods are necessary.
In this change, for methods that add one record unconditionally,
name them insertEntry.
  setIfaceValues -> insertEntry
  addEntry -> insertEntry

Test: atest FrameworksNetTests ImsPhoneCallTrackerTest TetheringTests
Test: m doc-comment-check-docs
Bug: 148895143
Change-Id: I801ddc49e283a254b9586700c9b597c0adb0d459
Merged-In: I801ddc49e283a254b9586700c9b597c0adb0d459
(cherry picked from aosp/1256352)
2020-03-17 14:59:31 +00:00
junyulai
ca952de92d [SP23] Address misc API review comment about NetworkStats
This change add several javadoc for NetworkStats and its Entry
class. Also remove IFACE_ALL constant accordlingly.

Test: atest FrameworkNetTests
Test: m doc-comment-check-docs
Bug: 148895143

Change-Id: Id1b8f41be79f847ad73197ff0e18258b6ee8a730
Merged-In: Id1b8f41be79f847ad73197ff0e18258b6ee8a730
(cherry picked from aosp/1256351)
2020-03-17 14:58:59 +00:00
junyulai
27d58bfd96 [SP21] Address comments for API council review about aosp/1172143
Test: atest FrameworksNetTests ImsPhoneCallTrackerTest
Test: atest TetheringTests NetworkStackTests
Test: m doc-comment-check-docs
Fix: 148552904

Change-Id: I141393f229e772d2eb9f7c156849e379bd71b845
Merged-In: I141393f229e772d2eb9f7c156849e379bd71b845
(cherry picked from aosp/1253717)
2020-03-17 14:57:59 +00:00
Automerger Merge Worker
f62907d9ca [SP20] Check signature permission when accessing network stats provider
Currently, registerNetworkStatsProvider requires the
UPDATE_DEVICE_STATS permission. This is a privileged permission
so it can be granted to preinstalled apps. Thus, apps like
GmsCore, or preinstalled apps will be able to update network stats.

This change checks for a new permission that would only allow
signature apps to declare that. Also check
MAINLINE_NETWORK_STACK permission to allow NetworkStack process
to use it.

Test: adb shell dumpsys netstats
Test: atest FrameworksNetTests
Bug: 149652079

Change-Id: Iaecbf10a7610461bd52e315659006c7332c416e6
Merged-In: Iaecbf10a7610461bd52e315659006c7332c416e6
Merged-In: Idfebd0a1988c3dcfd812d87e30f6a2034d6fbf6b
(cherry picked from commit e9e8d8f9ff096c1723eba1d74b17bb7cade7f23b)
2020-03-17 14:53:33 +00:00
junyulai
050c7de093 Fix typo in aosp/1242602
Test: m -j
Bug: 149652079
Change-Id: Ie023c8371785fc239c54eacbf056141c2e9e3444
Merged-In: Ie023c8371785fc239c54eacbf056141c2e9e3444
(cherry picked from aosp/1259461)
2020-03-17 12:08:59 +00:00
Automerger Merge Worker
e953a50e6b Add permission check functions to NetworkStatsService
This is shameless copied from ConnectivityService and plan to be
used in follow-up change. For long term perspective we should
have a permission util that contains those util in one place.

Test: m -j
Change-Id: If70e6e831c0386b604d0151cc0650f68457b6e5f
Merged-In: If70e6e831c0386b604d0151cc0650f68457b6e5f
Merged-In: I837545b54f36c8f21c878cbb1fd028ff23be6cb8
Bug: 149652079
(cherry picked from commit 4da7af7e7e4a0d3360cd41e98e4d6fa731d21515)
2020-03-17 09:33:11 +00:00
android-build-team Robot
ca4784ecb9 Snap for 6286840 from 6a781e90bda80da13816914cbdbfd686c860dd05 to rvc-release
Change-Id: I042a93be853413b2c0bd010aae493d8155f3dd97
2020-03-12 02:04:03 +00:00
Lorenzo Colitti
48aff64f9b Merge "Merge NetworkStatsService handler changes." into rvc-dev 2020-03-11 06:19:18 +00:00
android-build-team Robot
c7e0dcbc87 Snap for 6282804 from 76182efa9fdc08d31a2f348932b6a2cfbc65fdbc to rvc-release
Change-Id: I3b38c8604044864ccc9958a3d769e12ad0689720
2020-03-11 02:04:28 +00:00
android-build-team Robot
7aadcb0394 Snap for 6279178 from 54df41a8815959772c8088e3a4da545edecbfd4e to rvc-release
Change-Id: I7a1f4f7a982cdba25cd9954cf4e2103bbcbe0621
2020-03-10 02:12:27 +00:00
Automerger Merge Worker
3bc71e0d89 Add missing RequiresPermission to EthernetManager
The method requires NETWORK_STACK or MAINLINE_NETWORK_STACK permissions,
but the annotation was missing.

Test: m
Fixes: 150877670
Merged-In: I2af74cbcfa642f05f5e7bf85b2a8e8c38595f6ca
(cherry picked from commit e45d3ff849695977cb063cc59550c505b220bd6c)

Change-Id: Ia215b74df99ae60be2e380917be68a272d658ef4
2020-03-09 10:20:22 +00:00
Automerger Merge Worker
c0565de11f Merge NetworkStatsService handler changes.
=====
Remove the need of accessing handler in NSS unit test

Currently, to wait for handler becomes idle, specific message
is used and the test would wait for condition variable to be
open when the message is processed.

However, this is already done in the HandlerUtils. Thus,
there is no need to post such message manually in the handler.

Test: atest FrameworksNetTests
Bug: 150664039

Change-Id: Iab32b2dbab01634ca159dcb90fc9f929d1fed1a2
=====
Remove setHandler in NetworkStatsService

Currently, internal handler is set by setHandler after
constructing NSS object. This was introduced in ag/866187 to
access the handler in the unit test.

However, the design put NSS in a bad situation where all classes
that need handler or executor could not be final and need to be
dynamically allocated in order to get a valid handler.

Thus, since the usage of handler is removed in previous patch,
this change eliminate setHandler by initializing the handler in
the constructor.

Test: atest FrameworksNetTests
Bug: 150664039

Change-Id: I794a24d00b0ca9fdc78091e7b9ab7307e0f034b7
=====

Bug: 150664039
Change-Id: If256ed4437ddcbcc72a6f766cff2f4cc512ee3f7
Merged-In: If256ed4437ddcbcc72a6f766cff2f4cc512ee3f7
(cherry picked from commit 2a6439d7e2a3926e10a0b9a4dc730b1a022d8138)
2020-03-09 07:59:27 +00:00
Automerger Merge Worker
87aa2869fe Fix crash and duplicated ethernet tethering request
This change fix two things:
1. Handle ethernet callback in internal thread to avoid crash. IpServer
should be created from tethering thread, otherwise mIpNeighborMonitor of
IpServer would throw
   IllegalStateException("start() called from off-thread")
2. Ethernet tethering request may be duplicated if multiple
startTethering is called but no stopTethering

Bug: 130840861
Bug: 148824036
Test: ON/OFF ethernet tehtering manually
      atest TetheringTests

Change-Id: Ibd3ea6bc6751bd65647ff381f9b0124bc3395c09
Merged-In: I7c5127e96d80d077735010d2e62c7227805ccb10
Merged-In: Ibd3ea6bc6751bd65647ff381f9b0124bc3395c09
(cherry picked from commit 72702b979654234c18045f04270040056a74cf90)
2020-03-09 02:02:23 +00:00
android-build-team Robot
3ace4a8305 Snap for 6224475 from 09ca9ec0d1e3e48daab7ee076af0b7309e8acc72 to rvc-release
Change-Id: I85f1b6abd27b3712ccfd4bc40b4f2ba2afaace45
2020-02-21 03:13:55 +00:00
Automerger Merge Worker
662cc3d540 Merge "[SP12] Remove the usage of getVtDataUsage" am: afeed9dee4 am: 7fe2313922 am: ac4706dc7a
Change-Id: I28c84ee96a3a209868769aad16a2d2e596a0c342
2020-02-19 23:02:38 +00:00
Automerger Merge Worker
ac4706dc7a Merge "[SP12] Remove the usage of getVtDataUsage" am: afeed9dee4 am: 7fe2313922
Change-Id: Ia10e2365d5f02a1e3444d80e6d7f9d5da00264e0
2020-02-19 00:54:03 +00:00
Automerger Merge Worker
7fe2313922 Merge "[SP12] Remove the usage of getVtDataUsage" am: afeed9dee4
Change-Id: I4e617685c887098e5a93905b77455fb42116a99c
2020-02-19 00:33:48 +00:00
Junyu Lai
afeed9dee4 Merge "[SP12] Remove the usage of getVtDataUsage" 2020-02-19 00:13:02 +00:00
android-build-team Robot
14a33bb9ba Snap for 6214566 from 8ac64bc013a7b14c9996f504eb4c50b6d71c9257 to rvc-release
Change-Id: I2dc4f607967f2e9f5baaf624e97aba7085b9b972
2020-02-18 03:19:15 +00:00
Junyu Lai
50e1c228d0 Merge "[SP16] Address comments on aosp/1172143" am: f4eaaa2415 am: d58bf88378 am: 59a0c28cf3
Change-Id: I4cff4d096f375210585ceae5eb27002b97a35226
2020-02-17 14:18:32 +00:00
Junyu Lai
ad9585467c Merge "[SP17] Wait for stats providers to report stats update" am: 1e47a3e71d am: 48433d6735 am: 91c2f32f05
Change-Id: I719a1b2c75123f6fa6c765eeced055720c052c9b
2020-02-17 14:18:06 +00:00
android-build-team Robot
8510479a47 Snap for 6210127 from 9fdd67b83988e9db359ed8aa7a35cbb05a1dd683 to rvc-release
Change-Id: Id5f80c104b2f94ba79b3f32d1656160de25d7754
2020-02-15 03:12:12 +00:00
Junyu Lai
59a0c28cf3 Merge "[SP16] Address comments on aosp/1172143" am: f4eaaa2415 am: d58bf88378
Change-Id: Id6d4be756ec4bd6d3e9c7b8fa1d85b3bdc802a10
2020-02-15 02:51:23 +00:00
Junyu Lai
d58bf88378 Merge "[SP16] Address comments on aosp/1172143" am: f4eaaa2415
Change-Id: I9c826c08320e112466dea0d2628f3447ebcb7d02
2020-02-15 02:35:42 +00:00
Junyu Lai
f4eaaa2415 Merge "[SP16] Address comments on aosp/1172143" 2020-02-15 02:21:30 +00:00
Junyu Lai
91c2f32f05 Merge "[SP17] Wait for stats providers to report stats update" am: 1e47a3e71d am: 48433d6735
Change-Id: I4b5c9e1cca7641b786e118ff979b33b25394fa3e
2020-02-15 02:03:52 +00:00
Junyu Lai
48433d6735 Merge "[SP17] Wait for stats providers to report stats update" am: 1e47a3e71d
Change-Id: I5e6a69fb50c9820f8b0a7e834608a32f651a860a
2020-02-15 01:38:09 +00:00
Benedict Wong
4531c37767 [automerger skipped] Merge "Implement Ikev2VpnRunner" am: e334a83e46 am: c722981400 am: ae8b9c5683 -s ours
am skip reason: skipped by user benedictwong

Change-Id: Ie1f6f8dbd10161342a7f14935def73820a68b057
2020-02-14 20:11:15 +00:00
junyulai
304de51561 [SP17] Wait for stats providers to report stats update
From current design, the traffic accounted by stats providers
will be updated asynchronously when force polling. When upper
layer make two subsequently queries. They will get stale
stats upon the first query, and may get newest/stale stats
base on the result of race.

Thus, wait for a bit of time to allow asynchronous stats update
complete to reduce the chance of race. In pratice, it would
be finished in ~2ms when testing.

Test: systrace.py network
Test: atest FrameworksNetTests
Bug: 147460444
Change-Id: I22a00fc4049cddf77fd578e25769ae1979f2cc6d
2020-02-14 17:03:35 +08:00
junyulai
4fe16c5214 [SP16] Address comments on aosp/1172143
Test: atest FrameworksNetTests
Test: atest NetworkPolicyManagerServiceTest
Test: m doc-comment-check-docs
Bug: 130855321
Change-Id: Iccaab09f5b9668ec4a7249737c64a69cecb08d15
2020-02-14 16:53:40 +08:00
junyulai
12ddc700c8 [SP12] Remove the usage of getVtDataUsage
Currently NetworkStatsService holding a lock when invoking
getVtDataUsage, which causes a lot of deadlock problems since
Phone will also have binder calls to system_server.

Thus, this change uses a new set of API to break such situation,
that allows VT to report stats asynchronously.

Test: atest FrameworksNetTests FrameworksTelephonyTests
Bug: 130855321
Fix: 143923500

Change-Id: Ifdb8599c3bade09208b4730710fc99da1afad71d
2020-02-14 15:37:16 +08:00
android-build-team Robot
ce1ca88d15 Snap for 6206568 from 4e21e319cdf514b6c5a4f5a02eadd5ccd9445772 to rvc-release
Change-Id: Ic8d59142f4f9ee94cc49efc47c304087715dbc9a
2020-02-14 03:15:57 +00:00
Benedict Wong
ae8b9c5683 Merge "Implement Ikev2VpnRunner" am: e334a83e46 am: c722981400
Change-Id: I0048c33ac9b5b60d2f64a90d7c5d9e5e829cf24d
2020-02-13 21:46:13 +00:00
Benedict Wong
c722981400 Merge "Implement Ikev2VpnRunner" am: e334a83e46
Change-Id: I9b966b52f78fa54dca9d8c3032ec26ed853ad572
2020-02-13 21:31:28 +00:00
Benedict Wong
e334a83e46 Merge "Implement Ikev2VpnRunner" 2020-02-13 21:15:24 +00:00
Benedict Wong
c85b7b0114 Implement Ikev2VpnRunner
This change adds the implementation for IKEv2/IPsec VPNs.

Bug: 144246767
Test: Manually tested
Change-Id: I5ccec756cec49ccf57ccc4d5ad800eeb5d595a76
Merged-In: I5ccec756cec49ccf57ccc4d5ad800eeb5d595a76
2020-02-13 18:37:06 +00:00
Benedict Wong
c2eefbb98a Merge "Implement Ikev2VpnRunner" 2020-02-13 18:36:49 +00:00
Benedict Wong
9ee6603153 Implement Ikev2VpnRunner
This change adds the implementation for IKEv2/IPsec VPNs.

Bug: 144246767
Test: Manually tested
Change-Id: I5ccec756cec49ccf57ccc4d5ad800eeb5d595a76
2020-02-13 00:33:44 -08:00
Automerger Merge Worker
afff4915ec Merge "Fix incorrect interpolation of active bucket for partial requests." am: cb011605cf am: 244299e38b am: 16d7a45bfe
Change-Id: I3a7df5061e0a2a90231072a5cd3e8c799302b346
2020-02-13 08:26:15 +00:00
Automerger Merge Worker
16d7a45bfe Merge "Fix incorrect interpolation of active bucket for partial requests." am: cb011605cf am: 244299e38b
Change-Id: I1d6aa0c23fd227eca478e4a6ab5fd7dd26e4c297
2020-02-13 08:07:01 +00:00
Automerger Merge Worker
244299e38b Merge "Fix incorrect interpolation of active bucket for partial requests." am: cb011605cf
Change-Id: Ibfaf1e3d13ce758323c30381ba44702b6016d9eb
2020-02-13 07:53:18 +00:00
Maciej Żenczykowski
cb011605cf Merge "Fix incorrect interpolation of active bucket for partial requests." 2020-02-13 07:37:57 +00:00