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

Lorenzo Colitti   commited 2015-04-15 13:38:22 +09:00
36fbebe442
Adding per UID WiFi power distribution.
Change-Id: I88c539074607d7261f6c5cf1dbae47c3cf53f253

Adam Lesinski   commited 2015-04-07 11:37:10 -07:00
243d692232
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 22bb76b1b7.

Change-Id: Ieb11423c11cf9874a6175dce49843d0e1080c590

Bart Sears   commited 2015-04-07 06:14:04 +00:00
3daa046ac7
Adding per UID WiFi power distribution.
Change-Id: Ia3d97e0a1c3352127185c18626d8ba8221c9ab40

Adam Lesinski   commited 2015-04-06 18:36:06 -07:00
22bb76b1b7
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

Robert Greenwalt   authored and   Android Git Automerger   commited 2015-04-06 18:17:28 +00:00
5d271c5e21
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

Maunik Shah   commited 2015-04-04 21:48:24 +05:30
b22998939d
Replace usages of deprecated Resources.getColor() and getColorStateList()
Change-Id: I8f64fe6c4c44a92ff6d07250223ba590a1d691b0

Alan Viverette   commited 2015-03-18 18:37:18 -07:00
7f25a63f06
resolved conflicts for merge of b6b9fe21 to master
Change-Id: If4f62aa1fd8bb774288a677e7008e86a7e3ea6d9

Andreas Gampe   commited 2015-03-13 00:04:10 -07:00
b96902e7bc
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

Wenchao Tong   commited 2015-03-12 17:43:41 -07:00
ae7e9fb00a
Fix build, broken by https://android-review.googlesource.com/#/c/115890/
Change-Id: Ieafa2fb0a7f539d8f933ad9c98e3be80457da6e5

Lorenzo Colitti   commited 2015-03-12 16:48:12 +09:00
abd0acd039
Remove dead code, mostly DataStateTracker.
Change-Id: I1433937bffdb29bd42fb1adbfcf0a50ceffac7dd

Paul Jensen   commited 2015-03-11 10:03:58 -04:00
4c12c31336
Remove unused imports in frameworks/base.
Change-Id: I031443de83f93eb57a98863001826671b18f3b17

John Spurlock   commited 2015-02-28 14:47:49 -05:00
ca9ba60d53
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

Lorenzo Colitti   commited 2015-02-11 11:03:50 +09:00
bdda6bf579
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

Lorenzo Colitti   commited 2015-02-11 10:21:01 +09:00
66d4ed04ca
Merge "Log interface name and uid when filtering a blocked network." into lmp-mr1-dev
Erik Kline   authored and   Android (Google) Code Review   commited 2015-01-22 07:07:36 +00:00
8640c5de6c
Log interface name and uid when filtering a blocked network.
Bug: 18707263
Change-Id: Ide9a1670a97eae787b785933de0c80750c2b5601

Erik Kline   commited 2015-01-21 12:02:11 +09:00
a0c6e4539a
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

Robert Greenwalt   commited 2015-01-16 16:06:39 -08:00
b0491bb5a8
Merge "Don't blindly teardown unvalidated networks when releasing NetworkRequests." into lmp-mr1-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2015-01-14 12:39:01 +00:00
a76959f5f9
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

Paul Jensen   commited 2015-01-13 09:05:38 -05:00
203a744797
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 935ceef.

bug:18826162
Change-Id: I7bb4b99ec969099e9815f46d4c09253be71a29be

Paul Jensen   commited 2015-01-08 10:49:34 -05:00
1e5c6ab3ec
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

Robert Greenwalt   commited 2014-12-19 11:54:27 -08:00
01cf982f9d
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

Lorenzo Colitti   commited 2014-12-19 19:10:42 +09:00
af3f855333
Rename validated to everValidated.
This is a straight rename and thus a complete no-op from a
functionality perspective.

Bug: 18777225
Change-Id: I140d7640f1460c869a311294873772819a7a7059

Lorenzo Colitti   commited 2014-12-19 19:10:42 +09:00
80a0b535a8
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

Paul Jensen   commited 2014-12-15 15:20:30 -05:00
314f51e80d
Merge "Fix several HTTP proxy issues with multinetworking." into lmp-mr1-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2014-12-11 04:51:16 +00:00
269d28ea09
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

Paul Jensen   commited 2014-12-10 15:22:12 -05:00
1213135858
Merge "Re-remove CONNECTIVITY_CHANGE_DELAY and supporting functions." into lmp-mr1-dev
Erik Kline   authored and   Android (Google) Code Review   commited 2014-12-10 07:29:47 +00:00
b6992b4ea8
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

