History log of /frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
11ae28f387bc499ff82448d978dac9524b03f670 27-Sep-2016 Hugo Benichi <hugobenichi@google.com> Change network validation probe default configs

This patch changes the default configuration values for captive
portal detection.

Now by default:
- the HTTPS probe tries to connect to www.google.com/generate_204
instead of connectivitycheck.gstatic.com/generate_204
- the fallback probe is used and tries to connect to
google.com/gen_204
- the request header User-Agent field is set to appears similar to
a Chrome request.

Bug: 29367974
Change-Id: Ic965e2693e154e96bf0f7e4c1b9a2f704b9c3452
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
92eb22fdd2e5e2d99ca0b2c14e68dfd632323a90 27-Sep-2016 Hugo Benichi <hugobenichi@google.com> New Settings symbols for captive portal detection

This patch defines new Settings symbols for
- setting the probe urls for captive portal detection.
- setting which User-Agent to use for captive portal detection.

The existing default values for these settings are not changed, i.e:
- HTTP and HTTPS probes urls are unchanged.
- the fallback probe is not used.
- User-Agent is empty by default.

Bug: 29367974
Change-Id: I6e4b3b172e56b8b67fffa4b51f776d68d5851f25
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
d953bf853d233026c9064e6a0c962b14cf4658d6 27-Sep-2016 Hugo Benichi <hugobenichi@google.com> Captive portal detection uses 3rd fallback probe

This patch adds the possitibility to send a 3rd fallback validation
probe in sendParallelHttpProbes when neither the 1st http probe nor the
https probe came back with a conclusive answer.

This 3rd probe is only used for trying again captive portal detection
and does not return success, so that network validation always fails if
the https probe fails.

In addition, the url reveals a captive portal is now sent to the
CaptivePortalLoginActivity so that all three probes can use different
urls.

Bug: 29367974

Change-Id: I7385fde1aa1316d94aac350af0e956cb193aa4ee
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
f9fdf87af2fe0cb9b70ffa81a0912448f4ef4207 28-Jul-2016 Hugo Benichi <hugobenichi@google.com> IpConnectivityMetrics: no metrics upload in tests

Similarly to ApfTest, this patch changes ConnectivityServiceTest to use
a mock object instead of IpConnectivityLog so that running
ConnectivityServiceTest does not generate android.net.metrics events.

Bug: 30450301
Change-Id: Ibc0479f381f26e60baefbae15407c62aecbf6666
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
b57578ca4f0fa64406ffad09ad9250391e3bbfa5 30-Jun-2016 Lorenzo Colitti <lorenzo@google.com> Rewrite lingering.

The two major changes here are:

- Move lingering out of NetworkMonitor. The fact that lingering
is currently its own state in NetworkMonitor complicates the
logic there: while a network is lingering it cannot be in any
other state, we have to take care not to leave LingeringState
for the wrong reason, etc.
- Instead of keeping a single per-network boolean to indicate
whether a network is lingered or not, keep a linger timer for
every request. This allows us to fix various corner-case bugs
in lingering.

The changes in behaviour compared to the current code can be seen
in the unit test changes. Specifically:

1. Bug fix: when a network is lingered, and a request is added
and removed to it, the existing code tears the network down
immediately. The new code just sends another CALLBACK_LOSING
and resumes lingering with the original timeout.
2. Bug fix: if cell is unvalidated and wifi comes up and
validates before cell does (as might happen on boot), the
existing code immediately tears down cell. The new code
lingers cell, which is correct because unvalidated cell was
the default network, so an app might have been using it.
3. Correctness improvement: always send CALLBACK_AVAILABLE for
the new network before sending CALLBACK_LOSING. This was not
really an issue in practice, because the usual flow is:
- Network A is the default.
- Network B connects, CALLBACK_AVAILABLE.
- Network B validates, CALLBACK_LOSING.

Bug: 23113288
Change-Id: I2f1e779ff6eb869e62921a95aa9d356f380cf30a
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
cfddd6879283860bb4d2cf2972ea086f585a37ec 31-May-2016 Hugo Benichi <hugobenichi@google.com> Refactor IP connectivity event logging

