Commit Graph

1928 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
48433d6735 Merge "[SP17] Wait for stats providers to report stats update" am: 1e47a3e71d
Change-Id: I5e6a69fb50c9820f8b0a7e834608a32f651a860a
2020-02-15 01:38:09 +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
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
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
Automerger Merge Worker
9ec52c9fe8 Merge "[SP10] Add IntDef annotations for system api of NetworkStats" am: 9d8a9cbfcc
Change-Id: I4d352ed54671ce77ebbcaa9f0808a0ef703d3c6f
2020-02-12 04:54:02 +00:00
Treehugger Robot
9d8a9cbfcc Merge "[SP10] Add IntDef annotations for system api of NetworkStats" 2020-02-12 04:37:55 +00:00
Automerger Merge Worker
e49c7caae3 Merge "[SP11] add dumpsys support to dump stats inside providers" am: 2b4a6517bf
Change-Id: I44f69d27b89c6d0463a5b12b98e0cc3cf8297a33
2020-02-12 02:59:21 +00:00
Treehugger Robot
2b4a6517bf Merge "[SP11] add dumpsys support to dump stats inside providers" 2020-02-12 02:45:38 +00:00
junyulai
8016a35c78 [SP10] Add IntDef annotations for system api of NetworkStats
Test: m -j
Bug: 130855321
Change-Id: I8855ec95d5d086fc14e2eb71558bc2dcd9a830e5
2020-02-11 09:47:03 +00:00
Automerger Merge Worker
8abb5a0520 Merge changes Iaa6f0d65,I68a16b64 am: e486951a92
Change-Id: I687e59f2c25d5c5e2cb5b1574dbcf6f32ec8c817
2020-01-31 16:37:49 +00:00
David Su
e486951a92 Merge changes Iaa6f0d65,I68a16b64
* changes:
  Networking: Rename removeDoubleQuotes to sanitizeSsid
  Wifi: Rename removeDoubleQuotes to sanitizeSsid
2020-01-30 22:42:16 +00:00
Lorenzo Colitti
4036bb43a0 Merge changes I34842acd,Icc6c4d6b
am: 5312d0be3e

Change-Id: I38f5452905216ebf9e0b28311d34ad0667243274
2020-01-28 02:53:38 -08:00
Lorenzo Colitti
5312d0be3e Merge changes I34842acd,Icc6c4d6b
* changes:
  Add support for Ethernet tethering
  Local Tethering with ncm interface
2020-01-28 10:43:33 +00:00
Remi NGUYEN VAN
199d685186 Add support for Ethernet tethering
Ethernet tethering can be started via
startTethering(TETHERING_ETHERNET).

Test: flashed, enabled ethernet tethering, verified internet access on
      downstream.
Bug: 130840861

Merged-In: I34842acd94b972e440c3622f7617df10c18acf65
Change-Id: I34842acd94b972e440c3622f7617df10c18acf65
(cherry-pick with conflicts in test-current.txt)
2020-01-28 17:52:06 +09:00
Remi NGUYEN VAN
88bc15c4bc Merge "Support putting one Ethernet interface in server mode."
am: e7e38501e8

Change-Id: Ib1c26821880daa118b1911d4f98ebbd970c3c1b4
2020-01-28 00:37:20 -08:00
Lorenzo Colitti
19b8b88d18 Support putting one Ethernet interface in server mode.
requestTetheredInterface can be used to put an interface in server mode,
which will persist until release() is called on the returned request, or
until the requesting process dies.

Test: Enabled ethernet tethering with change on top
Bug: 130840861
Merged-In: Id96d581acb3fa4e52ca62dd94ec257f56bd3a1ce
Change-Id: Id96d581acb3fa4e52ca62dd94ec257f56bd3a1ce
(clean cherry-pick from internal branch)
2020-01-28 16:25:43 +09:00
Maciej Żenczykowski
2b92fa5323 Fix incorrect interpolation of active bucket for partial requests.
Just because the bucket is active (ie. overlaps with 'now') doesn't
mean the request necessarily covers the entire bucket.

For example a bucketDuration=5 with a bucket from curStart=1 to
curEnd=6 with now=4 and requests:
- from start=0 to end=3 --> overlap=[1,3] --> bucketSpan=2
- from start=2 to end=3 --> overlap=[2,3] --> bucketSpan=1
- from start=2 to end=5 --> overlap=[2,4] --> bucketSpan=2
- from start=2 to end=7 --> overlap=[2,4] --> bucketSpan=2
and the previously correctly handled cases:
- from start=0 to end=5 --> overlap=[1,4] --> bucketSpan=3
- from start=0 to end=7 --> overlap=[1,4] --> bucketSpan=3

We fix this by bounding the end of buckets to now, this means
that bucketDuration is no longer a constant, but it simplifies
all the rest of the logic.

Test: builds, atest
Bug: 143338233
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I642b57f7b8486071ad7808fd9b901859923b6d25
2020-01-27 18:39:15 -08:00
David Su
7ae4c7b600 Networking: Rename removeDoubleQuotes to sanitizeSsid
Bug: 145745815
Test: compiles
Change-Id: Iaa6f0d65cab556c24b0a9010427de8e6a02836c1
Merged-In: Iaa6f0d65cab556c24b0a9010427de8e6a02836c1
(clean cherry-pick from internal branch)
2020-01-27 13:51:56 -08:00
Steven Moreland
1e13dec72f Merge "NetworkStatsFactory.cpp: IWYU"
am: 79e97166a8

Change-Id: Ic76deb1a3f7b63237f93d1abea2a56ea14dc3465
2020-01-17 11:53:48 -08:00