Jeff Sharkey   commited 2014-12-08 14:50:14 -08:00
7c503b1a25
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

Jeff Sharkey   commited 2014-12-08 08:42:59 -08:00
fe0b08d122
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

Erik Kline   commited 2014-12-08 16:25:20 +09:00
e2d501253b
Merge "Don't send the same PendingIntent more than once." into lmp-mr1-dev
Jeremy Joslin   authored and   Android (Google) Code Review   commited 2014-12-06 02:05:22 +00:00
7032a8b913
Merge "Reap unvalidated networks that have no chance of becoming highest scoring." into lmp-mr1-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2014-12-06 01:23:56 +00:00
e19ed28412
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

Jeremy Joslin   commited 2014-12-05 14:58:04 -08:00
b9846d0e61
Merge "Fix issue #17323751: Additional items in aggregated battery stats" into lmp-mr1-dev
Dianne Hackborn   authored and   Android (Google) Code Review   commited 2014-12-05 22:54:08 +00:00
ebd504dc9a
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

Dianne Hackborn   commited 2014-12-05 13:54:24 -08:00
2813a69af1
Revert "Merge "Remove CONNECTIVITY_CHANGE_DELAY and friends." into lmp-mr1-dev"
This is the revert of ag/572619.

This reverts commit 31c992a477, reversing
changes made to 32b61ab28f54e5b00f472b2166f9b1100375e4ff.

Bug: 18609055
Bug: 17769720
Change-Id: I122eba200f2071d4e5777ec34c1d04fb567345a8

Erik Kline   authored and   Pavel Zhamaitsiak   commited 2014-12-05 18:02:56 +00:00
2e3fd9c6a2
Merge "Remember to cancel lingering when a network again satsifies a NetworkRequest." into lmp-mr1-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2014-12-04 19:27:52 +00:00
f2568cef34
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

Paul Jensen   commited 2014-12-04 11:22:39 -05:00
abda68bf52
Merge "Remove CONNECTIVITY_CHANGE_DELAY and friends." into lmp-mr1-dev
Erik Kline   authored and   Android (Google) Code Review   commited 2014-12-04 03:14:02 +00:00
31c992a477
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

Lorenzo Colitti   authored and   Jeff Davidson   commited 2014-12-02 10:27:05 -08:00
8db934afbf
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

Paul Jensen   commited 2014-12-02 09:26:17 -05:00
935ceef02a
Merge "Only use mDefaultDns if the network claims to offer Internet" into lmp-mr1-dev
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2014-12-02 06:47:52 +00:00
9cc5bd0f6c
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

Lorenzo Colitti   commited 2014-12-02 03:40:16 +09:00
aa4f1f6680
Fix the ordering of extra values in the PI.
Bug: 18539720
Change-Id: I6bb69394b05923ca25bc1b4902bc2540a13812bd

Jeremy Joslin   commited 2014-11-26 14:24:15 -08:00
362093ebaa
Merge "Don't let NetworkMonitor state stop user-initiated transitions." into lmp-mr1-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2014-11-26 12:05:01 +00:00
d59fd959b4
Merge "Don't enforce control permission when preparing consented VPN." into lmp-mr1-dev
Jeff Davidson   authored and   Android (Google) Code Review   commited 2014-11-24 21:19:56 +00:00
65f31d8ddc
Merge "Don't bother validating networks that don't satisfy the default request." into lmp-mr1-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2014-11-24 18:30:36 +00:00
d8b132b7b2
Merge "Delete unused/non-working code." into lmp-mr1-dev
Sreeram Ramachandran   authored and   Android (Google) Code Review   commited 2014-11-24 17:24:26 +00:00
eac470a946
Don't let NetworkMonitor state stop user-initiated transitions.
GCM can call reportInetCondition() at any time which can cause
the NetworkMonitor to transition states to reevaluate at any time.
Previously we were only listening for users clicking the sign-in
notificaiton or completing sign-in when in the appropriate state.
With this change NetworkMonitor's state does not stop us from
listening for the user's actions.

bug:17917929
Change-Id: Ic1da31d90f7090e5fc111874cb7c37d505aaf590

Paul Jensen   commited 2014-11-24 11:11:32 -05:00
073b8ab2da
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

Jeff Davidson   commited 2014-11-21 12:56:29 -08:00
2b1cc9574c