278715 Commits

Author SHA1 Message Date
Hugo Benichi
eb96bb7338 Removing bogus file added by mistake
This patch deletes a bogus file added by mistake in the change with
commit hash 147aa6d53bc1e9f8a3632553abcf936023806e1d.

Test: no code change.
Bug: 32198726

Change-Id: Iffc6b3a5ebd854dc81d537576a4405955abacba7
2016-12-09 18:28:19 +09:00
Jeff Sharkey
7c670da7ac DO NOT MERGE: Switch over to new "time.android.com" NTP pool.
am: dda938a698  -s ours

Change-Id: I2b1825f00459952d6f3430c99661aafc907e6c37
2016-12-09 09:27:54 +00:00
Stephen Chen
419a061017 DO NOT MERGE: Define API for metering network stats buckets.
am: dadf6caf9f  -s ours

Change-Id: I3dcf9d32deeb09d08364b135714b84e685767dee
2016-12-09 09:27:11 +00:00
Felipe Leme
fbbaf25665 DO NOT MERGE: Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock.
am: e4c029918f  -s ours

Change-Id: Ieeea6db94be1d402fe8129f02bea2586346dcf76
2016-12-09 09:26:31 +00:00
Felipe Leme
b296948b3b DO NOT MERGE: Use @Ignore to explicitly disable a @Test method.
am: 2026ca147b  -s ours

Change-Id: I17818101fa8f47d285cf772a0f67373c1dda5e30
2016-12-09 09:25:12 +00:00
Felipe Leme
82393f7b98 DO NOT MERGE: Fixed NetworkStatsServiceTest and converted it to JUnit4.
am: 77cba4bdf6  -s ours

Change-Id: I907010456f9bb9674748222fd5e82b8b64dce46f
2016-12-09 09:24:24 +00:00
Jeremy Joslin
12bb3f057b DO NOT MERGE: VPN network stat accounting changes.
am: ffe5a46b3e  -s ours

Change-Id: Ic42723be04158feafd268b3859f0e938d3e36d01
2016-12-09 09:23:37 +00:00
Hugo Benichi
f6cb43ae32 DO NOT MERGE: ConnectivityThread: use lazy holder idiom
am: ce765b7a51  -s ours

Change-Id: I0625013f14e4a2c24a238677a3de50961d114619
2016-12-09 09:22:57 +00:00
Hugo Benichi
7337239702 DO NOT MERGE: ConnectivityManager: use ConnectivityThread looper
am: 1853f78d76  -s ours

Change-Id: Ia41bae1435c94e042358e8b88b42f83cd5359a6e
2016-12-09 09:22:16 +00:00
Hugo Benichi
ef148edaa2 DO NOT MERGE: ConnectivityManager: a simpler CallbackHandler
am: 4983e55853  -s ours

Change-Id: I806d5d79994785357390707d77760af3af725477
2016-12-09 09:21:22 +00:00
Philip P. Moltmann
6e8a33a583 DO NOT MERGE: Indicate the NsdServiceInfo attributes are only filled in for a resolved service.
am: 29154b000f  -s ours

Change-Id: I5c7c11dc4f8112f0ca89b482c2ba10a6a94abfba
2016-12-09 09:20:02 +00:00
Jeremy Klein
3cd1ae2261 DO NOT MERGE: Add a null check for the OnStartTetheringCallback.
am: c8e4cc8e99  -s ours

Change-Id: I3290e0f17c8d29f7e7216687f85b7487a3b85ac5
2016-12-09 09:19:21 +00:00
Lorenzo Colitti
ab4c79bd96 Merge changes from topic 'framework-net-aosp'
* changes:
  DO NOT MERGE: frameworks-test: adding missing @SmallTest
  DO NOT MERGE: Netd events: record connect() success/errno
  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: NetworkMonitor: send one DNS probe per web probe
  DO NOT MERGE: NetworkMonitor metrics: add first validation information
  DO NOT MERGE: APF: also drop any ICMPv6 RSs
  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: VPN network stat accounting changes.
  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.
