Commit Graph

3366 Commits

Author SHA1 Message Date
Tamas Berghammer
9a5ec937be Merge "Update package names to work with the proto3 compiler" into nyc-mr1-dev-plus-aosp am: f7ee59ced0
am: b298682b02

Change-Id: I229a5c77a0dc5d75afc43669eb1d58d16f492844
2017-01-18 20:02:42 +00:00
Tamas Berghammer
756ca53401 Update package names to work with the proto3 compiler am: 671998abdb -s ours
am: 3e1868bdcb

Change-Id: I092a61abba417a71fe1a8eb9d29016e74808feb2
2017-01-18 19:55:14 +00:00
Tamas Berghammer
b298682b02 Merge "Update package names to work with the proto3 compiler" into nyc-mr1-dev-plus-aosp
am: f7ee59ced0

Change-Id: Ia944e535f7329c32bf34770fb0d99019cc1091f9
2017-01-18 18:06:43 +00:00
Tamas Berghammer
3e1868bdcb Update package names to work with the proto3 compiler
am: 671998abdb  -s ours

Change-Id: I8c957a9ad00cb393dbaaa05bec9730cc3a84a94e
2017-01-18 17:44:23 +00:00
Tamas Berghammer
f7ee59ced0 Merge "Update package names to work with the proto3 compiler" into nyc-mr1-dev-plus-aosp 2017-01-18 12:58:01 +00:00
Tony Mak
4a50842e4d DO NOT MERGE: Show notification for always-on app VPN
am: 7bce27af36  -s ours

Change-Id: I8af0a0746154d5774b0fb841616b57ce65a36707
2017-01-18 10:49:08 +00:00
Stephen Chen
9b5830847f DO NOT MERGE: Implement metered tracking for NetworkStats summary queries.
am: 64ee16a8dc  -s ours

Change-Id: I970aed286a5bcc69d2ee69ea23b53af36dc2bbea
2017-01-18 10:48:16 +00:00
Hugo Benichi
34a3b1a312 DO NOT MERGE: ConnectivityServiceTest: fix testAvoidBadWifiSettings
am: ec41a56b55  -s ours

Change-Id: Ifdac8feb994342d18a0795a676da558445867b1f
2017-01-18 10:47:07 +00:00
Hugo Benichi
4a111a86d9 DO NOT MERGE: Fix ConnectivityServiceTest testRequestBenchmark
am: 9fb6ca3be3  -s ours

Change-Id: Iccb849a88e017c3189b2c374a98c44dc58085861
2017-01-18 10:46:07 +00:00
Felipe Leme
8f19946d88 DO NOT MERGE: Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock.
am: 90a9ae5a11  -s ours

Change-Id: I4c92c8bfe7cd19839a86a63e5afb3b3868a63825
2017-01-18 10:43:14 +00:00
Felipe Leme
88b8d99ed5 DO NOT MERGE: Use @Ignore to explicitly disable a @Test method.
am: 23ea62316f  -s ours

Change-Id: I6e6fea2d375c40e53fee1877abeb06a9e6d2e218
2017-01-18 10:42:03 +00:00
Felipe Leme
f5692b584e DO NOT MERGE: Fixed NetworkStatsServiceTest and converted it to JUnit4.
am: 50d0a665a9  -s ours

Change-Id: I72964aed5f8f27120300948d57e4083bb81f06ec
2017-01-18 10:41:08 +00:00
Hugo Benichi
8605cc593c DO NOT MERGE: ConnectivityThread: use lazy holder idiom
am: b72e95b724  -s ours

Change-Id: I8af8bbe0b13b73d4c394c182d299a57c7d8b5736
2017-01-18 10:40:14 +00:00
Hugo Benichi
7ca7688868 DO NOT MERGE: ConnectivityManager: use ConnectivityThread looper
am: 0d51adaf98  -s ours

Change-Id: I12d27fd45f1182719df8c538e734419b640977e8
2017-01-18 10:38:59 +00:00
Hugo Benichi
eb689794d3 DO NOT MERGE: ConnectivityManager: a simpler CallbackHandler
am: f8198e48fd  -s ours

