Commit Graph

818 Commits

Author SHA1 Message Date
Hugo Benichi
e51bf9e2a4 Better ConnectivityMetricsEvent printing
This patch adds more information printing for IpConnectivity event
classes in android.net.metrics.

example:

ConnectivityMetricsEvent(14:36:35.799, 0, 1026): DhcpClientEvent(wlan0, DhcpRequestingState)
ConnectivityMetricsEvent(14:36:35.805, 0, 1026): DhcpClientEvent(wlan0, DhcpHaveAddressState)
ConnectivityMetricsEvent(14:36:35.809, 0, 4096): IpManagerEvent(wlan0, PROVISIONING_OK, 155ms)
ConnectivityMetricsEvent(14:36:35.810, 0, 1026): DhcpClientEvent(wlan0, DhcpBoundState)
ConnectivityMetricsEvent(14:36:35.871, 0, 2048): NetworkEvent(101, NETWORK_CONNECTED, 0ms)
ConnectivityMetricsEvent(14:36:35.874, 0, 2051): ValidationProbeEvent(101, PROBE_HTTP:599, 3ms)
ConnectivityMetricsEvent(14:36:35.874, 0, 2048): NetworkEvent(101, NETWORK_VALIDATION_FAILED, 0ms)
ConnectivityMetricsEvent(14:36:35.928, 0, 3072): DefaultNetworkEvent(0 -> 101, [WIFI], IPv4: false, IPv6: false)
ConnectivityMetricsEvent(14:36:37.008, 0, 2051): ValidationProbeEvent(101, PROBE_HTTP:204, 134ms)
ConnectivityMetricsEvent(14:36:37.008, 0, 2050): NetworkEvent(101, NETWORK_VALIDATED, 1137ms)

Also fixes a couple of event logging issues:
  - do no record spurious receive DhcpErrorEvent when a network goes down.
  - add an eventType field to IpManagerEvent instead of using the
    loggger component tag.

Bug: 28204408
Change-Id: Ia6f4ccfd7a0c63a5ccec18825f226c0b5781217b
2016-04-27 09:11:29 +09:00
Andreas Gampe
ae941d00cc Merge "Frameworks/base: Make debug helper lazy in ConnectivityManager" into nyc-dev am: 2082480 am: 12aea50
am: 9739a46

* commit '9739a467db314fc2ba0538a958d1f8c1e2693f95':
  Frameworks/base: Make debug helper lazy in ConnectivityManager

Change-Id: Iae09599af115044fd6e1c37c0f0222fe766281f0
2016-04-26 16:15:18 +00:00
TreeHugger Robot
2082480038 Merge "Frameworks/base: Make debug helper lazy in ConnectivityManager" into nyc-dev 2016-04-26 15:25:44 +00:00
Jeff Sharkey
00faf37463 resolve merge conflicts of d1153a3 to master
Change-Id: Iec9a4a76d0db0fbebdca8a732b4666cfaad70267
2016-04-25 16:40:38 -06:00
Andreas Gampe
b704658951 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 b027e6e92b.

Bug: 27265238
Change-Id: Ib4bfaf27acd234a035a5d198458340099a156a4c
2016-04-25 10:30:53 -07:00
Jeff Sharkey
40d1fb87a4 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
2016-04-24 14:39:34 -06:00
Lorenzo Colitti
b10b854bd3 Disambiguate NetworkCallback JavaDoc. am: 15874cd
am: c8a0754

* commit 'c8a0754b3d98e90a869acb9dcc8ca8ae40bcbde1':
  Disambiguate NetworkCallback JavaDoc.

Change-Id: Ibf47574237ea8467d8e536395d580bac9f8fea36
2016-04-15 09:54:58 +00:00
Lorenzo Colitti
15874cd028 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
2016-04-15 16:24:13 +09:00
Pierre Imai
06669fb25e Merge "Fix a memory leak in ConnectivityManager." into nyc-dev am: a5ccd54
am: e235da5