2016-12-09 09:11:22 +00:00
Hugo Benichi
cfcc1cb7bf 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: I7b0706a7e3368f971d508388e8ad4afc5de9d646
2016-12-09 14:35:05 +09:00
Hugo Benichi
5d0f28c7fd DO NOT MERGE: Netd events: record connect() success/errno
Test: $ runtest frameworks-net pass
Bug: 32198976

(cherry picked from commit 8b06bcdfd24100302818ae0e11ee751dd813d5cf)
2016-12-09 14:34:39 +09:00
Lorenzo Colitti
744b02069d DO NOT MERGE: Add missing dependency.
Change-Id: I5deb8e03eb368ab7003f9376f7b4459d2ef5e934
2016-12-09 14:23:17 +09:00
Tony Mak
de7f7d195e 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)

Change-Id: I929a05c24df01e21415535a333bb14ac4b790a9d
2016-12-09 14:23:10 +09:00
Stephen Chen
963e8ddf6d 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 25147878974f82f875062e99cdee85dd33f3f078)

Change-Id: I46da93ba4afa968facf98f7c3d844fd0c469095a
2016-12-09 13:59:33 +09:00
Hugo Benichi
2a43b208cc DO NOT MERGE: NetworkMonitor: send one DNS probe per web probe
This patch changes sligthly the two web probes mechanism for captive
portal detection and network validation so that DNS resolution is always
done for both probes.

In general the target web servers of the two parallel HTTP and HTTPS probes
are now different. This introduces a bias in the latency measurement of
th HTTPS probe since this latency will also include DNS resolution in
general.

Test: manual verification + $ runtest frameworks-net
Bug: 32198726

(cherry picked from commit ab61e7c324b24e46829495bc2597e42ea907c53d)

Change-Id: I3b32ae451f2241849fffe24956758a9f571b1ef1
2016-12-09 13:59:20 +09:00
Hugo Benichi
21680fd25d DO NOT MERGE: NetworkMonitor metrics: add first validation information
This patch adds first validation information to:
  - ValidationProbeEvent, by extending the probe_type int field of to
    also include a bit indicating if the probe was part of a first
    validation attempt or not.
  - NetworkMonitorEvent, by defining new contants for the event_type
    field.

Test: $ runtest frameworks-net
      + manually generating events and inspecting the
        output of $ adb shell dumpsys connmetrics list
Bug: b/32198726

(cherry picked from commit 147aa6d53bc1e9f8a3632553abcf936023806e1d)

Change-Id: Ie7a62c4f62a13ce52806d3adaa9e627cb246073c
2016-12-09 13:59:20 +09:00
Hugo Benichi
02428988ad DO NOT MERGE: APF: also drop any ICMPv6 RSs
Test: new unit test + $ runtest franeworks-net
Bug: 32833400

(cherry picked from commit f98182ef5e80ede5de7f2c2a5f40fc92a46c9704)

Change-Id: Ifaf6e778c811c7d865c790a293b1fce3f43cad1c
2016-12-09 13:59:19 +09:00
Hugo Benichi
53d83d5142 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 99c8294ef0c7a720364abb5884063e0a9d1bb5fe)

Change-Id: If41a24989d5f65aeb439f68741f511b5eb53b18d
2016-12-09 13:59:19 +09:00
Hugo Benichi
cbf8ff83a8 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 38be57b438a0c1754091f045317db2049304e16f)

Change-Id: I196ab9ef7f5abe456a783eed65db09279d2ecb8c
2016-12-09 13:59:18 +09:00
Jeff Sharkey
dda938a698 DO NOT MERGE: Switch over to new "time.android.com" NTP pool.
Also add logging to measure success/failure details.

Test: builds, boots, and NTP fix obtained
Bug: 32969463

(cherry picked from commit d3f689bf14a05de735b5cc92dcf20e7226c78690)

Change-Id: I7da416099ae903fd92beb516251ef4e51673eecf
2016-12-09 13:59:18 +09:00
Stephen Chen
dadf6caf9f DO NOT MERGE: Define API for metering network stats buckets.
This is a continuation of b/26545374, since now we can also set the
metered bit with NetworkScorer. The tracking of metered state changes
will be implemented in a seperate CL.

