Commit Graph

389 Commits

Author SHA1 Message Date
Hugo Benichi
b704e7aa75 Merge "NetworkNotificationManager: correctly handle existing notifications" into oc-dr1-dev
am: a03bf7acd1

Change-Id: I4ca3dcc293be5408a6f207e1ac1a7229a915723a
2017-07-28 04:39:14 +00:00
Hugo Benichi
3cff783a05 NetworkNotificationManager: correctly handle existing notifications
This patch corrects a regression added by commit fb2609d3ee that did
not take into account the case of multiple notifications shown for a
single network id. Given how network notifications are triggered, it can
happen that NO_INTERNET and SIGN_IN notifications are both triggered for
the same network when captive portal detection is slow.

Contrary to the situation before commit fb2609d3ee, a notification
priority order is introduced so that SIGN_IN always overrides
NO_INTERNET, and NO_INTERNET is ignored if SIGN_IN is already present.

Bug: 63676954
Bug: 62503737
Test: runtest frameworks-net, added new unit tests
Merged-In: Ib8658601e8d4dc6c41b335ab7dd8caa0cccd9531
Merged-In: I4432f66067ea1ab02e1d2dfe42530bcdafa52df6
Merged-In: I74631b0bfd14daf18a1641ed7f2ec323d636ebbf
Merged-In: I73cc879e910d503946facdba498b300337f349fd
Merged-In: Ieed9e3e7755e0c5f89dc41ef66f47d4dbf4c66a9
Merged-In: I0aa590170f1bd4c37175c7e35e54d52f1fb21347

(cherry picked from commit 5fcd050e0e)

Change-Id: I41675768ab59e9b23ca4275edf297b82595e5730
2017-07-28 09:17:20 +09:00
Hugo Benichi
c948cfab40 Merge "ConnectivityServiceTest: fix testNetworkInfoOfTypeNone" am: 24a2adfa27 am: f6883504c2 am: b1894abbc5
am: 443f3aa138

Change-Id: I7d3bfdf6d95d5db2d31439b5c3334569666864e1
2017-07-19 08:20:23 +00:00
Hugo Benichi
443f3aa138 Merge "ConnectivityServiceTest: fix testNetworkInfoOfTypeNone" am: 24a2adfa27 am: f6883504c2
am: b1894abbc5

Change-Id: I458a0fdae874039e0f1d5cd38ed8ad0a1754bba9
2017-07-19 08:15:12 +00:00
Hugo Benichi
b1894abbc5 Merge "ConnectivityServiceTest: fix testNetworkInfoOfTypeNone" am: 24a2adfa27
am: f6883504c2

Change-Id: I432f419d1c8f93136a76cbadfd32018294b3e3d7
2017-07-19 08:09:38 +00:00
Hugo Benichi
f6883504c2 Merge "ConnectivityServiceTest: fix testNetworkInfoOfTypeNone"
am: 24a2adfa27

Change-Id: I4be1d2ce67871c1e01364beca886fdd3af374321
2017-07-19 08:04:48 +00:00
Hugo Benichi
c1014509d8 ConnectivityServiceTest: fix testNetworkInfoOfTypeNone
This patch fixes a couple of flakyness issues with
testNetworkInfoOfTypeNone. It also fixes some typos and naming issues.

Bug: 62918393, 62918393
Test: runtest frameworks-net
Change-Id: I1c56557ab113d3ef57dbc06a6e882634d03c5b09
2017-07-19 15:08:49 +09:00
Lorenzo Colitti
6a5fe34edf resolve merge conflicts of a1d67fb38e to stage-aosp-master
am: 8228eb3446

Change-Id: Ic9ba31da8e5281c9dbc8fa7ff56a63956a495b72
2017-07-18 23:37:57 +00:00
Lorenzo Colitti
8228eb3446 resolve merge conflicts of a1d67fb38e to stage-aosp-master
Test: make -j64 services
Change-Id: I3955b01189993f3051c608bc5d07a87e4e3b5f0b
Merged-In: Ic1e799c17b4bb0272cf85e03d5ad14981a55defa
2017-07-19 07:35:31 +09:00
Charles He
fa9c0be357 Merge "Opt-out for always-on VPN" 2017-07-18 18:47:45 +00:00
Lorenzo Colitti
4ca0ba8f86 Fetch tethering offload stats.
Make tethering offload register an ITetheringStatsProvider and
fetch tethering stats from the hardware.

