Commit Graph

3058 Commits

Author SHA1 Message Date
Hugo Benichi
ccf7f00258 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
Change-Id: Ib20f4656620b119456c2cb1c709a7fe8195fe44d
2016-11-23 18:29:52 +09:00
Hugo Benichi
cf7db79028 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
Change-Id: I7601b2f1f11f83914f885a74c8a376173eed186b
2016-11-23 18:27:05 +09:00
Hugo Benichi
83f7a13fd7 Merge "Fix flaky IpPrefixTest." 2016-11-13 11:58:38 +00:00
Hugo Benichi
b3ac7ab583 Fix flaky IpPrefixTest.
Test: IpPrefixTest passes
Bug: 32561414
Change-Id: Ib4bffe9d33a6d4f5c2bd97798073de0f66d77645
2016-11-13 20:51:05 +09:00
Hugo Benichi
6e92ac355f DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission am: 4f299984a2 -s ours am: 37f3c58a0c -s ours am: 5a58c696f6 -s ours am: 5fec21d5e0 -s ours am: 70cd6f9877 -s ours am: d7e4af9ed6 -s ours am: 8fe310892b -s ours
am: 89683767de  -s ours

Change-Id: I2f2216c438756b0655d9183a98cee21cc642ec17
2016-11-10 19:02:03 +00:00
Hugo Benichi
89683767de DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission am: 4f299984a2 -s ours am: 37f3c58a0c -s ours am: 5a58c696f6 -s ours am: 5fec21d5e0 -s ours am: 70cd6f9877 -s ours am: d7e4af9ed6 -s ours
am: 8fe310892b  -s ours

Change-Id: I63236413fa5272bbfb8c4fba83879089007694bc
2016-11-10 18:55:34 +00:00
Hugo Benichi
d7e4af9ed6 DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission am: 4f299984a2 -s ours am: 37f3c58a0c -s ours am: 5a58c696f6 -s ours am: 5fec21d5e0 -s ours
am: 70cd6f9877  -s ours

Change-Id: I5bb53669285c0878905f8a2a70ff2dbe06c09ab2
2016-11-10 18:42:57 +00:00
Hugo Benichi
70cd6f9877 DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission am: 4f299984a2 -s ours am: 37f3c58a0c -s ours am: 5a58c696f6 -s ours
am: 5fec21d5e0  -s ours

Change-Id: I42aabc35fa30e242125015eac1b7d32790cc4528
2016-11-10 18:36:30 +00:00
Hugo Benichi
5fec21d5e0 DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission am: 4f299984a2 -s ours am: 37f3c58a0c -s ours
am: 5a58c696f6  -s ours

Change-Id: Ibe074076d22a736394a01d27aa9e1c7ed73458b2
2016-11-10 18:23:58 +00:00
Hugo Benichi
5a58c696f6 DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission am: 4f299984a2 -s ours
am: 37f3c58a0c  -s ours

Change-Id: If1903ace2a31d8ccf3c66916211a07ac342fc360
2016-11-10 18:11:02 +00:00
Hugo Benichi
37f3c58a0c DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission
am: 4f299984a2  -s ours

Change-Id: I2ba3b591df623298f41e92e6f0d067a6fcf30533
2016-11-10 18:04:26 +00:00
Hugo Benichi
4f299984a2 DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission
This patch creates a new permission used by ConnectivityService to give
access to restricted networks without the NET_CAPABILITY_NOT_RESTRICTED
capability bit on.

Bug: 24497316
Change-Id: I5b6c8a9ef14395b2f1ab26cb17b24d7876ec79f1
2016-11-09 19:08:30 -08:00
Tamas Berghammer
792b79610b Update package names to work with the proto3 compiler
Bug: b/28974522
Change-Id: I5f3adf4946ee4ba1e09e4f40afe83c151405972a
2016-11-08 14:06:09 +00:00
Hugo Benichi
f233f3a95f Merge "frameworks-test: adding missing @SmallTest" 2016-11-07 00:09:56 +00:00
Etan Cohen
aee533d295 Merge "[NAN-AWARE] Rename NAN to Aware" am: d5cfbc15de am: 518e755712 am: 517e26e2db
am: 2ad6b14d50  -s ours

