Commit Graph

2882 Commits

Author SHA1 Message Date
Pierre Imai
e3b646f25d 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)

Change-Id: I89e2fdfbbfa981d435a2974422d9d9c009872d76
2017-01-26 18:50:18 +09:00
Robin Lee
adb7a1c631 Merge "Disable always-on VPN in factoryReset"
am: 9847e78b72

Change-Id: I021b288e3db17ddefbea3645fd282e3ee123a6e8
2017-01-23 16:47:58 +00:00
Robin Lee
9847e78b72 Merge "Disable always-on VPN in factoryReset" 2017-01-23 16:40:07 +00:00
Erik Kline
b0949a3ede Merge "More concisely export whether we have a "tetherable configuration""
am: 1f2437c65a

Change-Id: I5f9717c9dab6b39f1fbf2186107b2a1f3f2d4f8f
2017-01-23 07:13:56 +00:00
Treehugger Robot
1f2437c65a Merge "More concisely export whether we have a "tetherable configuration"" 2017-01-23 07:04:22 +00:00
Erik Kline
21933391e8 More concisely export whether we have a "tetherable configuration"
Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes
    - vanilla WiFi-to-mobile tethering works
Bug: 32163131
Change-Id: I20dd36b5bf7fc55a639c76ea4bdb55b650654881
2017-01-23 13:04:28 +09:00
Hugo Benichi
dfcad2252b Merge "DO NOT MERGE Unit tests for NetworkNotificationManager"
am: 216a4e7655  -s ours

Change-Id: I05fe9095395df00b96df3cbe3a6e4f31a160e0b5
2017-01-20 07:51:31 +00:00
Hugo Benichi
f4fcd280f1 DO NOT MERGE Unit tests for NetworkNotificationManager
Test: new unit test, no functional changes.
Bug: 32198726

(cherry picked from commit baebb23d3c)

Change-Id: I123de68de9ae353b95edce89eb570cfbb5f8d9a3
2017-01-20 15:08:38 +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
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
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
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
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
Hugo Benichi
fce1a04cc7 DO NOT MERGE Captive portal systel log improvements
This patch improves system logging around captive portal detection to
make inspection of bug reports sligthly easier:

- NetworkMonitor now logs by default CMD_CAPTIVE_PORTAL_RECHECK and
  CMD_CAPTIVE_PORTAL_APP_FINISHED. Other system logs are kept off with
  a new VDBG boolean contant,
- NetworkNotificationManager now prints the notification id at
  notification time. This allows to easily correlate show and clear.
- errors in NetworkNotificationManager are logged as Throwable instead
  of through their implicit toString() method.

Test: $ runtest frameworks-net
Bug: 32198726

(cherry picked from commit 2a3998dd05)

Change-Id: I1eaab5ea702063dde3e23324d3a1b3dc172c5ac5
2017-01-05 12:09:35 +09:00
Hugo Benichi
79a968d619 DO NOT MERGE Fix flaky IpPrefixTest.
Test: IpPrefixTest passes
Bug: 32561414

(cherry picked from commit f5ec69155d)

Change-Id: I42928da87f7f336900b3a95ebbf28563864da8d4
2017-01-05 12:07:38 +09:00
Erik Kline
4f4a914a0f Merge "Have IpManager track L2-L4 signaling traffic required for IP connectivity."
am: 80ff5ecd4a

Change-Id: If85702e1cc44967841ab91d723aa627862bcda21
2016-12-15 12:22:06 +00:00
Erik Kline
867dfd1057 Have IpManager track L2-L4 signaling traffic required for IP connectivity.
Test: as follows
    - built and flashed
    - observed logcat
    - observed "dumpsys wifi ipmanager"
    - runtest BlockingSocketReaderTest passes
    - runtest ConnectivityPacketSummaryTest passes
Bug: 21859053
Bug: 26101306
Bug: 31742572
Bug: 31707128
Bug: 33531488

Change-Id: Ibecaf809dcc1813924b25749e8ba8eb2d4bdf114
2016-12-15 19:09:49 +09:00
Erik Kline
7b5f0a82d0 Merge "More correct startup and shutdown procedures."
am: 8a825051a2

