Commit graph android_packages_modules_Co.../services/core/java
Message SHA1
Merge "Don't allow an uncreated Network to satsify requests." into lmp-mr1-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2014-11-21 12:42:34 +00:00
9f8f78ca78
am c3f5d718: Merge "Fix null handling in proxies." into lmp-dev
automerge: 0a1f0d7

* commit '0a1f0d74f2':
  Fix null handling in proxies.

Geoffrey Borggaard   authored and   android-build-merger   commited 2014-11-21 10:17:39 +00:00
7057035ccc
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

Geoffrey Borggaard   commited 2014-11-20 19:48:20 +00:00
21523a4de1
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

Erik Kline   commited 2014-11-20 13:16:31 +09:00
fb087f1756
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

Paul Jensen   commited 2014-11-19 13:11:30 -05:00
adfd0a8857
Merge "Populate 464xlat LinkProperties only when the interface comes up." into lmp-mr1-dev
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2014-11-18 00:25:53 +00:00
3b5b0a22ea
Merge "air plane mode only send to the owner through the quick setting" into lmp-mr1-dev
xinhe   authored and   Android (Google) Code Review   commited 2014-11-17 22:18:11 +00:00
a5fd99e176
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

Jeff Davidson   commited 2014-11-17 21:03:10 +00:00
59b395fd7e
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

xinhe   commited 2014-11-17 11:35:01 -08:00
51e7703ca8
Populate 464xlat LinkProperties only when the interface comes up.
Currently Nat464Xlat reads the clat IPv4 address and updates the
clat LinkProperties when the interface is created. This causes a
race condition: because clatd only sets the IPv4 address after
creating the interface, it's possible that Nat464Xlat will read
the address before clatd has set it, causing the framework to
think that the clat IPv4 address is 0.0.0.0/32.

This seems to be happening more frequently now, perhaps because
clatd takes a bit longer to configure the IPv4 address now that
it needs to check that the address is free before using it.

Fix this by making Nat464Xlat listen for the interface coming up
instead of listening for the interface being added.

Bug: 12111730
Change-Id: Ic1c59b5b6dbb851b7431d1b06885f67803373bb9

Lorenzo Colitti   commited 2014-11-10 19:33:13 -08:00
6fef3fd724
Merge "Send broadcasts when VPNs come and go." into lmp-mr1-dev
Sreeram Ramachandran   authored and   Android (Google) Code Review   commited 2014-11-06 21:57:21 +00:00
b063786c78
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

Jeremy Joslin   commited 2014-11-06 11:43:27 -08:00
94c3099119
Merge "Update network selections on capability change." into lmp-mr1-dev
Jeff Davidson   authored and   Android (Google) Code Review   commited 2014-11-05 17:41:36 +00:00
6633afee4b
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

Jeff Davidson   commited 2014-11-04 16:48:27 -08:00
ee17a4ec14
Don't use framework permission strings for netd permissions.
These framework permission strings were being used as arbitrary labels
that mapped to netd permissions that have completely different meaning.
This leads to confusion, so use different strings.

Bug: 18194858
Change-Id: Ib3ec377ab26ce904d3d4678f04edec6cb1260517

Sreeram Ramachandran   commited 2014-11-04 10:15:03 -08:00
d84f7f863c
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

Sreeram Ramachandran   commited 2014-11-03 11:39:53 -08:00
1d4504357c
Enable 464xlat on wifi.
Bug: 12111730
Change-Id: If6d118a3c6e163262b09cc2fb3e3d3f9a81986ec

Lorenzo Colitti   commited 2014-10-30 20:31:27 +09:00
4061f43322
Add support for running 464xlat on wifi as well.
1. Add a command to NetworkManagementService to enable/disable
   IPv6 ND offload via netd.
2. Make Nat464Xlat enable offload if clatd successfully comes up
   on a wifi network (which means it detected a NAT64), and
   correspondingly re-enable offload when the clatd interface
   goes down.

This change does not enable clatd on wifi yet, that requires an
extra 2 lines to enable it.

Bug: 12111730
Change-Id: I4318611762a37487c9a84f8c4867ec5aece98be8

Lorenzo Colitti   commited 2014-10-30 20:31:26 +09:00
475674dc24
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

Lorenzo Colitti   commited 2014-10-29 01:23:26 +09:00
f46af8efdd
Change removeStackedLink to take an interface name.
This simplifies callers.

Also remove all "implementations" of addStackedLink and
removeStackedLink except the one in LinkProperties, because they
are unused.

Bug: 12111730
Change-Id: Ie294b855facba4b1436299dcb3211b72d9ba448e

Lorenzo Colitti   commited 2014-10-28 15:13:57 +09:00
b858857706
Propagate network state changes to the LockdownVpnTracker.
Bug: 17695048
Change-Id: I10378df0ab545729a6a315fd1bc8870cd98f47b3