Bug: 31015360
Bug: 26545374
Test: N/A

(cherry picked from commit 9ac251d1169639c7b955d63b21e80cbc5c394090)

Change-Id: I6a2fcc8577d62daa8823dff9e0128a5cf39ede7b
2016-12-09 13:59:17 +09:00
Felipe Leme
e4c029918f 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 b8f946dc4b24998f14e28573e452ab13ed533347)

Change-Id: Ia9929295ab2396a7ebb133e65d157f98414e4dfa
2016-12-09 13:59:14 +09:00
Felipe Leme
2026ca147b DO NOT MERGE: Use @Ignore to explicitly disable a @Test method.
BUG: 30839080
BUG: 31007021

(cherry picked from commit fc7d7a359f800d7320d29055ef3b4b75157aaf13)

Change-Id: I35942e60493adebb22871541a34240368c691ee7
2016-12-09 13:59:10 +09:00
Felipe Leme
77cba4bdf6 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 574f370c6da52eeffe747248d68ef044617c7bcf)

Change-Id: Ie09b2f43cf6ec745e404d5ec98bd0b072d211ea3
2016-12-09 13:59:04 +09:00
Jeremy Joslin
ffe5a46b3e DO NOT MERGE: 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

(cherry picked from commit 8b436d865c9f287e9ae491e5278cd8874f4a865b)

Change-Id: I06f01aa8fe5fdc06b2d36cfb9c68feb244c2e5de
2016-12-09 13:42:29 +09:00
Hugo Benichi
ce765b7a51 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 c4fe5d373caa9f53686e4d58e61394dd40558957)

Change-Id: If13b363889a8e9396273a90c3d9f9421a48aecbc
2016-12-09 13:42:26 +09:00
Hugo Benichi
1853f78d76 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 7724cdd8b90006c852644d06cf6c8a28450c71c6)

Change-Id: If956addbf8e7b11b36a4b966de7fca00e8f362c1
2016-12-09 13:42:24 +09:00
Hugo Benichi
4983e55853 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 d42650faaa33ec6274278c65a6042228555ddd4f)

Change-Id: I1b5fe2a361b5f623a8310ae698497c83d72f3034
2016-12-09 13:42:20 +09:00
Philip P. Moltmann
29154b000f DO NOT MERGE: Indicate the NsdServiceInfo attributes are only filled in for a resolved service.
Fixes: 28530428

(cherry picked from commit 7d5da4b044183826ac8388c8bdb94ac979a81797)

Change-Id: If2bfc06589adb361f11b89cd5923cb5c255cb680
2016-12-09 13:42:09 +09:00
Jeremy Klein
c8e4cc8e99 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 5f277e1667b49976a77c9fa79b9a04d775f3b49e)

Change-Id: Ia419ff68ef10f308f9e44be47420e27099ee6070
2016-12-09 13:42:02 +09:00
Hugo Benichi
933fb9f3b3 Merge changes from topic 'framework-net-aosp' am: 25afce88a6
am: 5910f412bd

Change-Id: I919fd8d8075c89aa9eb42b505017c075f61824ff
2016-12-09 03:47:48 +00:00
Hugo Benichi
44675b01b1 DO NOT MERGE: IpConnectivityMetrics: rate limit ApfProgramEvents am: f99a33a1b4 -s ours
am: 6765bc08d0  -s ours

Change-Id: I9e3ca112a654018d9d0b72ba1b0963e7fb678cf0
2016-12-09 03:46:50 +00:00
Hugo Benichi
e3876f699c DO NOT MERGE: TokenBucket for rate-limiting and throttling am: 05ad47add8 -s ours
am: c50e9972dd  -s ours

Change-Id: Iaaf4c3b0b335bf741452eb5bcd05c03f45d419fc
2016-12-09 03:45:57 +00:00
Hugo Benichi
5b4a49ea37 DO NOT MERGE: IpConnectivityMetrics reads buffer size in settings am: 8c9e4b68f0 -s ours
am: f3b4c26453  -s ours