Change-Id: Id51e99533ce8ab29bd40170f8eafc0f9702c16fb
2016-11-06 03:38:18 +00:00
Etan Cohen
517e26e2db Merge "[NAN-AWARE] Rename NAN to Aware" am: d5cfbc15de
am: 518e755712

Change-Id: Ief54b313dc5ca5d30645b55ed2ad0333036a1671
2016-11-06 03:21:37 +00:00
Etan Cohen
518e755712 Merge "[NAN-AWARE] Rename NAN to Aware"
am: d5cfbc15de

Change-Id: I2e788e19a11f2709f2e542dbdc4b58433a3574bf
2016-11-06 03:13:31 +00:00
Etan Cohen
d5cfbc15de Merge "[NAN-AWARE] Rename NAN to Aware" 2016-11-06 03:05:40 +00:00
Etan Cohen
e32acff815 [NAN-AWARE] Rename NAN to Aware
~Rename only (and any reformatting needed to pass lint) - no
functional changes!

Remove android.net.wifi.nan.STATE_CHANGED from manifest:
redundant/remnant of an older configuration.

(cherry-pick of commit a61b9fb569153917a650f1d48efa20ba8846a9f3)

Bug: 32263750
Test: All unit tests and integration (sl4a) tests pass.
Merged-In: Ie4ff675fa61041e8fcf6a9bf9900ea835d0a7614
Change-Id: I4206d2fd722dc7dec9df4aee5c818101d7f9dccc
2016-11-05 09:41:38 -07:00
Etan Cohen
e88f7fe854 [NAN-AWARE] Rename NAN to Aware
~Rename only (and any reformatting needed to pass lint) - no
functional changes!

Remove android.net.wifi.nan.STATE_CHANGED from manifest:
redundant/remnant of an older configuration.

(cherry-pick of commit cb25e91426)
(cherry-pick of commit b061f21e7e59a99834e163e2baa1c82229e419a6)

Bug: 32263750
Test: All unit tests and integration (sl4a) tests pass.
Change-Id: Ie4ff675fa61041e8fcf6a9bf9900ea835d0a7614
2016-11-04 15:42:08 -07:00
Stephen Chen
7581e6d766 Implement metered tracking for NetworkStats summary queries.
Dependent on ag/1550196 where API is defined.

Bug: 31015360
Bug: 26545374
Test: runtest --path
frameworks/base/core/tests/coretests/src/android/net/NetworkStatsTest.java,
other test classes.

Change-Id: I968b9e3352d7880e3fc438f12de628a2da057e0a
2016-11-04 09:55:21 -07:00
Hugo Benichi
174b398594 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
Change-Id: Ib42c4ab2d7214891cd451875ca4bf6db195538c1
2016-11-04 16:46:29 +09:00
Etan Cohen
aab195a223 [NAN-AWARE] Rename NAN to Aware [DO NOT MERGE]
am: cb25e91426  -s ours

Change-Id: I40abb81290d255c0369f4356bd78b46f5479a857
2016-11-03 20:03:59 +00:00
Michal Karpinski
bcf1936090 [DPM] DO can start network logging and listen for events
This CL adds:
1) Setter and getter in DPM to manipulate logging switch (retrieval
method to come in a subsequent CL(s)).
2) A way for DPM to register to listen for events.
3) Skeleton of NetworkLogger class (more to come in subsequent CL(s)).

Bug: 29748723
Change-Id: I5c04662ccc6febd2ba294b0eaca1ed1da9c16e47
2016-11-02 08:52:53 +00:00
Etan Cohen
cb25e91426 [NAN-AWARE] Rename NAN to Aware [DO NOT MERGE]
~Rename only (and any reformatting needed to pass lint) - no
functional changes!

Remove android.net.wifi.nan.STATE_CHANGED from manifest:
redundant/remnant of an older configuration.

