Commit graph android_packages_modules_Co.../services/core/java
Message SHA1
Merge changes I86257bc8,I5c2221c5 into nyc-dev
* changes:
  Use Netd's binder interface to set resolver configuration.
  Add Gservices settings for resolver configuration.

Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2016-05-02 12:49:19 +00:00
8925ef3257
Use Netd's binder interface to set resolver configuration.
BUG: 25731675
Change-Id: I86257bc84371832466161e5357ae173c305a7d18

Pierre Imai   commited 2016-05-02 08:29:21 +00:00
5b5fe390dd
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

Jeff Sharkey   commited 2016-04-29 13:44:07 -06:00
833c35b354
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

Amith Yamasani   commited 2016-04-28 10:02:44 -07:00
f786dbf65c
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

Felipe Leme   commited 2016-04-25 15:36:25 -07:00
e0565ece68
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

Jeff Sharkey   commited 2016-04-24 14:39:34 -06:00
ea4037847d
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

Hugo Benichi   commited 2016-04-22 17:08:56 +09:00
a616d96929
Merge "Cap number of NetworkRequests a UID can make to 100" into nyc-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2016-04-21 13:47:13 +00:00
4088540675
Some fixes in ConnectivityService event logging
Bug: 28204408
Change-Id: I44ed9539bb213a845c2bcc2861c947af7c3c9ef4

Hugo Benichi   commited 2016-04-21 11:03:08 +09:00
41667a0ca3
Cap number of NetworkRequests a UID can make to 100
This prevents DoSing ConnectivityService with too many requests.

Fixes: 27253080
Change-Id: Id0480d220b2f01b9ef1146bef8ead2fc8287e28d

Paul Jensen   commited 2016-04-20 10:52:47 -04:00
7f11b4f8b3
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

Felipe Leme   commited 2016-04-19 12:06:00 -07:00
56f0084553
Remove unnecessary allocation+unboxing of objects.
Transforming String->int can be done with 0 allocations
using Integer.parseInt.

bug: 28078871
Change-Id: I8d9f322d7154728849dde61ef282046032858d60

Narayan Kamath   commited 2016-04-18 09:55:59 +01:00
846fa3ec83
Also log IPv4 and IPv6 connectivity of any previous default network
Change-Id: I07595c0a131fea21914f524949cd64af87403b88

Erik Kline   commited 2016-04-14 17:54:46 +09:00
2e815d38ac
Log an event whenever we lose the default network.
Change-Id: Ia71865a90b2db5dc0d3ad627563a6b1f99686f04

Pierre Imai   commited 2016-04-14 15:38:29 +09:00
dd55013f97
Record the transport types for connectivity events.
BUG: 25691077
Change-Id: I40b6de5446325e717c0356603fd66cd395db9acb

Pierre Imai   commited 2016-04-14 15:38:17 +09:00
b5cffc79fb
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

Paul Jensen   commited 2016-04-12 08:54:36 -04:00
6b866480f5
Merge "Reinstate much-reduced ConnectivityService logging." into nyc-dev
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2016-04-11 16:08:52 +00:00
5275052215
Merge changes Ic2c84de7,I379aef92 into nyc-dev
* changes:
  Remove duplicated code in NetworkStateTrackerHandler.
  Improve Tethering and NativeDaemonConnector logging.

Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2016-04-11 14:27:31 +00:00
399db1e148
Reinstate much-reduced ConnectivityService logging.
Change-Id: I9d1292f8c036be2a854fdb537f4ccb957d211966

Lorenzo Colitti   commited 2016-04-11 23:19:06 +09:00
d0a7a79b6c
Remove duplicated code in NetworkStateTrackerHandler.
Also use MessageUtils to decode message names.

Change-Id: Ic2c84de73fbf3eb10cc9634a083e5d3b3ffb807a

Lorenzo Colitti   commited 2016-04-11 17:40:22 +09:00
f0461853c0
Merge "Internal API for system apps to determine default network for other apps" into nyc-dev
Robin Lee   authored and   Android (Google) Code Review   commited 2016-04-07 16:43:15 +00:00
f81cbe1697
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

Robin Lee   commited 2016-04-07 14:55:59 +00:00
da4d2e2b67
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

Erik Kline   commited 2016-04-06 11:30:51 +09:00
3d4ed1573a
Delete unused default DNS setting code
Change-Id: I601a647714171f205d179d6fef6c112949fc5a94

Erik Kline   commited 2016-04-05 11:48:01 +09:00
d6506a1d41
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

Paul Jensen   commited 2016-03-25 07:46:07 -04:00
5eaf63272a
Merge "Add initial connectivity metrics handling." into nyc-dev
Pierre Imai   authored and   Android (Google) Code Review   commited 2016-03-25 06:17:36 +00:00
956d4d5bc6
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

Pierre Imai   commited 2016-03-25 13:21:41 +09:00
9575d17915
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

