Commit Graph

1915 Commits

Author SHA1 Message Date
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
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
junyulai
e4437529ca [SP11] add dumpsys support to dump stats inside providers
Sample output is like below:
  Stats Providers:
    OffloadController Xt:
      NetworkStats: ...
    OffloadController Uid:
      NetworkStats: ...
    ImsPhoneCallTracker Xt:
      NetworkStats: ...

Test: adb shell dumpsys netstats (--uid)
Bug: 130855321

Change-Id: I968006de83e13e66bb3359135f0237daf7252bd2
2020-01-17 17:32:36 +08:00
Steven Moreland
79e97166a8 Merge "NetworkStatsFactory.cpp: IWYU" 2020-01-16 21:22:46 +00:00
Xin Li
3b49ef3445 DO NOT MERGE - Merge qt-qpr1-dev-plus-aosp-without-vendor (6129114) into stage-aosp-master
Bug: 146167222
Change-Id: Ifeb003ec9b3bf824f04d31a117aea65d517241fb
2020-01-15 16:15:41 -08:00
Steven Moreland
7b2c9ab255 NetworkStatsFactory.cpp: IWYU
Bug: 140330870
Test: N/A
Change-Id: Id6107c8a83b22ac56f4da61a5d5757d29ecb07ac
2020-01-14 09:25:32 -08:00
Maciej Żenczykowski
c728c5e185 Merge "minor change to keep it building"
am: f369b2f771

Change-Id: I63a9b21b59b1192065284f9e44071c368c12e641
2020-01-14 01:06:12 -08:00
Maciej Żenczykowski
f369b2f771 Merge "minor change to keep it building" 2020-01-14 09:03:11 +00:00
Junyu Lai
dfb59a3bd4 Merge changes from topic "sp04"
am: c621ac4b44

Change-Id: Ib2b96e64074a575c4d1a682e34bf6682c2fe4830
2020-01-13 06:12:54 -08:00
junyulai
a51ef24361 [SP04] add unit test for NetworkStatsProvider
am: a97b5c3bb3

Change-Id: Icd440ff9086604cb0baaa4cb3e8e458dcda3bb97
2020-01-13 06:12:48 -08:00
junyulai
573e809597 [SP03] support registerNetworkStatsProvider API
am: 258eb3b9e5

Change-Id: Id3a21676b6063048124c54035207a1c070df7a8c
2020-01-13 06:12:41 -08:00
junyulai
9ea8dae9fc [SP03.1] Replace com.android.internal.util.Preconditions.checkNotNull
am: 644ec019dd

Change-Id: I17550a2191ccd33a53a195df3cd178d93fbfe952
2020-01-13 06:12:31 -08:00
Junyu Lai
c621ac4b44 Merge changes from topic "sp04"
* changes:
  [SP05] add unit test for onStatsProviderLimitReached in NPMS
  [SP04] add unit test for NetworkStatsProvider
  [SP03] support registerNetworkStatsProvider API
  [SP03.1] Replace com.android.internal.util.Preconditions.checkNotNull
2020-01-13 14:09:52 +00:00
Artur Satayev
fcda85b772 Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv
Change-Id: I534e3fd1305e2f4af076986770033478448a665c
Merged-In: I534e3fd1305e2f4af076986770033478448a665c
2020-01-13 12:39:59 +00:00
junyulai
a97b5c3bb3 [SP04] add unit test for NetworkStatsProvider
Test: atest NetworkStatsServiceTest
Bug: 130855321
Change-Id: I0c19d8bedcb9398da3f464efe01e775fde9f8a78
2020-01-13 14:43:06 +08:00