This patch removes static methods for logging IP connectivity events
defined in android.net.metrics and replaces them with a single log()
instance method defined on IpConnectivityLog. Event constructors are
now public also. Every classes logging such events now create an
instance of IpConnectivityLog for logging event objects directly
instantiated with new.

Removing static dependencies allow straightforward testing of logging.

This patch also removes the base IpConnectivityEvent class which is not
needed any more.

Bug: 29035129
Change-Id: I3de700f93f46deaa48a759f938f7d00e1d8bff98
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
1bf6ec2f868041ba4c3d4c88d3ac482bfd4c52b9 24-May-2016 fionaxu <fionaxu@google.com> cold sim clean up

- add a new field: provisioningNotificationEnabled from NetworkMisc. set
to false if we want to hide "sign in" notification and placed
carrier-specific notification instead. it is set on connect, once set,
it is carrier-app's responsibility to post new UI to users
- rework on the interaction between carrier app and framework
- code cleanup
- unit test support

Bug: 28567303
Change-Id: Ic84db7ffbb920d15344717f104496d3cb82e1a85
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
c5be12e7ac43cbe8c68219fa702c6fb7f06183c3 19-Apr-2016 Lorenzo Colitti <lorenzo@google.com> Make isCaptivePortal perform both HTTP and HTTPS probes.

Also a couple of minor cleanups and logging tweaks.

Bug: 26075613
Change-Id: I67b09e96d72764179339b616072bb2ce06aabf33
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
cc92c6e87773df9d5a84922066716ae9bb09cd6d 21-Apr-2016 Hugo Benichi <hugobenichi@google.com> Split network monitoring and portal probe events

This patches changes how captive portal tests and network lifecycle
events are logged as connectivity events:
- it splits NetworkMonitorEvent into two event classes:
- ValidationProbeEvent for logging individual probe events.
- NetworkEvent for logging network connection, validation,
lingering, and disconnection.
- it removes the redundant CaptivePortalCheckResultEvent class.
The information logged in CaptivePortalCheckResultEvent was already
logged by NetworkMonitorEvent, but missing the evaluation durations.
It is now logged by ValidationProbeEvent.
- it removes the CaptivePortalStateChangeEvent class, which is now
redundant with NetworkEvent, but missing evaluation durations.

In addition, it adds event logging when ConnectivityService puts a
network into lingering or removes a network from lingering.

Bug: 28204408
Change-Id: I8f9752e4d36175ecfcbd1545a01a41bad6e06ea4
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
a488c23dd5c9e024fb8ec702cee722916cdeaf0e 15-Apr-2016 Erik Kline <ek@google.com> Expand NetworkMonitor metrics

- add netid to CaptivePortalStateChangeEvent
- add NetworkMonitorEvent for simple duration measurements

Bug: 28204408
Change-Id: I62035e07d64013878a0bce30c67c929c2c7e7a85
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
2324373124f0ba4e59ba6d3de9e274f2fa28cff0 06-Apr-2016 Paul Jensen <pauljensen@google.com> If Internet probe is redirected, pass redirect destination to NetworkAgent.

Transport may use the redirect to make additional determination about network
state.

Bug: 25203607
Change-Id: I07d8918f13fdcbe0b6fd757536bfc1850a2a244f
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
55618be44c5d2a7db3cf23881cace15108f07557 19-Feb-2016 Pierre Imai <imaipi@google.com> Add initial connectivity metrics handling.

Adds initial support for IP connectivity metrics collection (DHCP
client, IP reachability monitor, network monitor, connectivity
service).

Change-Id: If9a0455f2a34aa9abea90f9c1b38e4d895dc1a72
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
be12d76feb1ba55797b408e5fa13c9f9ca1e06ad 10-Mar-2016 Pierre Imai <imaipi@google.com> Remove an unnecessary InputStream and prevent leaking memory.

BUG: 27441906
Change-Id: Ib0ff36c0adc09e1f303a38e8355c84382cbc63fb
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
12acbd7836e989150d73b04452d8ee300d54bcf6 02-Feb-2016 Joe Onorato <joeo@google.com> Turn down the logging a little bit.

