Commit Graph

2392 Commits

Author SHA1 Message Date
junyulai
ab08ed986a [SM05] Enable record mobile network stats by collapsed rat type am: 0a59b1e599
Change-Id: If4bcfaefd2244be67449066ef54a6bdc0c00eb86
2020-03-19 09:31:00 +00:00
junyulai
2f3c57ee95 [SM04] Support fetching data with NetworkTemplate with subType am: 97ea6b222d
Change-Id: I3927277c41ba4b0cb5dc3a0309a5d4ca8f4d1dbc
2020-03-19 09:30:56 +00:00
junyulai
3968b6ddb8 [SM02] Support record mobile network stats by collapsed rat type am: 383c8e8556
Change-Id: Ia7dd0ae44fe951c00e365b94ac3b8a93230c96ab
2020-03-19 09:30:51 +00:00
junyulai
28255c9992 [SM07] Make combine subtype configurable from Settings am: 1e30781571
Change-Id: Ic8426ae36b5aaadfdd3292a3b70fc9b290443d5c
2020-03-19 06:37:59 +00:00
junyulai
f09a3e232f [SM05] Enable record mobile network stats by collapsed rat type am: dddf7d0a9a
Change-Id: I492dd32dc6b6af061da02a450c8c6abff0e8bf5e
2020-03-19 06:37:56 +00:00
junyulai
5341a72f55 [SM04] Support fetching data with NetworkTemplate with subType am: 00d94e3335
Change-Id: Ie22a2255f1d32b6c0b21a4c33bd6778255e4cbb5
2020-03-19 06:37:51 +00:00
junyulai
ad8e8bddfe [SM02] Support record mobile network stats by collapsed rat type am: 825f0828ac
Change-Id: Ie512faaa0799b3f352c3d646e30bd92e525d9d2c
2020-03-19 06:37:48 +00:00
junyulai
3faf37539a [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 550d61b8fa and
 fix merge conflict in SettingsBackupTest)
2020-03-19 10:10:07 +08:00
junyulai
0a59b1e599 [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 ff1d70e364)
2020-03-19 10:10:07 +08:00
junyulai
97ea6b222d [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 ec1c5fe86c)
2020-03-19 10:10:07 +08:00
junyulai
383c8e8556 [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 20f4805aad)
2020-03-19 10:10:07 +08: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
Lorenzo Colitti
013187d3e3 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
2020-03-19 09:46:37 +09: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
08ae898422 Snap for 6306509 from b1f2e3d0211be00397dcacc36296bf71800d3bbd to mainline-release
Change-Id: I4901b261694118fa1e9e82f927236842c4600e0b
2020-03-18 07:16:05 +00:00
Junyu Lai
9601eb5237 Merge "[SP25] Rename functions that add Entry conditionally" am: 338e4c0608 am: f17247045d
Change-Id: I59d965fa3a67be4994fe19a2f91e30d2ef114f81
2020-03-18 04:02:41 +00:00
Junyu Lai
1e2d51797a [automerger skipped] Merge "[SP25] Rename functions that add Entry conditionally" am: 338e4c0608 am: f17247045d -s ours
am skip reason: Change-Id I9495a198cf247e6c79100f7ac1edcea370b071de with SHA-1 544bc807a4 is in history

