3509 Commits

Author SHA1 Message Date
Lorenzo Colitti
5bad599e2e Merge "ConnectivityServiceTest: fix flaky tests" am: b8bbd30203 am: 8fea8e5bbd
am: c620e64f61

Change-Id: Iaa1ab50a323133cadfa4f39440fce982cde8d1fe
2017-01-27 10:00:06 +00:00
Lorenzo Colitti
c620e64f61 Merge "ConnectivityServiceTest: fix flaky tests" am: b8bbd30203
am: 8fea8e5bbd

Change-Id: I66f2c2174c2895224724245c1b3d815da1678955
2017-01-27 09:55:39 +00:00
Lorenzo Colitti
420ad9748a Merge "ConnectivityServiceTest: remove flaky waitForIdle test." am: be80577f5b am: 0c659d2065
am: f8cff961c8

Change-Id: I1d3707b4bc2ae00ca0fad1c3ec7e6ca859fcdd16
2017-01-27 09:55:36 +00:00
Lorenzo Colitti
f8cff961c8 Merge "ConnectivityServiceTest: remove flaky waitForIdle test." am: be80577f5b
am: 0c659d2065

Change-Id: I7fbf2cb2c9778f5c961335c5b9fd5a138ec140db
2017-01-27 09:51:39 +00:00
Lorenzo Colitti
8fea8e5bbd Merge "ConnectivityServiceTest: fix flaky tests"
am: b8bbd30203

Change-Id: I0577f6b48de8a95e7d12e58a672fb0374ced9403
2017-01-27 09:51:32 +00:00
Lorenzo Colitti
0c659d2065 Merge "ConnectivityServiceTest: remove flaky waitForIdle test."
am: be80577f5b

Change-Id: I444746af6adc7be4a3f69243379f65aadf29ea19
2017-01-27 09:47:05 +00:00
Lorenzo Colitti
b8bbd30203 Merge "ConnectivityServiceTest: fix flaky tests" 2017-01-27 09:40:47 +00:00
The Android Automerger
6a688ca1ad Merge commit '88932754ffdcbffb3cb43e03991e5eb598c10458' into nyc-mr1-dev-plus-aosp
* commit '88932754ffdcbffb3cb43e03991e5eb598c10458':
  Captive portals: login activity probes like NetworkMonitor
  Logging improvements in CaptivePortalLoginActivity
  Captive portal systel log improvements
  Fix flaky IpPrefixTest.
  Removing bogus file added by mistake
  frameworks-test: adding missing @SmallTest
  Netd events: record connect() success/errno
  Add missing dependency.
  Show notification for always-on app VPN
2017-01-27 06:39:52 +00:00
The Android Automerger
53095bb5bd Merge commit 'a19056c35d16ddb5a6c1d3343729701b8939f1e1' into nyc-mr1-dev-plus-aosp
* commit 'a19056c35d16ddb5a6c1d3343729701b8939f1e1': (35 commits)
  NetworkMonitor: send one DNS probe per web probe
  NetworkMonitor metrics: add first validation information
  APF: also drop any ICMPv6 RSs
  ConnectivityServiceTest: fix testAvoidBadWifiSettings
  Fix ConnectivityServiceTest testRequestBenchmark
  Switch over to new "time.android.com" NTP pool.
  Define API for metering network stats buckets.
  Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock.
  Use @Ignore to explicitly disable a @Test method.
  Fixed NetworkStatsServiceTest and converted it to JUnit4.
  VPN network stat accounting changes.
  ConnectivityThread: use lazy holder idiom
  ConnectivityManager: use ConnectivityThread looper
  ConnectivityManager: a simpler CallbackHandler
  Indicate the NsdServiceInfo attributes are only filled in for a resolved service.
  Add a null check for the OnStartTetheringCallback.
  TokenBucket for rate-limiting and throttling
  IpConnectivityMetrics reads buffer size in settings
  CaptivePortalLogin: set mixed content policy to compatibility.
  Add IP conn metrics to dumpsys and bug reports
  ...