Change-Id: Ib6e0e6f3577afac3b9bfe9a9b1cce70fb16d9d04
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
bfecba2938bd01299c74bc7d7cf0191c1908776a 20-Feb-2016 Lorenzo Colitti <lorenzo@google.com> Speed up ConnectivityServiceTest.

1. Override WakeupMessage with an implementation that uses
sendEmptyMessageDelayed. This allows us to replace a
6-second sleep with a 150ms wait.
2. Change waitFor()'s polling interval from 100ms to 50ms.

With these changes ConnectivityServiceTest goes from ~9s to ~3s.

Change-Id: Id78aab9cded90a5b17f09d7f437904e179808dd2
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
b7c2487c8b5fbd154643b8ddade8d88507cae137 04-Jan-2016 Udam Saini <udam@google.com> Makes captive portal server calculation in one place.

This also creates a hidden api for the captive portal server calculation
so that the Setup Wizard can use this as well.

bug:13246857
Change-Id: I4dfd0916df97cfce13252c7cc15f7bd05ed95f77
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
9d3aadb24778cc36a350a04b088d2ed7ee3790e1 02-Dec-2015 Lorenzo Colitti <lorenzo@google.com> Add a new WakeupMessage class and use it in two places.

This is useful when using the new AlarmManager direct callback
interface to wake up the system and request that an object whose
API consists of messages (such as a StateMachine) perform some
action.

In this situation, using AlarmManager.onAlarmListener by itself
will wake up the system to send the message, but does not
guarantee that the system will be awake until the target object
has processed it. This is because as soon as the onAlarmListener
sends the message and returns, the system is free to go to sleep
again.

Bug: 20157436
Bug: 25823676
Change-Id: Idff20029d287f26347441a2523b7fb20eda6a8b0
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
a991c66c12da30d0240ac6c98736edee93d95977 30-Jul-2015 Paul Jensen <pauljensen@google.com> Merge "Fix missing onLost NetworkCallbacks when network loses capability" into mnc-dev
cf4c2c637268b1a2979e20a8b5644916777a02a4 01-Jul-2015 Paul Jensen <pauljensen@google.com> Fix missing onLost NetworkCallbacks when network loses capability

If a network no longer satisfies a NetworkRequest, send the onLost
NetworkCallback. If it was a real request (not listen) then update
the NetworkFactories.

To test this change I created a little infrastructure to fake
different Internet connectivity probe results during tests. This
allowed me to rewrite some of ConnectivityServiceTest's logic for
validating networks. This brought to light a couple issues that
I had to address to keep tests passing:
1. testUnlingeringDoesNotValidate was relying on a bad side-effect
of my old method of ConnectivityServiceTest's logic for
validating networks, so I rewrote the test.
2. ConnectivityService was not sending out NetworkCallbacks for
WiFi when Cellular was validated. I'm including a fix for this
in this CL also.

Bug:22220234
Change-Id: I29314f38189817f8b2561a213c4f9e8522696663
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
e7d0179df53326a24c5b23812ea5d90a26c2d0a1 20-Jul-2015 Erik Kline <ek@google.com> Change to connectivitycheck.gstatic.com

Bug: 18869302
Bug: 22368233
Change-Id: Iaecb59e4ef13a0fa82a0a4a920689804d24044c8
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
bbce221eecdf54317dd0655e5f3507b82db4bfc1 10-Jul-2015 Paul Jensen <pauljensen@google.com> Merge "Fallback to Cellular if WiFi fails to validate" into mnc-dev
49e3edff5156f471819e4ea2a88994bca70bd870 22-May-2015 Paul Jensen <pauljensen@google.com> Add android.net.CaptivePortal class for captive-portal-handling-app callbacks

This new class replaces the awkward string token and ConnectivityManager APIs
used by apps handling captive portals.

Bug:21343774
Change-Id: I1a2c69edb17322715bf8422bb4216b0ea60bfd59
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
e098854c41a72b22f4174bc623e8e93cde8d7331 25-Jun-2015 Paul Jensen <pauljensen@google.com> Fallback to Cellular if WiFi fails to validate