Currently we fetch stats in the following cases:

1. Just after changing upstreams, we fetch stats from the
   previous upstream.
2. When we are polled by NetworkStatsService.

(cherry-picked from commit 5a7dea1a8e)

Bug: 29337859
Bug: 32163131
Test: builds, boots
Test: stats appear in tethering logs
Change-Id: If744f2e06cb6a3095a40199936b9afb76eff7b56
Merged-In: If744f2e06cb6a3095a40199936b9afb76eff7b56
2017-07-19 00:55:37 +09:00
Hugo Benichi
822c5bf778 IP connectivity metrics: fix tests after proto update
Update to ipconnectivity.proto in commit
6d2f506bfd broke the associated unit
tests (Change-Id: I4cf5b95956df721aecd63fddfb026a7266c190b9)

Bug: 34901696
Test: runtest frameworks-net
Change-Id: I57a6bad8a9836b1c45690c4589b416786ce1dfa0
2017-07-18 14:33:12 +09:00
Charles He
3673863f3b Opt-out for always-on VPN
Always-on VPN is a feature introduced in N. Since then, all VPN apps
targeting N+ are assumed to support the feature, and the user or the DPC
can turn on / off always-on for any such VPN app. However, a few VPN
apps are not designed to support the always-on feature. Enabling
always-on for these apps will result in undefined behavior and confusing
"Always-on VPN disconnected" notification.

This feature provides a new manifest meta-data field through which a VPN
app can opt out of the always-on feature explicitly. This will stop the
always-on feature from being enabled for the app, both by the user and
by the DPC, and will clear its existing always-on state.

A @hide API is provided to check whether an app supports always-on VPN.
Documentation is updated to reflect the behavior change.

Bug: 36650087
Test: runtest --path java/com/android/server/connectivity/VpnTest.java
Test: cts-tradefed run cts --module CtsDevicePolicyManagerTestCases --test 'com.android.cts.devicepolicy.MixedDeviceOwnerTest#testAlwaysOnVpnUnsupportedPackage'
Test: cts-tradefed run cts --module CtsDevicePolicyManagerTestCases --test 'com.android.cts.devicepolicy.MixedDeviceOwnerTest#testAlwaysOnVpnUnsupportedPackageReplaced'
Test: cts-tradefed run cts --module CtsDevicePolicyManagerTestCases --test 'com.android.cts.devicepolicy.MixedProfileOwnerTest#testAlwaysOnVpnUnsupportedPackage'
Test: cts-tradefed run cts --module CtsDevicePolicyManagerTestCases --test 'com.android.cts.devicepolicy.MixedProfileOwnerTest#testAlwaysOnVpnUnsupportedPackageReplaced'
Test: cts-tradefed run cts --module CtsDevicePolicyManagerTestCases --test 'com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testAlwaysOnVpnUnsupportedPackage'
Test: cts-tradefed run cts --module CtsDevicePolicyManagerTestCases --test 'com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testAlwaysOnVpnUnsupportedPackageReplaced'

Change-Id: I477897a29175e3994d4ecf8ec546e26043c90f13
2017-07-18 00:55:38 +01:00
Lorenzo Colitti
041111ff7e Merge changes Icc5aa605,If744f2e0,Ie1b5a5e4 into oc-dr1-dev
am: 3756636ad6

Change-Id: Ic1e799c17b4bb0272cf85e03d5ad14981a55defa
2017-07-14 01:01:29 +00:00
Lorenzo Colitti
5a7dea1a8e Fetch tethering offload stats.
Make tethering offload register an ITetheringStatsProvider and
fetch tethering stats from the hardware.

Currently we fetch stats in the following cases:

1. Just after changing upstreams, we fetch stats from the
   previous upstream.
2. When we are polled by NetworkStatsService.

Bug: 29337859
Bug: 32163131
Test: builds, boots
Test: stats appear in tethering logs
Change-Id: If744f2e06cb6a3095a40199936b9afb76eff7b56
2017-07-13 23:54:51 +09:00
Erik Kline
17a62281e4 Merge "Program offload-exempt local prefixes into the HAL" am: de837a97aa
am: ae21b89414

Change-Id: If96a33f26fed64a84219868d28765b7581ad453d
2017-07-13 09:07:01 +00:00
Erik Kline
ae21b89414 Merge "Program offload-exempt local prefixes into the HAL"
am: de837a97aa