Erik Kline   commited 2016-03-24 12:52:54 +09:00
f446f21fc2
Support registering a request for the default network
Change-Id: I079f5be97b585cf5692dd4c7a144b993d168a9a5

Erik Kline   commited 2016-03-22 15:44:16 +09:00
e0aed6342f
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

Lorenzo Colitti   commited 2016-03-16 15:45:47 +09:00
dad8897a98
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

Robin Lee   commited 2016-03-14 13:19:14 +00:00
b402c02f3c
Turn down the logging a little bit.
Change-Id: Ib6e0e6f3577afac3b9bfe9a9b1cce70fb16d9d04

Joe Onorato   commited 2016-03-04 12:21:30 -08:00
549c01ec10
Have ConnectivityService install packet filters when possible
am: 69b7682a46

* commit '69b7682a46':
  Have ConnectivityService install packet filters when possible

Paul Jensen   authored and   android-build-merger   commited 2016-03-03 14:48:45 +00:00
38ac9019d9
Support 464xlat on Ethernet.
am: bc241263b5

* commit 'bc241263b5':
  Support 464xlat on Ethernet.

Lorenzo Colitti   authored and   android-build-merger   commited 2016-03-03 08:39:16 +00:00
81cf43c087
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

Paul Jensen   authored and   Lorenzo Colitti   commited 2016-03-03 17:32:01 +09:00
69b7682a46
Support 464xlat on Ethernet.
Bug: 26991160
Change-Id: I848c9e86e1ed337e95cfddda46723a9a1dcaed30

Lorenzo Colitti   commited 2016-03-03 17:31:57 +09:00
bc241263b5
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

Robin Lee   commited 2016-02-29 16:29:44 +00:00
224743c6b7
Expose measurement results to interested callers.
am: 41e3340ade

* commit '41e3340ade':
  Expose measurement results to interested callers.

Erik Kline   authored and   android-build-merger   commited 2016-02-10 15:58:17 +00:00
b1ec885b3b
Expose measurement results to interested callers.
With this it's possible for callers to:

    Network network = ...
    LinkProperties lp = ...

    NetworkDiagnostics netdiag = new NetworkDiagnostics(network, lp, 5000);
    netdiag.startMeasurements();
    netdiag.waitForMeasurements();

    boolean result = true;
    for (Measurement m : netdiag.getMeasurements()) {
        if (!m.checkSucceeded()) {
            result = false;
            // Additional error handling here.
        }
    }

    return result;

Bug: 21832299
Bug: 26780890
Change-Id: Iaf7ff029e2c6a998b574c23d0dcde8d57a467a22

Erik Kline   commited 2016-02-11 00:28:27 +09:00
41e3340ade
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

Jeremy Klein   commited 2016-02-04 19:06:59 -08:00
24d06b2ee8
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

Jeff Davidson   commited 2016-01-29 10:13:18 -08:00
9804c89aab
Merge "Allow NetworkFactories to match any network specifier on a request" into mm-wireless-dev
am: c4752acb32

* commit 'c4752acb32':
  Allow NetworkFactories to match any network specifier on a request

Etan Cohen   authored and   android-build-merger   commited 2016-01-28 18:24:23 +00:00
a19d34ba18
Add the network handle to the NetworkAgentInfo#toString() output.
This will make it possible to find nethandles via, e.g.
 "dumpsys connectivity --short".

Without this, native multinetwork API debugging requires running
"dumpsys connectivity --diag" in order to see the nethandle values.

Bug: 19537384
Change-Id: Icdd2b112523d4ecf88d5339f229e714a56d248f8

Erik Kline   commited 2016-01-28 15:06:56 +09:00
b6b7ce4446
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

Jeremy Klein   commited 2016-01-26 11:10:55 -08:00
2ada3deec1
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

Jeremy Klein   commited 2016-01-25 16:37:09 -08:00
9a36ec8c25
Merge "Debug logging for when getActiveNetworkInfo returns BLOCKED." into mnc-dr1.5-dev am: a6855a1faa am: d841d71593
am: 228c56e200

* commit '228c56e200':
  Debug logging for when getActiveNetworkInfo returns BLOCKED.

Lorenzo Colitti   authored and   android-build-merger   commited 2016-01-22 18:50:49 +00:00
592da45e75
Debug logging for when getActiveNetworkInfo returns BLOCKED.
Bug: 26488100
Change-Id: I991581732d35aed18392bed2f3d69ca8fb231f5e

Lorenzo Colitti   commited 2016-01-22 05:21:34 +09:00
600e9a2d68
[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

Robin Lee   commited 2016-01-19 16:40:20 +00:00
4908ef3e42
Merge "Always-on app VPNs"
Robin Lee   authored and   Android (Google) Code Review   commited 2016-01-14 11:37:18 +00:00
5c1c2fa073
Always-on app VPNs
Bug: 22547950
Change-Id: I46b204170bfac58d944f39b22f815b080de71a58

Robin Lee   commited 2016-01-12 19:54:54 +00:00
33c73e2424