Commit Graph

2023 Commits

Author SHA1 Message Date
junyulai
8fbcf8b99b [SM02] Support record mobile network stats by collapsed rat type am: 383c8e8556 am: 3968b6ddb8
Change-Id: I3a8965424f1f28d1fa63bb469c10c735af67eb31
2020-03-19 09:40:45 +00:00
junyulai
b072165901 [SM07] Make combine subtype configurable from Settings am: 3faf37539a
Change-Id: I0c3f4a02f16eb6a4d9e48fa775bf456707d2b1bb
2020-03-19 09:31:02 +00:00
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
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
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
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
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
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
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
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
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
junyulai
9a4eeaea2f [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
2020-03-12 21:34:17 +08:00
Automerger Merge Worker
7de3ff8eda Merge changes from topic "sp20-stats-provider-permission" am: 51bbefacf2 am: bf292288b6
Change-Id: I765831bcb6059fa95cf59967becde4b9340cde39
2020-03-12 09:00:20 +00:00
Automerger Merge Worker
f43cef4969 Add permission check functions to NetworkStatsService am: df2aef7c1d am: ba550c1836
Change-Id: Ibd1d64edd72887961ee76a71df9c9b71c9727967
2020-03-12 09:00:17 +00:00
Automerger Merge Worker
bf292288b6 Merge changes from topic "sp20-stats-provider-permission" am: 51bbefacf2
Change-Id: I6111589d27501684b4c43711448a1fa08221a3f5
2020-03-12 08:39:54 +00:00
Automerger Merge Worker
ba550c1836 Add permission check functions to NetworkStatsService am: df2aef7c1d
Change-Id: Id2df1c6d5a5dc77f59f68772f5b46659fb956bc2
2020-03-12 08:39:48 +00:00
Junyu Lai
51bbefacf2 Merge changes from topic "sp20-stats-provider-permission"
* changes:
  [SP20] Check signature permission when accessing network stats provider
  Add permission check functions to NetworkStatsService
2020-03-12 08:19:24 +00:00
Benedict Wong
529e8aae25 Automatically set IPsec tunnel interface as up
This change makes IPsec tunnel interfaces automatically get brought up
once they are created. Originally this was considered to be an
additional safety check, as they would not be start routing traffic
until explicitly brought up. However, in the intervening time, the
NetworkManagementController now requires the NETWORK_STACK permission to
set an interface as up. Additionally, that call is a hidden API, and
thus not usable for use cases such as IWLAN.

Bug: 149348618
Test: FrameworksNetTests, CtsNetTestCases passing.
Change-Id: I55b63a748463a388e1e2991d2d5d6b3023545e60
2020-03-10 23:08:16 -07:00
Benedict Wong
7bcf9c28ac Relax IPsec resource count restrictions.
IPsec resource counts were selected to be conservative, due to unknowns
about device capabilities. Since then, it appears that we no longer need
such stringent quotas, and this can be relaxed.

Test: FrameworksNetTest passing
Change-Id: Id53d14e5698e5fcc410868424176b00350c7ae79
2020-03-10 23:08:13 -07:00
Automerger Merge Worker
7400d9c846 Merge "Add missing RequiresPermission to EthernetManager" am: b3d7fe48ad am: 360c24f950
Change-Id: I82aa6c27748dab5835158f4a64c3d8efbc8e28b4
2020-03-09 08:24:38 +00:00
Remi NGUYEN VAN
11f3924f18 Add missing RequiresPermission to EthernetManager
The method requires NETWORK_STACK or MAINLINE_NETWORK_STACK permissions,
but the annotation was missing.

Test: m
Fixes: 150877670
Change-Id: I2af74cbcfa642f05f5e7bf85b2a8e8c38595f6ca
2020-03-09 14:18:55 +09:00
Automerger Merge Worker
8297518d54 Merge "Merge stage-aosp-master to aosp-master - DO NOT MERGE" am: d11ef42169 am: f01b99332b
Change-Id: I3bc4f4e9dbe6e735c154338ab641b56e7c6ad027
2020-03-06 00:27:49 +00:00
Bill Yi
d11ef42169 Merge "Merge stage-aosp-master to aosp-master - DO NOT MERGE" 2020-03-05 18:27:30 +00:00
Automerger Merge Worker
74dcd87484 Merge changes I794a24d0,Iab32b2db am: f46d3aa4bb am: ae7c0fddb7
Change-Id: Ifb63c3d26c9da15b1074a6bd2e00f678f132122a
2020-03-04 13:36:09 +00:00
Automerger Merge Worker
ae7c0fddb7 Merge changes I794a24d0,Iab32b2db am: f46d3aa4bb
Change-Id: I03f6b9e521793b92f83a21583a2e53fb1d31fba1
2020-03-04 13:26:51 +00:00
Junyu Lai
f46d3aa4bb Merge changes I794a24d0,Iab32b2db
* changes:
  Remove setHandler in NetworkStatsService
  Remove the need of accessing handler in NSS unit test
2020-03-04 13:07:49 +00:00
junyulai
2999462561 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
2020-03-04 16:01:21 +08:00
Automerger Merge Worker
bf873f5ea0 Merge "Move DnsSdTxtRecord to net common static library" am: 8d6a6e0d4b am: faf27ff64c
Change-Id: I2d07d8fbd5d43d4dd2d10293d3dffae13d58ca9e
2020-03-04 06:09:59 +00:00
Automerger Merge Worker
faf27ff64c Merge "Move DnsSdTxtRecord to net common static library" am: 8d6a6e0d4b
Change-Id: I1101a06ab084e1ff61a785f78b1ae5ac50bfbcd8
2020-03-04 05:56:55 +00:00
Aaron Huang
e045a555af Move DnsSdTxtRecord to net common static library
DnsSdTxtRecord is moved to frameworks/libs/net for mainline
support. Also change the import path using this class.

Bug: 139268426
Bug: 135998869
Test: atest FrameworksNetTests
      ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh

Change-Id: I6118b313ce668707d598aa2eab9baee2f7622dbc
Merged-In: I6118b313ce668707d598aa2eab9baee2f7622dbc
2020-03-02 08:21:26 +00:00
Automerger Merge Worker
393687c8f8 Merge "Fix crash and duplicated ethernet tethering request" am: 41c82c99df am: b903184cdd
Change-Id: Ia6b75cce7a748177e99a4b53bb8036e3df3ac835
2020-02-28 03:03:59 +00:00
Automerger Merge Worker
b903184cdd Merge "Fix crash and duplicated ethernet tethering request" am: 41c82c99df
Change-Id: Idd4eca225909f88ef6d57fd8952ae497ec82115b
2020-02-28 02:49:58 +00:00
markchien
c8e7d759be 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: I7c5127e96d80d077735010d2e62c7227805ccb10
2020-02-27 14:50:16 +08:00
junyulai
f2b6d74356 [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: Idfebd0a1988c3dcfd812d87e30f6a2034d6fbf6b
2020-02-24 20:22:48 +08:00
junyulai
df2aef7c1d 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: I837545b54f36c8f21c878cbb1fd028ff23be6cb8
2020-02-24 20:22:38 +08: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