Change-Id: I741b6e31fb3adc922f47df824188786ff35e3aa9
2017-07-13 09:00:56 +00:00
Erik Kline
5acb4e3b62 Program offload-exempt local prefixes into the HAL
Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passes
    - observed calls to the HAL setLocalPrefixes in tethering log
Bug: 29337859
Bug: 32163131
Merged-In: I3c3bd4ee83ffe86ddbe6a16fbbfa0756bf5064d4
Merged-In: Iaf80e584df458010741401fc1a19e7f6e21923c1
Merged-In: Ifaf23c6179ead9de6ccfcf41e0c203025153167b
(cherry picked from commit 32179ff815)

Change-Id: I65ea833ac6fe7a75ebe546cfa358c4cffdf2de05
2017-07-13 16:43:34 +09:00
Erik Kline
b3d2aaaf2f Merge "Program offload-exempt local prefixes into the HAL" into oc-dr1-dev
am: aa7b8b5322

Change-Id: Iaf80e584df458010741401fc1a19e7f6e21923c1
2017-07-13 07:36:50 +00:00
Erik Kline
32179ff815 Program offload-exempt local prefixes into the HAL
Additionally:
    - move mOffloadController into MasterTetherSM

Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passes
    - observed calls to the HAL setLocalPrefixes in tethering log
Bug: 29337859
Bug: 32163131
Change-Id: Ifaf23c6179ead9de6ccfcf41e0c203025153167b
2017-07-13 13:45:49 +09:00
Erik Kline
d21ad47d43 Merge "Restructure use of absent tether_offload_disabled setting" am: 5bb30496cf
am: c8b4ef85dc

Change-Id: I2210e9d25a4e7c497b9383324e574c9f8aca0d6f
2017-07-12 06:25:04 +00:00
Erik Kline
c8b4ef85dc Merge "Restructure use of absent tether_offload_disabled setting"
am: 5bb30496cf

Change-Id: I9d1ec7d1c060278018c80c9374d724ee0ddba3a4
2017-07-12 06:18:11 +00:00
Erik Kline
5eaa7ed03b Restructure use of absent tether_offload_disabled setting
This restructures the fetching of the default disposition such
that we disable (and enable) the feature with only a single
character change.

Additionally: fix unittests with proper use of FakeSettingsProvider.

Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passed with developer enabled and disabled
Bug: 29337859
Bug: 32163131
Bug: 63250751
(cherry picked from commit c87cd41184)
Merged-In: Ib32489d07778465134bca52c589baddbd78ab129
Merged-In: I03d68b0da192fbd6172639343d4ab88c20127ad7
Merged-In: I10c0af2b2c4f6b6e613380e637cc3acb1f7a55a3

Change-Id: Ie16a022be8dacd76b0402bcb777680c36163a084
2017-07-12 13:29:22 +09:00
Erik Kline
9d9b5c22f1 Merge "Restructure use of absent tether_offload_disabled setting" into oc-dr1-dev
am: d8fdb26ebf

Change-Id: I03d68b0da192fbd6172639343d4ab88c20127ad7
2017-07-12 03:11:15 +00:00
Erik Kline
c87cd41184 Restructure use of absent tether_offload_disabled setting
This restructures the fetching of the default disposition such
that we disable (and enable) the feature with only a single
character change.

Additionally: fix unittests with proper use of FakeSettingsProvider.

Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passed with developer enabled and disabled
Bug: 29337859
Bug: 32163131
Bug: 63250751

Change-Id: Ib32489d07778465134bca52c589baddbd78ab129
2017-07-11 23:46:58 +09:00
Hugo Benichi
f060ecf1e8 Merge "ConnectivityManager: allow usage of TYPE_NONE" am: 279f32ded5 am: 0537f16516
am: 0278aa4b70

Change-Id: I1707e39308b0cf425b75e1e3f85323743c252c2f
2017-07-05 14:47:56 +00:00
Hugo Benichi
0278aa4b70 Merge "ConnectivityManager: allow usage of TYPE_NONE" am: 279f32ded5
am: 0537f16516

Change-Id: If6430976a3a894b9f883e03692e500eb013a5245
2017-07-05 14:40:34 +00:00
Hugo Benichi
0537f16516 Merge "ConnectivityManager: allow usage of TYPE_NONE"
am: 279f32ded5

Change-Id: I72dbd17db63bd7b8637e82f5cdcfec3bf1482962
2017-07-05 14:33:35 +00:00
Hugo Benichi
89c67d3211 Merge "ConnectivityServiceTest: more informative assert failures" am: 04d8a730a9 am: 0a7f5cc9d6
am: 14f400ca81

