Commit Graph

3209 Commits

Author SHA1 Message Date
Hugo Benichi
766e564647 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
Baligh Uddin
2ff98c432c Merge remote-tracking branch 'goog/cw-f-dev' into fix_merger
Bug: 32849428

* goog/cw-f-dev: (98 commits)
  Revert "Catch KeyStoreException for setting profile lock"
  Fix createConfirmDeviceCredentialIntent for wear for CTS.
  Fix default dialog background colour for watch devices.
  Catch KeyStoreException for setting profile lock
  Add cross-links between FINE and COARSE location permissions. bug: 25371600
  Fixed a bug with the emergency affordance in multi user
  Zygote: Additional whitelists for runtime overlay / other static resources.
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Zygote : Block SIGCHLD during fork.
  colors: add missing accent_material_{700,50} resources.
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Zygote : Block SIGCHLD during fork.
  DO NOT MERGE ANYWHERE Revert "DO NOT MERGE ANYWHERE libhwui: make setSurface asynchronous"
  ...

Change-Id: I63468da5bfa21ed9ac5985bbdbf3a61d4c389aa0
2016-11-22 17:19:45 -08:00
Etan Cohen
5eba9d7061 [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)
Change-Id: I2b7adffd82173cf8b99084cbfe5399961d51e148
2016-11-21 19:15:10 +00:00
Hugo Benichi
42664b1332 Merge "Fix flaky IpPrefixTest." 2016-11-13 11:58:38 +00:00
Hugo Benichi
f5ec69155d Fix flaky IpPrefixTest.
Test: IpPrefixTest passes
Bug: 32561414
Change-Id: Ib4bffe9d33a6d4f5c2bd97798073de0f66d77645
2016-11-13 20:51:05 +09:00
Hugo Benichi
68bf2e6cd8 DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission am: 849682f5a0 -s ours am: d55ff11c4b -s ours am: 0a159e0967 -s ours am: 24c196f55f -s ours am: ec451e5173 -s ours am: 05c86a58be -s ours am: 8fe310892b -s ours
am: 0606e70a9a  -s ours

Change-Id: I2f2216c438756b0655d9183a98cee21cc642ec17
2016-11-10 19:02:03 +00:00
Hugo Benichi
0606e70a9a DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission am: 849682f5a0 -s ours am: d55ff11c4b -s ours am: 0a159e0967 -s ours am: 24c196f55f -s ours am: ec451e5173 -s ours am: 05c86a58be -s ours
am: 8fe310892b  -s ours

Change-Id: I63236413fa5272bbfb8c4fba83879089007694bc
2016-11-10 18:55:34 +00:00
Hugo Benichi
05c86a58be DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission am: 849682f5a0 -s ours am: d55ff11c4b -s ours am: 0a159e0967 -s ours am: 24c196f55f -s ours
am: ec451e5173  -s ours

Change-Id: I5bb53669285c0878905f8a2a70ff2dbe06c09ab2
2016-11-10 18:42:57 +00:00
Hugo Benichi
ec451e5173 DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission am: 849682f5a0 -s ours am: d55ff11c4b -s ours am: 0a159e0967 -s ours
am: 24c196f55f  -s ours

Change-Id: I42aabc35fa30e242125015eac1b7d32790cc4528
2016-11-10 18:36:30 +00:00
Hugo Benichi
24c196f55f DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission am: 849682f5a0 -s ours am: d55ff11c4b -s ours
am: 0a159e0967  -s ours

Change-Id: Ibe074076d22a736394a01d27aa9e1c7ed73458b2
2016-11-10 18:23:58 +00:00
Hugo Benichi
0a159e0967 DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission am: 849682f5a0 -s ours
am: d55ff11c4b  -s ours

Change-Id: If1903ace2a31d8ccf3c66916211a07ac342fc360
2016-11-10 18:11:02 +00:00
Hugo Benichi
d55ff11c4b DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission
am: 849682f5a0  -s ours

Change-Id: I2ba3b591df623298f41e92e6f0d067a6fcf30533
2016-11-10 18:04:26 +00:00
Hugo Benichi
849682f5a0 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
55f36459c8 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
31720a9dc5 Merge "frameworks-test: adding missing @SmallTest" 2016-11-07 00:09:56 +00:00
Etan Cohen
8e96c20ede Merge "[NAN-AWARE] Rename NAN to Aware" am: 6c75254555 am: 4ddc6321ef am: 9f1b6c3da9
am: 2ad6b14d50  -s ours