Change-Id: Ie2413170190809b0a95749f6788fb54b0a9bafd7
2017-01-18 10:37:50 +00:00
Jeremy Klein
cc04cb21b5 DO NOT MERGE: Add a null check for the OnStartTetheringCallback.
am: 23143b98af  -s ours

Change-Id: I62e8648a232f8c9ec1fe97270b654078a59e3cb9
2017-01-18 10:37:31 +00:00
Etan Cohen
dcef2ac5fc DO NOT MERGE: [CS] Remove timeout event after first available
am: dcdf130646  -s ours

Change-Id: I84244312fb5314ac1d177571ff1a3fdd070480ef
2017-01-18 10:37:25 +00:00
Lorenzo Colitti
1c82b37a64 DO NOT MERGE: Move the connectivity tests to frameworks/base/tests/net.
am: 1747a76e9d  -s ours

Change-Id: I255b736255c6f165f1600fe064e86bbd33bfe810
2017-01-18 10:37:05 +00:00
Lorenzo Colitti
9e8ed8cc10 DO NOT MERGE: De-guava BroadcastInterceptingContext and move it to testutils.
am: 44d51c7147  -s ours

Change-Id: If776d54cd1138a9266268f43833f6c329cd6285d
2017-01-18 10:37:00 +00:00
Lorenzo Colitti
4914da7685 DO NOT MERGE: Move FakeSettingsProvider to a common location.
am: d32212f182  -s ours

Change-Id: I896ce2cf8abf50e5189f609a4f810296817695c9
2017-01-18 10:36:56 +00:00
Hugo Benichi
ff41de306f DO NOT MERGE: ConnectivityServiceTest: mark flaky test as such
am: 67e09ac87a  -s ours

Change-Id: Ifd485f77ada20a0773e791816e811fdf22442a92
2017-01-18 10:36:52 +00:00
Erik Kline
ca97beb317 DO NOT MERGE: Support timeouts for requestNetwork() invocations.
am: 1a1fea2d24  -s ours

Change-Id: Ife31e9372728e888ccf175f0a38577e17c3fc468
2017-01-18 10:36:44 +00:00
Pierre Imai
f3b25e71a6 DO NOT MERGE: Silence the obnoxious MTU 0 error message that occur when no MTU is specified for a given network.
am: 93d4c23fac  -s ours

Change-Id: I3fa3801e54b06ea4e51f1e0d3577a309f1b970ab
2017-01-18 10:36:39 +00:00
Tony Mak
7bce27af36 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 81f2dff176)

(cherry picked from commit 7b6200aa9f)

Change-Id: I42b4b24e25175bb7628b46a79431d2592644803c
2017-01-18 19:08:44 +09:00
Stephen Chen
64ee16a8dc DO NOT MERGE: 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.

(cherry picked from commit 7581e6d766)

(cherry picked from commit 0889b39d2c)

Change-Id: I79e401fc4159264a075febba82bd8c295b8e677f
2017-01-18 19:08:41 +09:00
Hugo Benichi
ec41a56b55 DO NOT MERGE: 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 ccf7f00258)

(cherry picked from commit aadb059a9f)

Change-Id: I432f90a699dadfef37a5d0a69e25050753340964
2017-01-18 19:08:39 +09:00
Hugo Benichi
9fb6ca3be3 DO NOT MERGE: 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 cf7db79028)

(cherry picked from commit d0f492a893)

Change-Id: I3caf10025f203156a297c0b522f24768a18accc9
2017-01-18 19:08:37 +09:00
Felipe Leme
90a9ae5a11 DO NOT MERGE: Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock.
Test: m -j32 FrameworksServicesTests && adb install -r -g ${ANDROID_PRODUCT_OUT}/data/app/FrameworksServicesTests/FrameworksServicesTests.apk && adb shell am instrument -e class "com.android.server.net.NetworkStatsServiceTest" -w "com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner"

BUG: 30943463

(cherry picked from commit 39e1923fbb)

(cherry picked from commit 8d517776e8)

Change-Id: I93cdfc8753dcded141732c0587783d1fa2085f5a
2017-01-18 19:08:29 +09:00
Felipe Leme
23ea62316f DO NOT MERGE: Use @Ignore to explicitly disable a @Test method.
BUG: 30839080
BUG: 31007021

