Commit Graph

3094 Commits

Author SHA1 Message Date
Tamas Berghammer
3b9f1466b1 Merge "DO NOT MERGE: Revert "Update package names to work with the proto3 compiler"" into nyc-mr1-dev-plus-aosp
am: a05cbcb4b1

Change-Id: I9d5789a9c4f12c12c5cc13eb8f92d3084a818440
2017-01-18 20:32:44 +00:00
Tamas Berghammer
8ad263e479 DO NOT MERGE: Revert "Update package names to work with the proto3 compiler"
am: 4dac494ece  -s ours

Change-Id: I09a58385e10e135af06dff346624dcbc9eb76a4f
2017-01-18 20:22:57 +00:00
Tamas Berghammer
a05cbcb4b1 Merge "DO NOT MERGE: Revert "Update package names to work with the proto3 compiler"" into nyc-mr1-dev-plus-aosp 2017-01-18 19:59:59 +00:00
Tamas Berghammer
4dac494ece DO NOT MERGE: Revert "Update package names to work with the proto3 compiler"
This reverts commit 0c0c8f7825.

Change-Id: I6e8d193fa22e0e7e30b214c13ae0480d3c9b0dc6
2017-01-18 19:33:22 +00:00
Tamas Berghammer
0d53c255ad Merge "Update package names to work with the proto3 compiler" into nyc-mr1-dev-plus-aosp
am: 4ce688e0d8

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

Change-Id: I8c957a9ad00cb393dbaaa05bec9730cc3a84a94e
2017-01-18 17:44:23 +00:00
Tamas Berghammer
4ce688e0d8 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
dc464b9525 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 9ca892f698)

(cherry picked from commit c777123d5c)

Change-Id: I42b4b24e25175bb7628b46a79431d2592644803c
2017-01-18 19:08:44 +09:00
Stephen Chen
5df334f572 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 9369e9d105)

(cherry picked from commit 757658193d)

Change-Id: I79e401fc4159264a075febba82bd8c295b8e677f
2017-01-18 19:08:41 +09:00
Hugo Benichi
0bcc4a517e 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 b54c8cffa8)

(cherry picked from commit b1bddc92c5)

Change-Id: I432f90a699dadfef37a5d0a69e25050753340964
2017-01-18 19:08:39 +09:00
Hugo Benichi
020844b6cf 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 766e564647)

(cherry picked from commit 8436dae4c3)

Change-Id: I3caf10025f203156a297c0b522f24768a18accc9
2017-01-18 19:08:37 +09:00
Felipe Leme
5210ff9305 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 de2a6f1b1d)

(cherry picked from commit 6670ab4480)

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

(cherry picked from commit a4dc2a7129)

(cherry picked from commit b8a440f538)

Change-Id: I45efc93b40e526467c97d0735289db1404ccd22d
2017-01-18 19:08:27 +09:00
Felipe Leme
d63c8bc4a2 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 f96df4b298)

(cherry picked from commit 00a6e6c111)

Change-Id: I6eee96178ade6adfc1406e06d5376206ca2420e5
2017-01-18 19:08:25 +09:00
Hugo Benichi
e4f69293e9 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 3ab84b087a)

(cherry picked from commit 8f201294fe)

Change-Id: Ic9a31809ef19e618246f9aa17f5df29bd65f8510
2017-01-18 19:08:23 +09:00
Hugo Benichi
9954fbdb65 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 3b41f05d68)

(cherry picked from commit 301b09738a)

Change-Id: If5c1e46ca6c4a09ef526cbe09654c5f55ef8d6ce
2017-01-18 19:08:21 +09:00
Hugo Benichi
5d2047de7b 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 0b42baf68a)

(cherry picked from commit 56260ed9cb)

Change-Id: I4d0b2441b6af76bc56b19218210a2a381532a3c4
2017-01-18 19:08:18 +09:00
Jeremy Klein
d707b3716b 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 35e99ea8ef)

(cherry picked from commit fb63d5a4ef)

Change-Id: Ia5f328c4b25aa6624dc3c8493eb0c7bbab99904c
2017-01-18 19:08:14 +09:00
Etan Cohen
a814243e87 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 5eba9d7061)

(cherry picked from commit 3fb372fe9f)

Change-Id: I0cf1a2b7d25bc9912e03fca30621809a9071396c
2017-01-18 19:08:11 +09:00
Lorenzo Colitti
e8d1e9daa0 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 5a7c486d70)