Change-Id: Id51e99533ce8ab29bd40170f8eafc0f9702c16fb
2016-11-06 03:38:18 +00:00
Etan Cohen
9f1b6c3da9 Merge "[NAN-AWARE] Rename NAN to Aware" am: 6c75254555
am: 4ddc6321ef

Change-Id: Ief54b313dc5ca5d30645b55ed2ad0333036a1671
2016-11-06 03:21:37 +00:00
Etan Cohen
4ddc6321ef Merge "[NAN-AWARE] Rename NAN to Aware"
am: 6c75254555

Change-Id: I2e788e19a11f2709f2e542dbdc4b58433a3574bf
2016-11-06 03:13:31 +00:00
Etan Cohen
6c75254555 Merge "[NAN-AWARE] Rename NAN to Aware" 2016-11-06 03:05:40 +00:00
Etan Cohen
7e93db5bda [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 a0edbf0ac8)

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
018d76cb9b [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 a0edbf0ac8)
(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
9369e9d105 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
3664598601 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
14a215edd3 [NAN-AWARE] Rename NAN to Aware [DO NOT MERGE]
am: a0edbf0ac8  -s ours

Change-Id: I40abb81290d255c0369f4356bd78b46f5479a857
2016-11-03 20:03:59 +00:00
Michal Karpinski
45fb09ff45 [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
a0edbf0ac8 [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
5a7c486d70 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
6a64dd2178 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
4163f9ca8f 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
877dd9b541 Extending DNS event reporting am: bca2d211f6 am: 24f2212843
am: 9351835591

Change-Id: Id482e6a300de49cc1d37ec6e38b9c651ec671f3e
2016-10-27 17:48:27 +00:00
Michal Karpinski
24f2212843 Extending DNS event reporting
am: bca2d211f6

Change-Id: I64e6a48fbbaa734447069b073c3499ef71af907c
2016-10-27 17:28:15 +00:00
Michal Karpinski
bca2d211f6 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 58a5c98b40)
2016-10-27 16:39:21 +00:00
Glen Kuhne
9318e37e71 Merge "Move ipconnectivity.proto to services-proto.jar" 2016-10-27 16:27:27 +00:00
Hugo Benichi
0f96fca5d3 Merge "ConnectivityServiceTest: mark flaky test as such" 2016-10-27 05:21:33 +00:00
Hugo Benichi
144810b6cf 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
1f0cb8f6ab 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
4237636ea2 Merge "Add unit tests for Tethering.isTetherProvisioningRequired" am: 836ffa6e1c am: d2b306dee1 am: 0dcc2eccba
am: 2ae41619ae

Change-Id: Iee7c8575ee22a494e2657e15e1aaae9b05a37045
2016-10-25 18:43:16 +00:00
Christopher Wiley
0dcc2eccba Merge "Add unit tests for Tethering.isTetherProvisioningRequired" am: 836ffa6e1c
am: d2b306dee1

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

Change-Id: I1dab386e3891c01a2917c32847d2aecdbfa10102
2016-10-25 18:23:02 +00:00
Christopher Wiley
fcc0d9fd8b 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
70544b339b 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
e3f7299ce2 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
6d8c1dfe4b 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
de4886b1bd VPN network stat accounting changes. am: adaddcd778 am: c63551df8e
am: bc3eed1e5a

Change-Id: I1edec6bf2a590f5b0ff010adfd6f2785a1aaa994
2016-10-21 23:47:35 +00:00
Jeremy Joslin
bc3eed1e5a VPN network stat accounting changes. am: adaddcd778
am: c63551df8e

Change-Id: I797ac586581f83ada0e94639dd435122c987f1c1
2016-10-21 23:43:06 +00:00
Jeremy Joslin
c63551df8e VPN network stat accounting changes.
am: adaddcd778

Change-Id: I1c65db583cdd1d5b519830e521c633cb8dee449f
2016-10-21 23:37:57 +00:00
Jeremy Joslin
adaddcd778 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
dbac14ba69 Merge "IpConnectivity metrics: add version number" 2016-10-21 04:35:52 +00:00
TreeHugger Robot
650fa1cca6 Merge "ConnectivityManager: use ConnectivityThread looper" 2016-10-21 01:49:46 +00:00
Hugo Benichi
3b41f05d68 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