History log of /frameworks/base/services/core/java/com/android/server/ConnectivityService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
60e8ddee376b26b9bd61eb4103e72c63df7bbe29 01-Jul-2016 Lorenzo Colitti <lorenzo@google.com> Make registerDefaultNetwork work on metered networks.

Bug: 29927488
Change-Id: I3b705c2ab0d1493546ffa5185bb5b07d5e25c897
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
ee27cabe343a665bc2224cdb598857d143b567b2 21-Jun-2016 Felipe Leme <felipeal@google.com> Ignore system apps on enforceMeteredApnPolicy().

BUG: 29514913
Fixes: 29448383
Change-Id: I19eb004c937e1c872bbf82caa7a919e43d48a259
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
3e343ffd913fe0c408c8a975a9ad442da65a498a 16-Jun-2016 Robin Lee <rgl@google.com> Merge "Move 'is already always-on' check into Vpn.java" into nyc-dev
9ff1a588786cb2963d76c75f3a077fc17fa1589c 10-Jun-2016 Robin Lee <rgl@google.com> Move 'is already always-on' check into Vpn.java

It's with the rest of the logic now and allows checking whether the
lockdown state matches, too, which led to a lot of misunderstandings.

Fix: 29199431
Change-Id: I94a2c38c4837f9c33b5b9c2becb52eeb7e2a2534
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
78452db2856d627008d64bb2054e8673f93df795 14-Jun-2016 Paul Jensen <pauljensen@google.com> Merge "Show sign-in to network notification to all users, not just owner." into nyc-dev
f8e903fe2c297b2e8a6cf22a148620930cf148b0 13-Jun-2016 Paul Jensen <pauljensen@google.com> Show sign-in to network notification to all users, not just owner.

All users should be made aware a captive portal is in place and be
given the opportunity to sign into the network. Without this fix
other users are not notified and given a chance to sign-in.

Change-Id: I1bf823d5f6a36f391dca4be5f6a584e8562a72a7
Fixes: 23079964
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
812800cb92090db31f609b907c4458ba76cf7f42 13-May-2016 Robin Lee <rgl@google.com> Package changed/removed listeners for always-on VPN

Fix 2 problems of always-on vpn after always-on package is removed
1. Prevent network being locked down (blocking all network traffic)
Otherwise, user has no way to download the vpn app from Play Store,
and never be able to gain control of the network again.
2. Allow user to connect other vpn app.

Implementation
1. Switch off always-on mode if the package gets removed.
2. Restart always-on mode if the package gets replaced/upgraded.

Bug: 29050764
Change-Id: Id3e389ae0b11c6002a5167919292d9634c2014cb
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
916f79882d7867d27fbd7abb32ec53028d9d3951 06-Jun-2016 Paul Jensen <pauljensen@google.com> Merge "Include network name in validation logs for dumpsys" into nyc-dev
0808eb8069ee75b93b3773b4123a85540eae738f 03-Jun-2016 Paul Jensen <pauljensen@google.com> Include network name in validation logs for dumpsys

Previously this was included in the log messages from NetworkMonitor
but that has been removed (ag/944107), making it frequently impossible
to know what network the logs apply to as there may be no way to
correlate NetIDs to WiFi SSIDs or Cellular networks if the log has wrapped.

Bug: 26075613
Change-Id: I2e3cd41fffb616ab9f855cb16790360bd3414793
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
b04a5eab84687d39685a75a04d62b4303134379a 30-May-2016 Victor Chang <vichang@google.com> Fix that fail to setup any vpn after Network Settings reset and always-on vpn is on

Cause: It revoked the user consent of the vpn app without reseting always-on vpn.
In addition, prepareVpn sets legacy vpn as the current package, the state in
Vpn.class is broken, as it thought the current always-on package is legacy vpn,
(mAlwaysOn is only for app vpn, not for legacy vpn). As a result, prepareVpn rejects
all VpnService.prepare.

Bug: 29031820
Change-Id: Id6bf1d6f38cf134a872811806301b8a602fb5725
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
48b18f4fa994e201e3eb4cca1e7c823b198359c5 25-May-2016 Robin Lee <rgl@google.com> Merge "Return legacy VPN info regardless of lockdown mode" into nyc-dev
9d4e66ece64f6b65d8a902a6f03f945a0fe88868 25-May-2016 Hugo Benichi <hugobenichi@google.com> Merge "Fix default network transition event recording" into nyc-dev
1654b1d11c3f4195d6f691bd1b6eb5aa672ffc94 24-May-2016 Hugo Benichi <hugobenichi@google.com> Fix default network transition event recording

When disconnecting from a default network X and falling back on another
connected network Y as the new default, ConnectivityService was
attempting to record this event as a X -> Y "atomic" transition.

In practice the default network connectivity is actually lost and
recovering default network takes some non-zero time.

This patch changes the event recording to always record disconnection as
X -> 0 events. At the same time, if there is a fallback network that is
elected as the new default ConnectivityService will also record a 0 -> Y
event.

This patch also improves pretty-printing of DefaultNetworkEvent.

Extract from $ adb shell dumpsys connectivity_metrics_logger --events
17:51:00.086: DefaultNetworkEvent(0 -> 100:CELLULAR)
17:51:25.232: DefaultNetworkEvent(100:IPv4 -> 101:WIFI) # wifi goes on
17:51:44.064: DefaultNetworkEvent(101:DUAL -> 0) # wifi goes off
17:51:44.187: DefaultNetworkEvent(0 -> 100:CELLULAR)

Bug: 28204408
Change-Id: I63252633235bf6ba833b9ac431a80dda75a93e67
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a4aba6eaf57ab0c41c03368eb7dae1abeba07273 21-May-2016 Felipe Leme <felipeal@google.com> Fixed enforceMeteredApnPolicy when Data Saver is on.

When enforceMeteredApnPolicy() is called when Data Saver mode is on and
the caller's UID is not whitelisted, it should add a
NET_CAPABILITY_NOT_METERED to the capabilities.