Change-Id: I4c417c2ba0747d2085169e47ae4a99e93c4d8814
2017-01-18 19:08:05 +09:00
Lorenzo Colitti
0c7a3c349d 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 6a64dd2178)

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 834805275a)

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

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 4166a1fcfa)

Change-Id: Ib82b162f354b8cbb521bc0783556f3225b4d12ac
2017-01-18 19:08:00 +09:00
Hugo Benichi
30c0460727 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 144810b6cf)

Change-Id: I32632bb763585c23f1de5bb1811a384a35bf9f64
2017-01-18 19:07:59 +09:00
Erik Kline
ee83e11aeb DO NOT MERGE: Support timeouts for requestNetwork() invocations.
(cherry-pick of 0b7a74842b)
(cherry picked from commit 155a59aa63)

Bug: 21414325

(cherry picked from commit 5791c5f681)

Change-Id: I640c43315a071ecbf881e5ce898164915e0b787f
2017-01-18 19:07:33 +09:00
Koichi, Sugimoto
45dbfe7c3e Disable always-on VPN in factoryReset
When network setting reset is started while always-on VPN is enabled,
application crash occurs with IllegalStateException in prepareVpn().

Therefore, it's necessary to also disable always-on VPN in factoryReset
before prepareVpn() when turning off VPN.

Bug: 29030858
Change-Id: I08c5406717dd7937d197c2e934a56d037477aafc
2017-01-18 10:02:58 +00:00
Pierre Imai
9e98fecd15 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 07c53a35ae)

(cherry picked from commit fb3178adfc)

Change-Id: I12ac6f511a6760ef26f489ba3a052ca3c125e5ee
2017-01-18 18:12:35 +09:00
Lorenzo Colitti
f9f8abce19 Merge "Enable mobile data always on." am: 7ab1654533 am: 0df74d1ee7
am: e50c60e1f1

Change-Id: Iaf4f84f53be65800c95a4f1b456a0d2d142c8c87
2017-01-17 04:36:21 +00:00
Lorenzo Colitti
e50c60e1f1 Merge "Enable mobile data always on." am: 7ab1654533
am: 0df74d1ee7

Change-Id: Ie2b6887021585a2e7246d66603dadc8d0fa1bd94
2017-01-17 04:31:00 +00:00
Lorenzo Colitti
0df74d1ee7 Merge "Enable mobile data always on."
am: 7ab1654533

Change-Id: I9758da5105b9a8eac66aaaf9e4a1658685a6a3f7
2017-01-17 04:25:44 +00:00
Treehugger Robot
7ab1654533 Merge "Enable mobile data always on." 2017-01-17 04:15:34 +00:00
Lorenzo Colitti
bcecc7a8ae 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
04d4730e15 Merge "ConnectivityServiceTest: some fixes in CallbackInfo" am: 37727596cc am: ac7e9a2b47
am: 073a0ac614

Change-Id: Ifc208e00e05efb29eaa2ab37abdc66d8c7ed8f4f
2017-01-16 05:13:01 +00:00
Hugo Benichi
073a0ac614 Merge "ConnectivityServiceTest: some fixes in CallbackInfo" am: 37727596cc
am: ac7e9a2b47

Change-Id: I839ed526e802b88bbed490b611f90d829b952f26
2017-01-16 05:04:39 +00:00
Hugo Benichi
ac7e9a2b47 Merge "ConnectivityServiceTest: some fixes in CallbackInfo"
am: 37727596cc

Change-Id: I636b7b0ef210aaa3e130e1c1a162a35cdc099295
2017-01-16 05:00:30 +00:00
Hugo Benichi
b573a2964c ConnectivityServiceTest: some fixes in CallbackInfo
- CallbackInfo becomes a static class so that it can be instantiated
  and looked at more easily than before.
- CallbackInfo gains hashCode() because it has equals().
- effectively final field are qualified final
- fixes bug when polling the next callback: poll() on a LinkedBlockingQueue
  returns null when timing out, which was not failing the test cleanly.

Test: ConnectivityServiceTest passes
Bug: 32561414
Change-Id: I64d382a35fe83f21bded98e6906c1ec70a8f1085
2017-01-16 11:15:04 +09:00
Etan Cohen
669e846a8a Merge "[AWARE] Unhide Wi-Fi Aware API (baseline)" am: dfe8f5dc13 am: 877ccf68fb
am: 463d3c6e7c

Change-Id: If2a6b632cd03984921572b190745865953a8e808
2017-01-11 23:22:51 +00:00
Etan Cohen
463d3c6e7c Merge "[AWARE] Unhide Wi-Fi Aware API (baseline)" am: dfe8f5dc13
am: 877ccf68fb

