Commit graph android_packages_modules_Co.../services
Message SHA1
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
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

Paul Jensen   commited 2014-09-07 13:16:03 -04:00
4fd960b44e
Don't send listening NetworkRequests to NetworkFactories.
We were doing this when a NetworkAgent updated its score.

bug:17393458
Change-Id: Id19ffc36b942b7112da70dfadd6abd57fcd128bd

Paul Jensen   commited 2014-09-07 13:10:07 -04:00
e252f4e0a0
Reserve NetIds 1..50 for OEM use.
Also reserve 51..100 for our use.

Bug: 17303534
Change-Id: Id082368b493dc3c5b5c479e51d273458d80ec6aa

Sreeram Ramachandran   commited 2014-09-05 16:24:51 -07:00
0fde0bec00
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

Paul Jensen   commited 2014-09-04 12:02:52 -04:00
57d231cfaa
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

Lorenzo Colitti   commited 2014-08-29 18:34:49 -07:00
786ae5df7d
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

Lorenzo Colitti   commited 2014-08-29 10:21:58 -07:00
2b2d73c7fd
Change TelephonyManager method name to accurately reflect functionality.
Bug: 17163860
Change-Id: I4390d79c49831454146a42b89520a16984c5f260

Diego Pontoriero   commited 2014-08-28 13:50:36 -07:00
4546d44570
Merge "Clean up Connectivity Logging." into lmp-dev
Robert Greenwalt   authored and   Android (Google) Code Review   commited 2014-08-28 16:29:55 +00:00
64c07932e3
Clean up Connectivity Logging.
bug:17285109
Change-Id: I61b98aa636996f8d4915fd954d49a22c20cfe9ab

Robert Greenwalt   commited 2014-08-27 14:49:14 -07:00
721f237014
Merge "Fix to allow removing sign-in notification when network removed." into lmp-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2014-08-26 23:58:40 +00:00
276d444af9
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

Paul Jensen   commited 2014-08-25 22:45:39 -04:00
c3deb11f7b
Merge "Remove listen requests properly." into lmp-dev
Robert Greenwalt   authored and   Android (Google) Code Review   commited 2014-08-25 23:12:46 +00:00
286ed87824
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

Robert Greenwalt   commited 2014-08-25 15:42:10 -07:00
bc5794d2ae
Update the http proxy on LinkProperty change.
bug:16308315
Change-Id: Ie44634a9223f289903c09653f77a998d3a344654

Robert Greenwalt   commited 2014-08-23 09:51:35 -07:00
63815c59c5
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

Jeff Davidson   commited 2014-08-21 16:21:29 -07:00
7af793a5c3
Merge "Change the NetworkInfo for disconnected types." into lmp-dev
Robert Greenwalt   authored and   Android (Google) Code Review   commited 2014-08-21 21:02:19 +00:00
140517a1c7
Change the NetworkInfo for disconnected types.
Don't send out NetworkInfos with UNKNOWN state for disconnected
networks - use DISCONNECTED.

bug:17095670
Change-Id: I863bebadc1f9a666572958b49d5e62809f485e5d

Robert Greenwalt   commited 2014-08-21 09:19:46 -07:00
7d5756de8c
Merge "Fix findConnectionTypeForIface." into lmp-dev
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2014-08-21 16:08:11 +00:00
a2d08df0a6
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

Lorenzo Colitti   commited 2014-08-20 09:11:14 -07:00
f47cdb166a
Added notification color to all system notifications
Bug: 17128331
Change-Id: I81a94510ef51b99916f314c0dd65852426a1fbeb

Selim Cinek   commited 2014-08-20 14:25:18 +02:00
f84112f025