Previously, once a network validated, for the purposes of comparing networks
to select the default network, we always considered it validated.
With this change if a network later fails to validate, we'll take this latest
validation result into account. This means if WiFi and cellular are up
(e.g. if we recently switched from cellular->WiFi, and cellular is now
lingering) and both are validated, but for some reason WiFi fails a validation,
cellular will become the default network connection.

Bug:20896761
Change-Id: I858aa10c1aaec5cd9032067f960963409107bdb1
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
2f0a8974d1f45aad590829042df8cff07e989635 25-Jun-2015 Paul Jensen <pauljensen@google.com> Log DNS results for network validation attempts

This should help aid debugging network validation failures.

Bug:19417093
Change-Id: Idb06f7334d7c14e69fd721a81a00ce3f8d529364
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
22e547ab74eb169782ddb8dc1a16dc327b7cd328 25-Jun-2015 Paul Jensen <pauljensen@google.com> Reducing logging in NetworkMonitor to avoid getting muted

NetworkMonitor's logs are critical for tracking down bugs.
If NetworkMonitor is too chatty it gets muted making it
very hard to track down connectivity failures, so reduce
the logging.

Bug:21480101
Change-Id: Ife63455ec60e4ca6bfb061f23cde09e8e9877601
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
22b4c6a027d72ec90dc91d150bee007cb8167eed 24-Jun-2015 Robert Greenwalt <rgreenwalt@google.com> Add Validation logging.

Persist the last 20 lines of validation info for the last 10
networks.

bug: 21599856
Change-Id: I8124480cc9181eea2adb7eb6eabcd07c9506b6d3
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
ee3e2ce4eea8a1788d91001224ef9f231c399b95 17-Jun-2015 Paul Jensen <pauljensen@google.com> Occasionally retest for captive portals once detected

Once a captive portal has been detected, retest for the presence of
the captive portal every 10 minutes. Some WiFi routers present a
captive portal when the backhaul goes away; with this change if the
backhaul returns and the captive portal goes away, the device will
detect this after a period and remove the notification.

Bug: 21545788
Change-Id: Icabf0a3fff37bccc95f99eba52af13f7a2ddc2f3
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
d7b6ca91e9ecac15949a4484d560cfab5833a431 13-May-2015 Paul Jensen <pauljensen@google.com> Revive ConnectivityServiceTest and add some tests.

Change-Id: I44740a7b21cff18ac2a67d09c4d0e597add19ee0
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
d9be23fa4cafc41dcb8b5e2f090e3f2d91197bfb 19-May-2015 Paul Jensen <pauljensen@google.com> Report invalid network after one failed attempt.

Also, blame UID requesting re-evaluation for first 5 attempts.

Bug:19648073
Change-Id: Ia04eeb1aeb59fcb21de098193dfad832d5fbe3a2
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
700f236afb373125353a304d9098557890b9253f 05-May-2015 Paul Jensen <pauljensen@google.com> Avoid surfacing "Sign in to network" notification if user selects "use as is"
from captive portal app.

Bug:20440795
Change-Id: I2582109008bc8659d64ead316843c15ca573b1ba
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
d0491e9a2c51f8b16f9e11627c38278e3649ae8c 05-May-2015 Paul Jensen <pauljensen@google.com> Make NetworkMonitor do exponential backoff between reevaluation attempts.

bug:19648073
Change-Id: Idbef196710f2851c4d9d39f5776dd80a2c150ddd
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
a179962b61a9c41e8859ce642471928f1ad33c60 24-Apr-2015 Etan Cohen <etancohen@google.com> Merge commit '25a217c' into merge2

Change-Id: I116a9dbf19e95651a7c50393e4dcd7fb59ca3f3f
25a217c0fbda9bbaf58ec08b91115e99f73b727f 28-Feb-2015 Paul Jensen <pauljensen@google.com> Add captive portal API.

This API allows apps other than the system's CaptivePortalLogin
to handle signing in to captive portals.