Bug: 32263750
Test: All unit tests and integration (sl4a) tests pass.
Change-Id: I6866f8825101a32adb9b05d83f0d9d3792b478b7
2016-10-31 15:37:59 +00:00
Lorenzo Colitti
384a9cb1f9 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
Change-Id: I4b389f7f4e33a996885b38670f585e58ca66f777
2016-10-28 17:12:36 +09:00
Lorenzo Colitti
f59c92bb17 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.

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
2016-10-28 17:12:36 +09:00
Lorenzo Colitti
1de880a8fa Move FakeSettingsProvider to a common location.
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: I82a1a1a7219cf1385092b84d85eddf9dda90c685
2016-10-28 17:12:31 +09:00
Michal Karpinski
ea584abdc5 Extending DNS event reporting am: 59af05d744 am: 4dfa5eb908
am: 9351835591

Change-Id: Id482e6a300de49cc1d37ec6e38b9c651ec671f3e
2016-10-27 17:48:27 +00:00
Michal Karpinski
4dfa5eb908 Extending DNS event reporting
am: 59af05d744

Change-Id: I64e6a48fbbaa734447069b073c3499ef71af907c
2016-10-27 17:28:15 +00:00
Michal Karpinski
59af05d744 Extending DNS event reporting
This adds hostname, array of addresses, total count of IP addresses
and uid to the existing pipeline.
Currently ignores the new data it receives, further work will be
done in the subsequent CLs.

Test: for now just the benchmarking, in the future unit and CTS

Bug: 29748723
Change-Id: Ice7db208282934e74f0e1808ffbae96d476c4216
(cherry picked from commit 33fa018898)
2016-10-27 16:39:21 +00:00
Glen Kuhne
6543f1534f Merge "Move ipconnectivity.proto to services-proto.jar" 2016-10-27 16:27:27 +00:00
Hugo Benichi
72753055a8 Merge "ConnectivityServiceTest: mark flaky test as such" 2016-10-27 05:21:33 +00:00
Hugo Benichi
6d278a5693 ConnectivityServiceTest: mark flaky test as such
This patch extracts into its own independent test a test sub-block looking
for a race condition when not waiting on handlers to become idle:
there is no way to prevent the race from not happening when looking for
it this way. This makes the test flakky.

This new independent test is tagged with @FlakkyTest(tolerance = 3).

Test: ConnectivityServiceTest passes, with higher probability.
Bug: 31479480
Change-Id: Ic0e2ffbe669f2ea8cc62e8a0d4763703368db019
2016-10-27 09:38:54 +09:00
Glen Kuhne
3935ae9967 Move ipconnectivity.proto to services-proto.jar
Moved ipconnectivity.proto from services.core.jar to
framework-protos.jar.
Replaced 'mergeFrom' MessageNano base class calls, with 'parseFrom'
IpConnectivityLog calls.

This solves an issue where the services.jar would conflict with
duplicate nano proto base class definitions in other .jars
(wifi-service.jar).

Bug: 32261442
Test: Existing unit tests pass
Change-Id: I49100935fcae2e85e12eaa7f3462864f3a340b97
2016-10-26 10:18:46 -07:00
Christopher Wiley
ab83d5b80c Merge "Add unit tests for Tethering.isTetherProvisioningRequired" am: 836ffa6e1c am: 4942a15e19 am: 1e0ea3cc22
am: 2ae41619ae

Change-Id: Iee7c8575ee22a494e2657e15e1aaae9b05a37045
2016-10-25 18:43:16 +00:00
Christopher Wiley
1e0ea3cc22 Merge "Add unit tests for Tethering.isTetherProvisioningRequired" am: 836ffa6e1c
am: 4942a15e19

Change-Id: Ica704d0a64dde80ae0a9f1cef0250bfbdafcd49a
2016-10-25 18:31:02 +00:00
Christopher Wiley
4942a15e19 Merge "Add unit tests for Tethering.isTetherProvisioningRequired"
am: 836ffa6e1c