Change-Id: I6f894d92451032657678639c3021eef07289a6a2
2017-01-11 23:17:19 +00:00
Etan Cohen
877ccf68fb Merge "[AWARE] Unhide Wi-Fi Aware API (baseline)"
am: dfe8f5dc13

Change-Id: I581b72ce62966f4c04427603a2b9686dcf46cc42
2017-01-11 23:12:16 +00:00
Etan Cohen
785ddc7f52 [AWARE] Unhide Wi-Fi Aware API (baseline)
Baseline Wi-Fi Aware API providing discovery and connectivity (data-path).

Bug: 30983968
Test: unit tests + integration (sl4a) tests passing.
Change-Id: Idd7c6a625f168717b083d5f13e291ce916571933
2017-01-11 11:13:26 -08:00
Tamas Berghammer
0c0c8f7825 Update package names to work with the proto3 compiler
Bug: b/28974522
Change-Id: I5f3adf4946ee4ba1e09e4f40afe83c151405972a
(cherry picked from commit 55f36459c8)
2017-01-11 11:27:38 +00:00
Hugo Benichi
d3a305abc6 DO NOT MERGE Captive portals: login activity probes like NetworkMonitor am: 22569ca49a -s ours am: b18218fb06 -s ours
am: 57c7fc11bd

Change-Id: I6f4c7a0c15373e56fc178f287f6a0eb54d0d4018
2017-01-11 01:42:01 +00:00
Hugo Benichi
553ad7bcbe DO NOT MERGE Captive portal systel log improvements am: fce1a04cc7 -s ours am: 73c57874b9 -s ours
am: f258886732

Change-Id: Ie831b10e45cee740f519896312ede84ebb69e6f2
2017-01-11 01:32:49 +00:00
Hugo Benichi
61dce05929 DO NOT MERGE Fix flaky IpPrefixTest. am: 79a968d619 -s ours am: 01eeebdf88 -s ours
am: 5c3b167517

Change-Id: Ieeeb425675715dc9910c4901f9c1bce7dbd168ad
2017-01-11 01:31:54 +00:00
Hugo Benichi
57c7fc11bd DO NOT MERGE Captive portals: login activity probes like NetworkMonitor am: 22569ca49a -s ours
am: b18218fb06  -s ours

Change-Id: Icf09b29bfe619ee56d4e9ae0d640ed00fbb4ef31
2017-01-11 01:27:40 +00:00
Hugo Benichi
f258886732 DO NOT MERGE Captive portal systel log improvements am: fce1a04cc7 -s ours
am: 73c57874b9  -s ours

Change-Id: If06761b413cda9d3f79aa79e8ae60cf0ce306946
2017-01-11 01:23:51 +00:00
Hugo Benichi
5c3b167517 DO NOT MERGE Fix flaky IpPrefixTest. am: 79a968d619 -s ours
am: 01eeebdf88  -s ours

Change-Id: Ic492f64b8fc44dc9a8ca1abd539fe757c703acac
2017-01-11 01:22:35 +00:00
Hugo Benichi
b18218fb06 DO NOT MERGE Captive portals: login activity probes like NetworkMonitor
am: 22569ca49a  -s ours

Change-Id: I12ea7b87369c3228bb1fcc914cfdb316a3b501ce
2017-01-11 01:18:00 +00:00
Hugo Benichi
73c57874b9 DO NOT MERGE Captive portal systel log improvements
am: fce1a04cc7  -s ours

Change-Id: Ibce1d4e604e5fd8c67c012cd7f264e4585117b24
2017-01-11 01:14:04 +00:00
Hugo Benichi
01eeebdf88 DO NOT MERGE Fix flaky IpPrefixTest.
am: 79a968d619  -s ours

Change-Id: I929a0ef7a6a044d2263a04867c2701653c3634de
2017-01-11 01:12:54 +00:00
Hugo Benichi
22569ca49a DO NOT MERGE Captive portals: login activity probes like NetworkMonitor
This patch changes CaptivePortalLoginActivity captive portal test to be
consistent with NetworkMonitor by:
 - using Network.java to open the http connection.
 - adding a UserAgent property to the request header.

Test: manually tested.
Bug: 32369183

(cherry picked from commit 454e066e27)

Change-Id: I559eb0497475daad758ba3b3395225dcd0a27a57
2017-01-05 12:12:50 +09:00