Change-Id: Ieed4f4a7634ee023ec58c91859263655e0ba62d4
Fixes: 28608499 (and https://code.google.com/p/android/issues/detail?id=208478)
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
d171df660e19bdba4d188beeb8b6023874712413 19-May-2016 Robin Lee <rgl@google.com> Merge "Lock down networking when waiting for always-on" into nyc-dev
17e6183b85ba3038acb935aaa01415058b2e6ddd 09-May-2016 Robin Lee <rgl@google.com> Lock down networking when waiting for always-on

Fix: 26694104
Fix: 27042309
Fix: 28335277
Change-Id: I47a4c9d2b98235195b1356af3dabf7235870e4fa
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
dbf0210f6f79a459ed6070c8b1859584a7ccfb12 17-May-2016 Robin Lee <rgl@google.com> Return legacy VPN info regardless of lockdown mode

This stops Settings from telling the user detailed information, and
doesn't really protect anything secret -- privileged apps can already
tell that there's an active VPN by looking at network info.

Change-Id: I9c2a3cab6dff1b62e94a9e0735dccde226fd26a3
Fix: 28624328
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
99d5d3d7759883119665d928d110edb14df44ecc 16-May-2016 Felipe Leme <felipeal@google.com> Added a onRestrictBackgroundBlacklistChanged() callback.

When an UID is added / removed to the Data Saver blacklist, it's
necessary to notify internal components such as the Settings UI (which
was erroneously listening to UID rules changes instead).

BUG: 28743623
BUG: 28791717

Change-Id: I11c85e141dfe074ad390fd324309d2412bfbbd45
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
781ba14af2a8c8e85f684208055dba0ebfd5db30 10-May-2016 Felipe Leme <felipeal@google.com> Fixed connectivity state in some power saving scenarios.

NetworkPolicyManagerService (NPMS) manages 4 type of network restriction
when apps are running on background:

- Data Saver Mode (data usage restriction on metered-networks)
- Battery Saver Mode (power restriction on all networks)
- Doze Mode (power restriction on all networks)
- App Idle (power restriction on all networks)

These restrictions affects 2 parts of the system:

- Internal framework state on NPMS which is propagated to other internal
classes.
- External firewall rules (managed by netd).

Although each of the power-related restrictions have their own external firewall
rules, internally apps are whitelisted to them through the same
whitelist, and the current code is only updating the internal state (and
notifying the internal listeners) when Battery Saver Mode is on.

As a consequence of this problem, there are scenarios where an app
correctly does not have internet access (because the firewall rules are
properly set), but the NetworkInfo state returns the wrong state (like
CONNECTED / CONNECTED).

This CL fixes this problem by splitting the power-related logic from
updateRulesForRestrictBackgroundLocked() into its own
method (updateRulesForPowerRestrictionsLocked()), and making sure such
method is called whenever the firewall rules are updated.

Externally to this change, the CTS tests were also improved to verify
the apps get the proper connection state; it can be verified by running:

cts-tradefed run commandAndExit cts -m CtsHostsideNetworkTests \
-t com.android.cts.net.HostsideRestrictBackgroundNetworkTests

BUG: 28521946
Change-Id: Id5187eb7a59c549ef30e2b17627ae2d734afa789
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
d31a97fd83468d27d0f4c6e1455c2f6f59d5a7c9 06-May-2016 Felipe Leme <felipeal@google.com> Fixed connectivity state in some restricted network scenarios.

NetworkPolicyManagerService (NMPS) keeps an internal list of uid
rules (mUidRules) for network restrictions, and when these rules
changes it needs to notify external listeners (such as
ConnectivityService / CS).

Prior to Android N, both Data Saver mode (the feature previously known
as "Restrict Baground Data") and Battery Save mode used the same set of
firewall rules to implement their restrictions: when Battery Saver mode
NPMS would mark all networks as metered and set the proper firewall
rules externally.

Recently, these 2 modes were split in 2 distinct firewall rules and
NMPS.updateRuleForRestrictBackgroundLocked() was changed to update
the mUidRules logic based on the Data Saver firewall (since the Battery
Saver firewall changes are handled externally, on
updateRuleForRestrictPowerLocked()). As such, CS was not notified when
the power-related changes were made, which would cause apps to get a
state of CONNECTED / CONNECTED when querying its active connection.

Another scenario that is not properly handled is when a UID whitelisted
for Data Saver is brought back to foreground: although the proper
firewall rules are set, CS is not notified, and the apps state would be
DISCONNECTED / BLOCKED.

This CL introduces many changes that fix this issue:

- Fixed updateRuleForRestrictBackgroundLocked() to invoke
onUidRulesChanged() when the Battery Saver status changed.
- Fixed updateRuleForRestrictBackgroundLocked() to invoke
onUidRulesChanged() when an app whitelisted for Data Saver is brought
back to the foreground.
- Added a new API (onRestrictPowerChanged() and getRestrictPower())
to notify external services about Battery Saver mode changes.
- Fixed CS logic to properly handle the Battery Saver changes.

Externally to this change, the CTS tests were also improved to verify
the apps get the proper connection state; they can be verified running:

cts-tradefed run commandAndExit cts -m CtsHostsideNetworkTests \
-t com.android.cts.net.HostsideRestrictBackgroundNetworkTests

BUG: 28521946

Change-Id: I8eaccd39968eb4b8c6b34f462fbc541e5daf55f1
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
46c4fc357ce8e686b6e7c2adda573e9870a8221f 04-May-2016 Felipe Leme <felipeal@google.com> Refactored NetworkPolicyManagerService mUidRules.

NetworkPolicyManagerService (NMPS) keeps an internal list of uid
rules (mUidRules) for network restrictions, and when these rules
changes it needs to notify external listeners (such as
ConnectivityService / CS).

Prior to Android N, both Data Saver mode (the feature previously known
as "Restrict Baground Data") and Battery Save mode used the same set of
firewall rules to implement their restrictions: when Battery Saver mode
NPMS would mark all networks as metered and set the proper firewall
rules externally.

Recently, these 2 modes were split in 2 distinct firewall rules and
NMPS.updateRuleForRestrictBackgroundLocked() was changed to update
the mUidRules logic based on the Data Saver firewall (since the Battery
Saver firewall changes are handled externally, on
updateRuleForRestrictPowerLocked()). As such, CS was not notified when
the power-related changes were made, which would cause apps to get a
state of CONNECTED / CONNECTED when querying its active connection.

This change refactores the mUidRules to use bitmasks, in preparation for
another change that will fix the issue.

It also fixes a minor bug that was preventing removed packages to be
removed from the whitelist.

BUG: 28521946
Change-Id: I9f0e1509a6192cad403f740c1cd76a6b7dab7d26
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
7ec93a1ee2d381fdcd3be271712e4179ddbf9829 04-May-2016 Robin Lee <rgl@google.com> Merge "Add lockdownEnabled parameter to always-on VPN API" into nyc-dev
a5e6553917359bb662c8f2788feb3d617803d406 04-May-2016 Robin Lee <rgl@google.com> Merge changes I31d5260d,Ied92f558 into nyc-dev

* changes:
Start VPN as early as possible during startup
Split network agent created state from connected state
323f29df583e9338e3b2bf90fc8c0785a934a61b 04-May-2016 Robin Lee <rgl@google.com> Start VPN as early as possible during startup

- Switch from USER_STARTING to USER_STARTED which is the foreground
version of the broadcast

- Set the new VPN network as CONNECTING initially to avoid spamming
apps with useless notifications ahead of the network being fully
available

Bug: 26694104
Fix: 28335277
Change-Id: I31d5260dda62ff440c31c44eb0aa5c891e2717e5
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
585e24889455d1d70d14a9c89a8acef922994898 02-May-2016 Robin Lee <rgl@google.com> Split network agent created state from connected state

Network creation setup sometimes involves extra steps after actually
calling into netd to create the underlying network, rules & routes &
to begin allowing sockets bound to it.

For example, VPN networks can set a UID whitelist or blacklist. This
should happen:

- AFTER there is a netID & network created in netd as
network-specific rules will need to be tied to / point at it. Those
rules are tied to the lifecycle of netd's network which is tracked
by `NetworkAgentInfo.created` on the frameworks side.

- BEFORE the CONNECTED broadcast and network callbacks have been sent
out so that we don't create a race condition between clients that
want to use the network and the server actually having the network
ready

The race condition existed prior to this change and required any client
making use of network callbacks to sleep for a short amount of time after
receiving to actually be able to use the network.

Among other things, that race condition is now fixed.

Bug: 26694104
Change-Id: Ied92f5588a98c3e97f456bc98b676bf201ab5472
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
dc67971a996c447c71ceb9ad983c79c96f598bcc 03-May-2016 Robin Lee <rgl@google.com> Add lockdownEnabled parameter to always-on VPN API

Allows callers to opt-out of blockading network traffic during boot and
on VPN app failure.

Bug: 26694104
Change-Id: Ibfbd43ad09a25f2e38053fcd6306df3711f8bde2
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
4a992cbde834fdf3770e34b21361b47f4786f65f 02-May-2016 Lorenzo Colitti <lorenzo@google.com> Merge changes I86257bc8,I5c2221c5 into nyc-dev

* changes:
Use Netd's binder interface to set resolver configuration.
Add Gservices settings for resolver configuration.
bd8759bdd102c1991f899bff4a4dd093345c6b52 28-Apr-2016 Pierre Imai <imaipi@google.com> Use Netd's binder interface to set resolver configuration.

BUG: 25731675
Change-Id: I86257bc84371832466161e5357ae173c305a7d18
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
1b6519bd87a59a10e9928e5772a17976692611da 28-Apr-2016 Jeff Sharkey <jsharkey@android.com> Flag to mark foreground jobs, fix data saver.

When a job will eventually run in the foreground, the internal
scheduling needs to ignore any background network restrictions when
satisfying constraints. This also means the job should ignore the
current device doze state, since the requesting app could get the
same behavior by starting their own foreground service.

Always dispatch network policy changes to ConnectivityService first
to ensure that it has up-to-date information. Fix bugs around data
saver that were causing networks to not be marked as BLOCKED for
background apps; before this fix apps would have been spinning in
internal connectivity loops, thinking that the network was actually
connected when the kernel was actually blocking their traffic.

Offer new ConnectivityService method overloads to ignore the blocked
state for a specific UID.

Print unsatisfied job constraints to aid debugging.

Bug: 26571724
Change-Id: Iaaa17933e6dc1bf6d3dff26d0bfc12222e51e241
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
ad2e4bf9f36cf612db6c397feca8effb125ee541 26-Apr-2016 Amith Yamasani <yamasani@google.com> Stop user faster and clear stale broadcasts

Moved several USER_STOPPING registered receivers to listen
to USER_STOPPED, since they don't need to be blocking the
shutdown of the user.

Clear all stale broadcasts when stopping a user, so that we
don't unnecessarily start up processes and deliver stale
broadcasts. This was causing code to run when the user was
already stopped and resulted in crashes when other providers
and services couldn't be started anymore. Hopefully this fixes
many of those races.

Bug: 28371487
Change-Id: Ic35a7a23fa8fe009a53f8bf7545d4dad5fa34134
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
70c8b9b66027409f9dec91872cbe8ae8756d5ea4 25-Apr-2016 Felipe Leme <felipeal@google.com> Tethering and Data Saver: There Can Be Only One!

If tethering is on when Data Saver mode is turned on, tethering should
be disabled, and vice-versa.

BUG: 28313291
Change-Id: I7f3dadbd97ea1492ab76b41043dea7487c1db02d
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
f07c7b9fd0a640bff4bf7690373613da217fe69b 22-Apr-2016 Jeff Sharkey <jsharkey@android.com> API changes for DownloadManager and JobScheduler.

To support moving DownloadManager, add new JobScheduler network type
constraint that matches "any network except roaming." Also add an
API to get a specific JobInfo by ID.

Since the default network can be different on a per-app basis, and
individual apps may be blocked due to app standby, evaluate job
connectivity constraints on a per-UID basis. To implement this
cleanly, add NetworkInfo.isMetered() to match the isRoaming() API.

Add new DownloadManager APIs to support charging and device idle
constraints, which are plumbed through to JobScheduler under the
hood when scheduled.

Add filtering to JobScheduler dumpsys to omit noisy details for
packages the caller isn't interested in.

Bug: 28098882, 26571724, 19821935
Change-Id: I09ca7184ef7ce6adba399f579d415a5fb2ea6110
/frameworks/base/services/core/java/com/android/server/ConnectivityService.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/ConnectivityService.java
3f4510535397bf103d0299440a0299ff8bbeec28 21-Apr-2016 Paul Jensen <pauljensen@google.com> Merge "Cap number of NetworkRequests a UID can make to 100" into nyc-dev
5f16f760ad2469c8d5636f45974a2f725ef289be 19-Apr-2016 Hugo Benichi <hugobenichi@google.com> Some fixes in ConnectivityService event logging

Bug: 28204408
Change-Id: I44ed9539bb213a845c2bcc2861c947af7c3c9ef4
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
4e1d3fdf7a43b3e43efac0a26ca3d0f458ce87d3 08-Apr-2016 Paul Jensen <pauljensen@google.com> Cap number of NetworkRequests a UID can make to 100

This prevents DoSing ConnectivityService with too many requests.

Fixes: 27253080
Change-Id: Id0480d220b2f01b9ef1146bef8ead2fc8287e28d
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
019fcd2bec414fbb730c0bb0fa62995ee692c5bf 19-Apr-2016 Felipe Leme <felipeal@google.com> Added onRestrictBackgroundWhitelistChanged callback.

When users add or remove an app to the Data Saver Mode whitelist, the
app is notified through a
ConnectivityManager.ACTION_RESTRICT_BACKGROUND_CHANGED. But besides this
broadcast, it's also necessary to notify internal apps such Settings,
hence a new method is being added to INetworkPolicyListener.

BUG: 27481520
Change-Id: I1537a77becf6b7da1535ed5faabdc894fd9f7084
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a09b4d2a611a7606e8fc8c73a24bd941b6fc173f 15-Apr-2016 Narayan Kamath <narayan@google.com> Remove unnecessary allocation+unboxing of objects.

Transforming String->int can be done with 0 allocations
using Integer.parseInt.

bug: 28078871
Change-Id: I8d9f322d7154728849dde61ef282046032858d60
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
48f12f2ad6e59484f528978ce3627c16be3bf10d 14-Apr-2016 Erik Kline <ek@google.com> Also log IPv4 and IPv6 connectivity of any previous default network

Change-Id: I07595c0a131fea21914f524949cd64af87403b88
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
04e22225a7d98cc8fc6bced71c89192e0cefc84b 12-Apr-2016 Pierre Imai <imaipi@google.com> Log an event whenever we lose the default network.

Change-Id: Ia71865a90b2db5dc0d3ad627563a6b1f99686f04
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
6b4e15b1558e13cb9d9b3975412c4c6bda6e0c37 06-Apr-2016 Pierre Imai <imaipi@google.com> Record the transport types for connectivity events.

BUG: 25691077
Change-Id: I40b6de5446325e717c0356603fd66cd395db9acb
/frameworks/base/services/core/java/com/android/server/ConnectivityService.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/ConnectivityService.java
ed748c2c56b8f4845cdf4e90161ed8ede933f087 11-Apr-2016 Lorenzo Colitti <lorenzo@google.com> Merge "Reinstate much-reduced ConnectivityService logging." into nyc-dev
b89d33ee4467161cb270d765bd873efab781004d 11-Apr-2016 Lorenzo Colitti <lorenzo@google.com> Merge changes Ic2c84de7,I379aef92 into nyc-dev

* changes:
Remove duplicated code in NetworkStateTrackerHandler.
Improve Tethering and NativeDaemonConnector logging.
39d2bb56b6a938ae053d96d385a68b858678d6ad 08-Apr-2016 Lorenzo Colitti <lorenzo@google.com> Reinstate much-reduced ConnectivityService logging.

Change-Id: I9d1292f8c036be2a854fdb537f4ccb957d211966
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
9b0c8fd95cd513660acfa990874ad3060403c8f3 05-Apr-2016 Lorenzo Colitti <lorenzo@google.com> Remove duplicated code in NetworkStateTrackerHandler.

Also use MessageUtils to decode message names.

Change-Id: Ic2c84de73fbf3eb10cc9634a083e5d3b3ffb807a
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
1b83651e7fca620589a6317d3a8559e43a19485c 07-Apr-2016 Robin Lee <rgl@google.com> Merge "Internal API for system apps to determine default network for other apps" into nyc-dev
d2baf792f8b7ae46aa6a35cff25eb7e3923f5125 24-Mar-2016 Robin Lee <rgl@google.com> Internal API for system apps to determine default network for other apps

Callers with CONNECTIVITY_INTERNAL permission can read off the netId
that an application is assigned to by default.

Necessary for making connections as the default network for a client
app eg. when downloading stuff on its behalf.

Bug: 27074270
Change-Id: I8d35e8e99126875f55f3c545090326f3e9be43fb
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
94887874e385797ac5290e867fe412b9d6fc2f9c 05-Apr-2016 Erik Kline <ek@google.com> Don't flush DNS cache on route changes.

Since Lollipop, routes are isolated within Networks. Flushing a
Network's DNS cache whenever that same Network's routes are updated
doesn't provide any benefit. Any system components depending on this
behaviour need to uncovered and fixed.

Additionally, clean up no-longer-used flushNetworkDnsCache(). This
should be replaced, when needed, by a proper binder interface to netd.

Change-Id: I34bf79e4839da014d466058a876d754209d0c007
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
3609013c8664c11defd50bd93ebbc6745c17a4e2 05-Apr-2016 Erik Kline <ek@google.com> Delete unused default DNS setting code

Change-Id: I601a647714171f205d179d6fef6c112949fc5a94
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
f21b4dc1d6e9cc3fc164828e9eba33445c0801d0 18-Mar-2016 Paul Jensen <pauljensen@google.com> Move ApfFilter from ConnectivityService to IpManager

There's a few advantages to having ApfFilter in IpManager:
1. If things go wrong, crashing a particular transport is less bad then
crashing ConnectivityService. We also don't want to use
ConnectivityService as a dumping ground for transport-specific logic.
2. This makes implementing WifiManager.MulticastLock a lot simpler and
safer because enabling/disabling it doesn't have to go through the
NetworkAgent, which could risk various races (e.g. installing a filter
into the wrong WiFi network).
3. IpManager is the ultimate source for LinkProperties for a particular
transport and since ApfFilter uses the LinkProperties it's better to
have it closely paired with the IpManager. Likewise, ApfFilter needs
to know the APF capabilities of the transport, so having it in
the transport avoids having to parcel this information through the
NetworkAgent.

Bug: 26238573
Change-Id: I99b85f2b64972f0e7572170ec5d1926081aa3429
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
f262a7e36932f8581cb147ad80dac7df6a5e7009 25-Mar-2016 Pierre Imai <imaipi@google.com> Merge "Add initial connectivity metrics handling." into nyc-dev
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/ConnectivityService.java
371c7b7dc6b922527390c42988c49d1ddd937d17 22-Mar-2016 Erik Kline <ek@google.com> Add "track default" type to NetworkRequestInfo

The "default network tracking" request is somewhere between a listen
and a request, in previous semantics. It is more like a listen in that
it doesn't cause any network to be brought up, but also like a request
in that will only get callbacks about a single network at a time (not
all networks that might match).

This change minimally splits the NetworkRequest types into 3: LISTEN,
REQUEST, and TRACK_DEFAULT.

Change-Id: I2d113b2f6eed526a7808592bce0118260a56f77c
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a2d29407d02ba692a90507db8b6fc2cf5cf89725 16-Mar-2016 Erik Kline <ek@google.com> Support registering a request for the default network

Change-Id: I079f5be97b585cf5692dd4c7a144b993d168a9a5
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
5ff640d1f257c351a0e22e243532fecc4682f36d 03-Mar-2016 Lorenzo Colitti <lorenzo@google.com> APF: add debug code.

1. Store additional debug information when RA filtering.
2. Add a toString method for RA packets.
3. Make "adb shell dumpsys connectivity apf" dump APF filter
state.

Bug: 26238573
Change-Id: I1441ff7bc90e63624f8b10a220b2ac97f4d390a5
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
18566c1baeaeeca2940e04e1d78640f5693c609b 14-Mar-2016 Robin Lee <rgl@google.com> Skip lockdown setup if user is not up yet

Sometimes USER_UNLOCKED can be sent before USER_STARTED. This puts
lockdown in a bad state as it needs a fully-functioning user to tie
itself to and listen for connectivity events.

Bug: 27637943
Change-Id: I41a784a75a8c8674cb61dbba10693dd56c9396dd
/frameworks/base/services/core/java/com/android/server/ConnectivityService.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/ConnectivityService.java
978c80b474e4b390e62da3e13b5e7e11667005bb 03-Mar-2016 Paul Jensen <pauljensen@google.com> Have ConnectivityService install packet filters when possible
am: 578a76e7de

* commit '578a76e7de77492ac33e407fff4fb9a2f5550d8a':
Have ConnectivityService install packet filters when possible
578a76e7de77492ac33e407fff4fb9a2f5550d8a 14-Jan-2016 Paul Jensen <pauljensen@google.com> Have ConnectivityService install packet filters when possible

Listen for ICMP6 router advertisements on networks that support
packet filters. Construct packet filters and install them to
ignore redundant future ICMP6 router advertisements.

Bug: 26238573
Change-Id: If78300b9fda257c21f3ee6533e1da7de9f897cb4
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
89e7a696f0902f1116f3ccc7eec786aec0c5de97 29-Feb-2016 Robin Lee <rgl@google.com> ConnectivityService: listen to USER_UNLOCKED too

When the credential-encrypted private storage for the target user is
unlocked, we should try to start up VPN for them.

Bug: 27357283
Change-Id: Id9079230d00e3cea08a49ae66bd1f553416b4f54
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
aaa20ad134069e4cefbbe9d2633a71482167f94b 29-Jan-2016 Jeremy Klein <jlklein@google.com> Remove several TetherUtil functions which are no longer needed.

Slowly chipping away at TetherUtil to clean up this code.
This CL also adds an admin check to
ConnectivityService.isTetheringSupported to get parity with the
TetherUtil function before removing it.

Change-Id: Ibe7c5c9fb420d57e5458f77dad30e8a1e751a3e2
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
0b93c5dd988250a0f0d6d9e7400c86e5801a3a30 20-Jan-2016 Jeff Davidson <jpd@google.com> Notify NetworkStatsService of roaming status changes.

When the roaming status of the cell network changes, it is handled as
follows:

-DcActiveState gets an event (either EVENT_DATA_CONNECTION_ROAM_ON or
EVENT_DATA_CONNECTION_ROAM_OFF) and calls
NetworkAgent#sendNetworkInfo with updated NetworkInfo.
-ConnectivityService then gets an EVENT_NETWORK_INFO_CHANGED and calls
updateNetworkInfo with the new info.

With the previous code, the NetworkAgent's NetworkInfo object would be
updated internally, but because the state of the connection had not
changed from CONNECTED, the change would be considered a duplicate and
otherwise ignored.

With the new code, we call notifyIfacesChanged() when the state is the
same but the roaming status has changed. That should be all that is
necessary, as roaming is not exposed as a link property or network
capability today.

Bug: 26545456
Change-Id: I33d32d1fa84ce41dbe01542e5b498eda4b744b74
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
e496c555b94086020b0ec155f6a87f6645c6cd93 28-Jan-2016 Etan Cohen <etancohen@google.com> Merge "Allow NetworkFactories to match any network specifier on a request" into mm-wireless-dev
am: bd0858ba67

* commit 'bd0858ba679cced35bda55a643707ad69e4caa34':
Allow NetworkFactories to match any network specifier on a request
fa8712bc0636e5a5a7f00eefc994be7fbfe2fddd 26-Jan-2016 Jeremy Klein <jlklein@google.com> Remove the unused Looper param from Tethering constructor.

Tethering just constructs its own Looper right below where it
assigns the looper param to mLooper.

Change-Id: I2d522942eff2ad3439bb3961e78ab0625d3fa9df
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
36c7aa03255d91cfa0808323ac475ad02d161d7d 22-Jan-2016 Jeremy Klein <jlklein@google.com> Expose a simple tethering API which includes provision checks.

This CL exposes startTethering and stopTethering functions which also
encapsulate all provisioning check logic. Right now, only silent checks
are implemented, but UI checks will come in a follow-up CL. GTS tests
and Settings changes are under the same topic ID.

BUG: 26247383
Change-Id: I65f61d899594cb3f9035d8496366af17a57a090f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
4ed030384ca0bcb2d0916bdd8e2cd2b4c38e0713 22-Jan-2016 Lorenzo Colitti <lorenzo@google.com> Merge "Debug logging for when getActiveNetworkInfo returns BLOCKED." into mnc-dr1.5-dev am: a6855a1faa am: d841d71593
am: af0c4d0c7e

* commit 'af0c4d0c7e680208075bea7b4b2df4d39ffc82f7':
Debug logging for when getActiveNetworkInfo returns BLOCKED.
c1a6ce70bef373c0fd1531fdd3f9553f9713c0af 21-Jan-2016 Lorenzo Colitti <lorenzo@google.com> Debug logging for when getActiveNetworkInfo returns BLOCKED.

Bug: 26488100
Change-Id: I991581732d35aed18392bed2f3d69ca8fb231f5e
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
9a5f48535d5d2972308c06d81fd55adf7e44dc49 17-Dec-2015 Robin Lee <rgl@google.com> [VPN] start lockdown before user is unlocked

Removed the dependency on KeyStore encryption by removing that flag for
VPN profiles which don't use secure credentials when saving in Settings.

Old encrypted profiles will simply fail to load untile USER_PRESENT is
sent, as before.

Bug: 26108660
Change-Id: I2677d741d54252f15cb772c94ce1b39041f1e19c
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
b68d2d5b68dc58fb7b75ce94af74de58a1b9d3f9 14-Jan-2016 Robin Lee <rgl@google.com> Merge "Always-on app VPNs"
244ce8ef5f201cf403bab43df8281671a9e94512 05-Jan-2016 Robin Lee <rgl@google.com> Always-on app VPNs

Bug: 22547950
Change-Id: I46b204170bfac58d944f39b22f815b080de71a58
/frameworks/base/services/core/java/com/android/server/ConnectivityService.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/ConnectivityService.java
ddb9ef0357e3ee609e188fb9e1e461f95aa601fa 18-Nov-2015 Etan Cohen <etancohen@google.com> Allow NetworkFactories to match any network specifier on a request

Current usage of NetworkSpecifier: network factory will match a request
if the request has either a (1) empty network specifier, or (2) a
network specifier which is identical to that of the network factory.
Note: 'matching' w.r.t. network specifier - all other matching rules
are still in effect.

Change: add rule (3) or the network specifier of the network factory
is the special string (which is defined as "*" and which user-facing
network requests aren't allowed to use).

Rationale: allows on-demand network creation.

Example:
- Can specify a Wi-Fi NetworkRequest with NetworkSpecifier="ssid"
- It will match a Wi-Fi network factory specifying NetworkSpecifier="*"
- That network factory will bring up a Wi-Fi network, connecting to the
specified SSID.
- Once the network is created it will create a NetworkAgent which will
now have a NetworkSpecifier matching that of the request (not the
match-all special string!)

That final step of making sure that the NetworkAgent matches the request
and not the match-all is critical to delivering any subsequent callbacks
correctly. I.e. your network will only get callbacks which match it.

Bug: 26192833
Change-Id: I49e3b492e0bb48a3f6e9a34e3f94f0e1cf89741f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
16c9a107b594816ce56b397f0a454368d9e20b35 15-Dec-2015 Lorenzo Colitti <lorenzo@google.com> Merge "Remove defunct EVENT_SEND_STICKY_BROADCAST_INTENT."
e0e413e2b17a0164e15c77f4ab51b3166f9111d2 10-Dec-2015 Dianne Hackborn <hackbod@google.com> Add new target SDK filtering feature to BroadcastOptions.

You can now control the range of target SDKs that receivers
will be need to have in order to receive your broadcast.

Use this for CONNECTIVITY_ACTION to not allow N+ applications
to receive these broadcasts through their manifest.

Also tweak the broadcast debug output code to now include the
disposition of each receiver in the list. This is becoming
important as skipping receivers is becoming a more common
thing to have happen.

Change-Id: I251daf68575c07cbb447536286ab4e68b7015148
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
8bcb273ff20b5f7c4fb0690f949d7f2d3d52acda 10-Dec-2015 Lorenzo Colitti <lorenzo@google.com> Remove defunct EVENT_SEND_STICKY_BROADCAST_INTENT.

http://ag/572619 , which removed the 3-second CONNECTIVITY_ACTION delay,
removed its only caller, but missed removing the message declaration
and processing code.

Bug: 20013379
Change-Id: Ice573569715ba424b8bf66d1dd08184d2b4a60f1
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
67fb3d7358f01c1bea429b680db54629d6ff4a19 22-Oct-2015 Lorenzo Colitti <lorenzo@google.com> Merge "Reinstate CHANGE_NETWORK_STATE as a normal permission." into mnc-dr-dev am: 809dcade99 am: bdc458048a am: bb8f652372
am: 8ecad265b6

* commit '8ecad265b6db57f78dd142e974057c91f69489ed':
Reinstate CHANGE_NETWORK_STATE as a normal permission.
d54270506669e474b5b8d1703212c77780a04ae9 15-Oct-2015 Lorenzo Colitti <lorenzo@google.com> Reinstate CHANGE_NETWORK_STATE as a normal permission.

This is a partial revert of http://ag/738523 , but not a full
revert because M apps that have gone through the WRITE_SETTINGS
route to obtain permission to change network state should
continue to have permission to do so.

Specifically:

1. Change the protection level of CHANGE_NETWORK_STATE back from
"signature|preinstalled|appop|pre23" to "normal". This allows
apps that declare CHANGE_NETWORK_STATE in their manifest to
acquire it, even if they target the M SDK or above.
2. Change the ConnectivityManager permission checks so that they
first check CHANGE_NETWORK_STATE, and then ask Settings
if the app has the WRITE_SETTINGS runtime permission.
3. Slightly simplify the code in the Settings provider code that
deals specifically with the ability to change network state.
4. Make the ConnectivityService permissions checks use the
ConnectivityManager code to avoid code duplication.
5. Update the ConnectivityManager public Javadoc to list both
CHANGE_NETWORK_STATE and WRITE_SETTINGS.

Bug: 21588539
Bug: 23597341
Change-Id: Ic06a26517c95f9ad94183f6d126fd0de45de346e
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
d913112189e3ea7e56e8b9d1ea19359fe0f3b707 21-Oct-2015 Lorenzo Colitti <lorenzo@google.com> Merge "Don\'t buzz when automatically connecting to captive portals" into mnc-dr-dev am: d214496319 am: 5c09f31e49 am: 18ec0b5187
am: d597bf8f53

* commit 'd597bf8f536b319c02f82663ecb67e64525b5187':
Don't buzz when automatically connecting to captive portals
46d50b708de20e2a26a61ba516c524841b4e11dc 21-Oct-2015 Lorenzo Colitti <lorenzo@google.com> Don't buzz when automatically connecting to captive portals

Play a sound and vibrate (by setting DEFAULT_ALL) only if the
user manually selected the network. This applies to both captive
portals and networks with no Internet access.

Bug: 24126143
Change-Id: Idf075d5c85f9f4b07a3431a25d1a3f7089cf1ee2
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
12ff46df1af8bd252c3973351cd52be178b415c4 14-Oct-2015 Erik Kline <ek@google.com> am 51eb6e14: am 9c8abd1d: am f23eece2: am b7e722b8: Merge "Don\'t crash if an invalid always-on VPN profile is configured." into mnc-dr-dev

* commit '51eb6e149581f04802784f972dfc3794a64a1788':
Don't crash if an invalid always-on VPN profile is configured.
b7e722b88fab8b67f8a2ef54a7acb8c6672b6f46 14-Oct-2015 Erik Kline <ek@google.com> Merge "Don't crash if an invalid always-on VPN profile is configured." into mnc-dr-dev
9b23f885525b38f0042b315e8254ea663e433ad8 13-Oct-2015 Lorenzo Colitti <lorenzo@google.com> Don't crash if an invalid always-on VPN profile is configured.

This is currently being hit because Settings does not clear the
always-on VPN configuration when the corresponding VPN profile is
deleted. This will be fixed in Settings, but there's no harm in
being robust to invalid configurations here.

Bug: 23625458
Change-Id: Id185a54d5892339197cd40026df5174debd957cf
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
75f47866066d5b06924530417c7cb72296753ccb 13-Oct-2015 Jeff Sharkey <jsharkey@android.com> resolved conflicts for f20a5700 to master

Change-Id: I1f13a63c3680901fac58ef709118c9242032b11f
a03ecf7d7c8ff2844caf5feecc6d29f1f7346ff9 12-Oct-2015 Jeff Sharkey <jsharkey@google.com> Merge "Push firewall rules up to ConnectivityService." into mnc-dr-dev
aa281e2bc054cfccaef80eb48342382e79dfeaba 04-Sep-2015 Lorenzo Colitti <lorenzo@google.com> Log UID and PID of legacy route requests.

Bug: 23801105
Change-Id: I1722af0424f5b9bbd7276b77ce1571842fa541b3
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
1c36315a36962321dfe870b07e28b04a1d6777e9 02-Sep-2015 Fyodor Kupolov <fkupolov@google.com> Fixed VPN support for restricted profiles in split system user model

In a new split system user model, owner of a restricted profile is not limited
to just user0. restrictedProfileParentId field should be used to get an owner.

Bug: 22950929
Change-Id: I928319a9450e543972237a42267eb2404e117c83
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
6bc0a2b6f8ca88fcb43a77e9afcbf9a8543e6284 15-Sep-2015 Lorenzo Colitti <lorenzo@google.com> Framework fixes for RSSI offload.

1. When registering a NetworkCallback, only update RSSI
thresholds if the request specifies a signal strength.
2. When releasing a NetworkCallback, only update RSSI
thresholds if the request specified a signal strength.
3. Add logging.

Add logging.
Bug: 21405941
Bug: 23679346
Bug: 23815756
Change-Id: I4bc42d0ab02285a7a9d14e09f8a1cd868f4d9d7f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
dc988061ac145c86d6871e249d65ca326aaff99f 14-Sep-2015 Jeff Sharkey <jsharkey@android.com> Push firewall rules up to ConnectivityService.

getActiveNetworkInfo() and friends already know how to augment their
results to help apps detect when network access is blocked. This
change wires up the new app-idle and device-idle firewall rules to
be reported through these APIs.

This also causes other platform tools like DownloadManager and
SyncManager to respect these new policies.

Bug: 24050462
Change-Id: Id9517b0b70be7e3ca2ab27bed8049db916e4d829
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
7914ce5dd4d2e53eba1a3a8a1ed97da96cec129f 08-Sep-2015 Lorenzo Colitti <lorenzo@google.com> Add tests for the PacketKeepalive API.

This currently fails in many different ways, but it tells us what
to fix.

Bug: 22606153
Bug: 23884210
Change-Id: If2e5ee0a8d7b26cad67d3d566ed5b1383e0db096
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
e58961aa5f86553f0106edbc03d1534b097fa25c 07-Aug-2015 Lorenzo Colitti <lorenzo@google.com> Get rid of shortSleep() in ConnectivityServiceTest.

Instead, use IdleHandler to wait for things to become idle.

Bug: 22606153
Change-Id: Ic6ab93ad4d336b40962f9be1096629a44b63ee2f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a9ebeeff038ae5064dd36418ebfc07796ef58769 04-Sep-2015 Robert Greenwalt <rgreenwalt@google.com> Cut down some logs.

bug:23623327
Change-Id: I737d4e6c384bf4da62c65ad2abe0c9b5dca0067a
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
e94a6ff5dcc1a4e4f66320f7cc1ccd4deb786073 01-Sep-2015 Robert Greenwalt <rgreenwalt@google.com> Add SUPL-specific network bcast

Move SUPL CONNECTIVITY_ACTION bcasts to a different, hidden intent
to reduce the churn of apps when SUPL comes/goes.

Short term hack until SUPL moves to use the new APIs and there's
no bcast.

bug:23350688
Change-Id: I3dc14b42afa72465260aa41ccedfe1df27baabd9
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
bda9b324c88b70514109f2d9ffc937ca3202fd03 19-Aug-2015 Adam Lesinski <adamlesinski@google.com> am 886e7a63: Merge "Change default cellular activity timeout to 10" into mnc-dev

* commit '886e7a63b122a30c69c663d32e3e5f880a07593e':
Change default cellular activity timeout to 10
ed6160d299dadb4898360d55b2fb14e69ebb7ab3 18-Aug-2015 Adam Lesinski <adamlesinski@google.com> Change default cellular activity timeout to 10

LTE radios take 10 seconds to power down, so we should set the
activity timeout to 10 seconds.

Bug:23294704
Change-Id: I7478b77f134b0fe2d82e39acd5c370add12735ca
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
26ab6ed3efd9bc55e342caabade46d00f8304240 08-Aug-2015 Billy Lau <billylau@google.com> am 70f998e5: Merge "Bug: 21588539 Move CHANGE_NETWORK_STATE to be in SYSTEM_SETTINGS" into mnc-dev

* commit '70f998e57df2b3ed79331669a93a0ba314f25e7d':
Bug: 21588539 Move CHANGE_NETWORK_STATE to be in SYSTEM_SETTINGS
70f998e57df2b3ed79331669a93a0ba314f25e7d 08-Aug-2015 Billy Lau <billylau@google.com> Merge "Bug: 21588539 Move CHANGE_NETWORK_STATE to be in SYSTEM_SETTINGS" into mnc-dev
a7238a397d5c3431eeb19b5b77e8c7c2bf0e608f 01-Aug-2015 Billy Lau <billylau@google.com> Bug: 21588539 Move CHANGE_NETWORK_STATE to be in SYSTEM_SETTINGS

Merge the CHANGE_NETWORK_STATE permission with WRITE_SETTINGS.

AndroidManifest.xml:
Raised the protection level of CHANGE_NETWORK_STATE permission from
normal to signature|appops and pre23|preinstall for compatibility

provider/Settings:
Wrote new helper methods to check if app is allowed to change network
state.

ConnectivityManager.java & ConnectivityService.java:
Replace enforcement checks for CHANGE_NETWORK_STATE with
checkAndNoteChangeNetworkStateOperations instead.

Change-Id: If8c2dd3c76a5324ca43f1d90fa17973216c2bcc5
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
86e7d135acbdb0055de6a687817d44ac60603c9f 05-Aug-2015 Paul Jensen <pauljensen@google.com> resolved conflicts for merge of dbc4edcc to mnc-dr-dev

Change-Id: I3a8624b2b375e0d174983d7690082e0e6932c4de
dbc4edccfced5cb739bae75e8cd15cecc39cf16e 05-Aug-2015 Paul Jensen <pauljensen@google.com> Merge "Fix NOT_RESTRICTED network capability and enforce it." into mnc-dev
487ffe7d3d84bf65212158f7098e8a84b5b55e09 24-Jul-2015 Paul Jensen <pauljensen@google.com> Fix NOT_RESTRICTED network capability and enforce it.

With this change:
1. NOT_RESTRICTED should be removed from NetworkRequests that bring up
special restricted carrier networks (e.g. IMS, FOTA).
2. NetworkRequests without NOT_RESTRICTED require CONNECTIVITY_INTERNAL
permission to register
3. Binding sockets to networks without NOT_RESTRICTED requires
CONNECTIVITY_INTERNAL permission

Bug:21637535
Change-Id: I5991d39facaa6b690e969fe15dcbeec52e918321
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
135c379115260f672fec023b0f9a020b8c51302b 31-Jul-2015 Hung-ying Tyan <tyanh@google.com> am 410abcdb: Merge "Revise lockdown check in getLegacyVpnInfo()" into mnc-dev

* commit '410abcdb41f5bca84574e7b07d3f022d5e05e4c9':
Revise lockdown check in getLegacyVpnInfo()
410abcdb41f5bca84574e7b07d3f022d5e05e4c9 31-Jul-2015 Hung-ying Tyan <tyanh@google.com> Merge "Revise lockdown check in getLegacyVpnInfo()" into mnc-dev
44c8c5ccaf1dfb5e059732c05e00e6891cb65f71 28-Jul-2015 Hung-ying Tyan <tyanh@google.com> Revise lockdown check in getLegacyVpnInfo()

Return null instead of raising exception in lockdown mode.

BUG=22749146

Change-Id: I0e9e3ded0d189e3fa9e872b7af9fe363799c85d6
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
682fd6aedea87e345f033b489ef9f6008bd19c30 30-Jul-2015 Paul Jensen <pauljensen@google.com> am a991c66c: Merge "Fix missing onLost NetworkCallbacks when network loses capability" into mnc-dev

* commit 'a991c66c12da30d0240ac6c98736edee93d95977':
Fix missing onLost NetworkCallbacks when network loses capability
a991c66c12da30d0240ac6c98736edee93d95977 30-Jul-2015 Paul Jensen <pauljensen@google.com> Merge "Fix missing onLost NetworkCallbacks when network loses capability" into mnc-dev
bf10991d76ce6674726a668939be300cae150130 29-Jul-2015 Paul Jensen <pauljensen@google.com> resolved conflicts for merge of 30813942 to mnc-dr-dev

Change-Id: I8b33797528f16596f0d350ad38458baa51fcacf6
308139425e697536304be55a5865aae7a290fb1d 29-Jul-2015 Paul Jensen <pauljensen@google.com> Merge "Disable WiFi autojoin when user decides via "Stay connected?" dialog" 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/ConnectivityService.java
62ca62b32aae083c0f2d8b0bbec1fbd7d698f4ad 28-Jul-2015 Lorenzo Colitti <lorenzo@google.com> am e288b3af: Merge changes I5c994de5,I6cb0dd84 into mnc-dev

* commit 'e288b3af14421731d8f477b97e8d77588f20498b':
Add a test for public bugs 2111 and 2136.
Always check off-link connectivity in NetworkDiagnostics.
87cfc70b732422d6927ad9fe97f1ad7ab65fd508 27-Jul-2015 Lorenzo Colitti <lorenzo@google.com> Always check off-link connectivity in NetworkDiagnostics.

Currently, NetworkDiagnostics only checks off-link connectivity if
one of the DNS servers is off-link. Make it check off-link
connectivity in all cases by sending probes to Google Public DNS
if off-link DNS servers are not specified.

Bug: 22569331
Bug: 22641669
Bug: 22748900
Change-Id: I6cb0dd8491bc0c1a488631deca56722b9c1d2b3f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
9d598e115f306e4f0860638c5647a959ac1320c5 13-Jul-2015 Erik Kline <ek@google.com> Pass signal strength thresholds inside a Bundle

Bug: 21407651
Change-Id: I2c80e89441e2eb15a246cb1fa9347f886cefa80f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
c3f21f3b8b01508f5dc01b2e5fa4c3d652bb67bb 06-Jul-2015 Lorenzo Colitti <lorenzo@google.com> Support NetworkCallbacks based on signal strength.

Bug: 21405941
Change-Id: I2ed8a5aeb8dac464a4305671ed22abcacb485bc9
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
8bf977d562b8f7261cf964bdf045b22bdbd92b7d 15-Jun-2015 Lorenzo Colitti <lorenzo@google.com> ConnectivityManager API for for packet keepalives.

Bug: 21405946
Change-Id: Ie1f8f8bee684fe2bb1092a9f1bc9f5dc29b1defc
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
260a36d1b20469d39490b61fca610271bfa53df2 07-Jul-2015 Lorenzo Colitti <lorenzo@google.com> Make immutable NetworkCapabilities more explicit.

Bug: 21405941
Change-Id: Iafd738c31747b0f5f9356bed1c97f5f282830af1
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
f95d220308492550b7bd6c019e4c725a810cd050 13-Jul-2015 Paul Jensen <pauljensen@google.com> Disable WiFi autojoin when user decides via "Stay connected?" dialog

If the user selects "No" in the "Stay connected?" dialog box:
1. Disable autojoining that network in the future, and
2. Disassociate from that network.

Bug:22187193
Change-Id: I14dc9236c57e3ab7d3ec95edc906787cbfbf3c9f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
776129402746be08d52bb9f0901f6ecd63b25399 14-Jul-2015 Erik Kline <ek@google.com> Merge "Log NetworkRequestInfo to get more detailed history" into mnc-dev
7523eb349e7ecb1fdfd8e8a9371306ab28c046ec 09-Jul-2015 Erik Kline <ek@google.com> Log NetworkRequestInfo to get more detailed history

Bug: 21641983
Bug: 22235775
Bug: 22299819
Bug: 22358164
Change-Id: I48a2d162dd499a3590f06d805267a63822856969
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
3ac71b7f870e6b0a2bb03fceeba8d330830a7412 11-Jul-2015 Robert Greenwalt <rgreenwalt@google.com> Fix filter on CONNECTIVITY_ACTION updates

Only send for network types which the network supports.

bug:22411968
Change-Id: I97765544eb653caf0ea4fc5d3feec5742d5d88dc
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
f180fe31de4cc428c298a2faed394c417ade5483 10-Jul-2015 Robin Lee <rgl@google.com> Merge "Legacy VPN calls to require a userID" into mnc-dev
3b9ce37b51dcc7729489701d4e797fe91f2ef559 10-Jul-2015 Paul Jensen <pauljensen@google.com> Fix build break.

Automatic merge commit caused breakage due to someone else's
intervening change adding a call site of a function whose last
parameter I removed. Function in question is
ConnectivityService.rematchAllNetworksAndRequests.
Changes that merged badly are 85cf78e and 8d48252.

Change-Id: I8fd32e1a187236a65c1b7c0ecdf17b817d108fd0
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
bbce221eecdf54317dd0655e5f3507b82db4bfc1 10-Jul-2015 Paul Jensen <pauljensen@google.com> Merge "Fallback to Cellular if WiFi fails to validate" into mnc-dev
d8cdba0d711f5956475b043a50a6041075157c77 10-Jul-2015 Paul Jensen <pauljensen@google.com> Merge "Prepare some ConnectivityService logic for fallback to Cellular change" into mnc-dev
00c64f7ca5b05384dc3c208eff43e0b1a037a7d0 10-Jul-2015 Paul Jensen <pauljensen@google.com> Merge "Add android.net.CaptivePortal class for captive-portal-handling-app callbacks" 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/ConnectivityService.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/ConnectivityService.java
85cf78edc92b85ec90e91de42b14b84e202260f3 25-Jun-2015 Paul Jensen <pauljensen@google.com> Prepare some ConnectivityService logic for fallback to Cellular change

Reduce the duplication of some logic so when falling back to Cellular
when WiFi fails to validate is enabled, there's less chance for bugs
and failures:
1. De-duplicate several Network vs NetworkRequest matching functions
2. Remove the very tricky nascent logic by adding a simple "lingering" bit.

Bug:20896761
Change-Id: I21da9e827eec9cfd6835fcaa650192b9186ed053
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
8d48252b80cdb261cd2fa7372a01e6197f95efa6 24-Jun-2015 Robert Greenwalt <rgreenwalt@google.com> Revive NetworkInfo's SUSPENDED state.

This got lost in the multinetwork work for L. It means
that if telephony stops having the ability to pass packets for a while
the rest of the platform doesn't know.

Telephony enters the suspended state if it enters a telephony call
while using certain radio access technologies, or if it switches to
one of those RATs while in a call. It also can enter this state if
it temporarily loses contact with the network - the modem will
not report the loss of the data call for an indeterminant time in
the hope that regaining the network will restore the connection
without harm to any ongoing ip layer interactions. For example
passing through a tunnel or taking an elevator trip may use this
mechanism.

bug: 19637156
Change-Id: If9fde68175e8561c19323c81fbfcb02a6e5a00fb
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
3eed5eca80f317d574d4468244a37fd5b60721a0 07-Jul-2015 Robin Lee <rgl@google.com> Legacy VPN calls to require a userID

This way, system applications with INTERACT_ACROSS_USERS permission will
be able to fetch the information they need.

Pre-requisite for bug 21499103

Change-Id: I7e759d5039ae6e85abc6435049016b1dcaabc834
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
2b61c6b16b73f3367e859b5d8ffc5da175d02d33 30-Jun-2015 Paul Jensen <pauljensen@google.com> Merge "Don't reevaluate disconnected networks" into mnc-dev
b36a3131d1b05efa176f79d318197499b2c45380 26-Jun-2015 Erik Kline <ek@google.com> Fix use of reachable DNS server logic

Move reachable DNS server computation out of ConnectivityService
and split it into LinkProperties#isReachable() and a companion
change in WifiStateMachine's makeLinkProperties().

Restore previous ConnectivityService#updateDnses() behaviour, as
the pruning is done in WifiStateMachine now.

Bug: 19470192
Bug: 20733156
Bug: 22098233
Change-Id: I810ef74d504e5dc1ca2017d435cdadd6b82171e6
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
ae3584bd8dbbe6c541896f19599596d5a7b6735c 27-Jun-2015 Robert Greenwalt <rgreenwalt@google.com> Merge "Add Validation logging." into mnc-dev
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/ConnectivityService.java
4e8050ed5fe48fb97e266a84baefd2638a8773eb 25-Jun-2015 Paul Jensen <pauljensen@google.com> Don't reevaluate disconnected networks

This serves no purpose and adds several log messages every time a
network disconnects. The extra log messages contribute to
NetworkMonitor's chatty-ness and towards it getting muted.

Bug:21480101
Change-Id: I372f9939c534f77b052a15fdb2cd5288d19ddbab
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
9ce8a9da407161dc6a17d100364b2e19c753765d 24-Jun-2015 Lorenzo Colitti <lorenzo@google.com> Use heads-up notifications when selecting networks with no Internet

Currently, when connecting to a network that has a captive portal
or has no Internet access, we display a regular notification.
Because this notification is easy to miss, switch to using a
heads-up notification if the user just manually selected the
network. If the system connects automatically, continue to use a
regular notification.

Bug: 20081183
Change-Id: I7a988b2bddfe898a0d2607ad85a04b227d678469
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
ad5f292b037a61b9975b1b8d10a1b4202ac533cf 23-Jun-2015 Adam Lesinski <adamlesinski@google.com> Merge "Extend the time between WiFi energy samples" into mnc-dev
06f46cb32067572f25721ebe62fefd29cc34c7f0 23-Jun-2015 Adam Lesinski <adamlesinski@google.com> Extend the time between WiFi energy samples

With bursty WiFi traffic, we end up sampling the WiFi controller's
energy data quite a lot. Extend the timeout so that we sample
once there has been no activity for 15 seconds.

Note: Once the WiFi radio goes down after being active, it can come back and be
active in less than 15 seconds, which means we may sample twice quickly.

Bug:21478443
Change-Id: I99081b664f8a33fef734bc55eef4d33ac297e83a
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
bb2e0e98160f099261876794518d4db62e309aec 16-Jun-2015 Paul Jensen <pauljensen@google.com> Disallow requesting networks with mutable NetworkCapabilities.

It's not clear what it means to request a network with a mutable
NetworkCapability like NET_CAPABILITY_VALIDATED or
NET_CAPABILITY_CAPTIVE_PORTAL. Presently requesting such a network
would fail in a number of different ways:
1. The NetworkFactories would fail to match the request against their
filter which doesn't include stateful NetworkCapabilities.
2. If the NetworkFactories did match, they'd bring up networks to try
and satisfy the requests, but the networks would not have any
mutable NetworkCapabilities initially so they'd be reaped.
Because of these problems it's safest to simply disallow these
requests.

Bug: 21343774
Change-Id: I56303242b81d39b370b8d5d1e32059bfcfc25949
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
1c7ba0285b3fe8de479d6c09b2ff45572913c2cb 16-Jun-2015 Paul Jensen <pauljensen@google.com> Fix missing NetworkCallbacks for NET_CAPABILITY_VALIDATED changes

Without this fix if a listening NetworkRequest with NET_CAPABILITY_VALIDATED
is submitted after a network has been validated but failed the most recent
validation attempt, the NetworkRequest will never receive callbacks.

Bug: 21343774
Change-Id: I6fa6d563c9a6f278b20e645776b707559033b249
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
3d194eae6f658ed865b2d3b748f8b83834c877ab 16-Jun-2015 Paul Jensen <pauljensen@google.com> Add NetworkCapabilities.NET_CAPABILITY_CAPTIVE_PORTAL

Bug: 21343774
Bug: 20898908
Change-Id: I23069a6cba346999d1b2eeaa445023bd6bf4ef94
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
422f04bc57309c34ca82746a95dda34b49b7fdf5 20-Jun-2015 Paul Jensen <pauljensen@google.com> Merge "Speed up network transition when WiFi disconnects" into mnc-dev
62d308033f6d5fc6247430a755774bd89ce4b4ee 17-Jun-2015 Paul Jensen <pauljensen@google.com> Speed up network transition when WiFi disconnects

Before falling back to cellular we used to first delete all the
network routing tables and rules for WiFi. This isn't necessary
and can take significant time as it requires a lot of netd
shelling out to ip and ip[6]tables to flush routes and remove
the incoming packet mark rule. Instead have netd delete all the
network routing tables and rules after we've either fallen back
to cellular or at least kicked off a cellular connection attempt.

Bug: 21932815
Change-Id: Iabac4a8b962492682df3073cc41a12e35bc9f1bb
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
2f56a33041b95fc9badcf08e8be4fd57eec56ccb 20-Jun-2015 Paul Jensen <pauljensen@google.com> Merge "Add ConnectivityManager.registerNetworkCallback(NetworkRequest, PendingIntent)" into mnc-dev
8e21d29f7e8691c5798ef613c2ccc4112c649421 20-Jun-2015 Paul Jensen <pauljensen@google.com> Merge "Don't send spurious onAvailable NetworkCallbacks when rematching" into mnc-dev
3d911469a190437fe936103e861bfa171841fbd6 12-Jun-2015 Paul Jensen <pauljensen@google.com> Don't send spurious onAvailable NetworkCallbacks when rematching

Bug:21762680
Change-Id: Ia701045dffc666fe75fba0e1771872147e37179a
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
694f2b847232c66c64a42aa1002c8e5b652342e0 17-Jun-2015 Paul Jensen <pauljensen@google.com> Add ConnectivityManager.registerNetworkCallback(NetworkRequest, PendingIntent)

Without this API we're more or less encouraging apps to have long running
processes (battery draining) to receive NetworkCallbacks for the stateful
NetworkCapabilities NET_CAPABILITIES_VALIDATED and
NET_CAPABILITIES_CAPTIVE_PORTAL. With this API they can instead using
PendingIntents which outlive their apps.

Bug: 21343774
Change-Id: I168d0ac3757729acf7ca5546079846f575a0eedd
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
4136850b80865141e554b61068c51f1d525b2600 17-Jun-2015 Erik Kline <ek@google.com> Carefully select which DNS servers to send to netd

Select only DNS servers that:
- are reachable, according to routes in the LinkProperties, AND

- have a "suitable" source address in the LinkProperites, meaning:
- IPv4 DNS server:
- only if LinkProperties has any IPv4 address
- IPv6 link-local DNS server:
- only if the server has a scopeId set
- assume for now that LinkProperties has a suitable
link-local address
- IPv6 non-link-local DNS server:
- only if LinkProperties has a global, preferred IPv6 address

Bug: 19470192
Bug: 20733156
Change-Id: Ibd95f3f7b33a4fb6c36d1cea4adb63c99068f657
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
434dde84eed746124fe2cf24d6496148cee48c58 11-Jun-2015 Paul Jensen <pauljensen@google.com> Remove dead hidden ConnectivityManager and NetworkInfo APIs.

- There are no callers of
NetworkInfo.setIsConnectedToProvisioningNetwork(), so remove all the
code that deals with mIsConnectedToProvisioningNetwork being true,
including the two ConnectiviyManager APIs.
- There are no callers of
ConnectivityManager.getMobileRedirectedProvisioningUrl(), so remove
the code that reads this URL.
- There are no callers of
ConnectivityManager.captivePortalCheckCompleted(), so remove this
API which is currently a no-op.

Change-Id: Ifa44c7553c7c45ebe261a2a124d9bf8d6f96c690
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
1ce4b6d3c6cb5b2eb9c9d00472be12245db92427 11-Jun-2015 Chris Wren <cwren@android.com> remove usage of deprecated method setLatestEventInfo

Bug: 18510449
Change-Id: I56a77991c729990e501f402e007dfa79ee57621e
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
c1e623bbcae1678f145106bb1838ee903ad00c6f 10-Jun-2015 Paul Jensen <pauljensen@google.com> Merge "Avoid overlapping NetIDs in ConnectivityServiceTest with real NetIDs" into mnc-dev
67b0b0756b47c0ef0c50ce42f140d36c200f7984 10-Jun-2015 Paul Jensen <pauljensen@google.com> Avoid overlapping NetIDs in ConnectivityServiceTest with real NetIDs

Overlapping the NetIDs can cause the ConnectivityService instance under test
to inadvertently use real networks, for example when NetworkMonitor attempts
to validate a network. This fixes test hangs when run on devices with
active internet connections.

Change-Id: I5e1898953f0117b9f75beccac4a52ae2db173567
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
bc7b1a4ca2f114d09ce186e25b18692df2c9e872 10-Jun-2015 Lorenzo Colitti <lorenzo@google.com> Merge "When no Internet access is detected, display a notification first." into mnc-dev
f6673d07c35f5f6e3d044667204f7abfdf745a33 21-May-2015 Lorenzo Colitti <lorenzo@google.com> When no Internet access is detected, display a notification first.

Previously, we displayed a dialog on top of whatever the user was
doing. Instead, display a notification that can take the user to
the dialog.

Because the notification is less intrusive, also enable it even
if the network without Internet access is already the system
default network. Previously we did not do this because in that
case the user might not have other useful options, and thus a
dialog would have been too intrusive.

Bug: 20081183
Bug: 20538448
Change-Id: I677be238d675c13a13dc0bae2dbb37cbe4f52cb6
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
64d6ce8a661fd63b90b4c9f3f7d400208cb2430a 10-Jun-2015 Erik Kline <ek@google.com> Merge "initial revision of NetworkDiagnostics" into mnc-dev
63cc6458ace9da6a064f254323fe493618a6c518 10-Jun-2015 Robin Lee <rgl@google.com> Merge "Switch over to updated VPN warning strings" into mnc-dev
472834518e2d23172189ee34e98c51f868628a90 01-Jun-2015 Robin Lee <rgl@google.com> Switch over to updated VPN warning strings

These are more consistent and have placeholders for the description of
whatever VPN apps are actually active.

Bug: 20516964
Bug: 17474682
Change-Id: I37ff287b795f10bbbb192540f09f8100bb27b1a0
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
379747a4040118130ca35947aef6942b2cd1cd67 05-Jun-2015 Erik Kline <ek@google.com> initial revision of NetworkDiagnostics

Bug: 21449922
Change-Id: I6a66cfa98601d6ccfe38ff840b0dd49ed1538a41
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a34af2c0d7bbce6469b0c6ab578f6e2c9cd38cfb 05-Jun-2015 Lorenzo Colitti <lorenzo@google.com> Merge "Remove "returning Blocked NetworkInfo" logspam." into mnc-dev
48a423f04585da05b48df5425487a4185b7f37ec 05-Jun-2015 Lorenzo Colitti <lorenzo@google.com> Remove "returning Blocked NetworkInfo" logspam.

Bug: 20006730
Change-Id: I2061127e3c7283c0a4899940d3fc224ca114f754
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
170d44083f9a8a71a17e01a3c199566b58029d46 04-Jun-2015 Feixiong Zhang <feixiong@google.com> Merge "Fix the empty reason field in connectivity change intent." into mnc-dev
376133f606338342de8a5261efd1155e2d99e470 02-Jun-2015 Feixiong Zhang <feixiong@google.com> Fix the empty reason field in connectivity change intent.

The code set it to null instead of info.getReason.

Change-Id: I1b26ad040c23da7080dbfaeb5376181998115805
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
577d79b556baf344c47a28c1264dee5dfac37a22 04-Jun-2015 Paul Jensen <pauljensen@google.com> Merge "Revive ConnectivityServiceTest and add some tests." into mnc-dev
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/ConnectivityService.java
76f087502dbf6747719adade4c7f124ce8360d2b 04-Jun-2015 Lorenzo Colitti <lorenzo@google.com> Merge "Disable mDefaultDns to see if we can remove it." into mnc-dev
6a5c0e10b192fe70e237c83bc752e2cbf66ffe0e 03-Jun-2015 Erik Kline <ek@google.com> Delete unsed mDnsLock.

Bug: 21449922
Change-Id: I0c9f95c30eaa170d809e86f6505379f34a0a7603
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
e380546aedb727a7a5f1f7b460124c3e57d5ac49 03-Jun-2015 Lorenzo Colitti <lorenzo@google.com> Make the dumpsys connectivity shorter and easier to read.

- Print NetworkFactories on one line.
- Only print LegacyTypeTracker networks if they are connected,
and record supported network types on a separate summary line.
- Print all tethering upstreams on one line.
- Summarize the state of the transition wakelock on one line.
- Don't print Inet condition reports if there are none.
(Currently there can never be any.)

Bug: 21449922
Change-Id: Ib4b29a7fd882e6c105839a255fffecf4f346cf7e
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
e3e314df4d52881225326d426a76e3e7f1bc40d3 20-Apr-2015 Stuart Scott <stuartscott@google.com> Network Reset should have a lockdown like Factory Reset.

bug:20332322
Change-Id: I7c61a011d11e89513757f112abf320bb2a785edb
(cherry picked from commit 94b038bbb291431a7b39611d72f206b07e839891)
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
1a81c39a937934062511fb585edc350b687582b2 21-May-2015 Paul Jensen <pauljensen@google.com> Null-check argument to ConnectivityManager.releaseNetworkRequest(PendingIntent)

Do this in ConnectivityService to prevent crashing framework.

Bug:21329396
Change-Id: Ifd9c970cd0da392d0bd5da9a9ae845fdf0b559b3
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
c1a9436d27e41347e6063b1cfb77eaef7e191ca4 19-May-2015 Paul Jensen <pauljensen@google.com> Merge "Query HTTP proxy for network via a new API to avoid permissions exceptions" into mnc-dev
93155b3d78608b73ca759ae7f24de5ddb8474fb8 14-May-2015 Lorenzo Colitti <lorenzo@google.com> Disable mDefaultDns to see if we can remove it.

Bug: 21146610
Change-Id: I385f1c8780acc97d955002f469a6c8ad65db1578
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
aba6cccd40e0393d7bcff7f6edb5ca8cfdd4c7b1 19-May-2015 Lorenzo Colitti <lorenzo@google.com> Merge "Make NET_CAPABILITY_VALIDATED (almost) a first-class citizen." into mnc-dev
3e5484d452cdf9f98e3c0e1abfe4a7297753cb5e 19-May-2015 Robin Lee <rgl@google.com> Merge "Support cross-user VPN calls (with permission)" into mnc-dev
76f67797032981ccb63e12e808ebc8bda636a740 14-May-2015 Lorenzo Colitti <lorenzo@google.com> Make NET_CAPABILITY_VALIDATED (almost) a first-class citizen.

1. Always keep ConnectivityService's validated bits current:
- Apply the validated bit whenever a NetworkAgent updates its
NetworkCapabilities.
- Set or clear the validated bit whenever lastValidated changes.
2. Send callbacks when the validation state of a network changes.
3. Delete getNetworkCapabilitiesAndValidation, removing code
duplication with getNetworkCapabilities.
4. Add the validated bit to NetworkCapabilities#toString.

Bug: 18591282
Bug: 20081183
Change-Id: I6aa53b61c15cc137f203f9fc6bbd4c16894be750
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
3b3dd942ec6a0beaccd1cef0723d72786435d8f3 12-May-2015 Robin Lee <rgl@google.com> Support cross-user VPN calls (with permission)

Settings and SystemUI need to act on other users than USER_OWNER.

This is gated by INTERACT_ACROSS_USERS_FULL in addition to the existing
CONTROL_VPN checks, so the number of processes able to interfere with
other profiles' VPNs should be quite small.

Bug: 20692490
Bug: 20747154
Bug: 20872408
Change-Id: I6e5d7220f73435bec350719e7b4715935caf4e19
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
cee9b51c4beec4494d78bab784ba7e7e20c30e31 06-May-2015 Paul Jensen <pauljensen@google.com> Query HTTP proxy for network via a new API to avoid permissions exceptions

Add @hidden ConnectivityManager.getProxyForNetwork() API.

Bug:20470604
Change-Id: I6a9bc4afc8273bc43b14cdeccfedbbf3ff66be40
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
8deb34106760abfea6f5cc65e727b9a54f480d16 14-May-2015 Lorenzo Colitti <lorenzo@google.com> Statically import NetworkCapabilities constants for brevity.

Bug: 18591282
Change-Id: I41c148951724136f31bc663fd81ca9f5de72818a
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
d49159f4e997faae6ef4141b667ad6fef74a6724 14-May-2015 Lorenzo Colitti <lorenzo@google.com> Don't display the "no Internet access" prompt on captive portals.

Bug: 20081183
Bug: 21066461
Change-Id: Idc71844a604f9ca655411c6916de256780ea4586
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
cc917ceefd694f58d8c9bffac18c9b017884ae22 30-Apr-2015 Lorenzo Colitti <lorenzo@google.com> Fix a race when removing from LegacyTypeTracker.

Because LegacyTypeTracker#remove can send broadcasts that cause
apps to refresh their view of network state, it needs to be
called only after network state has been updated. This requires
that callers determine whether the network was the default, and
updating state, before calling remove().

While I'm at it, fix maybeLogBroadcast's concept of whether the
network it's logging about is/was the default. This has never
been correct.

Bug: 20613953
Change-Id: Ia175ac454aa4e0a4c4f0151866314ebada681438
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
da4bfa81cdaccdc65d4812c81c892926cd0c9884 29-Apr-2015 Erik Kline <ek@google.com> Optionally add a default MOBILE request.

This enables persisting the mobile internet data connection, even
when Wi-Fi is enabled and serving as the default network (for faster
network switching).

Change-Id: I9d1512b3a8413c4f163c63d57e66bded017101e4
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
7094d22022c8e0c6ad71920b101434dded8a276e 02-May-2015 Sanket Padawe <sanketpadawe@google.com> Adding "Connected, no Internet" string in Wifi nw summary.

Bug: 17380953
Change-Id: I9664bcbf33832fe722e7d2b3125939287ee98098
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
15e47235c055495ec0ccc24768a6746a960d3a61 25-Apr-2015 Amith Yamasani <yamasani@google.com> Remove network access for idle apps

Track apps going in and out of idle in the NetworkPolicyManagerService.
Apply DROP rules in firewall controller if app is to be blacklisted
for network access.

Firewall can now be in whitelist (old) or blacklist mode. When in
blacklist, it allows all by default and we can selectively DENY
some uids.

Track app idle in UsageStats and update periodically.
Track charging/discharging states.

TODO: Check for appidle temporary parole state

Bug: 20066058
Change-Id: Ia65d7544204b3bcb78a517310ef4adcc05aac6fb
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a179962b61a9c41e8859ce642471928f1ad33c60 24-Apr-2015 Etan Cohen <etancohen@google.com> Merge commit '25a217c' into merge2

Change-Id: I116a9dbf19e95651a7c50393e4dcd7fb59ca3f3f
fa57c489f621cd10add639cf7df59f630a7f41a4 22-Apr-2015 Lorenzo Colitti <lorenzo@google.com> Allow apps with ACCESS_WIFI_STATE to listen for wifi networks

The compatibility measure introduced in bug 20081183 for apps
that connect to a Wi-Fi network without Internet access and then
expect to be able to use that network requires that such apps
register a NetworkCallback so that their WifiManager can pin them
to whatever wifi Network connects.

Currently, registering the callback requires ACCESS_NETWORK_STATE
and the app may not have that permission. Allow registering wifi
(only) callbacks if the app has ACCESS_WIFI_STATE.

If the app does not have ACCESS_WIFI_STATE (unlikely, since
CHANGE_WIFI_STATE is not very useful without ACCESS_WIFI_STATE),
then don't enable the compatibility measure.

Bug: 20081183
Bug: 20423580
Change-Id: Iad328d30c2d170dead883868fece3d922da68f6f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
b32243498fcf21212268b9dff558647d9e716a1c 22-Apr-2015 fenglu <fenglu@google.com> Merge "update API name to requestBandwidthUpdate()"
db57147a55aadca39280ed62516b4a49c69ba177 22-Apr-2015 fenglu <fenglu@google.com> update API name to requestBandwidthUpdate()

Change-Id: If26942978ffcc43f06f17dfad5da790f34758395
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
bba3270c34c9ee5e70a02d39e398114600d6a553 22-Apr-2015 Robert Greenwalt <rgreenwalt@google.com> Merge "Revert "requestBwUpdate() public API review""
2c22a91d4c1399cdbe2ade5f697aeb0f560e3f03 22-Apr-2015 Robert Greenwalt <rgreenwalt@google.com> Revert "requestBwUpdate() public API review"

This reverts commit 32f21da41031595a315aaf0eb67f6a094365f2b4.

Change-Id: I8c22d285ff1f56f1bd31a0fa9f2e6a79959347b1
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
1c7f96f3e81970cad2e15fa304f2fbd97cd7e7f8 22-Apr-2015 Robert Greenwalt <rgreenwalt@google.com> Merge "requestBwUpdate() public API review"
32f21da41031595a315aaf0eb67f6a094365f2b4 16-Apr-2015 fenglu <fenglu@google.com> requestBwUpdate() public API review

Change-Id: I1e780b2705d13bfc85a0a8712ac1dbd623b474a1
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
17e11fad0a6272dd750427e2e4cb9810e67b6dec 21-Apr-2015 Erik Kline <ek@google.com> Final removal of CONNECTIVITY_ACTION_IMMEDIATE.

Since the demise of the connectivity change delay,
CONNECTIVITY_ACTION_IMMEDIATE has been sent out back to back with
CONNECTIVITY_ACTION.

Interested parties should watch for CONNECTIVITY_ACTION.

Bug: 20013379
Change-Id: I072dddf95adb3bbd17fa1f7159d4ea848ade8f19
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
f1fb39763d87dabe254b6ed64ac8f20145035bc0 03-Apr-2015 Stuart Scott <stuartscott@google.com> Move factoryReset to service and protect.

bug:16161518
Change-Id: I02d1bbae1887c62ee426e6f03e8bc1f18c6666bf
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
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/ConnectivityService.java
3f2631f526d0a0ac0b57ac9f6d241bcc7aeb5f5b 16-Apr-2015 Lorenzo Colitti <lorenzo@google.com> Merge changes from topic 'wifi-alternate-reality'

* changes:
Pin a process to wifi when it calls enableNetwork(..., true)
Make CALLBACK_PRECHECK actually work.
b15e72b83c56d771f0fb1453b73e2fca6b09cce8 20-Mar-2015 fenglu <fenglu@google.com> LCE service implementation - connectivity side

Change-Id: If11bd99c44c7dc8d2aa2bc05a10e04421739baa6
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
bdc4549dcd2b0ebbdc87a3e8d6eb47f54cc58ce6 09-Apr-2015 Lorenzo Colitti <lorenzo@google.com> Make CALLBACK_PRECHECK actually work.

Currently, CALLBACK_PRECHECK is never fired, because we attempt
to send it just after a network has connected, before matching
requests to that network. So notifyNetworkCallbacks scans the
list of requests for the network, finds none, and does nothing.

Bug: 20038463
Change-Id: Ib0c6377c45990e358f926217d7c7defa74c1d59b
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
2bbd2b683042ea0a20c46b6dfd78b6b65fcc86eb 20-Mar-2015 fenglu <fenglu@google.com> LCE service implementation - connectivity side

Change-Id: If11bd99c44c7dc8d2aa2bc05a10e04421739baa6
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
cb43ebb3604d45da8677b8d19c935f0ace08ea53 16-Apr-2015 Vinit Deshpande <vinitd@google.com> Merge "am b5e0cfb..557d2f5 from mirror-m-wireless-internal-release"
e03c3c7edf54854ed22adf1e55b27b2408c4c66a 03-Apr-2015 Lorenzo Colitti <lorenzo@google.com> Prompt if a network without an Internet connection is selected

When a network is explicitlySelected, keep it connected but do
not automatically switch to it. Instead, attempt to validate it,
and if 8 seconds have passed and the network is not yet
validated, prompt the user asking whether to switch to it anyway.

Bug: 20081183
Change-Id: I03a8459eb39979e3dc8e94662b85a44605dd7e69
/frameworks/base/services/core/java/com/android/server/ConnectivityService.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/ConnectivityService.java
31a94f48bf8014cf6a1127bd23cf9a8541a9abed 13-Feb-2015 Paul Jensen <pauljensen@google.com> Add ConnectivityManager.getActiveNetwork().
Rework NetID allocation in ConnectivityService so registerNetworkAgent() can
return the allocated NetID.

Bug: 19416463
Change-Id: I68e395552cf27422c80b4dfae5db5d56a0d68f5d
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
e75b9e355500b7c6a05e4d6ec54ef48835707caa 06-Apr-2015 Paul Jensen <pauljensen@google.com> Non-functional code cleanup of ConnectivityService.

1. Remove ConnectivityService.findConnectionTypeForIface() as this can be done
just as easily with supported APIs now.
2. Avoid making copies of Network objects as this precludes reuse of Network
internals (e.g. socket factory, connection pool).

Change-Id: I52f92e35d769d8350471f485e408169608630082
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
e08af19fcc7b13d526f3dfd24d58300947cf1146 26-Mar-2015 Adam Lesinski <adamlesinski@google.com> Adding per UID WiFi power distribution.

Change-Id: I88c539074607d7261f6c5cf1dbae47c3cf53f253
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
e9b9b73ab598a912de04fbd5501bca5924ce8f71 07-Apr-2015 Bart Sears <bsears@google.com> Revert "Adding per UID WiFi power distribution."

This CL is breaking the clockwork settings app in master. Reverting
until Adam has a chance to investigate.

This reverts commit b943fabfc8ddb581dc2fd7288f87428dcb5d27b7.

Change-Id: Ieb11423c11cf9874a6175dce49843d0e1080c590
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
b943fabfc8ddb581dc2fd7288f87428dcb5d27b7 26-Mar-2015 Adam Lesinski <adamlesinski@google.com> Adding per UID WiFi power distribution.

Change-Id: Ia3d97e0a1c3352127185c18626d8ba8221c9ab40
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
b43755be6e95b39619bb64b283710092468154cf 06-Apr-2015 Robert Greenwalt <rgreenwalt@google.com> am 0270d86a: am 778f47e5: am 069f4cbc: Merge "Fix memory leak in Connectivity Service when phone app crashes"

* commit '0270d86ab755dabb7d20013dcb591d3facbe1a08':
Fix memory leak in Connectivity Service when phone app crashes
4b647f4c4ddac95cb8a907590843d3a95cd3c6ae 30-Mar-2015 Maunik Shah <mshah@codeaurora.org> Fix memory leak in Connectivity Service when phone app crashes

Upon crash of com.android.phone process, NetworkFactoryInfo is
not getting removed from HashMap and will get accumulated on
every start of the process.

Change-Id: Iafde28daddfc82728c03208522682b1efc85a121
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
4a357cd2e55293402d7172766f7f9419815fc1e8 19-Mar-2015 Alan Viverette <alanv@google.com> Replace usages of deprecated Resources.getColor() and getColorStateList()

Change-Id: I8f64fe6c4c44a92ff6d07250223ba590a1d691b0
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
43564472ee3d9c1ebce34d23d75522b0e4bd56e9 18-Mar-2015 Paul Jensen <pauljensen@google.com> Remove dead code, mostly DataStateTracker.

(cherry picked from AOSP commit 7fad4eb4b52bc6c7ddad47f70e0c310093fbde3b)

Change-Id: I18c44cd08dfb51e02a96d0b726e9af1db21e3058
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
db64454b3354e26c96fdb83a4443cce12e352640 13-Mar-2015 Andreas Gampe <agampe@google.com> resolved conflicts for merge of b6b9fe21 to master

Change-Id: If4f62aa1fd8bb774288a677e7008e86a7e3ea6d9
f5ea340aabee6e290448c8cc9fb0925da8b7db5e 04-Mar-2015 Wenchao Tong <tongwenchao@google.com> NetworkStatsService to adjust VPN stats before recording.

* Creates a new Parcelable class VpnInfo to hold required
parameters for VPN stats adjustments.
* ConnectivityService to collect infomation and provide
a list of VpnInfo, one for each user.
* NetworkStatsService passes the VpnInfo array to
NetworkStatsRecorder.
* NetworkStatsRecorder calls NetworkStats.migrateTun()
to do the math.
* Poll NetworkStats when the vpn application calls
setUnderlyingNetworks().

Bug: 19536273
Change-Id: I7a4c7726b8243fead10416f7ec6eb5cf95f20183
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
7b5be4c0c741e44a8592ece40902eb0071f6d138 12-Mar-2015 Lorenzo Colitti <lorenzo@google.com> Fix build, broken by https://android-review.googlesource.com/#/c/115890/

Change-Id: Ieafa2fb0a7f539d8f933ad9c98e3be80457da6e5
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
7fad4eb4b52bc6c7ddad47f70e0c310093fbde3b 21-Nov-2014 Paul Jensen <pauljensen@google.com> Remove dead code, mostly DataStateTracker.

Change-Id: I1433937bffdb29bd42fb1adbfcf0a50ceffac7dd
/frameworks/base/services/core/java/com/android/server/ConnectivityService.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/ConnectivityService.java
0831f66f1949307bae54ccf01d70283005467085 10-Feb-2015 Lorenzo Colitti <lorenzo@google.com> Make reportInetCondition revalidate if the report differs from our state

1. If reportInetCondition says the network is not working, and
the network is already marked not validated, don't revalidate
it. This was superfluous and should save battery.
2. If reportInetCondition says the network is working, and the
network is not marked as validated, revalidated. This will
allow us to get out of a validated state quickly based on app
input (e.g., allowing GCM's exponential backoff timer to drive
revalidation instead of our 10-minute timer).

Bug: 19258761
Bug: 19209043
Change-Id: Iaa4bac82d117ed1f4088dab106e6f6ce46b34bc3
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
d6a7980dd9a52f082091cf000095b77a9d44565d 05-Feb-2015 Lorenzo Colitti <lorenzo@google.com> Make getNetworkInfo() take into account VPN underlying networks.

If a user is subject to a VPN, getActiveNetworkInfo() will return
the VPN's underlying network (e.g., TYPE_WIFI), so that apps that
call getActiveNetworkInfo to answer questions like "is the device
connected to wifi?" will continue to work. Make getNetworkInfo
do this as well: if the query is for a network type that is
underlying the current user's VPN, then return that network.

Bug: 19196545
Change-Id: Ic5a651735b927c758594a26d26a03fbd704b52e6
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
147cf4b8c4345f2d086251313583888356317d2d 22-Jan-2015 Erik Kline <ek@google.com> Merge "Log interface name and uid when filtering a blocked network." into lmp-mr1-dev
338317edd553ff9e5c0e7bdb61fce478d89ecdd4 19-Jan-2015 Erik Kline <ek@google.com> Log interface name and uid when filtering a blocked network.

Bug: 18707263
Change-Id: Ide9a1670a97eae787b785933de0c80750c2b5601
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
51481857ea48abe1ff3346ca1034dd5fcb68eb72 08-Jan-2015 Robert Greenwalt <rgreenwalt@google.com> Fix legacy request removal.

Don't say we're disconnected from a legacy type until there are no outstanding requests for it.

bug:18946574
Change-Id: I8e45c4a7558f7ced0840b71c50081989ba13c1c7
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
9f0e9ad40633f0480c8b6209e52d61c5aac52d1d 14-Jan-2015 Paul Jensen <pauljensen@google.com> Merge "Don't blindly teardown unvalidated networks when releasing NetworkRequests." into lmp-mr1-dev
9936484667620ff20905ea8524265b4add39cd63 09-Dec-2014 Paul Jensen <pauljensen@google.com> Don't blindly teardown unvalidated networks when releasing NetworkRequests.

These networks may be on their way to becoming validated at which point
they could satisfy the default NetworkRequest. This change unifies the
is-this-network-needed code into a single function.

bug:18652378
Change-Id: Ia511d5c66be79b47dd7c9348ec02784ab30b960c
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
573a0354c5752769366b3365eb1be4adc569d096 08-Jan-2015 Paul Jensen <pauljensen@google.com> Remember to cancel lingering when a network again satsifies a NetworkRequest.

When WiFi's score drops and then comes back up we would previously linger
WiFi but forget to cancel the linger timeout, so 30s later WiFi would
unexpectedly tear down. This was not completely fixed in 0cc1732.

bug:18826162
Change-Id: I7bb4b99ec969099e9815f46d4c09253be71a29be
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
152ed37a3ecbd044cc039370e0299d6a0bbc9bc9 18-Dec-2014 Robert Greenwalt <rgreenwalt@google.com> Fix timing between bcast and net setup.

A legacy network type request would generate a bcast before the network
notification was sent - the legacy startUsingNetworkFeature API requires
the notification so it can bind your dns queries to the new network.
Fast-moving clients could try to use the network before it was ready.

bug:18792871
Change-Id: I24c46ef15c249c50bfc321f62756d1f66dc3a6a9
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
7b42f399430d5d4ace4efbee225bbd3ecd2d4146 17-Dec-2014 Lorenzo Colitti <lorenzo@google.com> Add a lastValidated bit and use it when reporting capabilities.

When we switched the way the status bar determines if a
connection is validated from using INET_CONDITION_ACTION
broadcasts to calling getDefaultNetworkCapabilitiesForUser(),
the statusbar stopped displaying ! when a network stopped having
working Internet connectivity. This is because the validated bit
is never set to false once a network is validated.

Fix this, hopefully temporarily, by introducing a new validated
bit that does go back to being false when a network no longer
has working connectivity, and use that bit in
getDefaultNetworkCapabilitiesForUser().

Bug: 18777225
Change-Id: I991c068be50252391d0e64c647fcf2e053dc82f9
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
d3b8a3e77696ecd90ce59a869aaadf1e7804a9c8 17-Dec-2014 Lorenzo Colitti <lorenzo@google.com> Rename validated to everValidated.

This is a straight rename and thus a complete no-op from a
functionality perspective.

Bug: 18777225
Change-Id: I140d7640f1460c869a311294873772819a7a7059
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
f4ffaa4f57a8af4452f27e47ca65ee85fa0a60dc 15-Dec-2014 Paul Jensen <pauljensen@google.com> Fix race between CONNECTIVITY_ACTION and setting default network.

Now that the delay between connectivity changes and CONNECTIVITY_ACTION
has been removed (ag/599650) races between CONNECTIVITY_ACTION and
the setting of the default network become more evident.
In http://crbug.com/441818 Chrome is calling getaddrinfo()
immediately after a device goes from no connectivity to cellular
connectivity, and Chrome is erroneously getting back EAI_NODATA
because netd hasn't yet set the default network for DNS resolutions.

bug:18757162
Change-Id: Ib607dcb3697403272a8c838713a9cb602e9c6820
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
2122e14cca3edc5099b90d8768b34d7a0e9fe148 11-Dec-2014 Paul Jensen <pauljensen@google.com> Merge "Fix several HTTP proxy issues with multinetworking." into lmp-mr1-dev
e0bef71662d81caaaa0d7214fb0bef5d39996a69 10-Dec-2014 Paul Jensen <pauljensen@google.com> Fix several HTTP proxy issues with multinetworking.

1. Send PROXY_CHANGE_ACTION broadcast when any network's proxy changes,
not just the default network.
2. When a process is bound to a particular Network, update the proxy
system properties to those for the bound Network, and keep them
updated when PROXY_CHANGE_ACTION broadcasts are received.
3. Make Network.openConnection() use the proxy for the Network.

bug:17905627
bug:17420465
bug:18144582

(cherry-pick of https://android-review.googlesource.com/#/c/115170)

Change-Id: Ia2819985e6108a8c121e74c683a5646becfd0a97
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
33cd463bbbbe47010ed44815fbfd0ab5e8fbf825 10-Dec-2014 Erik Kline <ek@google.com> Merge "Re-remove CONNECTIVITY_CHANGE_DELAY and supporting functions." into lmp-mr1-dev
6973634ce61ab7d4c1d51c70be6d51725b89e7b9 08-Dec-2014 Jeff Sharkey <jsharkey@android.com> Direct notification of network interface changes.

Connectivity broadcasts recently changed and are no longer sent for
certain types of network changes. For example, when stacked network
interfaces change for a mobile network. To ensure that we pick up
all these details, directly wire the two services together.

Also remove some unused code for split network types.

Bug: 18666753
Change-Id: I0467bd5b330c0e0cb51af2306d821b41ad16337a
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
3256601f5e4d94713f59e97b9d4912875c1bdcaf 03-Dec-2014 Jeff Sharkey <jsharkey@android.com> Offer to "merge" subscribers for data usage.

There are some cases where multiple subscriber identities (IMSI)
should be treated as "merged together" from a data usage
perspective. This is done by extending the template used for
matching purposes to support multiple subscribers.

Then, when we query historical usage or set network policies, we
normalize the matching template to merge to any other identities
that should be included. When normalizing, the "lowest" identity
is always used for equality and storage purposes, which allows
identities to come and go over time.

This change also fixes data usage recording for multi-SIM devices
by passing along the concrete subscriber identity for each network
interface. Also correctly create default policies for multi-SIM
devices. This change also drops setPolicyDataEnable() until it can
be wired up to the right underlying NetworkAgent. (This means we
still bring up the network, and then rely on iptables rules to block
traffic when over the limit, instead of proactively disabling the
connection.)

Bug: 18012787
Change-Id: If6acf32009fdfea2b836f5aff8e2f3e5e0248b4a
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
8f29dcfb53350cf687112ac79a806e4d34dfa22b 08-Dec-2014 Erik Kline <ek@google.com> Re-remove CONNECTIVITY_CHANGE_DELAY and supporting functions.

Since optimistic addresses are useable upon kernel notification
there is no need for this extra connectivity delay.

---

This functionality was originally submitted in ag/572619. Owing
to issues with bind()ing to optimistic addresses (see b/18609055)
this was reverted in ag/598673.

This reverts the revert. :-)

Bug: 17769720
Change-Id: Ibee490b2af72050693b6bd748193f51e312ca527
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
1edc73aa5dc24db39ec685f1950c5110699e301e 06-Dec-2014 Jeremy Joslin <jjoslin@google.com> Merge "Don't send the same PendingIntent more than once." into lmp-mr1-dev
891dd5743af17e3376b0b0438b149c565cf871c8 06-Dec-2014 Paul Jensen <pauljensen@google.com> Merge "Reap unvalidated networks that have no chance of becoming highest scoring." into lmp-mr1-dev
7929484dbf0f6eda75641f8b965d3ed5fa1fed52 04-Dec-2014 Jeremy Joslin <jjoslin@google.com> Don't send the same PendingIntent more than once.

Fixing a bug where a NetworkRequest's PendingIntent can be sent more
than once when networks are rematched before the intent completes.

Added a small delay before removing the request to give the receiving
client an opportunity to put in its own request. The delay value is
configurable via Settings.Secure.

Bug: 18614074
Change-Id: Iac7c5e5a04f42f2b6794e9e22349cc631bebeab7
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
0029f0ac36c28b60d59d3d70d148ba3136971b95 05-Dec-2014 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #17323751: Additional items in aggregated battery stats" into lmp-mr1-dev
1e01d16982e6b22ec4c0e2d6dc1e261eb6f92c8e 05-Dec-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17323751: Additional items in aggregated battery stats

- Now aggregate number of times each process has crashed and ANRed.
- Now aggregate total number of connectivity changes.
- Now record connectivity changes in the history.

Crash and ANR counts are new entries at the end of "pr" in checkin.

Connectivity change counts is a new entry at the end of "m" in checkin.

Connectivity changes in the history checkin are Ecn and include the
type of connection and its state.

Change-Id: I0c01186446034cf6c3fb97d45f5e3b5c69a0438a
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
e660e27603e93579b645544ceb9606ded81cea82 05-Dec-2014 Erik Kline <ek@google.com> Revert "Merge "Remove CONNECTIVITY_CHANGE_DELAY and friends." into lmp-mr1-dev"

This is the revert of ag/572619.

This reverts commit 9261d9d64548f0221de50eb99f3675488a4176a4, reversing
changes made to 32b61ab28f54e5b00f472b2166f9b1100375e4ff.

Bug: 18609055
Bug: 17769720
Change-Id: I122eba200f2071d4e5777ec34c1d04fb567345a8
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
efb81b9e965c4ba782151b6767e7e3df4f2cdfd2 04-Dec-2014 Paul Jensen <pauljensen@google.com> Merge "Remember to cancel lingering when a network again satsifies a NetworkRequest." into lmp-mr1-dev
b10e37fd1c3a95f7e621eed234c2491eb71241e2 25-Nov-2014 Paul Jensen <pauljensen@google.com> Reap unvalidated networks that have no chance of becoming highest scoring.

These networks are unneeded and waste battery. We won't bring up these
networks in the first place if they have no chance of becoming highest scoring.
This change handles the case where these networks are already up and
transition to a state where they have no chance of becoming highest scoring.
This happens when another network validates with a score higher than this
network can ever hope to attain.

bug:18489123
Change-Id: I77a96a72e250e25e44e0c50e7a928af8b35bb6ab
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
9261d9d64548f0221de50eb99f3675488a4176a4 04-Dec-2014 Erik Kline <ek@google.com> Merge "Remove CONNECTIVITY_CHANGE_DELAY and friends." into lmp-mr1-dev
403aa2684e0e93b4792aabc0bbe1f32ac5e417af 28-Nov-2014 Lorenzo Colitti <lorenzo@google.com> Make StatusBar display all default networks.

The basic principle is: if an app's traffic could possibly go
over a network without the app using the multinetwork APIs (hence
"by default"), then the status bar should show that network's
connectivity.

In the normal case, app traffic only goes over the system's default
network connection, so that's the only network returned.

With a VPN in force, some app traffic may go into the VPN, and thus over
whatever underlying networks the VPN specifies, while other app traffic
may go over the system default network (e.g.: a split-tunnel VPN, or an
app disallowed by the VPN), so the set of networks returned includes the
VPN's underlying networks and the system default.

Specifically:

1. Add a NETWORK_CAPABILITY_VALIDATED bit to NetworkCapabilities.
2. Add a hidden API to retrieve the NetworkCapabilities of
all default networks for a given macro-user.
3. Modify the status bar code that used getActiveNetworkInfo to
determine which network was active, and make it consider all
validated networks instead.
4. Because the set of active networks depends on which VPN app
the user is running, make the status bar re-evaluate the
networking situation when the active user changes.

Bug: 17460017
Change-Id: Ie4965f35fb5936b088e6060ee06e362c22297ab2
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
0cc1732cfb9d68779449b4c12661b4df6bfc720b 25-Nov-2014 Paul Jensen <pauljensen@google.com> Remember to cancel lingering when a network again satsifies a NetworkRequest.

When WiFi's score drops and then comes back up we would previously linger
WiFi but forget to cancel the linger timeout, so 30s later WiFi would
unexpectedly tear down. Also, make sure this is only done for created
Networks as "created" is the signal to initialy match Networks and requests.

bug:18169560
Change-Id: Ia69b110f6473371e556c60b950253758e023b7aa
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
32f3518dccf5c599c21b54095abe561f48277898 02-Dec-2014 Lorenzo Colitti <lorenzo@google.com> Merge "Only use mDefaultDns if the network claims to offer Internet" into lmp-mr1-dev
829dfa7cd80faa61b3f63c455f81411571144f82 28-Nov-2014 Lorenzo Colitti <lorenzo@google.com> Only use mDefaultDns if the network claims to offer Internet

Currently, if a network does not specify DNS servers, we default
it to using 8.8.8.8. This was done because the emulator did not
specify DNS servers. However, it causes queries to fail slowly,
instead of failing fast, on networks that do not have
connectivity to 8.8.8.8.

Bug: 18327075
Change-Id: I0df13ff4a17ee65e640be96695a3af31b020963a
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a68e7d730cf303b33d6aec9420c4bb4a92275baa 26-Nov-2014 Jeremy Joslin <jjoslin@google.com> Fix the ordering of extra values in the PI.

Bug: 18539720
Change-Id: I6bb69394b05923ca25bc1b4902bc2540a13812bd
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
6ea4e11d9817d85eb5c0ff445154985e4eb0c534 24-Nov-2014 Jeff Davidson <jpd@google.com> Merge "Don't enforce control permission when preparing consented VPN." into lmp-mr1-dev
e57064a289082758fcb9bb71f987dde84931e3e6 24-Nov-2014 Paul Jensen <pauljensen@google.com> Merge "Don't bother validating networks that don't satisfy the default request." into lmp-mr1-dev
6d0e8711d0612cfc9d9db2def57541076c0f7a40 24-Nov-2014 Sreeram Ramachandran <sreeram@google.com> Merge "Delete unused/non-working code." into lmp-mr1-dev
11008a78b8e30910cedd8b8431980c7738183292 20-Nov-2014 Jeff Davidson <jpd@google.com> Don't enforce control permission when preparing consented VPN.

If a VPN app requests to be prepared and has already obtained user
consent, there is no need to additionally enforce the control
permission. We only need to enforce the control permission when a VPN
is first being prepared, where such a preparation would bypass user
consent.

Also ensure that in this case, the VPN being prepared matches the
calling app. Otherwise an app could prepare another pre-consented VPN,
which is not particularly dangerous but is likely unexpected.

Finally, remove misleading comment in ConnectivityService#prepareVpn.
This method IS called from VpnService.prepare(), not only from
system-privileged apps.

Bug: 18442887
Change-Id: Ic3227c6c1c74312697f0576d3811b06692a4edff
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
c2c0beab79a907f63e109eefe2a5aabcf2e3fd8f 12-Nov-2014 Sreeram Ramachandran <sreeram@google.com> Allow VPNs to specify their underlying networks.

These are used when responding to getActiveNetworkInfo() (and cousins)
when an app is subject to the VPN.

Bug: 17460017
Change-Id: Ief7a840c760777a41d3358aa6b8e4cdd99c29f24
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
75f018e6a7c2280c62e686440000a1dcdf5179cf 19-Nov-2014 Sreeram Ramachandran <sreeram@google.com> Delete unused/non-working code.

Change-Id: I2cba9ffdb4ed547cb922d0ac08abf81e49ffa66b
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
21b5ee3f0e39be4a79bcfb2b79b0529f75f5cb58 13-Nov-2014 Sreeram Ramachandran <sreeram@google.com> Eliminate race conditions in UID-based network filtering.

The previous code retrieved information from the legacy tracker multiple
times for each user query, leading to race conditions where the info
could've changed between the calls.

Refactors the handling of legacy data types in ConnectivityService and
unifies call paths so that APIs that deal with legacy data types
(NetworkInfo and int/networkType) and newer types (such as Network) go
through common code paths, using NetworkState to hold all the necessary
data pieces. This enables follow-on bug fixes to getActiveNetworkInfo().

The changes are limited to public "query" APIs (those that retrieve some
network information or the other). More details about the specific
changes and their rationale can be found in the code review thread.

Bug: 17460017
Change-Id: I656ee7eddf2b8cace5627036452bb5748043406c
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
0653f508b58eab994089ae2da783852a5c1b4a8a 21-Nov-2014 Paul Jensen <pauljensen@google.com> Merge "Don't allow an uncreated Network to satsify requests." into lmp-mr1-dev
e548c3a3786a252d42b3c0ae0823f4718fcb9718 21-Nov-2014 Geoffrey Borggaard <geoffreyb@google.com> am c3f5d718: Merge "Fix null handling in proxies." into lmp-dev
automerge: 90ed95f

* commit '90ed95faeddf7ebe71320e3e0e80eb17d374e49c':
Fix null handling in proxies.
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/ConnectivityService.java
79adc958e5cd8daf7231ec042dfa367010d415f4 20-Nov-2014 Geoffrey Borggaard <geoffreyb@google.com> Fix null handling in proxies.

ProxyInfo.getPacFileUrl() can not be null. It will be equal to
Uri.EMPTY. Checking for null was causing global proxies to never be
disabled. Or more accurately, global proxies would be disabled, but
would reappear after a reboot.

ProxyInfo.getExclusionListByString() can be null. If no
exclusion list was specified, the proxy settings would not be
successfully saved, they would disappear after reboot.

Bug: 18453223
Change-Id: I1c27e5dca5b9664bb7468ea909bff489fa110a07
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
90e9307e8fa713081aeccd8f5f212c0f1255bd07 18-Nov-2014 Erik Kline <ek@google.com> Rename EXTRA_NETWORK ConnectivityManager constants.

Per b/18414703:

s/\<EXTRA_NETWORK_REQUEST_NETWORK\>/EXTRA_NETWORK/g
s/\<EXTRA_NETWORK_REQUEST_NETWORK_REQUEST\>/EXTRA_NETWORK_REQUEST/g

Additionally, associated string values updated to:

android.net.extra.NETWORK
android.net.extra.NETWORK_REQUEST

Bug: 18414703
Change-Id: I7aeed2161829742affc666e835a97ce2c28356fe
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
57a767ff22cc141c90627b480b48cbda7c89d62b 19-Nov-2014 Paul Jensen <pauljensen@google.com> Don't allow an uncreated Network to satsify requests.

This could happen when another Network changes its capabilities and
updateCapabilities() calls rematchAllNetworksAndRequests() which
calls rematchNetworkAndRequests() on all Networks, even those that
are uncreated.
Allowing uncreated Networks to satisfy requests can lead to bugs
where ConnectivityService instructs netd to perform actions
(e.g. set default Network) on uncreated Networks which netd doesn't
know about yet.

bug:18446301
Change-Id: I857262ac66d1d3af4c264ce128f0a4bee95655de
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a8e6d6fd993c449b442be8c19f6c2688b75c018d 17-Nov-2014 xinhe <xinhe@google.com> Merge "air plane mode only send to the owner through the quick setting" into lmp-mr1-dev
9a1da68bf7980449a5ee5d6fa9d9686b04d667ff 11-Nov-2014 Jeff Davidson <jpd@google.com> Expose a SystemApi method to prepare a VPN without consent.

This is NOT designed to be called normally. Most apps (even
system-privileged ones) should request user consent before launching a
VPN. However, it is needed to support flows where consent can be
obtained through other means external to the VPN flow itself.

The API requires a system-privileged permission, CONTROL_VPN.

Bug: 18327583
Change-Id: I1bcdcf0fb5707faeb861ec4535e7ccffea369ae7
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
98e25fc3771b8c51630ae05752e0b91ac01a97af 17-Nov-2014 xinhe <xinhe@google.com> air plane mode only send to the owner through the quick setting

It should send to all the uesers as it behaves in setting

Bug:18353278
Change-Id: Ib46a97e30bfba73dd78fab0c8139d6ccb7ad210f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
0cb1bc488c6578fde1503c53405715c564f0f7a0 06-Nov-2014 Sreeram Ramachandran <sreeram@google.com> Merge "Send broadcasts when VPNs come and go." into lmp-mr1-dev
46e3ac8bbca54b56af1947f64294e2a4c35cfa3c 05-Nov-2014 Jeremy Joslin <jjoslin@google.com> Implemented requestNetwork with a PendingIntent.

ConnectivityManager.requestNetwork(NetworkRequest, PendingIntent)
was unhidden and implemented.

Added ConnectivityManager.removePendingIntentRequest(PendingIntent) as
the companion method.

Bug: 17356414
Change-Id: I656a1e149cc1292c443ebfe9e61ee3eb5a80f143
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
9634abe86b02b6ea9b6ea6f03d9f78395b696a89 05-Nov-2014 Jeff Davidson <jpd@google.com> Update network selections on capability change.

Among other reasons, this is needed when a Wi-Fi connection is
upgraded from untrusted to trusted, so that the default route can be
updated to point to the Wi-Fi network instead.

Bug: 18206275
Change-Id: I53f7a6f00f66a23ae4873fa2334cd8a621f39d4f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
60c0c0da0a122702c8425808cdc2c7a79738295c 30-Oct-2014 Sreeram Ramachandran <sreeram@google.com> Send broadcasts when VPNs come and go.

This is achieved by adding TYPE_VPN as a supported legacy type.
Note that this is added in code, and not in a config.xml file,
so there's no way to remove TYPE_VPN (i.e., make it unsupported).

Bug: 17426546
Change-Id: I02eb5f22737720095f646f8db5c87fd66da129d6
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
8e3f4fbdf6e562f4f5731b98e327e8af33b75c4c 22-Oct-2014 Erik Kline <ek@google.com> Remove CONNECTIVITY_CHANGE_DELAY and friends.

Once optimistic addresses become useable upon kernel notification
there will be no need for a connectivity delay.

This change requires kernel changes like:
https://android-review.googlesource.com/#/c/109934

Bug: 17769720
Change-Id: I8510c540aa655aad6a82ee322d591331357ee272
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
954394653dad05838235f48244a4320893e0f0cf 09-Oct-2014 Lorenzo Colitti <lorenzo@google.com> Support more than one clatd at a time.

1. Make Nat464Xlat a per-network object, one for every network
requiring clat, instead of a ConnectivityService singleton.
2. Make the NetworkManagementService clatd commands take an
interface.
3. When we attempt to start clatd on a network, store its
Nat464Xlat object in the NetworkAgentInfo, so we have an
authoritative way of knowing whether clat is running on a
given network.
4. Rework Nat464Xlat, hopefully simplifying it.

Bug: 12111730
Change-Id: I1fa5508ef020cd1c3d1c7a1f7b06370ac5fc2ae2
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
0cb7903ddedbbb8a8171926e4460b74af589369d 15-Oct-2014 Lorenzo Colitti <lorenzo@google.com> Propagate network state changes to the LockdownVpnTracker.

Bug: 17695048
Change-Id: I10378df0ab545729a6a315fd1bc8870cd98f47b3
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
483d1fb3a6b55c1309cbc2948b261fae936965e0 04-Oct-2014 Robert Greenwalt <rgreenwalt@google.com> Switch the NetworkInfo.mIsAvailable default

The placeholder for disconnected networks was setting it to false, but
this technically means that we know an attempt to connect to that
network will fail (which we don't really now). Some applications use
this an decide not to bother trying - an MMS app for example would
never send an MMS because it thinks the network is never available.

This is a L regression.

bug:17669247
Change-Id: Id6041f226da069c267c56418d42c55978c36c66f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
24861eabe641d5a147f127c8e7f98fab949224ab 03-Oct-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Send callbacks for Net property changes" into lmp-dev
a848c1cc0a7b72b192aef9de2d448b3e1d17619c 01-Oct-2014 Robert Greenwalt <rgreenwalt@google.com> Send callbacks for Net property changes

LinkProperties and NetworkCapabilities changes were not calling app callbacks.

bug:17681483
Change-Id: I67dac3c4dc1284f5c4bfb24de239da4ec776336f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a11b5e34f50899a48531bb84ba3f6d796a64985e 03-Oct-2014 Paul Jensen <pauljensen@google.com> Merge "Send updated NetworkAgent score to NetworkFactories when validated." into lmp-dev
6eead851d2ea56c3e7319587d4066b1828d54699 03-Oct-2014 Paul Jensen <pauljensen@google.com> Merge "Allow any unvalidated Network to satisfy NetworkRequests." into lmp-dev
cf0f97a3aa754f5e75bf1dc5d4e78ca46aa17513 02-Oct-2014 Jason Monk <jmonk@google.com> Synchronize on all sendProxyBroadcast calls

To avoid race conditions. Also make mDefaultProxy volatile for
safety.

Bug: 17697364
Change-Id: I8f0abb1a6e1c816f3addc11a69ff794ad767f2cf
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
c8b9a7428d12a782deda1b807164f0ec74d1ad12 30-Sep-2014 Paul Jensen <pauljensen@google.com> Send updated NetworkAgent score to NetworkFactories when validated.

Previously the score was not sent out causing other NetworkFactories
to have the lower unvalidated score and to repeatedly try to bring
up a new Network only to have it torn down.
Also, avoid logging an error when tearing down a network with only
listening requests.

bug:17726566
Change-Id: I82ff7c9bd5ec962f62a50ad0042c278622953969
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
4b9b2be8945a4f22676ea948ae260108159e26a3 26-Sep-2014 Paul Jensen <pauljensen@google.com> Allow any unvalidated Network to satisfy NetworkRequests.

Explicitly selected Networks may never be validated (e.g. Chromecast)
but are still given a high score so they can explicitly become the
default Network. Without this fix they do not become the default
Network if another Network is present. This was an artifact of how
unvalidated Networks were handled, but now that unvalidated Networks
are properly handled, ala 50807d, we can freely rematch even
unvalidated Networks and NetworkRequests.
Also, never linger and teardown unvalidated Networks as the user
might be in the process of signing in. This better matches prior
behavior when unvalidated networks didn't match NetworkRequests,
and thus were never lingered.
Also, don't disconnect networks that may be lingering. The
disconnect logic in rematchNetworkAndReqeuests() is adjusted to only
fire when a network is newly validated.
It is incorrect to consider rematching uncreated Networks and
explicitly selecting created Networks, so this change logs error
messages in those cases.

bug:17647968
bug:17396616
Change-Id: Id6b8a350b8200f484d5bfd14ca0a8f64f08846a0
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
e4a05afe85f15472325db9c535ef81f409fb6070 24-Sep-2014 Sreeram Ramachandran <sreeram@google.com> Send app permissions to netd.

Based largely off Robert's http://ag/546170 (thanks!)

Bug: 15413737
Change-Id: I8a1f0a184923c4c0a4935e6b88895bcc05e39f02
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
d8f7e048281559462f9c590f9d7d48fb7fe065ce 30-Sep-2014 Lorenzo Colitti <lorenzo@google.com> Merge "Update LegacyTypeTracker state before sending connect broadcasts." into lmp-dev
89e0f0937a70d73b5ed188c9337b4d33860e5573 15-Sep-2014 Paul Jensen <pauljensen@google.com> Move mobile provisioning APN support into telephony.

Most of this logic is simply removed from ConnectivityService.
The captive portal detection is now done by the NetworkMonitor.
The notification logic is still left in ConnectivityService as
it's used by both the NetworkMonitor and telephony's mobile
provisioning logic.

bug:17324098

Change-Id: Ibd1c42b1a75795f90a6483d3d0a5a14f88b193d8
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
061f4159dca9b68f0315d725a945af9736dde62f 28-Sep-2014 Lorenzo Colitti <lorenzo@google.com> Update LegacyTypeTracker state before sending connect broadcasts.

Currently, LegacyTypeTracker sends out connected broadcasts
before updating its internal lists of networks. This creates a
race condition where an app can query LegacyTypeTracker state
(e.g., via getActiveNetworkInfo) as soon as it gets the
broadcast, and get information that has not been updated.

Bug: 17540101
Change-Id: Iefd6d5e9fd0b427c5872166208831f70fcef8b6f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
75b8966cad24354272759a1579376f7e64e40050 24-Sep-2014 Lorenzo Colitti <lorenzo@google.com> Merge "Only stop/start clatd if necessary." into lmp-dev
e034716628de94399717a744f14bdfd534d8f87a 24-Sep-2014 Lorenzo Colitti <lorenzo@google.com> Merge "Block address families with routes, not NetworkAgent side channel" into lmp-dev
1df5fa55c5a5c1ba054b783ea639c99d57c357cf 20-Sep-2014 Lorenzo Colitti <lorenzo@google.com> Only stop/start clatd if necessary.

Previously we would restart clatd on every LinkProperties
change, which now happens every time we switch radio technology
(e.g., LTE to HSPA). We also would not stop it if the link got
an IPv4 address.

Bug: 15024258
Bug: 17186694
Bug: 17569702
Change-Id: I65cfcd5e7acec8ea1a12392a59dabd668c58490f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
74971c75dcdfacdf49f110c2104f20e704bffdcb 23-Sep-2014 Paul Jensen <pauljensen@google.com> Merge "Remove needless locking of mRulesLock that caused deadlocks." into lmp-dev
60446165d8bd44f72cec8d0c5583a688369fa660 19-Sep-2014 Lorenzo Colitti <lorenzo@google.com> Block address families with routes, not NetworkAgent side channel

Now that we support unreachable routes, use those to block
address families on VPNs. This is a much more elegant solution.
Also update LinkProperties when IP addresses are added and
removed, fixing a TODO.

Bug: 17462989
Change-Id: Ib749d84710dca70d672350b9f129bb91419ec77e
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
f9ee0e50545ba5e592147037f67155a29b3130ca 19-Sep-2014 Paul Jensen <pauljensen@google.com> Remove needless locking of mRulesLock that caused deadlocks.

The locks were added in c006f1 when underlying functions weren't performing
locking. In d2a4587 the underlying functions were changed to perform locking
but the higher level locking wasn't removed. The higher level locking can
now cause deadlocks with the new NetworkAgentInfo locking. This change
removes the needless higher level locking. Now all mRulesLock locking
only guards simple accesses to the appropriate two data strucures so there is
no chance of a deadlock. I verified that all accesses to the appropriate
two data structures are guarded by mRulesLock locking.

bug:17569997
Change-Id: Id9f4e3d19d6895876925ae32f12460db30359368
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
f3b47e95b14d040c4239b9188a10a4befb607459 18-Sep-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Use unified Tethering Permission Check" into lmp-dev
edb47668f072ba82ca389a1b78b1a2024ac31663 17-Sep-2014 Robert Greenwalt <rgreenwalt@google.com> Use unified Tethering Permission Check

The BT and Wifi mechanisms for enabling Tethering did their own
permission checks. This set of changes unifies the check into
a ConnectivityManager function so they can be kept in sync.

bug:17435527
Change-Id: I8c157a5acf56ffbddd349cb6a45160ae7be8541b
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
e73cc4646bed3926024c9f54ca59e3a82a97b56c 08-Sep-2014 Robert Greenwalt <rgreenwalt@google.com> Add NetworkAgent event for ExplicitlySelected

Lets Wifi tell us when the user selected this AP vs auto-connected.

bug:17396168
Change-Id: I6e067ab62ed49040629aa31fe07ff880d3d542f0
/frameworks/base/services/core/java/com/android/server/ConnectivityService.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/ConnectivityService.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/ConnectivityService.java
2161a8ea123134ee3f9a10c0f8f56aabd8289f69 11-Sep-2014 Paul Jensen <pauljensen@google.com> Better handling of unvalidated networks.

Give unvalidated networks penalized scores and allow them to satisfy
requests.

Previously unvalidated networks were never allowed to satisfy
NetworkRequests and so never caused CONNECTIVITY_ACTION broadcasts.
Previously if there were no other networks present an unvalidated
network would still be made the default. This change formalizes
this behavior using our existing network score logic by assigning
unvalidated networks a highly penalized score.

bug:16358003
bug:17364306
Change-Id: I28fcd6f5ac4b52a4d1c234c472cfa8ba998bcc6f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
8c9e975c44d35c111176e4b8c38555121495e7ae 10-Sep-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Don't accept score below 0." into lmp-dev
35f7a94c846cfdaa75ed6bc58ec37bdef7a09be8 09-Sep-2014 Robert Greenwalt <rgreenwalt@google.com> Don't accept score below 0.

Network Factories are allowed to go below, but networks need to be
constrained. Allowing the network to go below 0 meant that -1 could
sometimes leak through and foul the logic.

The core of 17361330 will be fixed when we stop sending scores for
listens to NetworkFactories, but it exposed this issue too. Summary:

1 - add a network listener. This isn't a request so it's not sent
to networks.
2 - alter your score (ethernet sets score to -1 when the link goes
down) (16:07:39.782)
3 - a bug in ConnectivityService causes score changes to get sent for
all network requests and network listeners causing NetworkFactories
to no see 2 entities. This bug will be fixed by a pending change
(https://googleplex-android-review.googlesource.com/#/c/540840/).
This causes the ethernet NetworkFactory to see two entities, both
served by networks of score -1. (16:07:39.989)
4 - disconnect Ethernet - this only sends 0 scores for known
requests, not network listeners. Had it been sent for both entities
they both would have evaluated that the networkfactory score (-1)
was lower than the request score (0) and both released their
refcount. (16:08:03.147)
5 - this means the listener is tracked by the EthernetNetworkFactory
with a score of -1 while the factory itself has a score of -1 so the
network release isn't called.

bug:17361330
Change-Id: Ife34ca0f9c233dd3c3df80f6fea580af43afcdeb
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
eea87a3a44b27d849c594f1fcea57013f7c4d2fb 09-Sep-2014 Paul Jensen <pauljensen@google.com> Merge "Stop logging false error when lingering completes." into lmp-dev
fc2c5c919973c1b3c571eadca4bdf0d99167b2d1 09-Sep-2014 Paul Jensen <pauljensen@google.com> Merge "Don't send listening NetworkRequests to NetworkFactories." into lmp-dev
f9b42de2ab33de2eddf0bf25d88e3f4512aaf932 09-Sep-2014 Paul Jensen <pauljensen@google.com> Merge "Implement ConnectivityManager.reportBadNetwork() to trigger network validation." into lmp-dev
b31c0636344d8b0888e9ccf726d3f3cf6fc6f9aa 05-Sep-2014 Paul Jensen <pauljensen@google.com> Stop logging false error when lingering completes.

When lingering completes ConnectivityService would log an error message
saying the Network still had NetworkRequests. Fixed by ignoring
listening NetworkRequests which aren't a problem.

Change-Id: Ie78a1f91c47b012eae28a377dd77bee2cfcbde3b
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
d7063e66ab03f68a85ec96df2e83e2af551bef77 05-Sep-2014 Paul Jensen <pauljensen@google.com> Don't send listening NetworkRequests to NetworkFactories.

We were doing this when a NetworkAgent updated its score.

bug:17393458
Change-Id: Id19ffc36b942b7112da70dfadd6abd57fcd128bd
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
8f4d42ce00609e95ef1e842953c6d05fc60e991d 06-Sep-2014 Sreeram Ramachandran <sreeram@google.com> Reserve NetIds 1..50 for OEM use.

Also reserve 51..100 for our use.

Bug: 17303534
Change-Id: Id082368b493dc3c5b5c479e51d273458d80ec6aa
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
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/ConnectivityService.java
17e7e9757d9fe304351dc566fd12b8c03196cee2 30-Aug-2014 Lorenzo Colitti <lorenzo@google.com> Kill the NetworkInfo(int type) constructor. IT'S A TRAP!

This constructor does nothing, including doing nothing with its
only argument. This causes it to return a NetworkInfo for
TYPE_MOBILE no matter what was passed in.

Bug: 16610051
Change-Id: I4ccd5ec050f7824fb06496c00fcd7901defeb7bd
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
b57edc5ae999abd9c7310833f4f10bbacbc469d7 23-Aug-2014 Lorenzo Colitti <lorenzo@google.com> Pass the socket mark for DNS queries to dnsmasq.

This makes tethered clients use the correct DNS servers when
tethering to non-default networks like the DUN APN.

Bug: 16357676
Change-Id: I8933b6de198a92c2aaf0291931ace8966ddba275
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
3892fc0349a91097f53152eaf2801dfebb2066ca 28-Aug-2014 Diego Pontoriero <diegs@google.com> Change TelephonyManager method name to accurately reflect functionality.

Bug: 17163860
Change-Id: I4390d79c49831454146a42b89520a16984c5f260
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
2836dbb9536263a8d4e33a751fb41efc5a58186e 28-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Clean up Connectivity Logging." into lmp-dev
fc0c6890c675494b15cd847b20c5a5ede491fc3c 27-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Clean up Connectivity Logging.

bug:17285109
Change-Id: I61b98aa636996f8d4915fd954d49a22c20cfe9ab
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
e30735c7dc574ac6b40d871d2bee99eb8ecd3000 27-Aug-2014 Paul Jensen <pauljensen@google.com> Merge "Fix to allow removing sign-in notification when network removed." into lmp-dev
5df4bec50495914b47b6a2f73f20d2bd24a9f9ea 26-Aug-2014 Paul Jensen <pauljensen@google.com> Fix to allow removing sign-in notification when network removed.

When the NetworkMonitor is told a network disconnected and a sign-in
notification has been shown to the user, the NetworkMonitor requests
the notification be removed. This request goes to the
ConnectivityService who may have already removed the NetworkAgentInfo
from mNetworkForNetId so we cannot look up the NetID in there.
There is no harm in allowing notification hiding for networks that
are disconnected as the notification logic does not effect the
Network state (like the validation message that caused the addition
of the Network liveness check).

bug:17261757
Change-Id: Id0a299e230ae37e641ac2faeebc45550e27c1fa4
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
739d6dbf9bb11a84652d5a5b7127192c1f9a6806 26-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Remove listen requests properly." into lmp-dev
4456cf3ff0aa5fbd4a9a08c0987360b61fd38fa8 25-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Remove listen requests properly.

https://googleplex-android-review.googlesource.com/#/c/527772/
correctly stopped adding listen requests to the mNetworkForRequestId
sparse array, but when we remove requests, if it's not getting
serviced by a network, we don't remove it from the network. That
means that when we go to send a notification for that network we have
a request affiliated with the network, but don't have data for the
request and hit this NPE.

If it's not a request, don't do the optimization and remove it only
from the network servicing the request, but instead scan all networks
and remove it from each, if found.

bug:17239054
Change-Id: I49165ed08c224ef20f703469f9ce39df5f21b163
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
b98c59896cf93f019155ba95ceb2a301cea7513f 23-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Update the http proxy on LinkProperty change.

bug:16308315
Change-Id: Ie44634a9223f289903c09653f77a998d3a344654
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
6f91390f1a1ebef4e45ebaa78259f866cebc976f 22-Aug-2014 Jeff Davidson <jpd@google.com> Allow NetworkRequest release from the system process.

Otherwise attempts to release that are triggered by the binder death
receipient will be rejected.

Bug: 17187437
Change-Id: If3924d82dba69c572708e04c11d17ed25ae6870d
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
56a9ed858c73a8483c34c56dd77665b13e100a74 21-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Change the NetworkInfo for disconnected types." into lmp-dev
bdb1bdf57b8c4348a02fc085b05b7b0f57abe7b5 21-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Change the NetworkInfo for disconnected types.

Don't send out NetworkInfos with UNKNOWN state for disconnected
networks - use DISCONNECTED.

bug:17095670
Change-Id: I863bebadc1f9a666572958b49d5e62809f485e5d
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a945c352730b2e43d0d6ea3af4c14994a340b3e8 21-Aug-2014 Lorenzo Colitti <lorenzo@google.com> Merge "Fix findConnectionTypeForIface." into lmp-dev
1c3a35bcff2deeef8aa064a3e44bdd68aa18994e 20-Aug-2014 Lorenzo Colitti <lorenzo@google.com> Fix findConnectionTypeForIface.

This is used by the VPN to notice when its underlying connection
has gone away. I'm fixing this using network types and not
NetworkCapabilities because

1. I don't know of a way to use the new API to get callbacks for
a specific network. You can get them based on capabilities,
but it's not clear how to construct a NetworkCapabilities
object that will only match a specific network, or only match
the default network.
2. It's a smaller change.

Bug: 15070628
Change-Id: Id6a6a183da83636c0859db4c954093bd684c01ea
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
35228d72e12ce7bdf39c4f6b09600cc4e1c3e0c1 21-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Avoid reusing a currently active NetID." into lmp-dev
1bbcaa0fc4e514baf8242b147f5ad40782d9f801 21-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Fix listening NetworkRequests to listen for all networks." into lmp-dev
0d39e6722b77a6ee7872c377fea8453f0102f2bf 21-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Fix CS/NetworkMonitor race." into lmp-dev
60061a6ebf4ef758c4a47d210de0e5be2484be5b 05-Aug-2014 Paul Jensen <pauljensen@google.com> Avoid reusing a currently active NetID.

There are only a limited number (65526) of NetIDs so the chance for reusing
one exists. Reusing a currently active NetID will cause problems like netd
failures and overwriting entries in mNetworkForNetId.

bug:16815182

Change-Id: Ib75302beae3179c3f3b90c345cf4d2cf5f4ad2be
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
73ed9d8dee5ef7139b84c8e1713fec7ff5ccce5d 20-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Fix CS/NetworkMonitor race.

If we have a message in flight about a NetworkAgentInfo when it gets disconnected
we are left with a zombie network. Fixes this by verifing the network is still
live before we process the msg.

bug:17142206
Change-Id: I2c94a39b3ea97c1562066571b277280c1f69f71c
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
0311b2b31a9577a89fc0a2ed82ba761aa97df06b 19-Aug-2014 Paul Jensen <pauljensen@google.com> Fix listening NetworkRequests to listen for all networks.

This is a small change but should fix a number of functional problems:
1. When registering a listening NetworkRequest and when a Network is
validated, we should always add the listening NetworkRequest to the
Network's list of NetworkRequests if the Network satisfies the
NetworkRequest. Previously in both cases this was only done for
the highest scoring network. This enables the listening
NetworkRequest to listen for all networks, not just the highest
scoring network.
2. No longer add listening NetworkRequests to mNetworkForRequestId as
it doesn't make sense as it's a 1:1 mapping but listening
NetworkRequests to Networks is a many:many mapping.
3. Don't "keep" a Network that's finished validating when only a
listening NetworkRequest requests it.
4. Don't send updated scores to NetworkFactories from listening
NetworkRequests. NetworkFactories and NetworkAgents shouldn't
concern themselves with listening NetworkRequests.

bug:16680764
Change-Id: Iaba14263227771e4bd84ee4bce488beaef20a8a3
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
c8f0ffa297d1d5d51c6fa60e7d7cd56a8bc91d1d 21-Aug-2014 Jeff Davidson <jpd@google.com> Merge "Less intrusive VPN dialog and other UX tweaks." into lmp-dev
05542603dd4f1e0ea47a3dca01de3999a9a329a9 11-Aug-2014 Jeff Davidson <jpd@google.com> Less intrusive VPN dialog and other UX tweaks.

-The ability to launch VPNs is now sticky; once approved by the user,
further approvals are not needed UNLESS the connection is revoked in
Quick Settings.

-The old persistent notification has been removed in favor of the new
Quick Settings UI.

-The name of the VPN app is now pulled from the label of the VPN
service rather than the app itself, if one is set.

Bug: 12878887
Bug: 16578022
Change-Id: I102a14c05db26ee3aef030cda971e5165f078a91
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
3f38f72a1b629f8887787415129615c506f89621 21-Aug-2014 Diego Pontoriero <diegs@google.com> Merge "Change CARRIER_SETUP hook in ConnectivityService to use Aeroshell API for determining carrier app instead of MCC/MNC." into lmp-dev
255dd04271088590fedc46c8e22b2fd4ab142d39 19-Aug-2014 Selim Cinek <cinek@google.com> Added notification color to all system notifications

Bug: 17128331
Change-Id: I81a94510ef51b99916f314c0dd65852426a1fbeb
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
3f05bf4d7838cb719e78f9d93b22d7ce777392c5 06-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Add tcp buffer size conduit to NetworkAgent.

bug: 16549611
Change-Id: I7d97dedea2c7c1aed2eccb185645889424508591
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
43074032d6ee3576416c86342da3a7a3291049a7 16-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Fix a logic error so mtu works.

bug:17046179
Change-Id: I744a2fd425627da16d9779df3a96541506e0b6b3
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
15afd8115869bf22534a1f26fe6e389c9e5ef413 06-Aug-2014 w19976 <w19976@motorola.com> Configure MTU based on network MTU parameter

Add logic to obtain the mtu from the network PCO parameter and set it to kernel
when the mobile data connection is established. When there is no PCO mtu configured
from the network, the mtu size defined in the corresponding APN will be used. In case
no mtu size is defined for an APN used for data connection, the MCC/MNC based MTU
defined in the framework overaly will be applied.

bug:17046179
Change-Id: I6465d4b8f2076aaa380ae3617fb3f24adbe136d4
/frameworks/base/services/core/java/com/android/server/ConnectivityService.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/ConnectivityService.java
d45afac287f54f610b795dcd9513bcd032695363 12-Aug-2014 Diego Pontoriero <diegs@google.com> Change CARRIER_SETUP hook in ConnectivityService to use Aeroshell API
for determining carrier app instead of MCC/MNC.

Related ConnectivityService change: http://ag/374479

Related Aeroshell change to SetupWizard: http://ag/520857

Bug: 16457806
Change-Id: I78eb2a25d578400c2de6bae4af3d6e8e1ee4d0c7
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
70236bf4f10b485c20fd7aab80c9309a8b8f5cbf 08-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Remove extraneous clearing of inet condition

This was old code I missed in previous inet condition refactor
and caused us to show "not connect" icon any time we connected
to a secondary network (mms/supl/etc).

bug:16896743
Change-Id: I0fa62e09bb0b7c0ee0864bb1f95967eac5f60d3e
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
eb2c2c790c4b86c9c09245e0b87a38972713434a 12-Aug-2014 Jeff Sharkey <jsharkey@android.com> Hack and ship: NetworkStats edition.

Some devices use clatd for catching raw IPv4 traffic when running on
a pure-IPv6 carrier network. In those situations, the per-UID
stats are accounted against the clat iface, so framework users need
to combine both the "base" and "stacked" iface usage together.

This also means that policy rules (like restricting background data
or battery saver) need to apply to the stacked ifaces.

Finally, we need to massage stats data slightly:

-- Currently xt_qtaguid double-counts the clatd traffic *leaving*
the device; both against the original UID on the clat iface, and
against UID 0 on the final egress interface.

-- All clatd traffic *arriving* at the device is missing the extra
IPv6 packet header overhead when accounted against the final UID.

Bug: 12249687, 15459248, 16296564
Change-Id: I0ee59d96831f52782de7a980e4cce9b061902fff
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
bf4eed772a35a8ae6ddac1b8f6dc0744756c7c75 07-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> First pass of changing statusbar connectedness

Switching from GCM-only inet condition reports to using our network
validation (captive portal check).

Note that currently the GCM signal is disconnected. Next step is to
make the bad-network report API trigger a re-evaluation of the network
and get negative reports from the NetworkMonitor.

Change-Id: Ie2ebab1e5c04775e3c4d6738f656a6c8157dba76
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
eec75412a971a5ccb769364120c769c331946eb3 04-Aug-2014 Paul Jensen <pauljensen@google.com> Stop ConnectivityService from talking to netd about uncreated networks.

This avoids logged netd errors that are red-herrings.

bug:16667349
Change-Id: I5d6f1681f1d38dab0af4c535573a0c45c0216603
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
8043df68bff0b6e1240b571cffa7f9d9155e2281 07-Aug-2014 Paul Jensen <pauljensen@google.com> Merge "Flush DNS cache when routes change." into lmp-dev
5fb2c6ffe75d4089ec57ae42f2e5c7423c648dec 06-Aug-2014 Paul Jensen <pauljensen@google.com> Flush DNS cache when routes change.

We used to do this but the change got lost in the NetworkAgent
upgrade. This brings it back. ConnectivityService has netd do
the actual flushing.

bug:16549455
Change-Id: I11ddd55fcb9d1ed1d2c6a9be7eb8c57e41bdbdb8
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
ab14df37ab9fcc63affb877833ee7869e1450bb2 04-Aug-2014 Paul Jensen <pauljensen@google.com> Remove dead CaptivePortalTracker.

Captive portals are now detected by the NetworkMonitor.

Change-Id: Ibfb04bf83b1028231397a577468f110d7ab1dc06
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
83f0f755b04075f6f342d2ae1eeef192ebecdcb3 02-Aug-2014 Robert Greenwalt <rgreenwalt@google.com> Add Logging around getNetworkInfo.

bug:16610051
Change-Id: I04f19efc99bce6d990364291b6cd8105f08ab263
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a793a671976eab3f7199e00e2fa0affb2cf5bc56 31-Jul-2014 Lorenzo Colitti <lorenzo@google.com> Improve LegacyTypeTracker.

Keep track of requests as well as of networks that come and go.
This is necessary, for example, to ensure that we pretend that
HIPRI has gone down when the HIPRI request goes away, even
though the underlying cell network is actually completely
unaffected.

Also, ensure that when switching default networks we send
disconnect broadcasts (and do so *before* connect broadcasts, to
maintain the illusion).

Bug: 16610051
Change-Id: Ib3c831387124940156df05b312cc36bc0724373e
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
d49ac33b5e1c0bd0370255d8e3da64ed634e2b41 31-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Add logging of Legacy Type info.

There are some bugs where getActiveNetworkInfo gives bad data (seemingly)
and this will give the backing data in logs.

bug:16610051
Change-Id: Iad867485ad78daeb3e88665dcd0fdb0af756a3bf
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
5c1c832a8f87850f55755202f1f7caa510449d87 29-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Remove dead code 4.

Removing:
handleDnsConfigurationChange
updateDnsLocked
updateRoutes
handleConnectivityChange
handleConnect
handleDisconnect

Adding a missing flushVmDnsCache and setting of mActiveDefaultNetwork

Change-Id: I681fc72c317833ea1deb42db0b43d2adb21baeff
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
1ea93a3b4f0454a693fd1b276b47c3944c1a8bb6 27-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Remove dead code 3.

Removing mNetRequestersPids and mPriorityList.

Change-Id: I8295040436b62f7f6495ece7154246fb719288a4
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
f4e0c0cb8ef22fdb20ae74b444c9f4b7d15ded8b 27-Jul-2014 Sreeram Ramachandran <sreeram@google.com> Allow VPNs to add/remove link addresses dynamically.

Bug: 15409819
Change-Id: If91fc6891d7ce04060362c6cde8c57462394c4e8
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
6831f1d80f9a5ad2400bd186fb6179e0e511be05 27-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Remove dead code 2.

Removing ConnectivityService.NetworkFactory. This requires disabling
the ConnectivityServiceTest, but that's been broken since we stopped
using NetworkStateTrackers anyway.

Change-Id: I9b86bd37eb9d018c40f60dca5b00d62c36d4e3ad
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
39ca3f5f698c4213bff5b1982463f6d2ddbc9653 28-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Remove dead code 1." into lmp-dev
42065ac64cba166dc0fe602957ea8fe80bf406e2 27-Jul-2014 Sreeram Ramachandran <sreeram@google.com> Prohibit address families by default unless a VPN explicitly allows them.

Bug: 15972465
Change-Id: I3278d94536fefacc86390c1ba4231680f7be8589
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
39fa65a3be4932ddadb5104fd0de9ef2121b3bc7 27-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Remove dead code 1.

Starting with startUsingNetworkFeature and stop.
Figure it's easier to code review incremental changes.

Change-Id: I19aee65e740858c3a9a2a1a785663f6fee094334
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
f9b5c26309c9d6c2e5ad5116d8e0e055bc5818a2 27-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Move Alarm setup to systemReady.

Don't register alarms before the system is ready.

bug:16484913
Change-Id: Iae5c75ff8d40d4d39dbb23ff65a600b4a00cd1f0
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
8cd33ed84e94036a5e1201485af7603dc6fb0d9b 24-Jul-2014 Sreeram Ramachandran <sreeram@google.com> Implement support for bypassable VPNs.

Bypassable VPNs grab all traffic by default (just like secure VPNs), but:
+ They allow all apps to choose other networks using the multinetwork APIs.
If these other networks are insecure ("untrusted"), they will enforce that the
app holds the necessary permissions, such as CHANGE_NETWORK_STATE.
+ They support consistent routing. If an app has an existing connection over
some other network when the bypassable VPN comes up, it's not interrupted.

Bug: 15347374
Change-Id: Iaee9c6f6fa8103215738570d2b65d3fcf10343f3
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
fab50167a88941b1088130b6b62b1200088764cc 23-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Fix DUN-based tethering.

It was calling into dead ConnectivityService code rather than using
the new ConnectivityManager shim code.

bug:15221541
Change-Id: I1e3eea8a658a162ce36673ed1cf7b1e7e4372c42
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a7d31bf3076a8c3ed5e9decbdf913534fd15ff66 23-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Reenable logging.

ConnectivityService has been rewritten for L and is in a stabilizing period.
We need the logging to track down bugs people report.
Restoring to Pre-L conditions.

If there's excess logging please report it - it probably indicates a bug.

Change-Id: I7baf891e3bf12e1545afeb92b8d5af0b01e12a7b
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
03666c705ddabe0e7c5869ab69c2ca8b964164e9 20-Jul-2014 Sreeram Ramachandran <sreeram@google.com> Cleanup: Delete dead code.

Bug: 15413389
Change-Id: I315468832ef18ffc84174e54774ab63b86d284dc
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
17d47989ee53c9e54f250d29a343ba949edf0ff9 17-Jul-2014 Yao Chen <yaochen@google.com> Updated media browsing API & tests.

Change-Id: I3a1e3eead99a98b1890e05843dd90203cee517b7
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
27b02b7aba848167e263e5fec9c1c7102b334731 14-Jul-2014 Paul Jensen <pauljensen@google.com> Make a network the default when it connects if we have no default.

When a network comes online, is a candidate for being the default network
(i.e. satisfies default NetworkRequest), and the device has no default
network, then make the new network the default network for the purposes
of routing network traffic. This does not affect NetworkRequests or
NetworkCallbacks. This ignores but does not affect network validation.

Benefits:
1. Offers a fail-safe in case network validation returns a false negative.
For example: It would be nice if every Android device didn't fail when
clients3.google.com/generate_204 went down.
2. Offers a method to debug connectivity issues.
For example: If WiFi is failing, disabling Cellular would rule out
interference from WiFi network validation.
3. Reduces delay between no connectivity and any connectivity.
4. Offers a fail-safe in cases of unreliable networks.
For example: You need rescuing from a remote location with a weak signal
offering 90% packet loss. You just want your distress call to go out
but are infuriated to find network validation blocks connectivity.

Change-Id: I78621a1fe8ed2a336591f65bf7b07a6cbcc7ba5e
/frameworks/base/services/core/java/com/android/server/ConnectivityService.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/ConnectivityService.java
06b6cdaed5c68816faac9d2354c6caf61e65e19d 12-Jul-2014 Sreeram Ramachandran <sreeram@google.com> Remove unnecessary code and APIs.

This stuff has been replaced by setNetworkForUser() in NetdClient.

Change-Id: If525ee259b74314191d1913f7c2a3e828e05c38f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
9cd6e647c63be7ba726687943e139a04ed1846f7 11-Jul-2014 Aaron Whyte <awhyte@google.com> resolved conflicts for merge of d2b5f7da to master

Change-Id: I8ec28728c12d7cc3ce2c4f3d09d9ce6162504618
f5e6747440cc0d29c663a792e32d9618f842ecf2 10-Jul-2014 Aaron Whyte <awhyte@google.com> Allow overlays to configure ConnectivityService's network sampling to not wake the device.
This can increase clockwork device battery life.
Bug:15455204

Change-Id: Ifc551e6a522627dc8e5cfdfb8f56d4e3cbeea936
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
bcc76d345cdad2eff0f64d1dca9f92f94c8b9f07 11-Jul-2014 Paul Jensen <pauljensen@google.com> Define NETID_UNSET in ConnectivityManager.

This allows some cleanup and removal of dead code.

bug:15489928
Change-Id: Iaf0507bc2e8ec6dcc253f01f61c5b221d46581f9
/frameworks/base/services/core/java/com/android/server/ConnectivityService.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/ConnectivityService.java
7237965c0d6f86a5f6e71d23645c37022edc4175 10-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Refactor wifi p2p's startDhcpServer function"
9c7e2c2cb491268db0322ad78856faf0582e61d1 23-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Refactor wifi p2p's startDhcpServer function

Add getTetheredDhcpRanges() interface and call it before calling
mNwService.startTethering to update dhcp ranges. This will allow
p2p apps to run well concurently with other tethering apps.

Manual import of AOSP change 81546 by jianzheng.zhou@freescale.com

Change-Id: Iebc62f95bdcedde80e2c1d3e9580d3f625c3b50b
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
ff6ecccdc8c32129eed036793fef4a05becfe447 10-Jul-2014 Paul Jensen <pauljensen@google.com> Merge "Enable network validations and add app to handle captive portal login."
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/ConnectivityService.java
73b6cbae0cf6ca71453c526895a735130e72c9c0 23-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Add Network inspection API.

Adds getNetworksNetworkInfo.
Adds getAllNetworks.

Cleans up some synchronization issues.

Change-Id: I82c7a4b554e3c6c1adfe6027cc54b028ed6dbac9
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
4bb015d90ae2aa3ce30778f3f584e0b7124f7505 05-Jul-2014 Joe LaPenna <jlapenna@google.com> CW on Master: Disable CaptivePortalTracker, EthernetService

BUG: 15143878

Change-Id: I6c534a28c1fcd475982ae70e7f3af69f3a219e24
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
8283f8802d7e4d78c7eb031ddac07a4cfdc30771 08-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Remove dead code.

Also adds a TYPE_VPN so the VPN can be strongly typed.

Change-Id: Ibf39450c480f16ce5ab4c25b47965691b844fb92
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
620a5466ce5f401aafa6a438383016640ec51d1a 07-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Remove unused api."
e585bfe80c1a4c49a17f19006129f1c45af174e2 02-Jul-2014 Paul Jensen <pauljensen@google.com> When adding a NetworkRequest, cancel linger for satisfying Network.

This fixes a problem where a requested network can later suddenly disappear if
it was lingering when the request arrived and later the linger timeout expired.

bug:15927234
Change-Id: Ib3fae45820ce4421e3bc5b623937a16d5f1efa0f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
17c3e0fbfcd404fb253288b386d7b39368d5852a 02-Jul-2014 Robert Greenwalt <rgreenwalt@google.com> Remove unused api.

bug:15595155
Change-Id: Ifd79365bd45f20f531782244f471a4cfc32a4135
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
fc6b2a0be3524e09c6e12eeaf0222a2ecf2a3007 24-Jun-2014 Julia Reynolds <juliacr@google.com> Apply the tethering user restriction to connectivity service.

Bug: 15852213
Change-Id: Ib2df696189981ed1b31955257047fac3ee403965
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
2771181c9b82b6b41da7ebd47fbe1baf8791c8ac 26-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Simplify the network transition wakelock.

Make it all internal to ConnectivityService - we know when a network
is lost, so grab a wakelock then.
Moves the call out of WifiStateMachine which was grabbing at bad times
like every dhcp renewal or corp-network roam. These would always
go the full 1 minute and chew up battery.

bug:15595155
Change-Id: I80157a818cc149072cc7706d78c1e79c6e679ab3
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
3e0e3bc617c4fd0e03b88ae04a618381b20a383c 26-Jun-2014 Ram <ram.pl@samsung.com> MS: Adding Support for Emergency APN in Telephony Framework
(base/telephony)

Replacement for https://partner-android-review.googlesource.com/#/c/171175/

Change-Id: I16fc37f5c00ed79f2370bc46554fc7a24c52c4cb
Conflicts:
core/java/android/net/ConnectivityManager.java
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
7ecb42fb65ac46bf1f3c9348557fcdc54bfe9416 16-May-2014 Paul Jensen <pauljensen@google.com> Enforce ConnectivityManager.releaseNetworkRequest callers own the NetworkRequest

Enforce that callers of ConnectivityManager.releaseNetworkRequest() are the
creators of the NetworkRequest being released by matching UIDs.

Change-Id: I439468c054bacc035e2db2c4967b24d183e78e9c
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
81c884ee525408d07ddf737f0c303d3475a7c44f 20-May-2014 Paul Jensen <pauljensen@google.com> Convert BluetoothTetheringDataTracker into a NetworkFactory.

bug:15407087

Change-Id: I0437ca52dedf73e8ec69ac82e46353f6fafc4a42
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
76ea6c68d3222441970ef98079ba30710ac8c595 23-Jun-2014 Lorenzo Colitti <lorenzo@google.com> Teach LinkProperties whether it's provisioned or not.

In IPv4, a link is provisioned when DHCP succeeds. In IPv6, a
there is no such signal, because addresses and DNS servers can
be notified by the kernel at different times.

Add an isProvisioned method that returns true if we believe that
enough information has configured to use a network. For IPv6,
this requires an IP address, default route, and DNS server. For
IPv4, this requires only an IPv4 address, because we support
static configuration that doesn't have a default route or DNS
server.

To do this we use the existing hasIPv4Address method, rename the
all-but unused hasIPv6Address method to hasGlobalIPv6Address
(which is what we want anyway) and add new hasIPv[46]DefaultRoute
and hasIPv[46]DnsServer methods.

Bug: 9180552
Change-Id: Ib2f5ff8af920f7b6f1edf0e2afaaa0edce9bc72d
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
52a327263d1cdbab53f9d9087b67bcfea087407e 13-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> am 2d0ab42b: Merge "Apply API Council comments to ConnectivityManager" into lmp-preview-dev

* commit '2d0ab42b1420db884d26fd2ef22710b5a887e9a6':
Apply API Council comments to ConnectivityManager
6078b50b017fbcf8d6cbf9f83226ed5667d5729e 12-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Apply API Council comments to ConnectivityManager

rename isNetworkActive -> isDefaultNetworkActive
rename registerNetworkActiveListener -> registerDefaultNetworkActiveListener
make listenForNetwork/requestNetwork take a NetworkRequest
rename NetworkCallbackListener -> NetworkCallback
rename listenForNetwork -> registerNetworkCallback
rename releaseNetworkRequest -> unregisterNetworkCallback
remove NetworkRequest param from NetworkCallback functions
rename onNetworkCapabilitiesChagned to onCapabilitiesChanged
remove onReleased
change time units in onLosing from Sec -> ms

bug: 15142362
Change-Id: Ibc96e3f461706efe1eafa0d85605249cfd6e9fdd
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
7c9f5529ea07fda43a68f9b5de204cf2b90d1b61 12-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> am 558aeb90: Merge "Make NetworkCapabilities publicly immutable." into lmp-preview-dev

* commit '558aeb901144fac460575402e38fc8baa2da83eb':
Make NetworkCapabilities publicly immutable.
7569f1811f6061b2a6605c69bca1bb7af72ae1a0 09-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Make NetworkCapabilities publicly immutable.

Applying API council comments.

bug: 15142362

(cherry picked from commit Ie0bde68b72656a676d90c0343b9756fe9268d8d6)
Change-Id: Ie0bde68b72656a676d90c0343b9756fe9268d8d6
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
594b456b6e2aa4142fa31394cdd39bd4cc7a1d3a 12-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Minor changes to the LinkAddress API docs." into lmp-preview-dev
55213c80229cc9cbec328f0ec9a842f5d66c35c2 12-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Add a new IpPrefix class and use it in RouteInfo." into lmp-preview-dev
6307b35e1d3a8d577877be0b4c9cea1a909b6329 04-Jun-2014 Sreeram Ramachandran <sreeram@google.com> Add a new IpPrefix class and use it in RouteInfo.

This change uses IpPrefix only in the public API and continues
to use LinkAddress for everything else. It does not change the
callers to use the new APIs, with the exception of changing
all current uses of getDestination to getDestinationLinkAddress
to make room for the new getDestination method that returns an
IpPrefix.

Based on Sreeram's earlier change:
https://googleplex-android-review.git.corp.google.com/#/c/477874/
but a bit simplified and with a bit more documentation.

Bug: 15142362
Bug: 13885501
Change-Id: Ib4cd96b22cbff4ea31bb26a7853989f50da8de4e
(cherry picked from commit 7d3b4b9a3d4de9673119632da0ebd583e50126f7)
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
00a0fd650b7a31dffb88c229242bb04fa0b487a4 09-Jun-2014 Lorenzo Colitti <lorenzo@google.com> Minor changes to the LinkAddress API docs.

1. Rename getNetworkPrefixLength to getPrefixLength. Update all
callers in frameworks/base and add a shim method and a TODO
for the rest.
2. @hide isSameAddressAs. It doesn't add much, and it's just
one-liner that callers can implement if they want.
3. Fix the alignment of the initial paragraph (<ul> should have
been </ul>).
4. Remove the documentation that talks about creating
LinkAddresses, since there's no public API for creating them.

With these changes I think LinkAddress is fine as a public API.

Bug: 15142362
Change-Id: Iaf3b1db577745bb68a9e1dd7f96d666dd3f3ec7c
(cherry picked from commit 9ab53650cfcd91a2a151b44b3fd1381841f76269)
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
25702b39675c51dd4963eb71b66b20126a55cc05 06-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Fix public API of LinkProperties.

bug:15142362
(cherry picked from commit 51d898fd0223a4b7c728980ab987dd985c02df5f)
Change-Id: I1457111da7d3bd09998f7e010febb8bb4c45c8bc
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
7dc78cf3af9fd11a4f1e2e981ce584a23755ea9e 09-Jun-2014 Lorenzo Colitti <lorenzo@google.com> Minor changes to the LinkAddress API docs.

1. Rename getNetworkPrefixLength to getPrefixLength. Update all
callers in frameworks/base and add a shim method and a TODO
for the rest.
2. @hide isSameAddressAs. It doesn't add much, and it's just
one-liner that callers can implement if they want.
3. Fix the alignment of the initial paragraph (<ul> should have
been </ul>).
4. Remove the documentation that talks about creating
LinkAddresses, since there's no public API for creating them.

With these changes I think LinkAddress is fine as a public API.

Bug: 15142362
Change-Id: Iaf3b1db577745bb68a9e1dd7f96d666dd3f3ec7c
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
cc91c7b804a079f7b20404827277c61dd403805f 04-Jun-2014 Sreeram Ramachandran <sreeram@google.com> Add a new IpPrefix class and use it in RouteInfo.

This change uses IpPrefix only in the public API and continues
to use LinkAddress for everything else. It does not change the
callers to use the new APIs, with the exception of changing
all current uses of getDestination to getDestinationLinkAddress
to make room for the new getDestination method that returns an
IpPrefix.

Based on Sreeram's earlier change:
https://googleplex-android-review.git.corp.google.com/#/c/477874/
but a bit simplified and with a bit more documentation.

Bug: 15142362
Bug: 13885501
Change-Id: Ib4cd96b22cbff4ea31bb26a7853989f50da8de4e
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
0409e9f0af69e1941b025c6c5cb788036a9dc7b6 10-Jun-2014 Amit Mahajan <amitmahajan@google.com> resolved conflicts for merge of 437a77d4 to master

Change-Id: I65585939a57c561064d370be131c0197de0f08c3
3f175a3587f5f7c7d6189c0fd09468bae4e81325 09-Jun-2014 Amit Mahajan <amitmahajan@google.com> am e5a28d34: am 20c5ce50: Handle provisioning APN by turning off/on radio.

* commit 'e5a28d34f662c469f85590dda28fc02eca12204b':
Handle provisioning APN by turning off/on radio.
df2b878ff4e7b4a258588d3a93574c399db78a07 06-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Fix public API of LinkProperties.

bug:15142362
Change-Id: I1457111da7d3bd09998f7e010febb8bb4c45c8bc
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
8ae980dcef1265f69fe41338f17266c2a8ec8d20 04-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> DO NOT MERGE Report new network scores back to factories.

This is a first order approx of what we want - should probably be good enough in most cases.

bug:15277751

Change-Id: I10e3b25f6ad5c7e022ba966ed514d4e6a999180d
(cherry picked from commit 94a5c61cb82401dd777d0a7ac43183d92d955323)
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a995aba36fff573e30859e29a736e151e56fb50a 04-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Report new network scores back to factories."
ac96c52350a16706570f97491034fa8565c42a5e 04-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Report new network scores back to factories.

This is a first order approx of what we want - should probably be good enough in most cases.

bug:15277751

Change-Id: I10e3b25f6ad5c7e022ba966ed514d4e6a999180d
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
2d37070ec13df5650093f8967655938298290ee7 04-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Fix legacy APIs.

Two fixes. First make sure we mark the request as handled by the network handling it.
Second, convert ensureRouteToHostForAddress to use the new legacyNetworkForType.

bug:14993207
Change-Id: I230968938ca0ed91f834b36a2af60caff2eab682
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
32aa65a11207e1fb7d346a68fdf3299f87a20db4 03-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Fix Legacy NetworkInfo API

Make the connectivity changed broadcasts send correct NetworkInfos.
Also update the results of getNetwork.

bug:15290306
bug:15191336
bug:14993207
Change-Id: Ie99ad25f3ebb90d18348e7013761b139e7481866
(cherry picked from commit 16fe1c18289de200d2249e51db8c0986619f487b)
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
b90b20b5d57809da5c91bac9ff45c2ac323d9637 03-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Fix Legacy NetworkInfo API

Make the connectivity changed broadcasts send correct NetworkInfos.
Also update the results of getNetwork.

bug:15290306
bug:15191336
bug:14993207
Change-Id: Ie99ad25f3ebb90d18348e7013761b139e7481866
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
55691b8cc725297e0d36799e234cba3c8c3410f6 27-May-2014 Robert Greenwalt <rgreenwalt@google.com> Refactor NetworkFactory.

Make NetworkFactory a concrete class and divide responsibilites between it and NetworkAgent.
Factory will track requests and by default give a single connect/disconnect api for ease
of use. Then NetworkAgent is created and destroyed as needed with very simple logic.

Change-Id: I401c14a6e5466f2fc63b04219b97ff85bb9af291
(cherry picked from commit 9a17b9c5a256cb4bb14821c5ee89b03b99c045e8)
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
562cc54536f1e75d80855de4d1eccaeefd689a32 16-May-2014 Robert Greenwalt <rgreenwalt@google.com> Rewrite startUsingNetworkFeature for new API

bug:14993207
Change-Id: I041a80faa07bf3094af13a6c606f3b15aa03f789
(cherry picked from commit 09fe5e618b09965183cf53fba87c39025a19e8d1)
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
3192dec32180f56733e631c2d9ec62fa1359283d 27-May-2014 Robert Greenwalt <rgreenwalt@google.com> Refactor NetworkFactory.

Make NetworkFactory a concrete class and divide responsibilites between it and NetworkAgent.
Factory will track requests and by default give a single connect/disconnect api for ease
of use. Then NetworkAgent is created and destroyed as needed with very simple logic.

Change-Id: I401c14a6e5466f2fc63b04219b97ff85bb9af291
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
8f3799867d2c3322a7191803b2dda54583305ea0 03-Jun-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Rewrite startUsingNetworkFeature for new API"
515350a5e2b3fcac79f4ecfbd3d4d7485c04eff5 23-May-2014 Sreeram Ramachandran <sreeram@google.com> Support legacy routes added by apps via ensureRouteToHost().

Change-Id: I0ee1ca89fdc859d75a89021ca8c1902811b1e4a9
(cherry picked from commit fb17b32550de624b7f476b70b7a2fc77f31dde7d)
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
1fbcb2719828f16aec8b2d742a20b98e4a2cf17c 23-May-2014 Sreeram Ramachandran <sreeram@google.com> Support legacy routes added by apps via ensureRouteToHost().

Change-Id: I0ee1ca89fdc859d75a89021ca8c1902811b1e4a9
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
bce0106c417db7dd04daec9dc4cef9e7cf30446d 29-May-2014 Lorenzo Colitti <lorenzo@google.com> Don't break things if a network goes back to CONNECTED.

Currently, if a network goes from CONNECTED to some other "live"
state (e.g., CONNECTING, because it's VERIFYING_POOR_LINK) and
back, ConnectivityService treats it as if a new network had
connected. This causes it to attempt to create the network
(which fails, since a network with that netid already exists), to
trigger verification, and if the verification succeeds, to tear
down the network because the request it's satisfying is already
satisfied by the network itself.

Instead, if creating the network fails, assume it's because the
network had already been created, and bail out.

Also, when validation completes, ignore NetworkRequests that were
being served by the same NetworkAgent as before.

Bug: 15244052

(cherry picked from commit cfff026ec47afc7e31f60f80e3deea7f4e2f9be5)

Change-Id: I52c2220e8f1d98fca765880be3040593e92722ed
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
51ed158a946f3a908b691389296dbb0136bc1c9c 29-May-2014 Lorenzo Colitti <lorenzo@google.com> Don't break things if a network goes back to CONNECTED.

Currently, if a network goes from CONNECTED to some other "live"
state (e.g., CONNECTING, because it's VERIFYING_POOR_LINK) and
back, ConnectivityService treats it as if a new network had
connected. This causes it to attempt to create the network
(which fails, since a network with that netid already exists), to
trigger verification, and if the verification succeeds, to tear
down the network because the request it's satisfying is already
satisfied by the network itself.

Instead, if creating the network fails, assume it's because the
network had already been created, and bail out.

Also, when validation completes, ignore NetworkRequests that were
being served by the same NetworkAgent as before.

Bug: 15244052
Change-Id: Ifd73558e5be452d9ef88c64cca429d5f302bf354
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
afa05c0b43cbc065181d5c2d6ee368a08bb00c3b 22-May-2014 Robert Greenwalt <rgreenwalt@google.com> Move dis/enable of mobile data to Telephony

ConnectivityService doesn't do this anymore.

bug:15077247
Change-Id: I3208c91b2c0369b594987f39ca29da7478435513
(cherry picked from commit 53013c87496980b534e447e717a32698fbd4bca0)
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
71bf33a02f49444fbfa35b267c70592f3b07a07d 16-May-2014 Robert Greenwalt <rgreenwalt@google.com> Rewrite startUsingNetworkFeature for new API

bug:14993207
Change-Id: I041a80faa07bf3094af13a6c606f3b15aa03f789
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
293251318168ad2dbfeb3d18176936fe2cc16325 22-May-2014 Dianne Hackborn <hackbod@google.com> (DO NOT MERGE) Battery monitoring fixes:

- Improve monitoring of level changes to not be confused
when it goes up while draining or down while charging.
- Put back in connectivity service code to tell battery
stats about the interfaces.
- Turn back on reporting of mobile radio active state
from the RIL.
- Fix bug in marshalling/unmarshalling that would cause
the UI to show bad data.

Change-Id: I733ef52702894cca81a0813eccdfc1023e546fce
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
02a217fad03a695522b2c4d4872f69e3e083059e 22-May-2014 Dianne Hackborn <hackbod@google.com> Merge "Battery monitoring fixes:"
2d4b4ed681efcfb64c4d2b4d2a2d236aae1dc7ee 22-May-2014 Dianne Hackborn <hackbod@google.com> Battery monitoring fixes:

- Improve monitoring of level changes to not be confused
when it goes up while draining or down while charging.
- Put back in connectivity service code to tell battery
stats about the interfaces.
- Turn back on reporting of mobile radio active state
from the RIL.
- Fix bug in marshalling/unmarshalling that would cause
the UI to show bad data.

Change-Id: I733ef52702894cca81a0813eccdfc1023e546fce
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
47eecf03307acfb1bc7d4ad51311beb4eeb99366 22-May-2014 Robert Greenwalt <rgreenwalt@google.com> Move dis/enable of mobile data to Telephony

ConnectivityService doesn't do this anymore.

bug:15077247
Change-Id: I3208c91b2c0369b594987f39ca29da7478435513
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
3c44c99af500601fbb8ba6b8f71e5d930ca5e269 22-May-2014 Lorenzo Colitti <lorenzo@google.com> Delete the EthernetDataTracker.

Code search says these are the only two files that use it. The
tracker will be resurrected in a slightly different form in
frameworks/opt/net/ethernet.

Bug: 14993642
Bug: 14981801
Change-Id: I2477668ca78dfe46661dda1d97c7f786fd7eba35
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a67be03f9e2734c0a6c03af20e17f963daaed257 17-May-2014 Robert Greenwalt <rgreenwalt@google.com> Add NetworkFactory names and unregistration.

Some Factories come and go (Telephony) and so they need to be able to unregister.
Also, debugging is tough when the factories are anonymous, so add names for logging.

Lastly, only send single set of NetworkRequests to a newly registered NetworkFactory
and only send the requests.

Change-Id: I717d63363f25c446f8ecf38d933b1a35d744af6e
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
5d2e896457b3a803309f7babeb984a7d1a3b4f5f 19-May-2014 Robert Greenwalt <rgreenwalt@google.com> Fix the build

Change-Id: I18f78f6055f6f9c14571058d6834c8dec01aa732
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
34524f06fb77607884c69f891471725f4ac0889a 19-May-2014 Robert Greenwalt <rgreenwalt@google.com> Add javadoc for NetworkRequest.

Also moved the requestId serial number out of this public class into CS.

Had to leave NetworkRequest hidden for now because the docs refer to things still hidden
in ConnectivityManager.

Change-Id: I14d1fe52d992adf5e4dc197b8f5433e40b0adfe6
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
311060571ccf5c9bd6ece57c109a22494d1c1db1 17-May-2014 Robert Greenwalt <rgreenwalt@google.com> Decouple network_sampling frequency from VDBG

Add a special debug flag for testing network sampling.

Change-Id: Ibe572c3b5648ca25f1e5be2c61e5c5ad2979b2cb
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
fcfef283d8707f8e695645fe10dba531b7673c14 16-May-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Clean up when we switch networks."
4064af844ca6e58dc2908525634c13c4be277eac 16-May-2014 Robert Greenwalt <rgreenwalt@google.com> Clean up when we switch networks.

Need to unhitch mNetworkForRequestId when a network is no longer
satisfying a request.

Change-Id: I3b3cde7dd92ec87a76ae7a0825ad22e892fa8fd5
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
d5648dcf6a477a350c281c769bae07b8cbe982a3 16-May-2014 Robert Greenwalt <rgreenwalt@google.com> Add net.dns system properties

Some apps rely on them.

bug: 14992618
Change-Id: I5766f26b77004e9cfcc90fac657817eab67f9ac7
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
54b6fd0cbe48fc0980da0617352785c973c60c86 14-May-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Add networks and requests to CS.dump"
c9c90c771c9cd1381a49b714df9a2bc392959fcc 14-May-2014 Robert Greenwalt <rgreenwalt@google.com> Add networks and requests to CS.dump

Adds debugging.

Change-Id: I352dfe970c990fd210f3d1598519e321bbdd6ed5
(cherry picked from commit 9bdf6bd99db56c652ba9a62d91f258d11d19ca9f)
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
9258c64bef1a01fe89bc7c1fa402c44c0e6a1255 27-Mar-2014 Robert Greenwalt <rgreenwalt@google.com> Add Multinetwork API

Change-Id: I3a9cef0d416db96d05098dd989ee3fef3b1e9274
(cherry picked from commit cc5e6afa1ba0bef099bcb21a64a36bc2bf7951db)
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
12e6735f77a6f8cbf71edde4f156f40668d2d25b 14-May-2014 Robert Greenwalt <rgreenwalt@google.com> Handle legacy synchronous inspectors

getNetworkInfo, getActiveNetworkInfo, etc

Conflicts:
services/core/java/com/android/server/ConnectivityService.java

Change-Id: I4611d6481b1a76fe4a4ce22232a2a329de2a6e0c
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
3b75982e39ed9370153ae7f238f1d6041b9506ed 13-May-2014 Paul Jensen <pauljensen@google.com> Get clatd/Nat464Xlat working with new NetworkAgents.

Change-Id: I65dfb59ce519a42bdb872940d229039b5403fd92
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
7ef92576016aaa43e3488b6ddc213b7c1e52b118 14-May-2014 Lorenzo Colitti <lorenzo@google.com> Fix compile errors after merge.

These are due to changes to ConnectivityService that were made
after master-multinetwork-dev branched off. They mostly didn't
cause merge conflicts because they were in different parts of
the file from the multinetwork changes, but they cause compile
errors now. These particular changes should be fine - they are
all in dead code anyway, and their functionality had already
been re-implemented in the new code.

Change-Id: I0ac9e39c3c975c8e8dc04ad11b6b85366693865c
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
b6bb6c61dd77c1b3007f0b0bbb89ee693e63d0b6 12-May-2014 Paul Jensen <pauljensen@google.com> Disable calls to MobileDataStateTracker.isProvisioning() as there is no more
MobileDataStateTracker so these just crash.

Change-Id: Ib45a85db505c0a99fb65d9a6d0c39b860f9d019d
/frameworks/base/services/core/java/com/android/server/ConnectivityService.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/ConnectivityService.java
992f25257938ecc0378514f21c6e6e6375272976 28-Apr-2014 Paul Jensen <pauljensen@google.com> Separate network and interface addition/removal netd APIs.
This should facilitate stacked interfaces (i.e. clatd).

Change-Id: Ib3e7a4d3847ef6ec4449451f6da42e75959baa4f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
7b81602f3c18df8a4ca0342c514af8f7e394c0d7 19-Apr-2014 Robert Greenwalt <rgreenwalt@google.com> Enabling internal msg apis

NetworkFactory and NetworkAgent. First trying with wifi and
getting rid of WifiStateTracker.

Conflicts:
api/current.txt
services/core/java/com/android/server/ConnectivityService.java

Change-Id: I7f0ec13d7d8988b32f3c6dc71f72012f3349fe02
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
b2829fa165124264c7ec06a6e23b08a1d97b99e5 16-Apr-2014 Sreeram Ramachandran <sreeram@google.com> Specify netId when adding/removing routes.

Change-Id: I07fd950aee726e9721153f75c3e4c10d8e19d8e9
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
79a10584802f327bcfca11c5000658b3be74819d 16-Apr-2014 Sreeram Ramachandran <sreeram@google.com> Set and clear the default network.

Change-Id: I305951e0c4735d708804baa597cc2d9b10f501c0
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
13e817df516a803fbedeacca2c802a9fc1c1370f 10-Apr-2014 Paul Jensen <pauljensen@google.com> Use NetId instead of interface name when communicating DNS changes to netd.

Change-Id: Ic82b73de6f50d39d56c5e1a32f5b1f3ebb80bb7d
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
89fb3eb718f890ace30e63bd4ab4ad5409d8600d 31-Mar-2014 Robert Greenwalt <rgreenwalt@google.com> Stop adding host routes for dns

bug:13550136
Change-Id: I748e13b96dab111f8f6a4b11d9beaf2a72d0742b
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
e049c23980409be6576da3d30538a6cdc43854dd 12-Apr-2014 Robert Greenwalt <rgreenwalt@google.com> Add NetworkFactory support.

This is a protocol allowing transports to dynamically register with CS for
Handler to Handler communications.

bug:13885501
Change-Id: Ic7275e3724a15efc7e5f80981560c4cb3106007b
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
9876e6334d1d3649ecd1e99e597834e70c531d57 13-May-2014 Robert Greenwalt <rgreenwalt@google.com> Comment out some new netd calls to fix networking.

bug:14869053
Change-Id: Ifc44f3cbadd0402c7b06e01962695e6b65dc48b3
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
f9cb86aebe9647e0fe0137fc198ba16c017445c6 09-Apr-2014 Robert Greenwalt <rgreenwalt@google.com> Replace LinkCapabilities with NetworkCapabilities

Also remove unused LinkSocket and LinkSocketNotifier.
bug:13885501

Change-Id: Id426e31b201fa4f29109b5fea485d8efb34519d3
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
9ba9c58e4a249456794fbfb9989f27bd846d067e 20-Mar-2014 Robert Greenwalt <rgreenwalt@google.com> First pass on multinetwork framework

Starting to switch netd to use NetId.
Adding the Network identifying class

bug:13550136
Change-Id: Ie0db4fb17c9300bfafb63329adfa02339911b33d
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
56cf1ab4105cffd5afb3abd1411fd38d98002853 28-Apr-2014 Jason Monk <jmonk@google.com> Fix Global Proxy when used with PAC

Since PAC needs to relay the local proxy port back to the
ConnectivityService it ends up calling handleApplyDefaultProxy...
This works fine for PAC on WiFi, but when tested on global proxy
(not currently used anywhere), it sets the mDefaultProxy. This
mDefaultProxy does not get cleared when the global proxy is cleared
and requires a reboot to get things cleared out.

This CL adds a check to overwrite mGlobalProxy rather than
mDefaultProxy in this use case.

Change-Id: I92782d11e213b91f8ddda2faaf996a7252273fc3
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
207900c23b26d0df9ab28c709db4a1007d7d7904 25-Apr-2014 Jason Monk <jmonk@google.com> Make proxy API public

Also exposed proxy-related functions that were on the
ConnectivityManager.

Change-Id: I9fb5f1bcc257a6198679ea1d56e18da2ec5a3b33
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
ff3bb2fe95a7d0158f5a456368eb7fa91069bc23 24-Mar-2014 Chad Brubaker <cbrubaker@google.com> am 7f623d6b: am 9506e84b: am c7726147: am 1fce89d9: am de4e7b49: Merge "Include the interface for clearDnsInterfaceForUidRange" into klp-dev

* commit '7f623d6b9459bc982c49f0a74aa2c9911f8e1dd8':
Include the interface for clearDnsInterfaceForUidRange
c77261471432e1577586395dd0a6a481ef7431b5 21-Mar-2014 Chad Brubaker <cbrubaker@google.com> am 1fce89d9: am de4e7b49: Merge "Include the interface for clearDnsInterfaceForUidRange" into klp-dev

* commit '1fce89d946760a1bcf3a733f55494f963eab00c2':
Include the interface for clearDnsInterfaceForUidRange
4a6f0879502bea0258876497926aa31e7e837032 19-Mar-2014 Etan Cohen <etancohen@google.com> Merge "Catch Netd exceptions to avoid runtime restart"
d9cb2f3d062d409f5300a131cd920313fb92580e 19-Mar-2014 Robert Greenwalt <rgreenwalt@google.com> Catch Netd exceptions to avoid runtime restart

bug:13475636
Change-Id: If36a0051a957fc066711fe8225f8981bc07add04
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
1b98e90db063da97c6bb9d47aa9798c8c32a58b5 19-Mar-2014 Robert Greenwalt <rgreenwalt@google.com> resolved conflicts for merge of 0bff77d6 to master

Change-Id: Ia4c86126079740978658a05579b56d59d41a7b01
42b746e4d8baa6141598ddaae7148baea2ddf366 19-Mar-2014 Robert Greenwalt <rgreenwalt@google.com> am bd84f01c: am 5d3d4ee3: Merge "Handle provisioning APN by turning off/on data." into klp-dev

* commit 'bd84f01c6ce122ab58fc7c5b687dc8bfb0fb03e6':
Handle provisioning APN by turning off/on data.
0535a9f7aa5d0f875b06845e9af5f6dbfc5c8a19 13-Mar-2014 Ashish Sharma <ashishsharma@google.com> Include elapsed realtime (nanos) of the event in the radio state change notifications.

Bug: 13247811
Change-Id: I3454aa159a68b9087b4762df947b41965b5a3941
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
4f26139661b0039cff5e570975e6bf9b0bbce1af 14-Mar-2014 JP Abgrall <jpa@google.com> am 4ecd833e: am 7baa7c80: Merge "ConnectivityService: add support to set TCP initial rwnd" into klp-dev

* commit '4ecd833ee35d1120f8c1ae52367947cacfc263a4':
ConnectivityService: add support to set TCP initial rwnd
7c2b1625d66d3c80c313160f78c8bccd9499539e 14-Mar-2014 Chad Brubaker <cbrubaker@google.com> am 78f204ae: am 8e240af5: Merge "Remove SO_BINDTODEVICE from VPN protect" into klp-dev

* commit '78f204aed8c0f3c8174616801d66f96a9a00a5fd':
Remove SO_BINDTODEVICE from VPN protect
74f99a4e904af56a62f86b81831c23c763b6001e 13-Mar-2014 Chad Brubaker <cbrubaker@google.com> am 7fb07438: am 674f85af: Merge "Only allow System apps to make VPN exempt routes" into klp-dev

* commit '7fb074389370ac93afc5830189371dc3ec26265c':
Only allow System apps to make VPN exempt routes
f5729a6a1573ba27f69a5c5dc144be3f8f60b026 13-Mar-2014 Chad Brubaker <cbrubaker@google.com> am 1011960c: am decfd707: Merge "Add the calling package name to requestRouteToHost" into klp-dev

* commit '1011960c44a4f84d53d05199fe1ca09be9473822':
Add the calling package name to requestRouteToHost
bf9eec4c3bbbacd0954d819c18709962a81338bf 05-Mar-2014 Robert Greenwalt <rgreenwalt@google.com> am 1c8ba7e5: am bad3a9e6: am 2d1e8c49: Merge "Only apply tcp buffer sizes for default net" into klp-dev

* commit '1c8ba7e551274782f3f61b90807711a056cc9730':
Only apply tcp buffer sizes for default net
0f3237476904a59e351ef1d451cb7453b63b1d58 04-Mar-2014 Robert Greenwalt <rgreenwalt@google.com> Merge "Only apply tcp buffer sizes for default net"
d49f64c6054dc864f651fc57a174cc3991571548 01-Mar-2014 Robert Greenwalt <rgreenwalt@google.com> Only apply tcp buffer sizes for default net

This may mean that secondary networks have bad network settings,
but currently default settings are overriden by secondary nets
which seems worse.

bug:13211589
Change-Id: I3ef1a17ccde05306d786729c4369a31f78b2ebcf
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
77b987f1a1bb6028a871de01065b94c4cfff0b5c 27-Feb-2014 Dianne Hackborn <hackbod@google.com> Hold a wake lock while dispatching network activity events.

Also add new API for determining whether the current data network
is active, and thus better scheduling network operations. This
API is designed to not be tied to a mobile network -- regardless
of the network, apps can use it to determine whether they should
initiate activity or wait. On non-mobile networks, it simply always
reports as the network being active.

This changed involved reworking how the idle timers are done so
that we only register an idle timer with the current default
network. This way, we can know whether we currently expect to
get callbacks about the network being active, or should just always
report that it is active. (Ultimately we need to be getting this
radio active data from the radio itself.)

Change-Id: Iaf6cc91a960d7542a70b72f87a7db26d12c4ea8e
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
f87b2248497223a18ee0e5403967a5de55d8cbb5 28-Feb-2014 Chad Brubaker <cbrubaker@google.com> Merge "Remove SO_BINDTODEVICE from VPN protect"
786e71ab11f2d89afffc9db7473f16206395c813 06-Feb-2014 Jake Hamby <jhamby@google.com> Remove unneeded new RIL command.

Remove the recently added RIL_REQUEST_SET_RADIO_MODE command and update
the definition of the RIL_REQUEST_NV_RESET_CONFIG parameter.
Also remove some accidentally added debug log lines.

Bug: 12864208
Change-Id: I6f035d6900c9fcb1427bad62057d7b4a1d3cd99c
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
9862a48574bc088eed97ce8a23b51797e623f863 24-Feb-2014 Chad Brubaker <cbrubaker@google.com> Merge "Only allow System apps to make VPN exempt routes"
4845037a48aa4463028fbea912dcb982a56daaa2 24-Feb-2014 Chad Brubaker <cbrubaker@google.com> Merge "Add the calling package name to requestRouteToHost"
c023453a2b79b338aea36b48fd610a099379d34c 14-Feb-2014 Chad Brubaker <cbrubaker@google.com> Only allow System apps to make VPN exempt routes

requestRouteToHost will only allow system applications to make routes
exempt from the VPN's routing rules.

If a VPN is currently running and a non-system app requests a route it
will only succeed if that host is currently covered by a VPN exempt
routing rule. Otherwise it will fail.

For example, if a VPN is running and the MMS network is brought online
those routes will be added as VPN exempt. If an application then tries
to request a route to a MMS endpoint it will succeed because the routes
already exist. If an application tries to request a route to a host
covered by the VPN the call will fail.

Bug: 12937545
Change-Id: If7bcec91bbb96c62c8fb69748c975847e6c00b6f
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
32d1ac4d45c25180cb841664986398c7e23995e4 21-Feb-2014 JP Abgrall <jpa@google.com> ConnectivityService: add support to set TCP initial rwnd

The value for the TCP initial receive window comes from,
in order,

kernel
/proc/sys/net/ipv4/tcp_default_init_rwnd

init.rc (via properties)
net.tcp.default_init_rwnd

properties
net.tcp.default_init_rwnd

gservices
Settings.Global.TCP_DEFAULT_INIT_RWND

Bug: 12020135
Change-Id: I0e271be19472900fa9f3bab037d53383ec014a9e
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
a45610fc1f767d014c0773a910e3e6a1a280db5d 19-Feb-2014 Patrick Tjin <pattjin@google.com> Modify unexpected mtu debug message to print mtu

Change-Id: Iacc78582c5e3d6b156e8e2eda25e89e0e5be6eda
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
f81daa986e3a2d75c6f2398a59b965790484e0a2 14-Feb-2014 Chad Brubaker <cbrubaker@google.com> Add the calling package name to requestRouteToHost

The calling package name will be used to check if an application is a
system application when deciding if a route should be exempt from VPN
routing rules.

Bug: 12937545
Change-Id: I2c09c875fe9bb9685871a0a801ddcbb32fc17405
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
bcf12b302cd2715de54493808b2503de05c53757 11-Feb-2014 Chad Brubaker <cbrubaker@google.com> Remove SO_BINDTODEVICE from VPN protect

SO_BINDTODEVICE is not needed with policy routing.
SO_BINDTODEVICE was also used on the default iface which causes problems
when the default iface is IPv6 only and the socket tries to connect to a
IPv4 address.

Bug: 12940882
Change-Id: I5b2bde0ac5459433fc5749f509072a548532f730
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
e13c4c0b664dabdc069ca8f9601d96a337eb02f9 12-Feb-2014 Dianne Hackborn <hackbod@google.com> Start tracking radio up time.

We now always turn on network state tracking for mobile,
and push this information down to battery stats.

In battery stats we use this to both log the changes in
the history and keep track of the total time the mobile
radio was active.

Power computation is switched over to using this information
to help determine power use, which will hopefully make it
more accurate (not counting inaccuracies in knowing when it
actually goes down).

Note yet done is aggregating this data per-uid, to better
emphasize which apps are causing the radio to be up. Right
now we just spread the total time across all uids weighted
by the total number of packets they have sent and received.

Also put in the battery stats infrastructure for bluetooth to
address issue #12973036: Improve power_profile.xml

Change-Id: I39d11b7ff6ae4f336f253d1cba308d8569de7e0d
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
8f9b33e77686de8e917ba61c5e2f2e31a1e0e49b 15-Jan-2014 Jake Hamby <jhamby@google.com> Add new RIL commands to read/write NV items and reset NV config.

Add new RIL commands and generic code cleanups.

The only changes required for OMA DM support are the
addition of five new methods in ITelephony.aidl for
reading/writing NV items and performing NV config and
radio resets (requires MODIFY_PHONE_STATE), along with
the new RIL request IDs in RILConstants.java.

Bug: 12864208
Change-Id: I958d2571580d98a49936ef2e6822e5ac086acbe2
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
945d69d7b843ed319ec98986b033ea7b86383e69 31-Jan-2014 Hui Lu <huilu@google.com> am 3cab7fc1: Merge "Add proxy as another network." into klp-modular-dev

* commit '3cab7fc1b8f06166df3a58cf10d4a0db36bde788':
Add proxy as another network.
1c5624a0128397fa6fd6484e6a473bad10547a34 15-Jan-2014 Hui Lu <huilu@google.com> Add proxy as another network.

Change-Id: I70cb6ac5604c4f0d6a752a291c40de2445ae98bb
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
d01f8422dad3a8933111b334a8f9c2469bd0e4a6 24-Jan-2014 Robert Greenwalt <rgreenwalt@google.com> Clean up dhcp no-op logging

bug:10553167
Change-Id: I1f6feb9a44e17d45ffc9f28b37bf5690230a3ade
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java
49782e46c0eb85a25ae2abcf80880c48dbab5aea 20-Dec-2013 Amith Yamasani <yamasani@google.com> am 9158825f: Move some system services to separate directories

* commit '9158825f9c41869689d6b1786d7c7aa8bdd524ce':
Move some system services to separate directories
9158825f9c41869689d6b1786d7c7aa8bdd524ce 22-Nov-2013 Amith Yamasani <yamasani@google.com> Move some system services to separate directories

Refactored the directory structure so that services can be optionally
excluded. This is step 1. Will be followed by another change that makes
it possible to remove services from the build.

Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
/frameworks/base/services/core/java/com/android/server/ConnectivityService.java