* commit 'e235da5d5cb1db440db228ee23314617e7dd9aa4':
  Fix a memory leak in ConnectivityManager.

Change-Id: I713b4d68033aaac4ef2ada50a486538459814e77
2016-04-13 06:44:29 +00:00
Pierre Imai
a5ccd54500 Merge "Fix a memory leak in ConnectivityManager." into nyc-dev 2016-04-13 06:37:33 +00:00
Paul Jensen
f2f05c4e50 Merge "If Internet probe is redirected, pass redirect destination to NetworkAgent." into nyc-dev am: 45e879c
am: 2c1f03a

* commit '2c1f03ade023a61428b7d9101bc10e4c88ae941a':
  If Internet probe is redirected, pass redirect destination to NetworkAgent.

Change-Id: I4c5f5cb8591d8729de9036a6c2aabacd4aba0f39
2016-04-13 02:02:13 +00:00
Paul Jensen
9c9e48fbd1 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
2016-04-12 08:54:36 -04:00
Pierre Imai
66d9bd8806 Fix a memory leak in ConnectivityManager.
Remove callbacks from the internal storage when they are being unregistered.

Change-Id: Ia42ed7aefaebd8caf3eada8e42b6cb7a940d7647
2016-04-12 15:00:28 +09:00
Robin Lee
908a75e480 Merge "Internal API for system apps to determine default network for other apps" into nyc-dev am: 80f2000
am: a948f88

* commit 'a948f8872aa045ab22f42285f195fdb413c5ff66':
  Internal API for system apps to determine default network for other apps

Change-Id: Ib719f0cebb41afe4aa52241f3797598a7e468d2d
2016-04-07 16:51:53 +00:00
Robin Lee
80f2000491 Merge "Internal API for system apps to determine default network for other apps" into nyc-dev 2016-04-07 16:43:15 +00:00
Robin Lee
5b52bef8d8 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
2016-04-07 14:55:59 +00:00
Erik Kline
e9c091ba5a Merge "Make public the registerDefaultNetworkCallback API" into nyc-dev am: df78e84
am: a577a3a

* commit 'a577a3a29f601fd2b71ad89eedcc52bdd8efbccb':
  Make public the registerDefaultNetworkCallback API

Change-Id: Ic749ede5b84e443fed04701ecdd0f6521a77158f
2016-04-06 08:58:22 +00:00
Erik Kline
7c912a4025 Make public the registerDefaultNetworkCallback API
Change-Id: I89d7a6f49f5d6a0da3402a07407b0f8d93181b4f
2016-04-06 12:22:47 +09:00
Paul Jensen
7e35dac240 Merge "Move ApfFilter from ConnectivityService to IpManager" into nyc-dev am: 732340c
am: ebdf3f0

* commit 'ebdf3f006854b04de2508314be7ac0788b6faa99':
  Move ApfFilter from ConnectivityService to IpManager
2016-03-25 13:01:09 +00:00
Paul Jensen
6b7f7a0852 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
2016-03-25 07:46:07 -04:00
Jeremy Klein
407e2a51e0 Merge "Add a null check for the OnStartTetheringCallback." 2016-03-23 18:52:16 +00:00
Pierre Imai
9b71d6659d Merge "Improve NetworkCapabilities command chaining." into nyc-dev 2016-03-23 01:11:15 +00:00
Paul Stewart
e611bda1e2 Merge changes Iddeebeb8,Idd1e37a3 into nyc-dev
* changes:
  WifiManager: Use ConnectivityThread
  Create ConnectivityThread
2016-03-22 22:23:48 +00:00
Pierre Imai
aabd22dad9 Improve NetworkCapabilities command chaining.
setNetworkSpecifier() now returns this.
BUG: 26797290