(cherry picked from commit 2b54780c88)

(cherry picked from commit 0e6e089843)

Change-Id: I45efc93b40e526467c97d0735289db1404ccd22d
2017-01-18 19:08:27 +09:00
Felipe Leme
50d0a665a9 DO NOT MERGE: Fixed NetworkStatsServiceTest and converted it to JUnit4.
Most tests were failing because due to a null NetworkCapabilities.
Example:

1) testNetworkStatsWifi(com.android.server.net.NetworkStatsServiceTest)
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.net.NetworkCapabilities.hasCapability(int)' on a null object reference
	at
	com.android.server.net.NetworkStatsService.updateIfacesLocked(NetworkStatsService.java:983)

BUG: 30839080

(cherry picked from commit 34634f9339)

(cherry picked from commit bf499379b8)

Change-Id: I6eee96178ade6adfc1406e06d5376206ca2420e5
2017-01-18 19:08:25 +09:00
Hugo Benichi
b72e95b724 DO NOT MERGE: ConnectivityThread: use lazy holder idiom
This patch changes the way that the ConnectivityThread is lazily
instantiated by using the "lazy initialization holder class idiom".

The first code point that tries to obtain a reference to the unique
ConnectivityThread instance will trigger the creation of the Singleton
class, which will guarantee a thread-safe initialization of the static
INSTANCE field inside Singleton according to the language specs.

This is the Item #71 of Effective Java.

The unique static instance of ConnectivityThread is not stored directly
inside ConnectivityThread class but is stored in a static nested class.
This is to avoid triggering the creation of that unique instance when
Zygote does class preloading at phone startup. Otherwise this would lead
to Zygote creating a new OS thread during preloading, which is a fatal
error.

Test: frameworks-wifi tests pass
Bug: 26749700
Bug: 28537383
Bug: 32130437

(cherry picked from commit f8ddba2cbd)

(cherry picked from commit e5ef0ce33c)

Change-Id: Ic9a31809ef19e618246f9aa17f5df29bd65f8510
2017-01-18 19:08:23 +09:00
Hugo Benichi
0d51adaf98 DO NOT MERGE: 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

(cherry picked from commit 3a54555e85)

(cherry picked from commit 94e0d04479)

Change-Id: If5c1e46ca6c4a09ef526cbe09654c5f55ef8d6ce
2017-01-18 19:08:21 +09:00
Hugo Benichi
f8198e48fd DO NOT MERGE: ConnectivityManager: a simpler CallbackHandler
This patch simplifies CallbackHandler in the following way:
  - CallbackHandler directly uses the static references to
    sNetworkCallback and sCallbackRefCount. This allows to remove
    instance fields in CallbackHandler.
  - CallbackHandler does not have a reference to ConnectivityManager
    anymore
  - CallbackHandler.getObject() is now generic in a type-safe way.

Test: ConnectivityServiceTest passes
Bug: 28537383
Bug: 32130437

(cherry picked from commit fe3325f2a5)

(cherry picked from commit 515e786cfd)

Change-Id: I4d0b2441b6af76bc56b19218210a2a381532a3c4
2017-01-18 19:08:18 +09:00
Jeremy Klein
23143b98af DO NOT MERGE: Add a null check for the OnStartTetheringCallback.
This avoids a NullPointerException when trying to call the callback
and gives a more readable error message.

(cherry picked from commit 49a5795ef0)

(cherry picked from commit d0542adb0b)

Change-Id: Ia5f328c4b25aa6624dc3c8493eb0c7bbab99904c
2017-01-18 19:08:14 +09:00
Etan Cohen
dcdf130646 DO NOT MERGE: [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 88087226a6)

(cherry picked from commit 69e6a108a5)

Change-Id: I0cf1a2b7d25bc9912e03fca30621809a9071396c
2017-01-18 19:08:11 +09:00
Lorenzo Colitti
1747a76e9d DO NOT MERGE: 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 384a9cb1f9)

Change-Id: I4c417c2ba0747d2085169e47ae4a99e93c4d8814
2017-01-18 19:08:05 +09:00
Lorenzo Colitti
44d51c7147 DO NOT MERGE: 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 f59c92bb17)

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