Change-Id: If00f0fd750d54074c0c642465384446502c1deec
2017-07-05 14:33:34 +00:00
Hugo Benichi
14f400ca81 Merge "ConnectivityServiceTest: more informative assert failures" am: 04d8a730a9
am: 0a7f5cc9d6

Change-Id: If152d2eb134f678673b76b181146874bf65fc536
2017-07-05 14:26:23 +00:00
Hugo Benichi
0a7f5cc9d6 Merge "ConnectivityServiceTest: more informative assert failures"
am: 04d8a730a9

Change-Id: Iaa55014ae4c2f4927059735c349c40ada836b79b
2017-07-05 14:19:33 +00:00
Hugo Benichi
7ee7b4c6d4 Merge "ConnectivityServiceTest: eliminate remaining sleep()" am: 66788dc4d8 am: 2d452e6c48
am: 80bc56bf2a

Change-Id: I5e33e909cd8887460c2641c069432ec6bfa5beda
2017-07-05 12:49:04 +00:00
Hugo Benichi
80bc56bf2a Merge "ConnectivityServiceTest: eliminate remaining sleep()" am: 66788dc4d8
am: 2d452e6c48

Change-Id: I6426659d9cf84f7e1d142b006ffe69df304f7a91
2017-07-05 12:41:53 +00:00
Hugo Benichi
2d452e6c48 Merge "ConnectivityServiceTest: eliminate remaining sleep()"
am: 66788dc4d8

Change-Id: Ib1e31c2b8999d07b20ef4cef8e70d851f93df6e5
2017-07-05 12:35:01 +00:00
Hugo Benichi
16f0a9436a ConnectivityManager: allow usage of TYPE_NONE
This patch allows to use TYPE_NONE for the legacy network type variable
of NetworkInfo. This usage is "safe" with respect to legacy APIs using
network types as most of them already returns null or do nothing for
TYPE_NONE.

Of the existing APIs in ConnectivityManager that accept a network type
argument, those which were already returning null or doing nothing for
TYPE_NONE are:
  getNetworkInfo(int)
  getNetworkForType(int)
  stopUsingNetworkFeature(int, String)
  networkCapabilitiesForType(int)
  requestRouteToHostAddress(int, InetAddress)
  reportInetCondition(int, int)
  isNetworkSupported(int)
  getLinkProperties(int)

Only setProvisioningNotificationVisible needs an additional guard
against TYPE_NONE.

Bug: 30088447
Bug: 62844794
Test: runtest frameworks-net
Change-Id: I112596fcd03d3c2cd42a2a84d265adb38e3944bb
2017-07-05 21:30:52 +09:00
Hugo Benichi
fed512a795 ConnectivityServiceTest: more informative assert failures
Bug: 62918393
Test: runtest frameworks-net
Change-Id: If87315ef7cba6380596f48b92c7e0f6eeccc8368
2017-07-05 21:30:10 +09:00
Erik Kline
53e5c05d83 DO NOT MERGE ANYWHERE
This reverts a duplicate test method resulting from a bad merge.

Test: as follows
    - built

Change-Id: I8ca7c97a28fbf7d20753bb4d1f942e5c04a4edf8
2017-07-05 19:55:45 +09:00
Erik Kline
c99ff3a1e7 resolve merge conflicts of b1eb85c9a8 to stage-aosp-master
am: dbc7279e85

Change-Id: I0280190a1d2d48ca2e80e823ed43112161af8271
2017-07-05 09:17:46 +00:00
Erik Kline
dbc7279e85 resolve merge conflicts of b1eb85c9a8 to stage-aosp-master
Test: I solemnly swear I tested this conflict resolution.

Merged-In: I3ae731c21f292a476a9e30e229d66ef6ab4a0545
Merged-In: I717fdd269b012f32548ebe0603999ae403b03100
Merged-Id: Ia8f7f3616f1358b0427386ce8aff26899e03ac07
Merged-In: Ie32f50ec1a07e3126a05abee27c76bc63cdaca14
Change-Id: I217d7ca2958f3d6ca8992f738a034693a0fac486
2017-07-05 16:48:19 +09:00
Hugo Benichi
91c7ff95bd ConnectivityServiceTest: eliminate remaining sleep()
ConnectivityServiceTest was still using sleep() in a few places although
these were unnecessary:
  - in testSatisfiedThenLostNetworkRequestDoesNotTriggerOnAvailable(),
    expectNoCallback() and expectAvailableCallback() already include
    waitForIdleHandler calls that drain the message queues and make
    sleep no-ops.
  - in testTimedoutAfterUnregisterdNetworkRequest, the sleeps were
    introduced before unregisterNetworkCallback was changed to have a
    synchronous effect for callback unregistration, therefore the sleep
    becomes simply non-sensical. To reflect this the name of the method
    is also changed.