Change-Id: Ia8bd0836d9ac715408eca102bf4a2d23f044fa72
2016-03-22 22:29:22 +09:00
Erik Kline
23bf99c956 Support registering a request for the default network
Change-Id: I079f5be97b585cf5692dd4c7a144b993d168a9a5
2016-03-22 15:44:16 +09:00
Lorenzo Colitti
d8332d1a1b Remove framework code that calls SIOCKILLADDR
Bug: 26976388
Change-Id: I652361d9e650a77085070d6c26b28b7638ba2dfe
2016-03-22 12:54:32 +09:00
Paul Stewart
1f6a458995 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
2016-03-19 10:05:06 -07:00
Jeremy Klein
35e99ea8ef Add a null check for the OnStartTetheringCallback.
This avoids a NullPointerException when trying to call the callback
and gives a more readable error message.

Change-Id: Id0353ef541c76efcb4a9a12c082e1b6ec9389f02
2016-03-14 12:57:17 -07:00
Jeff Davidson
43e43a99c9 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
2016-03-14 11:24:12 -07:00
Paul Jensen
1d411461ef Have ConnectivityService install packet filters when possible
am: 9eca1f6072

* commit '9eca1f607295b7138ac2113f77ae6018fe17f200':
  Have ConnectivityService install packet filters when possible
2016-03-03 14:48:45 +00:00
Paul Jensen
9eca1f6072 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
2016-03-03 17:32:01 +09:00
Lorenzo Colitti
fd38423bd4 Merge changes Ic366b532,I0179b45b into nyc-dev
* changes:
  Move PinningNetworkCallback out to a new NetworkPinner class.
  Use MessageUtils in ConnectivityManager.
2016-03-02 04:18:03 +00:00
Jeff Sharkey
c78f85ca53 When system server goes down, crash apps more.
Apps making calls into the system server may end up persisting
internal state or making security decisions based on the perceived
success or failure of a call, or the default values returned.

The reality is that if the system process just died, init will be
along shortly to kill all running apps, so we should have no problem
rethrowing the RemoteException as a RuntimeException.

Bug: 27364859
Change-Id: Ife0bcb079636c88d54c44d17eb580409fd79028b
2016-03-01 19:29:16 -07:00
Lorenzo Colitti
b027e6e92b Use MessageUtils in ConnectivityManager.
Change-Id: I0179b45bc54ffced8e5647d6f005b891b5de93ab
2016-03-01 22:57:29 +09:00
Erik Kline
866306752b Delete all NetworkUtils DHCP-related code.
am: af0170a562

* commit 'af0170a562468acc53ef60f1d97c4dbd259b9af9':
  Delete all NetworkUtils DHCP-related code.
2016-02-22 09:16:16 +00:00
Erik Kline
af0170a562 Delete all NetworkUtils DHCP-related code.
Bug: 26991160
Change-Id: I2c74e0161f43f65c1b6a85dc9f294b64c8f1ae6e
2016-02-22 15:14:31 +09:00
Felipe Leme
e6303009b0 Merge "Created a ACTION_RESTRICT_BACKGROUND_CHANGED intent." 2016-02-02 23:59:30 +00:00
Felipe Leme
d34c9af3e2 Created a ACTION_RESTRICT_BACKGROUND_CHANGED intent.
This intent will be broadcasted when:

- Global restrict background setting is changed (sent to all packages)
- An individual uid is added to or removed from the whitelist (sent just
  to the packages belonging to that uid).

This intent is only sent to registered receivers.

BUG: 26451391
Change-Id: Ic0a5771f88baa52076ad04764f29098a386463cc
2016-01-28 13:28:11 -08:00
Etan Cohen
e2131c4d88 Merge "Allow NetworkFactories to match any network specifier on a request" into mm-wireless-dev
am: 9c28a90451

* commit '9c28a90451edaf8e90d2d87f8142dc7a7ff1eb9d':
  Allow NetworkFactories to match any network specifier on a request