bug:19416463
Change-Id: I27fce5856b635233e6ff66396d50ccabedd76cf5
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
80047faad914c9b9b4966d6b58fc22800c3fcebc 15-Apr-2015 Vinit Deshpande <vinitd@google.com> am b5e0cfb..557d2f5 from mirror-m-wireless-internal-release

557d2f5 Merge "Add ConnectivityManager.reportNetworkConnectivity() API" into m-wireless-dev
ab5267a Fix onLost/onFound logic in isSettingsAndFilterComboAllowed
bfd17b7 Add ConnectivityManager.reportNetworkConnectivity() API
238e0f9 OBEX Over L2CAP + SDP search API for BT profiles
31a94f4 Add ConnectivityManager.getActiveNetwork(). Rework NetID allocation in ConnectivityService so registerNetworkAgent() can return the allocated NetID.
bf18bed Merge "Non-functional code cleanup of ConnectivityService." into m-wireless-dev
db8784e Merge "Cleanup of Video Call pause functionality." into m-wireless-dev
e75b9e3 Non-functional code cleanup of ConnectivityService.
e593d0a Onfound onlost feature.
0326f58 Merge "API for config app." into m-wireless-dev
e9b056f API for config app.
d5351e7 RTT framework interface update
582b868 Unhide Network.openConnection(URL, Proxy).
0d719ca Fix typos in ConnectivityManager documentation.

Change-Id: Ib4c88f6d7ad1b24227b032555c62a5804194384b
bfd17b75a67e3a3c9a99a87db35be4d753e6bd08 07-Apr-2015 Paul Jensen <pauljensen@google.com> Add ConnectivityManager.reportNetworkConnectivity() API

This new API allows reporting networks that are perceived to provide Internet
connectivity and networks that are not. This allows the framework to avoid
needlessly reevaluating networks where the apps perception matches the
framework's perception. This was not possible with the prior API,
reportBadNetwork.

Bug: 16214361
Change-Id: Id4409bd7538854bd837231fb50e693c10a62b4f2
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
08c7116ab9cd04ad6dd3c04aa1017237e7f409ac 28-Feb-2015 John Spurlock <jspurlock@google.com> Remove unused imports in frameworks/base.

Change-Id: I031443de83f93eb57a98863001826671b18f3b17
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
8fe1742946e92dfe7e01e6a06f48ad626c01bd35 02-Feb-2015 Paul Jensen <pauljensen@google.com> Facilitate network validation on networks with a per-network PAC.

On networks with a per-network PAC, Network.openConnection(URL) will
fetch using NO_PROXY. This will fail on networks where Internet
access is only permitted via the proxy. Always failing network
validation has the potential to disable WiFi auto-join. Instead
of performing the normal connectivity check, instead attempt to
fetch the PAC, as this is meant to succeed with NO_PROXY.

bug:19143573
Change-Id: Ia482f5c046d338c27daf42571f20851dfa36671c
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
351bfad339ede00a81862b3b57234d7a32067279 22-Jan-2015 Lorenzo Colitti <lorenzo@google.com> Make NetworkMonitor less aggressive on broken networks.

1. Retry validation 3 times instead of 10.

Reducing the number of retries speeds up dead network detection
and saves battery on networks that are don't have Internet access
(or block our connectivity checks).

Retrying 10 times is overkill. Each attempt sends 5-10 DNS
requests, waits 10 seconds to transfer only 3 or 4 packets, and
can last up to tens of seconds. Also, in MR1 we now retry every
10 minutes.

2. Make periodic revalidation only try once.

When validating periodically to see if a non-working connection
is working again, only make one attempt every 10 minutes, not
three.

3. Rename "retries" to "attempts" to make things a bit clearer.

Bug: 18922569
Bug: 18869302
Change-Id: I5f70b420c4f1bac0c33bb9ab6afb322902cdac4b
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
cd29cb66f92b008e8547f70b30223ce8dbc1fb86 13-Jan-2015 Lorenzo Colitti <lorenzo@google.com> Switch the connectivity check to its own hostname.