(cherry picked from commit 9d6921c144)

Change-Id: I8a95d4618dced81f173d2b38b9c1dfe3860b348a
2017-01-18 19:08:02 +09:00
Lorenzo Colitti
d32212f182 DO NOT MERGE: Move FakeSettingsProvider to a common location.
(cherry picked from commit 1de880a8fa)

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

(cherry picked from commit 91f851c6ea)

Change-Id: Ib82b162f354b8cbb521bc0783556f3225b4d12ac
2017-01-18 19:08:00 +09:00
Hugo Benichi
67e09ac87a DO NOT MERGE: 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

(cherry picked from commit 6d278a5693)

Change-Id: I32632bb763585c23f1de5bb1811a384a35bf9f64
2017-01-18 19:07:59 +09:00
Erik Kline
1a1fea2d24 DO NOT MERGE: Support timeouts for requestNetwork() invocations.
(cherry-pick of 8616c69985)
(cherry picked from commit 66721821df)

Bug: 21414325

(cherry picked from commit 950bfc31f9)

Change-Id: I640c43315a071ecbf881e5ce898164915e0b787f
2017-01-18 19:07:33 +09:00
Pierre Imai
93d4c23fac DO NOT MERGE: Silence the obnoxious MTU 0 error message that occur when no MTU is
specified for a given network.

Bug: 10705136

(cherry picked from commit 98f9c2c23b)

(cherry picked from commit 68902bc1df)

Change-Id: I12ac6f511a6760ef26f489ba3a052ca3c125e5ee
2017-01-18 18:12:35 +09:00
Lorenzo Colitti
156231784f Merge "Enable mobile data always on." am: 68317d6329 am: ab50ac01d0 am: 3daca8b56b
am: 8dfc506c43

Change-Id: I8d61c1a22a702cbd23638d46dfad36365b29180c
2017-01-17 06:56:53 +00:00
Hugo Benichi
8982f8a91c Merge "ConnectivityServiceTest: some fixes in CallbackInfo" am: 37727596cc am: 540eca1aac am: d630a308c0
am: f0b40b6764  -s ours

Change-Id: I2877281247a78e4d814a1df8bea71fd3c37b1962
2017-01-17 06:48:05 +00:00
Lorenzo Colitti
8dfc506c43 Merge "Enable mobile data always on." am: 68317d6329 am: ab50ac01d0
am: 3daca8b56b

Change-Id: Iaf4f84f53be65800c95a4f1b456a0d2d142c8c87
2017-01-17 04:36:21 +00:00
Lorenzo Colitti
3daca8b56b Merge "Enable mobile data always on." am: 68317d6329
am: ab50ac01d0

Change-Id: Ie2b6887021585a2e7246d66603dadc8d0fa1bd94
2017-01-17 04:31:00 +00:00
Lorenzo Colitti
ab50ac01d0 Merge "Enable mobile data always on."
am: 68317d6329

Change-Id: I9758da5105b9a8eac66aaaf9e4a1658685a6a3f7
2017-01-17 04:25:44 +00:00
Treehugger Robot
68317d6329 Merge "Enable mobile data always on." 2017-01-17 04:15:34 +00:00
Lorenzo Colitti
73f44c7656 Enable mobile data always on.
Test: has been on in fishfood several months.
Bug: 23113288
Change-Id: I73ba432f619d28dab78e2d865d56aa7e7c5a67f9
2017-01-17 11:07:50 +09:00
Hugo Benichi
c3225d1596 Merge "IP connectivity metrics: fix tests" 2017-01-16 08:28:47 +00:00
Hugo Benichi
60ad351e6b Stricter NetworkNotificationManagerTest
This patch changes NetworkNotificationManagerTest to populate extraInfo
of NetworkInfo in order to catch regressions in malformed format Strings
of log statements in NetworkNotificationManager.

Test: verified that the test fails when reintroducing the format String
bug.
Bug: 33737715

(cherry picked from commit 85a6c96ef3)

Change-Id: Ic2f23e860a17cb83b90edcfd2ba365134cacfe36
2017-01-16 15:15:26 +09:00