Commit graph

2,491 commits

Message SHA1
Frameworks/base: Make debug helper lazy in ConnectivityManager
Place helper map for callback field names into a holder. This avoids
the reflective calls in static initialization of ConnectivityManager
in the common (non-debug) case, which means the class can be
compile-time initialized. Also saves the storage necessary (both
the storage array as well as the reflection metadata).

Follow-up to 7e28683228.

Bug: 27265238
Change-Id: Ib4bfaf27acd234a035a5d198458340099a156a4c

Andreas Gampe   commited 2016-04-25 10:30:53 -07:00
9537278b82
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
Disambiguate NetworkCallback JavaDoc.
The JavaDoc for many of the requestNetwork and
[un]registerNetworkCallback APIs incorrectly mentions the
PendingIntent version of the APIs instead of the NetworkCallback
version.

Also fix a minor issue in the registerDefaultNetworkCallback
JavaDoc: the default network request is an implementation detail,
so don't mention it. Instead, talk about the "system default
network".

Change-Id: Id94d98261daa2bd768c10e033cb8092729b21c91

Lorenzo Colitti   commited 2016-04-15 16:24:13 +09:00
ad458adea7
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
Merge "Fix a memory leak in ConnectivityManager." into nyc-dev
Pierre Imai   authored and   Android (Google) Code Review   commited 2016-04-13 06:37:33 +00:00
d97107a879
Merge "If Internet probe is redirected, pass redirect destination to NetworkAgent." into nyc-dev
Paul Jensen   authored and   Android (Google) Code Review   commited 2016-04-13 01:33:37 +00:00
7e261a101a
Merge branch \'mnc-mr-docs\' into mnc-ub-dev
am: 199565d  -s ours

* commit '199565d7a0': (546 commits)
  Update studio landing page and add all-new install flow docs. bug: 27850063 (update system reqs for 2.0) bug: 27725026 (update download page for 2.0) bug: 23908299 (clean up download and get started)
  docs: April 2016 Dashboard update
  docs: Added  new  partner logos to the car brands section of auto index page.
  Revert "Updates for Play" April Fool's joke.
  Updates for Play.
  docs: "Result is:" paragraph now in correct position on page.
  docs: Fixed namespace shown in a line of style XML
  docs: Add note about missing recording functionality in Live Channels
  docs: NDK r11c - release notes and downloads
  docs: Removed dead link in "create project" TOC.
  docs: Corrected reference link for NotificationManager.notify().
  docs: Added link to "preparing for multiwindow" blog post
  docs: Clarified how multi-window applies to activities in task stack
  [RenderScript] Update documentation about API level and RS Support Lib.
  cherrypick from mnc-docs docs: Updated API changes for Dinar wearable support.
  simplification and clarification to the Studio Overview
  Substitute for placeholder text.
  docs: Added missing semicolon within code sample.
  docs: Fixed Marshmallow links in API level table.
  docs: Update Nexus 9, 9G OTA images for N Preview
  ...

Change-Id: I2a64872d24ff2780503766f94e6d693edbdd47b8

Dirk Dougherty   authored and   android-build-merger   commited 2016-04-12 19:23:52 +00:00
9262ac2d97
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
Fix a memory leak in ConnectivityManager.
Remove callbacks from the internal storage when they are being unregistered.

Change-Id: Ia42ed7aefaebd8caf3eada8e42b6cb7a940d7647

Pierre Imai   commited 2016-04-12 15:00:28 +09:00
57f56137ea
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 "Excluded certain APNs (e.g. IMS) from mobile data usage." into nyc-dev
Jack Yu   authored and   Android (Google) Code Review   commited 2016-04-09 03:30:31 +00:00
6924695bc1
Excluded certain APNs (e.g. IMS) from mobile data usage.
Added not_metered capability to a mobile network if none
of its associated APN types are metered. Also used not_metered
capability to determine if a network should be accounted for
data usage or not instead of using network type, which is
always MOBILE after refactoring. Will add VT usage support
in next phase.

bug: 20888836
Change-Id: Id692cb856be9a47d0e918371112630128965b1bb

Jack Yu   commited 2016-04-07 10:07:31 -07:00
43c255193a
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
Merge "Make public the registerDefaultNetworkCallback API" into nyc-dev
Erik Kline   authored and   Android (Google) Code Review   commited 2016-04-06 08:51:08 +00:00
7faccef84c
Merge branch 'mnc-mr-docs' into mnc-ub-dev
Large merge to reconnect automerger for docs branch to mainline.

 Conflicts:
	docs/html-intl/intl/es/index.jd
	docs/html-intl/intl/es/preview/download.jd
	docs/html-intl/intl/es/preview/index.jd
	docs/html-intl/intl/ja/index.jd
	docs/html-intl/intl/ja/preview/download.jd
	docs/html-intl/intl/ja/preview/index.jd
	docs/html-intl/intl/ko/index.jd
	docs/html-intl/intl/ko/preview/download.jd
	docs/html-intl/intl/ko/preview/index.jd
	docs/html-intl/intl/pt-br/index.jd
	docs/html-intl/intl/pt-br/preview/download.jd
	docs/html-intl/intl/pt-br/preview/index.jd
	docs/html-intl/intl/ru/index.jd
	docs/html-intl/intl/ru/preview/download.jd
	docs/html-intl/intl/ru/preview/index.jd
	docs/html-intl/intl/zh-cn/index.jd
	docs/html-intl/intl/zh-cn/preview/download.jd
	docs/html-intl/intl/zh-cn/preview/index.jd
	docs/html-intl/intl/zh-tw/index.jd
	docs/html-intl/intl/zh-tw/preview/download.jd
	docs/html-intl/intl/zh-tw/preview/index.jd
	docs/html/guide/topics/manifest/compatible-screens-element.jd
	docs/html/guide/topics/manifest/uses-feature-element.jd
	docs/html/preview/download.jd
	docs/html/preview/features/runtime-permissions.jd
	docs/html/sdk/index.jd
	docs/html/tools/revisions/studio.jd
	docs/html/tools/sdk/eclipse-adt.jd
	docs/html/tools/support-library/features.jd
	telephony/java/android/telephony/TelephonyManager.java

