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

Udam Saini   commited 2016-01-08 14:38:31 -08:00
53b71ee34b
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

Etan Cohen   commited 2015-12-15 08:06:54 -08:00
d988de60d7
Merge "Remove defunct EVENT_SEND_STICKY_BROADCAST_INTENT."
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2015-12-15 13:24:52 +00:00
50461077fe
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

Dianne Hackborn   commited 2015-12-10 12:12:00 -08:00
6782e22930
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

Lorenzo Colitti   commited 2015-12-10 13:08:35 +00:00
048896e466
Merge "Reinstate CHANGE_NETWORK_STATE as a normal permission." into mnc-dr-dev am: 809dcade99 am: bdc458048a am: bb8f652372
am: c41cfe3335

* commit 'c41cfe3335':
  Reinstate CHANGE_NETWORK_STATE as a normal permission.

Lorenzo Colitti   authored and   android-build-merger   commited 2015-10-22 06:33:09 +00:00
93a2f99192
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

Lorenzo Colitti   commited 2015-10-22 08:33:45 +09:00
91de63b074
Merge "Don\'t buzz when automatically connecting to captive portals" into mnc-dr-dev am: d214496319 am: 5c09f31e49 am: 18ec0b5187
am: aea9258396

* commit 'aea9258396':
  Don't buzz when automatically connecting to captive portals

Lorenzo Colitti   authored and   android-build-merger   commited 2015-10-21 02:28:06 +00:00
d1023e8476
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

Lorenzo Colitti   commited 2015-10-21 09:59:31 +09:00
c22996447c
am bc68bc37: am 9c8abd1d: am f23eece2: am f90627d4: Merge "Don\'t crash if an invalid always-on VPN profile is configured." into mnc-dr-dev
* commit 'bc68bc37c4':
  Don't crash if an invalid always-on VPN profile is configured.

Erik Kline   authored and   Android Git Automerger   commited 2015-10-14 18:01:48 +00:00
818b1622e7
Merge "Don't crash if an invalid always-on VPN profile is configured." into mnc-dr-dev
Erik Kline   authored and   Android (Google) Code Review   commited 2015-10-14 17:37:57 +00:00
f90627d40b
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

Lorenzo Colitti   commited 2015-10-13 15:29:14 +09:00
f5e2883d41
resolved conflicts for a8f0bb0f to master
Change-Id: I1f13a63c3680901fac58ef709118c9242032b11f

Jeff Sharkey   commited 2015-10-12 17:51:45 -07:00
025424f274
Merge "Push firewall rules up to ConnectivityService." into mnc-dr-dev
Jeff Sharkey   authored and   Android (Google) Code Review   commited 2015-10-12 16:34:19 +00:00
22d9b51ce0
Log UID and PID of legacy route requests.
Bug: 23801105
Change-Id: I1722af0424f5b9bbd7276b77ce1571842fa541b3

Lorenzo Colitti   commited 2015-10-09 13:08:34 +09:00
ce3a70be65
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

Fyodor Kupolov   commited 2015-09-28 16:44:04 -07:00
188d3bda6e
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

Lorenzo Colitti   commited 2015-09-15 16:00:39 +09:00
71ec67ddf7
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

Jeff Sharkey   commited 2015-09-14 15:49:36 -07:00
baefe062f7