2017-01-27 06:39:05 +00:00
Hugo Benichi
352147a308 frameworks-test: adding missing @SmallTest
This activates all frameworks-test tests in runs of the continuous
platform tests.

Test: $ runtest frameworks-net passes (expect Tether
Bug: 32561414
(cherry picked from commit fa8a6f6220d1a0027ba7969c2d3f72690ddc6495)

Change-Id: I7b0706a7e3368f971d508388e8ad4afc5de9d646
2017-01-26 18:52:45 +09:00
Hugo Benichi
222ebe48ba Netd events: record connect() success/errno
Test: $ runtest frameworks-net pass
Bug: 32198976

(cherry picked from commit 8b06bcdfd24100302818ae0e11ee751dd813d5cf)

Change-Id: Ib3be06d2678c3fcfe4fa9d7b77f50c6e8812db3d
2017-01-26 18:52:41 +09:00
Tony Mak
094fbe6719 Show notification for always-on app VPN
This is the same notification as the one shown during legacy lockdown
mode, sans the 'reset' button.

The notification is only shown during times when VPN has not yet
established or has failed, for example during boot or after a crash.

Bug: 29123115

(cherry picked from commit 1a405fe300950d6ceae2166fd074b596d8110dbe)

Change-Id: I929a05c24df01e21415535a333bb14ac4b790a9d
2017-01-26 18:52:35 +09:00
Hugo Benichi
5c2111bc3a APF: also drop any ICMPv6 RSs
Test: new unit test + $ runtest franeworks-net
Bug: 32833400

(cherry picked from commit f98182ef5e80ede5de7f2c2a5f40fc92a46c9704)

Change-Id: Ifaf6e778c811c7d865c790a293b1fce3f43cad1c
2017-01-26 18:52:21 +09:00
Hugo Benichi
d49596f479 ConnectivityServiceTest: fix testAvoidBadWifiSettings
This patch introduces an assertEventuallyThat helper function in
ConnectivityServiceTest which given a boolean function retries until the
function returns true or until a maximum retry time is reached.

This function is used to fix flakyness of testAvoidBadWifiSetting where
the Message posted by reevaluate() could reach the Handler's
MessageQueue after waitForIdle takes effect, resulting in the test to
fail.

Instead of fixing the flakyness by introdcing hard sleep times,
assertEventuallyThat is used to reduce the overall test time.

With this change the test has been observed to pass with 100% success
rate over 50000 invocations.

Test: $ runtest frameworks-net
Bug: 32561414

(cherry picked from commit 99c8294ef0c7a720364abb5884063e0a9d1bb5fe)

Change-Id: If41a24989d5f65aeb439f68741f511b5eb53b18d
2017-01-26 18:52:18 +09:00
Hugo Benichi
b038044758 Fix ConnectivityServiceTest testRequestBenchmark
This patch fixes flakyness of testRequestBenchmark by adjusting time
limit for callback registration from 100ms to 180ms, and time limits for
onAvailable and onLost triggers from 30ms to 40ms.

With these timeouts the test succeeds 100% over 5000 iterations.

When using 150ms for registration timeout, running the test 5000 times
fails 2 times.

When using 30ms for onLost timeout, running the test 5000 times fails
1 times.

In addition, this patch also cleans testRequestBenchmark and uses the
more stable SystemClock.elapsedRealtime() for duration measurements.

Test: $ runtest frameworks-net
Bug: 32561414

(cherry picked from commit 38be57b438a0c1754091f045317db2049304e16f)

Change-Id: I196ab9ef7f5abe456a783eed65db09279d2ecb8c
2017-01-26 18:52:14 +09:00
Hugo Benichi
728842ad47 IpConnectivityMetrics reads buffer size in settings
Test: IpConnectivityMetricsTest passes. Also manually changed the new
setting and verified the buffer size is as expected after flushing the
buffer.
Bug: 32198637

(cherry picked from commit 05686dbb6b965eb1a54591d2ed2334337886c6ee)

Change-Id: Iefbeac3a688b260fb3f92dfe0bfd9db28e26749d
2017-01-26 18:51:30 +09:00
Hugo Benichi
d19752c3d0 IpConnectivity metrics: add version number
This patch adds a version field to ipconnectivity.proto and populates it
to 2, which is the logical version number for NYC-MR2.

Test: IpConnectivity{EventBuilder,Metrics}Test pass
Bug: 32127906

(cherry picked from commit d680d4c856f54bea0c60dea74ba4204822391e49)

Change-Id: If8f167c0dc4c1abe0e235e2adfd131168a4ddc52
2017-01-26 18:51:18 +09:00
Etan Cohen
1256590348 [CS] Remove timeout event after first available
Guarantees that timeouts are only delivered if a network never
becomes available. Once a network is available the timeout is
canceled.

Bug: 31402633
Test: all timeout related unit tests pass (new one added)

(cherry picked from commit 681fcda5896fd6c94f8a543ef9983c0a0644e87e)

Change-Id: I7cd3086544c881915fc6dbf14b87a24ab0cd8748
2017-01-26 18:51:15 +09:00
Hugo Benichi
f488ffd3be ApfTest: tag tests with @SmallTest or @MediumTest
Test methods not tagged with @{Small,Medium,Large}Test will not appear
in the Android Platform Continuous Testing dashboard.

Test methods tagged with @LargeTest will not be run in the Android
Platform Continuous Testing dashboard.

Test: ApfTest passes ($runtest frameworks-net)
Bug: 31479480

(cherry picked from commit 4195c28347cc100954f83c3c92b4dde4673f8608)

Change-Id: Ia215fc8e2ccc61f6223c24fdf390e1e759de302f
2017-01-26 18:51:12 +09:00
Lorenzo Colitti
f537c5eb74 Unbreak TetherInterfaceStateMachineTest.
This was broken by the implementation of IPv6 tethering, which
relies on various private classes which end up calling unmockable
final classes like NetworkInterface.

Making everything public like this is almost certainly not the
best way of fixing this test, but on the other hand there is
value to the test continuing to pass.

Test: runtest frameworks-net  # Everything passes.
Test: IPv6 tethering continues to work.

(cherry picked from commit 7e0eeca8ba4063d0d35dda9a8dfcc612e45efb87)

Change-Id: I8a3cf466871c026f4ae0f5cfa73071338cdf5b7e
2017-01-26 18:51:09 +09:00
Lorenzo Colitti
47a44ba2b1 Move the connectivity tests to frameworks/base/tests/net.
This will give us a good place to put all the networking tests.

Fix: 31479480
Test: adb  shell am instrument -w -e notClass com.android.server.connectivity.tethering.TetherInterfaceStateMachineTest 'com.android.frameworks.tests.net/android.support.test.runner.AndroidJUnitRunner'  # PASS

(cherry picked from commit ecc986d430f4b8158f177ed97d2edb741f11ff71)

Change-Id: I993eeaa5dec001c39389023f355f506129b356e7
2017-01-26 18:50:59 +09:00
Lorenzo Colitti
adaa652337 De-guava BroadcastInterceptingContext and move it to testutils.
Removing the static dependency on guava reduces test compile time
by about 20 seconds on a Z840, thus substantially speeding up the
compile/test cycle.

Make FutureIntent public instead of package-private because it is
used directly by NetworkPolicyManagementServiceTest, which as of
this CL is now in a different package.

(cherry picked from commit 281a17c9580de5c9898be7d9654d428801976511)

Test: runtest frameworks-services -c com.android.server.ConnectivityServiceTest  # PASS
Test: runtest frameworks-services -c com.android.server.NetworkPolicyManagerServiceTest  # PASS
Test: runtest frameworks-services -c com.android.server.net.NetworkStatsServiceTest  # PASS
Test: runtest frameworks-services -c com.android.server.NetworkManagementServiceTest  # Already failing.
Bug: 31479480
Change-Id: Ifab32c9214e9caab71dbf93b3d3ca88df6f49636
2017-01-26 18:50:52 +09:00
Lorenzo Colitti
c869089383 Move FakeSettingsProvider to a common location.
(cherry picked from commit 7df1a82802cdf842d07a86a80383c7d5ea7ae53a)

Test: runtest frameworks-util -c com.android.internal.util.test.FakeSettingsProviderTest
Test: runtest frameworks-services -c com.android.server.ConnectivityServiceTest
Test: runtest frameworks-services -c com.android.server.retaildemo.PreloadAppsInstallerTest
Test: runtest frameworks-services -c com.android.server.retaildemo.RetailDemoModeServiceTest
Bug: 31479480
Change-Id: I8d4d4de2937012dd33924f53e68f96241a9b2b4f
2017-01-26 18:50:48 +09:00
Hugo Benichi
141923e5b6 DO NOT MERGE frameworks-test: adding missing @SmallTest
This activates all frameworks-test tests in runs of the continuous
platform tests.

Test: $ runtest frameworks-net passes (expect Tether
Bug: 32561414

(cherry picked from commit fa8a6f6220d1a0027ba7969c2d3f72690ddc6495)

Change-Id: I84f9aecfbf9ebe07c6fcfec26acb2c2cfaae2d60
2017-01-24 15:42:45 +09:00
Hugo Benichi
ad4db4ed58 ConnectivityServiceTest: remove flaky waitForIdle test.
This patch removes testNotWaitingForIdleCausesRaceConditions() from
ConnectivityServiceTest because it is in nature flaky and prevents using
ConnectivityServiceTest as a patch presubmit check. Estimated failure
rate is 1/15 on Nexus 6p.

This patch also simplifies how ConnectivityServiceTest waits for
handlers to become idle by removing IdleableHandlerThread and turning it
into a signle static method.

Test: $ runtest frameworks-net
Bug: 31479480
Change-Id: I2d78709cbb61d5d01cd59cff326469417f73f1ab
2017-01-24 15:22:48 +09:00
Hugo Benichi
dfb559a363 ConnectivityServiceTest: fix flaky tests
This patch adjusts timeouts in ConnectivityServiceTest to fix tests
known to fail spruriously.

Test: ran the following tests 500 times without observing any failure
 - testBackgroundNetworks()
 - testMultipleLingering()
 - testPacketKeepalives()
 - testSatisfiedNetworkRequestDoesNotTriggerOnUnavailable()
 - testSatisfiedThenLostNetworkRequestDoesNotTriggerOnUnavailable()
Bug: 32561414
Change-Id: I184fe7189aac768a65b927cc42eefaf8b1b3f930
2017-01-24 15:21:18 +09:00
Erik Kline
552f5620d1 Merge "Add test for updateMobileRequiresDun()" am: 7f018500dc am: 2a3338084a
am: 503374c0ae

Change-Id: I25751833ed6623ab156156fc76aa23b158a60fb4
2017-01-23 11:06:06 +00:00
Erik Kline
503374c0ae Merge "Add test for updateMobileRequiresDun()" am: 7f018500dc
am: 2a3338084a

Change-Id: I3fe2605bba2a8c8ee3284f3c3278258d37fae46b
2017-01-23 10:59:41 +00:00
Erik Kline
2a3338084a Merge "Add test for updateMobileRequiresDun()"
am: 7f018500dc

Change-Id: Ic7b984105e2c245a992446e15d11dd19e4671a57
2017-01-23 10:53:11 +00:00
Erik Kline
973c7df054 Add test for updateMobileRequiresDun()
This test validates that when a mobile upstream has been requested
changing the "DUN required" state results in updating the requested
network appropriately.

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-test passes
Bug: 32163131

Change-Id: Ia3a1f6493ea348eb75e334344468a980206f618f
2017-01-23 17:47:22 +09:00
Erik Kline
d870ed9e26 Merge "Address a few unittest comments." am: 9c3a298748 am: d4d464ae2c
am: 8de6457414

Change-Id: I007c10df7bd3658453cb245d11f5b606ac70e0b3
2017-01-21 04:57:32 +00:00
Erik Kline
8de6457414 Merge "Address a few unittest comments." am: 9c3a298748
am: d4d464ae2c

Change-Id: Iacb543c081a89327c66ce849b764866f12bc60d0
2017-01-21 04:50:36 +00:00
Erik Kline
d4d464ae2c Merge "Address a few unittest comments."
am: 9c3a298748

Change-Id: I2d41cdbe05653bcbed9d3b38b440c06b98006809
2017-01-21 04:43:27 +00:00
Erik Kline
430b1ff0f0 Merge "Address comments from previous change (320592)" am: e7cb6c3761 am: b6f606b59f
am: 454a408717

Change-Id: I374c8c63e4fb3310c3c50cc531a65005991c2fe2
2017-01-20 10:14:50 +00:00
Erik Kline
35eee13df4 Address a few unittest comments.
Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 32163131
Change-Id: I8f6002243031dceff60b3d6d377b9e25f239eb23
2017-01-20 19:13:20 +09:00
Erik Kline
454a408717 Merge "Address comments from previous change (320592)" am: e7cb6c3761
am: b6f606b59f

Change-Id: Icc5aa3d6cafd9829e65a0e82523727a9aba4ade5
2017-01-20 10:10:52 +00:00
Erik Kline
b6f606b59f Merge "Address comments from previous change (320592)"
am: e7cb6c3761

Change-Id: I3266a02a4a2fd76c4bb2f1a744103add63307e26
2017-01-20 10:04:51 +00:00
Treehugger Robot
e7cb6c3761 Merge "Address comments from previous change (320592)" 2017-01-20 09:57:27 +00:00
Lorenzo Colitti
6bcbb16630 Merge "Don't loop forever on zero-length ICMPv6 ND options." am: e7128b10a8
am: 113d5f8f40

Change-Id: Ic2d6596d14f6176a823fd66b400af8515617c66d
2017-01-20 08:58:47 +00:00
Lorenzo Colitti
113d5f8f40 Merge "Don't loop forever on zero-length ICMPv6 ND options."
am: e7128b10a8

Change-Id: If2260dd2b1bdaf2619cee668f8c2ef81e9dcfdce
2017-01-20 08:54:42 +00:00
Treehugger Robot
e7128b10a8 Merge "Don't loop forever on zero-length ICMPv6 ND options." 2017-01-20 08:47:17 +00:00
Erik Kline
efdd3f4ce0 Address comments from previous change (320592)
Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes
    - vanilla wifi-to-mobile tethering works
Bug: 32163131

Change-Id: I8788cb0d93606a2893c3dbc4f22e72f450f319b8
2017-01-20 16:31:29 +09:00
Lorenzo Colitti
1eda5b25ce Don't loop forever on zero-length ICMPv6 ND options.
Bug: 33828433

(cherry picked from commit 2f157c421a9fa15660b8f1bc0c64b1ebb45fa64a)

Change-Id: Icc03f0fcbf40d87e0b9c69e1172802ffcc85531b
2017-01-20 15:48:21 +09:00
Hugo Benichi
55b5f0f9eb DO NOT MERGE Unit tests for NetworkNotificationManager
Test: new unit test, no functional changes.
Bug: 32198726

(cherry picked from commit 74264329da5c52fbbafc1d20457056fdeabe19dc)

Change-Id: I123de68de9ae353b95edce89eb570cfbb5f8d9a3
2017-01-20 15:08:38 +09:00
Paul Duffin
43267b4b9e Merge "Prepare for removal of legacy-test from default targets" am: c74ccf1588 am: ab62fd67d8
am: 56a2ae1056

Change-Id: I0ede6895eb25f72a74af3ac4431a21960500bec5
2017-01-19 11:49:28 +00:00
Paul Duffin
56a2ae1056 Merge "Prepare for removal of legacy-test from default targets" am: c74ccf1588
am: ab62fd67d8

Change-Id: I923de1762a15fca7dc255f9dfe0ecce6f54d333c
2017-01-19 11:44:56 +00:00
Paul Duffin
ab62fd67d8 Merge "Prepare for removal of legacy-test from default targets"
am: c74ccf1588

Change-Id: Id4876a2597171ac78062acf8194fce1af6d50b77
2017-01-19 11:40:22 +00:00
Paul Duffin
ccb0445027 Prepare for removal of legacy-test from default targets
In preparation for removing junit classes from the Android API
the legacy-test target will be removed from the
TARGET_DEFAULT_JAVA_LIBRARIES. This change adds explicit
dependencies on junit and/or legacy-android-test to ensure that
modules will compile properly once it is removed.

(cherry picked from 6387604f9e672ece85e07c4bcbd7be396867f06f)

Bug: 30188076
Test: make checkbuild
Merged-In: I13e88297731253420e4e5f5291d503f13a39a156
Change-Id: I58446eb8c45d8ac2bcdbc9fa40d1321e811bdd4b
2017-01-19 09:43:05 +00:00
Lorenzo Colitti
5db17efcf6 Merge changes from topic 'net-update-mr2-dev-plus-aosp' into nyc-mr2-dev-plus-aosp
* changes:
  DO NOT MERGE: Add IP conn metrics to dumpsys and bug reports
  DO NOT MERGE: Add missing dependency.
  DO NOT MERGE: Show notification for always-on app VPN
  DO NOT MERGE: Implement metered tracking for NetworkStats summary queries.
  DO NOT MERGE: ConnectivityServiceTest: fix testAvoidBadWifiSettings
  DO NOT MERGE: Fix ConnectivityServiceTest testRequestBenchmark
  DO NOT MERGE: Switch over to new "time.android.com" NTP pool.
  DO NOT MERGE: Define API for metering network stats buckets.
  DO NOT MERGE: Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock.
  DO NOT MERGE: Use @Ignore to explicitly disable a @Test method.
  DO NOT MERGE: Fixed NetworkStatsServiceTest and converted it to JUnit4.
  DO NOT MERGE: ConnectivityThread: use lazy holder idiom
  DO NOT MERGE: ConnectivityManager: use ConnectivityThread looper
  DO NOT MERGE: ConnectivityManager: a simpler CallbackHandler
  DO NOT MERGE: Indicate the NsdServiceInfo attributes are only filled in for a resolved service.
  DO NOT MERGE: Add a null check for the OnStartTetheringCallback.
  DO NOT MERGE: [CS] Remove timeout event after first available
  DO NOT MERGE: ApfTest: tag tests with @SmallTest or @MediumTest
  DO NOT MERGE: Unbreak TetherInterfaceStateMachineTest.
  DO NOT MERGE: Move the connectivity tests to frameworks/base/tests/net.
  DO NOT MERGE: De-guava BroadcastInterceptingContext and move it to testutils.
  DO NOT MERGE: Move FakeSettingsProvider to a common location.
  DO NOT MERGE: ConnectivityServiceTest: mark flaky test as such
  DO NOT MERGE: Add fuzzing tests to ApfFilter RA processing
  DO NOT MERGE: Support timeouts for requestNetwork() invocations.
  DO NOT MERGE: Silence the obnoxious MTU 0 error message that occur when no MTU is specified for a given network.
2017-01-18 10:29:57 +00:00
Tony Mak
b31b83377b DO NOT MERGE: Show notification for always-on app VPN
This is the same notification as the one shown during legacy lockdown
mode, sans the 'reset' button.

The notification is only shown during times when VPN has not yet
established or has failed, for example during boot or after a crash.

Bug: 29123115

(cherry picked from commit 1a405fe300950d6ceae2166fd074b596d8110dbe)

(cherry picked from commit de7f7d195eec64802b7b6eee819c699f1a7d6951)

Change-Id: I42b4b24e25175bb7628b46a79431d2592644803c
2017-01-18 19:08:44 +09:00