Change-Id: I7f2eee043702be1a8878851793b9b17bdb89766b
2016-12-09 03:45:08 +00:00
Lorenzo Colitti
f32347ef25 DO NOT MERGE: CaptivePortalLogin: set mixed content policy to compatibility. am: b55bf38351 -s ours
am: d1c92f25b3  -s ours

Change-Id: I441369366958f6bc55776a4f449715103ed61cc0
2016-12-09 03:43:42 +00:00
Hugo Benichi
af7c2d6c96 DO NOT MERGE: Add IP conn metrics to dumpsys and bug reports am: 5635c270a1 -s ours
am: a67ede1e15  -s ours

Change-Id: I5b363f1f5a3b4dae5de156ea9014d9d259219bcd
2016-12-09 03:42:53 +00:00
Hugo Benichi
f567aa22ff DO NOT MERGE: IpConnectivity metrics: add version number am: 9df2ae138b -s ours
am: 0e67ef7d3f  -s ours

Change-Id: I05ffe76ca4f266bd341fc298cbc03da62991e4bb
2016-12-09 03:41:57 +00:00
Hugo Benichi
5910f412bd Merge changes from topic 'framework-net-aosp'
am: 25afce88a6

Change-Id: I04262e6b654c8ce0fd44139d5568783d75ccbe7b
2016-12-09 03:31:44 +00:00
Hugo Benichi
6765bc08d0 DO NOT MERGE: IpConnectivityMetrics: rate limit ApfProgramEvents
am: f99a33a1b4  -s ours

Change-Id: Iedfe60899226b6007963b0852f87ecebb5bc987e
2016-12-09 03:31:37 +00:00
Hugo Benichi
c50e9972dd DO NOT MERGE: TokenBucket for rate-limiting and throttling
am: 05ad47add8  -s ours

Change-Id: I7f5a7a47d7e430fc503612bfd0a844b5ffe1bde9
2016-12-09 03:30:56 +00:00
Hugo Benichi
f3b4c26453 DO NOT MERGE: IpConnectivityMetrics reads buffer size in settings
am: 8c9e4b68f0  -s ours

Change-Id: Ie3265557cacf2014ace63fcd73f1334330558631
2016-12-09 03:29:58 +00:00
Lorenzo Colitti
d1c92f25b3 DO NOT MERGE: CaptivePortalLogin: set mixed content policy to compatibility.
am: b55bf38351  -s ours

Change-Id: Ia5ca5f84367fd92848aa03446617bb296d4c93b3
2016-12-09 03:28:51 +00:00
Hugo Benichi
a67ede1e15 DO NOT MERGE: Add IP conn metrics to dumpsys and bug reports
am: 5635c270a1  -s ours

Change-Id: Ia9b6e6887fd80211ff054584127ec9141a22fd57
2016-12-09 03:28:06 +00:00
Hugo Benichi
0e67ef7d3f DO NOT MERGE: IpConnectivity metrics: add version number
am: 9df2ae138b  -s ours

Change-Id: If27714f6dc3475030da891cd25a0f8e174ea83e3
2016-12-09 03:27:23 +00:00
Treehugger Robot
25afce88a6 Merge changes from topic 'framework-net-aosp'
* changes:
  DO NOT MERGE: IpConnectivityMetrics: rate limit ApfProgramEvents
  DO NOT MERGE: TokenBucket for rate-limiting and throttling
  DO NOT MERGE: IpConnectivityMetrics reads buffer size in settings
  DO NOT MERGE: CaptivePortalLogin: set mixed content policy to compatibility.
  DO NOT MERGE: Add IP conn metrics to dumpsys and bug reports
  DO NOT MERGE: IpConnectivity metrics: add version number
2016-12-09 03:19:13 +00:00
Hugo Benichi
f99a33a1b4 DO NOT MERGE: 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

(cherry picked from commit e1c173d2240a8eedf7685c9371087dc047a6931f)

Change-Id: Idb640dec13ba64180985544b9709a586af66eb6e
2016-12-09 11:21:31 +09:00