Bug: 18467482
Bug: 18869302
Bug: 18924197
Change-Id: I1de478e9c8a165faf6f1bf81e042d1de9e03c3d5
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
f9fff92d70d20644c5263563f1d0827eaf3315f6 06-Dec-2014 Jeff Davidson <jpd@google.com> Fix flipped captive portal bit in network conditions bcast.

Bug: 18651036
Change-Id: I191fcafab1fc5ba65be06359da1edc7ca5aabc6a
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
7bd8eaf5687e7edbc8c0fb05f371ffb2121d70f9 03-Dec-2014 Paul Jensen <pauljensen@google.com> Retry failed network validation every 10 minutes.

This allows for better recovery from ISP outages.

bug:18489123
Change-Id: Iefffe870bd6b7c19827fdbc323024a600a6025f9
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
be3736d38774210549deb2999bb226d83a29f1ee 26-Nov-2014 Paul Jensen <pauljensen@google.com> Merge "Don't let NetworkMonitor state stop user-initiated transitions." into lmp-mr1-dev
71b645fe9cb8106dfcbf025a3fd7f58698c051bb 13-Oct-2014 Paul Jensen <pauljensen@google.com> Don't let NetworkMonitor state stop user-initiated transitions.

GCM can call reportInetCondition() at any time which can cause
the NetworkMonitor to transition states to reevaluate at any time.
Previously we were only listening for users clicking the sign-in
notificaiton or completing sign-in when in the appropriate state.
With this change NetworkMonitor's state does not stop us from
listening for the user's actions.

bug:17917929
Change-Id: Ic1da31d90f7090e5fc111874cb7c37d505aaf590
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
2c311d61eaf331818e601f97485f88c4cf26384d 17-Nov-2014 Paul Jensen <pauljensen@google.com> Don't bother validating networks that don't satisfy the default request.

The only immediate change in behavior is not validating untrusted networks.

bug:18299572
bug:18394654

Change-Id: I8d626baf37db0bd0f55ddf3af8a0abf094a12369
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
532b6143f6369224b0c220bad08ae48a979b5adf 10-Nov-2014 Paul Jensen <pauljensen@google.com> Fix NetworkMonitor logging to include NetID.

This was broken when NetID selection was moved to after
NetworkAgentInfo construction time. NetworkMonitor inherits
from StateMachine whose log tag is immutable after construction
making it impossible to include the NetID. Instead define a
simple log function in NetworkMonitor that includes correct
NetID. This makes debugging via logs much easier and avoids
ambiguities that can make logs useless.

Change-Id: Ie72fc210b92bd425184d288b35ed476669e2e073
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
7bfa35742a2ac204c71a35801fd4068a2b6ce4a9 19-Sep-2014 Paul Jensen <pauljensen@google.com> Merge "Fix to make repeated lingerings work." into lmp-dev
dcbe8356138bfba3f4bad31c1a7ad036b86f47f4 16-Sep-2014 Paul Jensen <pauljensen@google.com> Fix to make repeated lingerings work.

Previously PendingIntent.getBroadcast() would match an existing Intent
which had the wrong token. Fixed by distinguishing Intents by action.

bug:17482680
bug:17509008
Change-Id: Ib15bb006888850683cc47ca09920962f0707b351
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
49f63fbed4cd84f5da182c85e8b999037dc64f3b 13-Sep-2014 Robert Greenwalt <rgreenwalt@google.com> Report Network status to NetworkAgent.

Currently just valid/invalid based on NetworkMonitor findings.

Changed NetworkMonitor to start out in default state since starting in Offline causes
a spurious invalid report at creation time.

Added some logging.

bug:17395269
Change-Id: I9ae650b561834d8f8979033744d97df852e76df9
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
ad50a1fed01e7c24531ad26d9de70c7b0127ea76 05-Sep-2014 Paul Jensen <pauljensen@google.com> Update Inet state when NetworkMonitor re-evaluates a network.

Previously the Inet state (the little exclamation mark beside the WiFi
and Cellular bars) only transitioned from bad to good once. With this
change it can transition back to bad (and later to good again) if a network
re-evaluation is triggered, say by ConnectivityManager.reportBadNetwork.
Also, avoid triggering re-evaluation in two unwanted cases.