Change-Id: I4844130b04ded0fc913593081d07a6052bdc0e42
2016-12-15 05:25:48 +00:00
Treehugger Robot
8a825051a2 Merge "More correct startup and shutdown procedures." 2016-12-15 05:10:11 +00:00
Erik Kline
679d496620 More correct startup and shutdown procedures.
During IpManager startup, anything sending messages to the state machine
must not begin doing so until after the state machine has been started.
Reorder the constructor accordingly.

During shutdown, AvoidBadWifiTracker needs to unregister the registered
BroadcastReceiver and might as well also unregister the ContentObserver.

Test: backport from internal
Bug: 33388922
Change-Id: I58e07f7ccddaab160c153bcfb69fd45f50bb8710
2016-12-15 10:43:41 +09:00
Erik Kline
af3207bddd Merge "Stop setting net.hostname"
am: 5603f5aabc

Change-Id: Id03d2f8bf6fa8b447c5f32d3d2a51faef193ba62
2016-12-14 07:59:59 +00:00
Treehugger Robot
5603f5aabc Merge "Stop setting net.hostname" 2016-12-14 07:51:00 +00:00
Erik Kline
1b81ea3e69 Stop setting net.hostname
Test: as follows
    - basics:
        - built
        - flashed
        - booted
    - connect to {v4-only, dualstack, v6-only} networks
        - verified expected connectivity on each
    - runtest frameworks-net
Bug: 30979015

Change-Id: I65e9878c7b8eaddaba1c0e1b8566ddfa0760047f
2016-12-14 13:11:15 +09:00
Erik Kline
cc122a0d6c Merge "Stop setting net.dns{1234} system properties."
am: 269d35f870

Change-Id: I9b31b281896995943ce8217c3230867db380a841
2016-12-12 08:29:14 +00:00
Treehugger Robot
269d35f870 Merge "Stop setting net.dns{1234} system properties." 2016-12-12 08:16:35 +00:00
Lorenzo Colitti
5ad2853426 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
787d3da986 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 3664598601)

Change-Id: I7b0706a7e3368f971d508388e8ad4afc5de9d646
2016-12-09 14:35:05 +09:00
Hugo Benichi
74e67ae938 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
Tony Mak
c777123d5c 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)

Change-Id: I929a05c24df01e21415535a333bb14ac4b790a9d
2016-12-09 14:23:10 +09:00
Stephen Chen
757658193d 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)

Change-Id: I46da93ba4afa968facf98f7c3d844fd0c469095a
2016-12-09 13:59:33 +09:00
Hugo Benichi
b1bddc92c5 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)

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

Change-Id: I196ab9ef7f5abe456a783eed65db09279d2ecb8c
2016-12-09 13:59:18 +09:00
Felipe Leme
6670ab4480 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)

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

(cherry picked from commit a4dc2a7129)

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

Change-Id: Ie09b2f43cf6ec745e404d5ec98bd0b072d211ea3
2016-12-09 13:59:04 +09:00
Jeremy Joslin
8c7be6114c 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 13dd0e99ba)

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

Change-Id: If13b363889a8e9396273a90c3d9f9421a48aecbc
2016-12-09 13:42:26 +09:00
Hugo Benichi
301b09738a 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)

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

Change-Id: I1b5fe2a361b5f623a8310ae698497c83d72f3034
2016-12-09 13:42:20 +09:00
Jeremy Klein
fb63d5a4ef 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)

Change-Id: Ia419ff68ef10f308f9e44be47420e27099ee6070
2016-12-09 13:42:02 +09:00
Treehugger Robot
6b0570513e 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
6d442d82d0 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 e3f7299ce2)

Change-Id: Idb640dec13ba64180985544b9709a586af66eb6e
2016-12-09 11:21:31 +09:00
Hugo Benichi
834405cbe4 DO NOT MERGE: 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

(cherry picked from commit 6d8c1dfe4b)

Change-Id: Iefbeac3a688b260fb3f92dfe0bfd9db28e26749d
2016-12-09 11:21:26 +09:00