Change-Id: I1dab386e3891c01a2917c32847d2aecdbfa10102
2016-10-25 18:23:02 +00:00
Christopher Wiley
a28f756e2d Add unit tests for Tethering.isTetherProvisioningRequired
Check that we tolerate various dependencies not being available.

Bug: 31946071
Test: These are tests

Change-Id: Ic0a9cd6f255ba9ff4c774dee640df1a0bdf8dc39
2016-10-24 17:07:05 -07:00
TreeHugger Robot
9e4d9c5b99 Merge changes I1a544a8d,Ie78d3fb0
* changes:
  IpConnectivityMetrics: rate limit ApfProgramEvents
  IpConnectivityMetrics reads buffer size in settings
2016-10-24 14:45:46 +00:00
Hugo Benichi
811c4cec75 IpConnectivityMetrics: rate limit ApfProgramEvents
This patch uses the previously introduced TokenBucket to rate limit
ApfProgramEvents, still allowing for burst of ApfProgramEvents when a
new interface is set up (due to ipv4 provisioning, multicast lock, ipv6 RAs
triggering new APF program events in short amounts of time).

Test: new test in IpConnectivityMetricsTest
Bug: 1550402
Change-Id: I1a544a8d62e6b02f0ed0088ab76c4bad338d2f44
2016-10-24 21:54:37 +09:00
Hugo Benichi
d5f78a08b4 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
Change-Id: Ie78d3fb03cea7883585549dac4f2063f0a8d9f4b
2016-10-24 13:52:41 +09:00
Jeremy Joslin
d3e5e4ee60 VPN network stat accounting changes. am: 38bf381574 am: 47c9d37d53
am: 6c41722128

Change-Id: I1edec6bf2a590f5b0ff010adfd6f2785a1aaa994
2016-10-21 23:47:35 +00:00
Jeremy Joslin
6c41722128 VPN network stat accounting changes. am: 38bf381574
am: 47c9d37d53

Change-Id: I797ac586581f83ada0e94639dd435122c987f1c1
2016-10-21 23:43:06 +00:00
Jeremy Joslin
47c9d37d53 VPN network stat accounting changes.
am: 38bf381574

Change-Id: I1c65db583cdd1d5b519830e521c633cb8dee449f
2016-10-21 23:37:57 +00:00
Jeremy Joslin
38bf381574 VPN network stat accounting changes.
Properly account for VPN apps that make heavy use of the tun
interface. Prior to this change a VPN app could be incorrectly charged
for more data than it actually used if it sent more traffic through
the tun interface than the underlying interface.

This change excludes VPN app traffic on the tun interface from the
adjustment pool and doesn't redistribute traffic to the VPN app.
Instead all of the redistributed traffic is deducted from the VPN app
which effectively represents any overhead incurred by the VPN app.

BUG: 30557871
Change-Id: I62a75a0c0c0111e052b7903baa9f5d6d94ef57fd
2016-10-21 18:47:57 +09:00
Hugo Benichi
b04e839e44 Merge "IpConnectivity metrics: add version number" 2016-10-21 04:35:52 +00:00
TreeHugger Robot
92983c0794 Merge "ConnectivityManager: use ConnectivityThread looper" 2016-10-21 01:49:46 +00:00
Hugo Benichi
3a54555e85 ConnectivityManager: use ConnectivityThread looper
This patch removes the static singleton looper used by
ConnectivityManager and instead uses the common ConnectivityThread.

This allows to removes the static atomic counter used to track
the number of registered NetworkCallback in ConnectivityManager, because
the looper is not turned off anymore when no callbacks are registered.

Also an overloaded version of sendRequestForNetwork is added taking as a
new parameter a Handler. This will allow to overload various callback
and request related API calls with user provided Handlers.

Test: ConnectivityServiceTest passes
Bug: 26749700
Bug: 28537383
Bug: 32130437
Change-Id: I431afcee7c7155bd7bac23a2e1e97fd5d6520c74
2016-10-21 08:54:34 +09:00
Hugo Benichi
a267249806 Merge "ConnectivityThread: use lazy holder idiom" 2016-10-20 23:49:03 +00:00