Bug: 28000173
Change-Id: Iacab0481175f1b32e0ac3bab98cde9e994100e94

Trevor Johns   commited 2016-04-05 20:32:07 -07:00
199565d7a0
Make public the registerDefaultNetworkCallback API
Change-Id: I89d7a6f49f5d6a0da3402a07407b0f8d93181b4f

Erik Kline   commited 2016-04-06 12:22:47 +09:00
b3547c0a9a
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
Add a toString method to ApfCapabilities.
Change-Id: I505b90b7cd818cb3477990ec6b41b16db46d1c08

Lorenzo Colitti   commited 2016-03-28 17:33:30 +09:00
fc254678ee
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
Merge "Improve NetworkCapabilities command chaining." into nyc-dev
Pierre Imai   authored and   Android (Google) Code Review   commited 2016-03-23 01:11:15 +00:00
71d97f556f
Merge changes Iddeebeb8,Idd1e37a3 into nyc-dev
* changes:
  WifiManager: Use ConnectivityThread
  Create ConnectivityThread

Paul Stewart   authored and   Android (Google) Code Review   commited 2016-03-22 22:23:48 +00:00
26d7f6c450
Improve NetworkCapabilities command chaining.
setNetworkSpecifier() now returns this.
BUG: 26797290

Change-Id: Ia8bd0836d9ac715408eca102bf4a2d23f044fa72

Pierre Imai   commited 2016-03-22 22:29:22 +09:00
f51179babc
Support registering a request for the default network
Change-Id: I079f5be97b585cf5692dd4c7a144b993d168a9a5

Erik Kline   commited 2016-03-22 15:44:16 +09:00
e0aed6342f
Remove framework code that calls SIOCKILLADDR
Bug: 26976388
Change-Id: I652361d9e650a77085070d6c26b28b7638ba2dfe

Lorenzo Colitti   commited 2016-03-22 12:54:32 +09:00
0251d679fb
Create ConnectivityThread
Create a common singleton thread to be shared among all
connectivity tasks.  Instead of launching separate threads to
handle downstream messages from the various service instances used
in connectivity, these managers can choose to share this instance.

Bug: 27695292

Change-Id: Idd1e37a3e793c5485091509c3d7351e4d29288f0

Paul Stewart   commited 2016-03-19 10:05:06 -07:00
910adce8b4
Fix IdleableHandlerThread.
Occasionally, ConnectivityServiceTest fails with "BUG: only one
idle handler allowed". I have not been able to reproduce this
consistently, but code inspection reveals an unsafe access to
mIdleHandler inside queueIdle. Wrap that in a synchronized block.

Change-Id: I27307e2e55fa8d937d7f043bd436894091c3c667

Lorenzo Colitti   commited 2016-03-17 10:52:57 +09:00
0cbda755e9
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
Merge "NetworkStats.Bucket API polish." into nyc-dev
Jeff Davidson   authored and   Android (Google) Code Review   commited 2016-03-14 19:30:23 +00:00
7b8ee822d4
NetworkStats.Bucket API polish.
-Add @IntDef constants for STATE_ and ROAMING_.
-Expand docs for ROAMING_ constants.
-Use ROAMING_NO/YES instead of ROAMING_DEFAULT/ROAMING.

Bug: 27531260
Change-Id: I54ecfb4148caa549214df0bee9983036ffa4cb55

Jeff Davidson   commited 2016-03-14 11:24:12 -07:00
2cf791102e
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
DO NOT MERGE: Move PinningNetworkCallback out to a new NetworkPinner class.
am: a27c12ef29  -s ours

* commit 'a27c12ef29':
  DO NOT MERGE: Move PinningNetworkCallback out to a new NetworkPinner class.

Lorenzo Colitti   authored and   android-build-merger   commited 2016-03-07 22:19:32 +00:00
e4ffb0392e
DO NOT MERGE: Move PinningNetworkCallback out to a new NetworkPinner class.
Cherry-picked from 6282a08d3a

Bug: 19159232
Change-Id: Ic366b53259ee5944a8e864876425a6558c0a7216

Lorenzo Colitti   authored and   Paul Stewart   commited 2016-03-07 10:34:32 -08:00
a27c12ef29
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