2016-01-28 18:24:23 +00:00
Etan Cohen
9c28a90451 Merge "Allow NetworkFactories to match any network specifier on a request" into mm-wireless-dev 2016-01-28 18:20:09 +00:00
Lifu Tang
4cbe078ac0 Merge changes from topic '2016 GPS Changes'
* changes:
  Framework support to read newly added fields
  Added an API to query GPS hardware version info
  GPS Measurement and Navigation APIs go public
  Supported GNSS multi-constellation in frameworks
2016-01-28 02:02:17 +00:00
Shishir Agrawal
35759f9151 Unhiding MSIM APIs.
1. Unhide MSIM APIs in TelephonyManager that already have non-MSIM equivalent
   APIs public.
2. Make MSIM API naming consistent (overloaded, no suffix).
3. Unhide APIs in SubscriptionManager that are necessary for MSIM.

Bug: 26772894
Change-Id: Ibebab7379ea79c8e4812bbd190342827048e30e2
2016-01-26 13:47:27 -08:00
Shishir Agrawal
77d691763f DO NOT MERGE : Unhiding MSIM APIs.
1. Unhide MSIM APIs in TelephonyManager that already have non-MSIM equivalent
   APIs public.
2. Make MSIM API naming consistent (overloaded, no suffix).
3. Unhide APIs in SubscriptionManager that are necessary for MSIM.

Bug: 26772894
Change-Id: Ibebab7379ea79c8e4812bbd190342827048e30e2
2016-01-26 09:29:24 -08:00
Jeremy Klein
3dabcb9434 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
2016-01-25 16:37:09 -08:00
Lifu Tang
0a922fd0db Supported GNSS multi-constellation in frameworks
Change-Id: I82574afd3697c47e806d2cfaedc33756d0353b73
2016-01-25 15:15:14 -08:00
Felipe Leme
7e4c185b15 Fixed RestrictBackgroundStatus signature by adding @hide.
BUG: 26082535
Change-Id: I2e4b63327a8f791db01ee0c1ab090557170857fa
2016-01-25 12:09:03 -08:00
Felipe Leme
3051135227 Created new public API so applications can customize its metered network
usage while running in background.

The new API is 'int getRestrictBackgroundStatus()' and returns the
following values:

 - RESTRICT_BACKGROUND_STATUS_DISABLED: no restrictions
 - RESTRICT_BACKGROUND_STATUS_WHITELISTED: restriction but app is
   whitelisted
 - RESTRICT_BACKGROUND_STATUS_ENABLED: full restriction

The proper way to interprete these values for using metered networks
while running on background is:

 - When disabled, there is no restriction and the application could use the
   metered networks freely.

 - When whitelisted, the application can use the metered network, but should try
   to minimize the usage.

 - When enabled, the application should not try to use metered networks at
   all, since the usage will be denied.

BUG: 26451391
Change-Id: If07d42bb88e4c02802df0234861f38aef2cfead7
2016-01-22 10:50:11 -08:00
Jeff Davidson
d6c5e33f82 Merge "Implement roaming tracking in NetworkStats summary queries." 2016-01-20 01:43:02 +00:00
Jeff Davidson
2fd68b3a3e Implement roaming tracking in NetworkStats summary queries.
Whether a network is deemed roaming or not was already being tracked
as part of the NetworkIdentitySet, so the underlying data store
already tracks roaming and native data separately. However, this data
was being aggregated together in NetworkStatsCollection#getSummary,
since the NetworkIdentitySet is converted to an iface name for the
purposes of matching, and the iface name will be identical whether or
not the iface is considered roaming. Now it is separated.

Also fixes a long-standing bug in NetworkIdentitySet where an identity
read from a saved file would always be considered roaming == false,
even if it wasn't at the time it was written.

Bug: 25813438
Change-Id: I11ab5b51182ed8da7af8fde468df065f9fdc3dad
2016-01-19 16:57:51 -08:00
Robin Lee
e7a3e95319 Merge "Always-on app VPNs" 2016-01-14 11:37:18 +00:00