bug:16214361
Change-Id: I7856724249ffcbb0945276dcf45019876231fdaf
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
f9b42de2ab33de2eddf0bf25d88e3f4512aaf932 09-Sep-2014 Paul Jensen <pauljensen@google.com> Merge "Implement ConnectivityManager.reportBadNetwork() to trigger network validation." into lmp-dev
7ccd3dfd53d8d45c447398ff137f052865dfd3b3 29-Aug-2014 Paul Jensen <pauljensen@google.com> Implement ConnectivityManager.reportBadNetwork() to trigger network validation.

Network traffic used to perform the network validation is billed to the UID of
the caller of reportBadNetwork. This change does not change the actions taken
upon validation failing or succeeding: NetworkMonitor will show the sign-in
notification if a captive portal is found. NetworkMonitor will inform
ConnectivityService if a network tests functional. NetworkMonitor will not
take action if a network lacks any connectivity.
Also, remove an unused Thread that was confusing bandwidth billing.

bug:17326268
Change-Id: I7fea23480af54211004a0a1c535a71c2793f21bb
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
1f0ce3382132d02981193a1fa27306a6c7baaf50 03-Sep-2014 Paul Jensen <pauljensen@google.com> Merge "Use alarm rather than delayed message to end lingering." into lmp-dev
177cd38b00c7c61c13bad65c8a4e3fc859335162 25-Aug-2014 Paul Jensen <pauljensen@google.com> Merge "Remove captive portal sign-in actions." into lmp-dev
a68d21350266a6abc16aeb3fec84eafd85b77cc8 22-Aug-2014 Paul Jensen <pauljensen@google.com> Remove captive portal sign-in actions.

This reverts commit e0101cd and removes the related NetworkMonitor code.
The thinking is the broadcasts are not robust enough as they rely on apps
working together and are not sufficiently tested.

bug:17115050
Change-Id: I433032867cc4fea7191a1b13842b16825dc74df4
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
79a08051c5588d8420656813b21993d490e93dd0 21-Aug-2014 Paul Jensen <pauljensen@google.com> Use alarm rather than delayed message to end lingering.

Ending lingering is critical to good battery life. Delayed messages
are not delivered when the device is in a deep sleep, alarms are
however.

bug:17140462
Change-Id: I07e905479f316217d816b36e8c4d96d5daed0047
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
9f1274b7e43d14c7e3a42148ebfda3905fec8b06 21-Aug-2014 Lorenzo Colitti <lorenzo@google.com> Rework the per-network URL API.

This addresses API council comments.

Bug: 17112978
Change-Id: I698b243b2b685d1f25414cee72450be3ae0c2bf0
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
55298581a0750505bc7da0539fe94255f95326a4 20-Aug-2014 Paul Jensen <pauljensen@google.com> Send captive portal broadcast as user CURRENT.

Previously this was sent without a qualifying user.

bug:17138439
Change-Id: I6345f2375fee168f86c0611e76f869e7377befbe
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
d6a3f7ed90d7fa861f579968f12cc30015b3a989 19-Aug-2014 Paul Jensen <pauljensen@google.com> Add missing break statements to avoid unnecessary network validation.

The missing break statements were causing unnecessary network
validation for VPNs and networks that don't provide internet access.

bug:16680764
Change-Id: I714bacdff350a818f7bfba2f505b95c4b3559699
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
fb68f8fbe0213841f393f8bdb5313e4e44f4f116 13-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Don't send NetworkMonitor bcast until systemReady

bug:16913951
Change-Id: I26c5c3353c2d8821452f81765875958d5b9d385b
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
306f1a45c636e3721ae4b84b8797e6349ae6ff57 04-Aug-2014 Paul Jensen <pauljensen@google.com> Add back in ACTION_NETWORK_CONDITIONS_MEASURED broadcast.

This broadcast used to be sent out by the now defunct CaptivePortalTracker.
Begin sending it out again from the NetworkMonitor who now tests for
captive portals.

Change-Id: Ia33beb04e78cfc4fc042c3b999a3d4e2f9ba4c96
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
e547ff281020b08eb51ef7b2786831f7aacdd73c 04-Aug-2014 Paul Jensen <pauljensen@google.com> Use OkHTTP instead of my home-made HTTP, for network validation.