Change-Id: I19399123661123386472ff3f39d268d85917cbe1
2020-03-18 04:02:05 +00:00
Junyu Lai
f17247045d Merge "[SP25] Rename functions that add Entry conditionally" am: 338e4c0608
Change-Id: I7e0698f0e60d4c26864ceb728b74a265351a8506
2020-03-18 03:45:41 +00:00
Junyu Lai
338e4c0608 Merge "[SP25] Rename functions that add Entry conditionally" 2020-03-18 03:16:41 +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
a79dab9229 [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
Merged-In: I9495a198cf247e6c79100f7ac1edcea370b071de
(cherry picked from ag/10700816)
2020-03-18 00:29:15 +00:00
junyulai
c87482ed57 [SP25] Rename functions that add Entry conditionally am: 544bc807a4
Change-Id: I5f9924cf5b3eccfcdaa6dda991a102b97cebd11a
2020-03-17 23:35:57 +00:00
junyulai
effcd8d405 [automerger skipped] [SP24] Rename functions that add Entry unconditionally am: 02a6340ca0 -s ours
am skip reason: Change-Id I801ddc49e283a254b9586700c9b597c0adb0d459 with SHA-1 e7c6c25653 is in history

Change-Id: I480e66ff5b65a1ba24ecffb288ba429c2f94219e
2020-03-17 23:35:52 +00:00
junyulai
959458b6dd [automerger skipped] [SP23] Address misc API review comment about NetworkStats am: ca952de92d -s ours
am skip reason: Change-Id Id1b8f41be79f847ad73197ff0e18258b6ee8a730 with SHA-1 c7e8100faa is in history

Change-Id: Ia71c3307443fc1d994fd07dcf20d5ca32d145765
2020-03-17 23:35:50 +00:00
junyulai
af1d560d1f [automerger skipped] [SP21] Address comments for API council review about aosp/1172143 am: 27d58bfd96 -s ours
am skip reason: Change-Id I141393f229e772d2eb9f7c156849e379bd71b845 with SHA-1 9a4eeaea2f is in history

Change-Id: I80ab45b6a34b66f1bed766b3e2fb72926325021e
2020-03-17 23:35:48 +00:00
Automerger Merge Worker
6a2a493c55 [automerger skipped] [SP20] Check signature permission when accessing network stats provider am: f62907d9ca -s ours
am skip reason: Change-Id Idfebd0a1988c3dcfd812d87e30f6a2034d6fbf6b with SHA-1 f2b6d74356 is in history

Change-Id: I41bb8c1d96e494f4e54ab59138f1257cc23f05c7
2020-03-17 23:35:44 +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
Automerger Merge Worker
79606cc385 [automerger skipped] Merge "Fix typo in aosp/1242602" into rvc-dev am: 984a51c6ee -s ours
am skip reason: Change-Id Ie023c8371785fc239c54eacbf056141c2e9e3444 with SHA-1 9d4e21f0be is in history

Change-Id: Ie4565f23be593f4ed5f398ffd320eb8897fd9736
2020-03-17 14:26:58 +00:00
Automerger Merge Worker
c884826573 [automerger skipped] Merge "Add permission check functions to NetworkStatsService" into rvc-dev am: 70731d4348 -s ours
am skip reason: Change-Id I837545b54f36c8f21c878cbb1fd028ff23be6cb8 with SHA-1 df2aef7c1d is in history

Change-Id: Ie92995d3a60e009aff0913f1e9c039972837fff5
2020-03-17 12:14:30 +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
Automerger Merge Worker
940f7154cd Merge changes I801ddc49,Id1b8f41b am: 2395cf16b9 am: 14b1bb2401
Change-Id: Ib25ca9a843f19fb3791afbe23c065a0a7bb3b11f
2020-03-16 11:56:41 +00:00
Automerger Merge Worker
1c27e5a4cc Merge changes I801ddc49,Id1b8f41b am: 2395cf16b9 am: 14b1bb2401
Change-Id: Ibc0b7c74ce55198fc6804b5cf1ea414aad912a4f
2020-03-16 11:56:19 +00:00
Automerger Merge Worker
14b1bb2401 Merge changes I801ddc49,Id1b8f41b am: 2395cf16b9
Change-Id: I604bcfab22d7b26b84bf126d02d9be612fcb6d29
2020-03-16 11:41:19 +00:00
Treehugger Robot
2395cf16b9 Merge changes I801ddc49,Id1b8f41b
* changes:
  [SP24] Rename functions that add Entry unconditionally
  [SP23] Address misc API review comment about NetworkStats
2020-03-16 11:38:00 +00:00
Automerger Merge Worker
7730f7fe95 Merge "Fix typo in aosp/1242602" am: 1ae5516429 am: 934bb9fa9c
Change-Id: I3f1078dd2ea942860e43d5421fa44e438c9de21d
2020-03-16 08:52:50 +00:00
Automerger Merge Worker
e681bebdf8 Merge "Fix typo in aosp/1242602" am: 1ae5516429 am: 934bb9fa9c
Change-Id: Icd65f665812d14f23671be65d1d182d2a78ecf2f
2020-03-16 08:52:39 +00:00
Automerger Merge Worker
934bb9fa9c Merge "Fix typo in aosp/1242602" am: 1ae5516429
Change-Id: Ie617874be311e84e04d889f6c2069c77c25150b7
2020-03-16 08:36:03 +00:00
junyulai
9d4e21f0be Fix typo in aosp/1242602
Test: m -j
Bug: 149652079
Change-Id: Ie023c8371785fc239c54eacbf056141c2e9e3444
2020-03-16 15:00:24 +08:00
junyulai
e7c6c25653 [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
2020-03-16 14:27:45 +08:00
junyulai
c7e8100faa [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
2020-03-16 14:27:45 +08:00
Automerger Merge Worker
759f420024 [SP21] Address comments for API council review about aosp/1172143 am: 9a4eeaea2f am: 759155a3a3
Change-Id: I86cf3b57722f64c0989ce606fde71d6173f812bb
2020-03-16 03:14:01 +00:00
Automerger Merge Worker
610e81320d [SP21] Address comments for API council review about aosp/1172143 am: 9a4eeaea2f am: 759155a3a3
Change-Id: Ia5e64eb524a852539850f46df87a6b28d4910cbc
2020-03-16 03:13:45 +00:00
Automerger Merge Worker
759155a3a3 [SP21] Address comments for API council review about aosp/1172143 am: 9a4eeaea2f
Change-Id: I8634d6f6ed65ec6b10009a90b147881fe1fc4530
2020-03-16 03:03:51 +00:00