Bug: 62918393
Test: runtest frameworks-net
Change-Id: I7b701ecf5846a5e1890e86107b8d2544b419ce44
2017-07-05 16:07:57 +09:00
Erik Kline
2dce7712f3 Switch to USB_CONFIGURED as the primary USB readiness signal
Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passes
    - USB tethering on and off works as expected
Bug: 32163131
Bug: 36216864
Bug: 62147658
Bug: 62552150

Merged-In: I3ae731c21f292a476a9e30e229d66ef6ab4a0545
Merged-In: I717fdd269b012f32548ebe0603999ae403b03100
Merged-Id: Ia8f7f3616f1358b0427386ce8aff26899e03ac07
Change-Id: Ia8f7f3616f1358b0427386ce8aff26899e03ac07
(cherry picked from commit c438e306cc)
2017-07-05 12:40:40 +09:00
Erik Kline
61be696468 Switch to USB_CONFIGURED as the primary USB readiness signal
Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passes
    - USB tethering on and off works as expected
Bug: 32163131
Bug: 36216864
Bug: 62147658
Bug: 62552150

Merged-In: I3ae731c21f292a476a9e30e229d66ef6ab4a0545
Merged-In: I717fdd269b012f32548ebe0603999ae403b03100
Change-Id: Ia8f7f3616f1358b0427386ce8aff26899e03ac07
(cherry picked from commit c438e306cc)
2017-07-05 12:32:41 +09:00
Erik Kline
c651117d70 Switch to USB_CONFIGURED as the primary USB readiness signal
am: c438e306cc

Change-Id: I717fdd269b012f32548ebe0603999ae403b03100
2017-07-05 03:07:21 +00:00
Erik Kline
c438e306cc Switch to USB_CONFIGURED as the primary USB readiness signal
Test: as follows
    - built
    - flashed
    - booted
    - "runtest frameworks-net" passes
    - USB tethering on and off works as expected
Bug: 32163131
Bug: 36216864
Bug: 62147658
Bug: 62552150
Change-Id: Ia8f7f3616f1358b0427386ce8aff26899e03ac07
2017-07-05 00:36:04 +09:00
Roland Levillain
d3f26b6731 Merge "Revert "ConnectivityManager: allow usage of TYPE_NONE""
am: 10c314e19a

Change-Id: I49221522c1a9a6e7d4ae72529c1a47b736e26a39
2017-07-04 11:31:30 +00:00
Roland Levillain
8f68232271 Merge "Revert "ConnectivityServiceTest: more informative assert failures""
am: d10790c902

Change-Id: Ie61051984a1b6efbb0b19754ce0fb99024ab296a
2017-07-04 11:24:25 +00:00
Roland Levillain
962f1842ca Merge "Revert "ConnectivityServiceTest: eliminate remaining sleep()""
am: 1e3624527b

Change-Id: If210f213c7840c218d5e847667c7613d53f86661
2017-07-04 11:22:32 +00:00
Roland Levillain
afd69a0d57 Revert "ConnectivityManager: allow usage of TYPE_NONE"
This CL is breaking some internal builds.

This reverts commit 726931ebf4.

Change-Id: Ie79214808d84c73f54a525f515b4c90a3fb23542
2017-07-04 11:14:03 +00:00
Roland Levillain
3c16b64246 Revert "ConnectivityServiceTest: more informative assert failures"
CL https://android-review.googlesource.com/#/c/420720/ is
breaking several internal builds, and CL
https://android-review.googlesource.com/#/c/422480/ must
be reverted beforehand.

This reverts commit a6981669c4.

Change-Id: I5883409452d39e1834e183aa7b5ccdbf14291ca5
2017-07-04 11:11:35 +00:00
Roland Levillain
1e3624527b Merge "Revert "ConnectivityServiceTest: eliminate remaining sleep()"" 2017-07-04 11:11:09 +00:00