The home-made version was only done because there was no previous way to
perform network-specific HTTP. The home-made version has already shown
incompatibility, see linked bug.

bug:16316314
Change-Id: Ic9e50174552d1466eb1ff59ff9d28e18035cc3e0
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
f0382899c71a540103ba2dbcd0fe8aa8c926c4a8 30-Jul-2014 Lorenzo Colitti <lorenzo@google.com> Use a new socket for each of the host's IP addresses.

If Socket.connect() times out, the socket cannot be used any
more - any attempt to do so fails with EBADF. Use a new
socket for each IP address.

Bug: 16664129
Change-Id: If3616df86f7c2da0eabd30dca5db65d0da85cb17
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
ae6dffb69792a93422c3bbc50088572c99e5b7be 17-Jul-2014 Lorenzo Colitti <lorenzo@google.com> Use getBoundURL for network validation.

Disable for now, until we're more confident that it doesn't choke
on strange captive portals.

Change-Id: Ic8e66a379d32c915c949df70ca0d38535cd5dbe0
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
1fd9aeef08fac363ec3ef2eb61cea519a04c51fd 18-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Quit NetworkMonitors at end of life.

We were creating and orphaning a thread for each network.
Cleanup after ourselves.

bug:16119890
Change-Id: I8c8a9fe471e43f31f712844915992084074e8047
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
fdc4e4af7305514359e041dbec742f4b6561e393 15-Jul-2014 Paul Jensen <pauljensen@google.com> Fix hiding of sign-in to network notification.

Don't rely on the NetworkAgent still being connected when we go to
hide the notification. The notification is hidden when the
NetworkAgent is disconnected so that wasn't a safe assumption.
By using the NetID as the notification identifier we also fix the
issue of multiple notifications of the same network type inadvertently
hiding the incorrect notification with the same network type.

bug:16317917
Change-Id: I01fdc466a0f430af9fc378445586ec7b83b3ac83
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
2bb7e341684ee875bece9fc3c5e03326ae0367d1 15-Jul-2014 Paul Jensen <pauljensen@google.com> Fix T-Mobile provisioning detection.

Add User-Agent to HTTP request for captive portal.

bug:16316314
Change-Id: I32d4f75f4eb114574dd2a39d241cb085383b4f94
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
6bc2c2c34f2b23eae79ad733c97a691734055c4f 07-May-2014 Paul Jensen <pauljensen@google.com> Convert Vpn from NetworkStateTracker to NetworkAgent.

This eliminates the need for the ConnectivityService.VpnCallback class.
This requires shifting VPNs to the new "network" netd API.
VpnService.protect() is modified to no longer go through ConnectivityService.
NetworkCapabilities is extended to add a transport type for VPNs and a
capability requiring a non-VPN (so the default NetworkRequest isn't satisfied
by a VPN).

bug:15409918
Change-Id: Ic4498f1961582208add6f375ad16ce376ee9eb95
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
869868be653cb8eedd338e8347dfee1520d38cec 15-May-2014 Paul Jensen <pauljensen@google.com> Enable network validations and add app to handle captive portal login.

Network validation prevents networks claiming to provide internet connectivity
from becoming the default network in cases where internet connectivity is not
found to actually exist.
If a captive portal is encountered the appropriate broadcasts and notifications
are surfaced to allow apps to handle signing in. If no app handles signing in,
my system app will handle it.

Bug:15409233
Bug:15409354

Change-Id: Ie240d7eac4bdbab8cc7578782bd72d8b26de7951
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java
ca8f16ad14819ba17f5ff3d2e2bf6fbc9bbaa9f7 09-May-2014 Paul Jensen <pauljensen@google.com> Add NetworkMonitor.
At present the network evaluation / captive portal detection
is disabled pending addition of API to bind socket to network.

Change-Id: I5d1f5dc86d4dd9481d52dd45d6da0732054c8315
/frameworks/base/services/core/java/com/android/server/connectivity/NetworkMonitor.java