Lorenzo Colitti   commited 2014-10-16 01:16:50 +09:00
31c6a49c78
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

Robert Greenwalt   commited 2014-10-03 16:05:36 -07:00
145bafa9a1
Merge "Send callbacks for Net property changes" into lmp-dev
Robert Greenwalt   authored and   Android (Google) Code Review   commited 2014-10-03 15:36:39 +00:00
586413f351
Send callbacks for Net property changes
LinkProperties and NetworkCapabilities changes were not calling app callbacks.

bug:17681483
Change-Id: I67dac3c4dc1284f5c4bfb24de239da4ec776336f

Robert Greenwalt   commited 2014-10-02 21:05:44 -07:00
78ac81a8d1
Merge "Send updated NetworkAgent score to NetworkFactories when validated." into lmp-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2014-10-03 02:18:12 +00:00
1ee5fa8f7b
Merge "Allow any unvalidated Network to satisfy NetworkRequests." into lmp-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2014-10-03 02:16:44 +00:00
3b66397c8c
Synchronize on all sendProxyBroadcast calls
To avoid race conditions.  Also make mDefaultProxy volatile for
safety.

Bug: 17697364
Change-Id: I8f0abb1a6e1c816f3addc11a69ff794ad767f2cf

Jason Monk   commited 2014-10-02 15:39:38 -04:00
f326ffef6f
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

Paul Jensen   commited 2014-10-02 11:06:43 -04:00
ab9bdd51c9
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

Paul Jensen   commited 2014-10-02 10:56:51 -04:00
d4e077c124
Send app permissions to netd.
Based largely off Robert's http://ag/546170 (thanks!)

Bug: 15413737
Change-Id: I8a1f0a184923c4c0a4935e6b88895bcc05e39f02

Sreeram Ramachandran   commited 2014-10-01 20:22:34 -07:00
c5756e42a4
Merge "Update LegacyTypeTracker state before sending connect broadcasts." into lmp-dev
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2014-09-30 03:05:49 +00:00
0e2d354589
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

Paul Jensen   commited 2014-09-29 11:37:43 +00:00
82c7e42f84
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

Lorenzo Colitti   commited 2014-09-29 20:15:33 +09:00
497b4b0d84
Merge "Only stop/start clatd if necessary." into lmp-dev
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2014-09-24 01:21:17 +00:00
3e5e56df71
Merge "Block address families with routes, not NetworkAgent side channel" into lmp-dev
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2014-09-24 01:21:06 +00:00
b30dbe08be
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

Lorenzo Colitti   commited 2014-09-24 00:03:23 +09:00
667da2828b
Merge "Remove needless locking of mRulesLock that caused deadlocks." into lmp-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2014-09-23 12:00:35 +00:00
099cbb0577
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

Lorenzo Colitti   commited 2014-09-23 10:48:28 +09:00
d63379ab2e
Remove needless locking of mRulesLock that caused deadlocks.
The locks were added in c006f1 when underlying functions weren't performing
locking.  In 21062e7 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

Paul Jensen   commited 2014-09-19 11:14:12 -04:00
e801542935
Merge "Use unified Tethering Permission Check" into lmp-dev
Robert Greenwalt   authored and   Android (Google) Code Review   commited 2014-09-18 00:02:16 +00:00
ab9254efd3
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

Robert Greenwalt   commited 2014-09-17 16:18:12 -07:00
b39204f207
Add NetworkAgent event for ExplicitlySelected
Lets Wifi tell us when the user selected this AP vs auto-connected.

bug:17396168
Change-Id: I6e067ab62ed49040629aa31fe07ff880d3d542f0

Robert Greenwalt   commited 2014-09-16 17:03:59 -07:00
cea86b065f
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

Robert Greenwalt   commited 2014-09-14 07:43:10 -07:00
135a724164
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

Paul Jensen   authored and   Robert Greenwalt   commited 2014-09-12 23:02:28 +00:00
5877e73315
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

Paul Jensen   commited 2014-09-12 13:32:00 -04:00
19d1d36ec0
Merge "Don't accept score below 0." into lmp-dev
Robert Greenwalt   authored and   Android (Google) Code Review   commited 2014-09-10 19:30:22 +00:00
6df9633596
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

Robert Greenwalt   commited 2014-09-10 10:39:37 -07:00
4a4ecd2c5f
Merge "Stop logging false error when lingering completes." into lmp-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2014-09-09 10:59:42 +00:00
a826bcd428
Merge "Don't send listening NetworkRequests to NetworkFactories." into lmp-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2014-09-09 10:59:20 +00:00
57250f0cae
Merge "Implement ConnectivityManager.reportBadNetwork() to trigger network validation." into lmp-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2014-09-09 10:58:59 +00:00
49fe68628d