445 Commits

Author SHA1 Message Date
Lorenzo Colitti
e0938bed96 am a5bfd73a: am ab5e962e: am d7121f56: am 0257c82f: am 11e84bde: Merge "Don\'t mark NetworkRequests restricted when they don\'t have restricted caps" into mnc-dev
* commit 'a5bfd73ab683d3310ee3ce31d7ad3edb656aa858':
  Don't mark NetworkRequests restricted when they don't have restricted caps
2015-08-19 21:23:03 +00:00
Lorenzo Colitti
0257c82fa1 am 11e84bde: Merge "Don\'t mark NetworkRequests restricted when they don\'t have restricted caps" into mnc-dev
* commit '11e84bde9e98cb4b777a67208989d259883e9375':
  Don't mark NetworkRequests restricted when they don't have restricted caps
2015-08-19 20:54:48 +00:00
Xiaohui Chen
594f208d66 Clean up USER_OWNER reference in pm/Settings
Bug: 19913735
Change-Id: I538ed443b945e9cbb731520450bf5ef39882ae37
2015-08-19 17:34:15 +00:00
Paul Jensen
aae613d961 Don't mark NetworkRequests restricted when they don't have restricted caps
Requests without NET_CAPABILITIES_INTERNET and just the default network
capabilities should not be marked restricted.  Without this fix apps
can hit permissions exceptions if they inadvertently make requests
without NET_CAPABILITIES_INTERNET.

Bug:23164917
Change-Id: I4c7136821315bcb05dfc42ffbc505a5d4f6109e6
2015-08-19 11:08:38 -04:00
Paul Jensen
9180e2ea59 am abd27102: am 41779e46: am 95297732: am 86e7d135: resolved conflicts for merge of dbc4edcc to mnc-dr-dev
* commit 'abd27102f4e232be448bc6012e0bd833637ab3fa':
  Fix NOT_RESTRICTED network capability and enforce it.
2015-08-05 11:44:46 +00:00
Paul Jensen
86e7d135ac resolved conflicts for merge of dbc4edcc to mnc-dr-dev
Change-Id: I3a8624b2b375e0d174983d7690082e0e6932c4de
2015-08-05 07:07:24 -04:00
Paul Jensen
dbc4edccfc Merge "Fix NOT_RESTRICTED network capability and enforce it." into mnc-dev 2015-08-05 10:03:47 +00:00
Paul Jensen
487ffe7d3d Fix NOT_RESTRICTED network capability and enforce it.
With this change:
1. NOT_RESTRICTED should be removed from NetworkRequests that bring up
   special restricted carrier networks (e.g. IMS, FOTA).
2. NetworkRequests without NOT_RESTRICTED require CONNECTIVITY_INTERNAL
   permission to register
3. Binding sockets to networks without NOT_RESTRICTED requires
   CONNECTIVITY_INTERNAL permission

Bug:21637535
Change-Id: I5991d39facaa6b690e969fe15dcbeec52e918321
2015-08-04 07:24:24 -04:00
Lorenzo Colitti
00c8a9d60a am 5bbbf8ed: am 3b03916d: am c7a86e90: am c70348c1: am 496a9d26: Merge "Stop supporting legacy ConnectivityManager routing methods in M." into mnc-dev
* commit '5bbbf8edfd74389f9b38d3497d6d86afb543b8f2':
  Stop supporting legacy ConnectivityManager routing methods in M.
2015-07-31 05:49:08 +00:00
Lorenzo Colitti
c70348c194 am 496a9d26: Merge "Stop supporting legacy ConnectivityManager routing methods in M." into mnc-dev
* commit '496a9d269b0778ffa1965f3b11d768fe70fd7719':
  Stop supporting legacy ConnectivityManager routing methods in M.
2015-07-31 05:24:49 +00:00
Lorenzo Colitti
ffc42b0b7b Stop supporting legacy ConnectivityManager routing methods in M.
The methods startUsingNetworkFeature, stopUsingNetworkFeature and
requestRouteToHost were @removed in all the M preview builds, but
internal and external developers have noted that this imposes
additional burden for applications that need to work across
multiple platform versions because it causes compile-time errors.

We switched from @removed back to @deprecated to avoid these
problems. In order to effectively deprecate these methods, which
are error-prone and insecure, make them throw
UnsupportedOperationException if the app's target SDK is M or
above.

Because there are still one or two places in system code that use
these APIs, exempt Process.SYSTEM_UID and the OMA-DM client from
the check for now.

Bug: 22728205
Change-Id: I790bd32f3aa8067cbb625962a209bb9232f4b58c
2015-07-31 11:08:27 +09:00
Paul Jensen
722113aa5f am 917b275d: am 06287d1c: am 9a2314b0: am 682fd6ae: am a991c66c: Merge "Fix missing onLost NetworkCallbacks when network loses capability" into mnc-dev
* commit '917b275d6b54b08edb6326512d7e48a02163e730':
  Fix missing onLost NetworkCallbacks when network loses capability
2015-07-30 03:12:21 +00:00
Paul Jensen
682fd6aede am a991c66c: Merge "Fix missing onLost NetworkCallbacks when network loses capability" into mnc-dev
* commit 'a991c66c12da30d0240ac6c98736edee93d95977':
  Fix missing onLost NetworkCallbacks when network loses capability
2015-07-30 02:20:49 +00:00
Paul Jensen
a991c66c12 Merge "Fix missing onLost NetworkCallbacks when network loses capability" into mnc-dev 2015-07-30 02:10:50 +00:00
Lorenzo Colitti
98140ecef0 am 2ae3a05b: am b0014e9f: am 08ef66bb: am 62ca62b3: am e288b3af: Merge changes I5c994de5,I6cb0dd84 into mnc-dev
* commit '2ae3a05b424f7ef7c3a28507e2c19fde7f1e5963':
  Add a test for public bugs 2111 and 2136.
  Always check off-link connectivity in NetworkDiagnostics.
2015-07-28 18:48:06 +00:00
Paul Jensen
cf4c2c6372 Fix missing onLost NetworkCallbacks when network loses capability
If a network no longer satisfies a NetworkRequest, send the onLost
NetworkCallback.  If it was a real request (not listen) then update
the NetworkFactories.

To test this change I created a little infrastructure to fake
different Internet connectivity probe results during tests.  This
allowed me to rewrite some of ConnectivityServiceTest's logic for
validating networks.  This brought to light a couple issues that
I had to address to keep tests passing:
1. testUnlingeringDoesNotValidate was relying on a bad side-effect
   of my old method of ConnectivityServiceTest's logic for
   validating networks, so I rewrote the test.
2. ConnectivityService was not sending out NetworkCallbacks for
   WiFi when Cellular was validated.  I'm including a fix for this
   in this CL also.

Bug:22220234
Change-Id: I29314f38189817f8b2561a213c4f9e8522696663
2015-07-28 12:19:32 -04:00
Lorenzo Colitti
62ca62b32a am e288b3af: Merge changes I5c994de5,I6cb0dd84 into mnc-dev
* commit 'e288b3af14421731d8f477b97e8d77588f20498b':
  Add a test for public bugs 2111 and 2136.
  Always check off-link connectivity in NetworkDiagnostics.
2015-07-28 01:20:16 +00:00
Lorenzo Colitti
f28e62bdf6 Add a test for public bugs 2111 and 2136.
Bug: 22602137
Bug: 22104401
Change-Id: I5c994de53b5906416767a8a1abe38fe59afb7cc0
2015-07-27 17:22:21 +09:00
Lorenzo Colitti
cc5b9d6efc am 15cda089: am 6163290e: am e647d93d: am 8bf977d5: ConnectivityManager API for for packet keepalives.
* commit '15cda089b6209ba8d68beea81271b44612bbfb95':
  ConnectivityManager API for for packet keepalives.
2015-07-18 18:05:13 +00:00
Lorenzo Colitti
8bf977d562 ConnectivityManager API for for packet keepalives.
Bug: 21405946
Change-Id: Ie1f8f8bee684fe2bb1092a9f1bc9f5dc29b1defc
2015-07-18 17:00:13 +00:00
Fyodor Kupolov
b5143ecfee am 1fa2a088: am 1281575c: am 41fac5e8: am 189f3136: am 98724126: Merge "Added sendBroadcastMultiplePermissions method" into mnc-dev
* commit '1fa2a0888284ae00c905dce7a3003b995815467a':
  Added sendBroadcastMultiplePermissions method
2015-07-15 01:58:48 +00:00
Fyodor Kupolov
d4fd8c766d Added sendBroadcastMultiplePermissions method
Added Context.sendBroadcastMultiplePermissions(Intent intent, String[]
receiverPermissions) method, which allows an array of required permissions
to be enforced.

Bug: 21852542
Change-Id: I27c9130e8f004b428452501ebc8a36aabde1f343
2015-07-14 17:25:42 -07:00
Fyodor Kupolov
9ac5983c7b am 7aeb1a5c: am cf4617cf: am 1aeceef4: am fc4acfd9: am 4a817924: Merge "Revert "Allow array of required permissions in sendBroadcast"" into mnc-dev
* commit '7aeb1a5c19a1226f2b0ca7b498bdad941d206808':
  Revert "Allow array of required permissions in sendBroadcast"
2015-07-15 00:11:44 +00:00
Fyodor Kupolov
34ff2b04c9 am 64e8aa18: am 7f006b52: am 70174794: am ef77c116: am d69a82c1: Merge "Allow array of required permissions in sendBroadcast" into mnc-dev
* commit '64e8aa18f8c089989113ecd8775d41bffe74b41d':
  Allow array of required permissions in sendBroadcast
2015-07-14 23:10:56 +00:00
Fyodor Kupolov
e37520b49d Revert "Allow array of required permissions in sendBroadcast"
This reverts commit b4e7283c9afd9fb15ebd63f6ce9b75c9c1af658b.

Change-Id: Ie8390964bda5bdfa869cee8f46584043d8e7c664
2015-07-14 22:29:21 +00:00
Fyodor Kupolov
b4e7283c9a Allow array of required permissions in sendBroadcast
Added Context.sendBroadcast(Intent intent, String[] receiverPermissions)
method, which allows an array of required permissions to be enforced.

Bug: 21852542
Change-Id: I3b8ff258fa9f3249c344bb8093b820b24eef00c0
2015-07-14 12:50:22 -07:00
Paul Jensen
365504aca4 am c4417cf9: am f50ac2e7: am cfedbc43: am 7f9e3274: am bbce221e: Merge "Fallback to Cellular if WiFi fails to validate" into mnc-dev
* commit 'c4417cf98a98211072b36cb246d0e30aa650e2f2':
  Fallback to Cellular if WiFi fails to validate
2015-07-10 16:58:13 +00:00
Paul Jensen
84bfd14cce am f1576d8d: am 54b98c71: am 99ef3aef: am b54ec1bd: am d8cdba0d: Merge "Prepare some ConnectivityService logic for fallback to Cellular change" into mnc-dev
* commit 'f1576d8d07e844331685c35d976125f51a6d1a4d':
  Prepare some ConnectivityService logic for fallback to Cellular change
2015-07-10 16:58:06 +00:00
Paul Jensen
bbce221eec Merge "Fallback to Cellular if WiFi fails to validate" into mnc-dev 2015-07-10 15:51:38 +00:00
Paul Jensen
d8cdba0d71 Merge "Prepare some ConnectivityService logic for fallback to Cellular change" into mnc-dev 2015-07-10 15:51:23 +00:00
Paul Jensen
e098854c41 Fallback to Cellular if WiFi fails to validate
Previously, once a network validated, for the purposes of comparing networks
to select the default network, we always considered it validated.
With this change if a network later fails to validate, we'll take this latest
validation result into account.  This means if WiFi and cellular are up
(e.g. if we recently switched from cellular->WiFi, and cellular is now
lingering) and both are validated, but for some reason WiFi fails a validation,
cellular will become the default network connection.

Bug:20896761
Change-Id: I858aa10c1aaec5cd9032067f960963409107bdb1
2015-07-09 10:26:17 -04:00
Paul Jensen
85cf78edc9 Prepare some ConnectivityService logic for fallback to Cellular change
Reduce the duplication of some logic so when falling back to Cellular
when WiFi fails to validate is enabled, there's less chance for bugs
and failures:
1. De-duplicate several Network vs NetworkRequest matching functions
2. Remove the very tricky nascent logic by adding a simple "lingering" bit.

Bug:20896761
Change-Id: I21da9e827eec9cfd6835fcaa650192b9186ed053
2015-07-09 10:26:08 -04:00
Lorenzo Colitti
ecd4f608fb am af16f554: am 2893051a: am b0b3d0bc: Fix two parsing bugs in new DHCP client.
* commit 'af16f5549e4ad6dd169865b28f86d0f3c5f7af87':
  Fix two parsing bugs in new DHCP client.
2015-07-06 15:56:26 +00:00
Lorenzo Colitti
b0b3d0bcfb Fix two parsing bugs in new DHCP client.
1. We don't parse PAD options properly, leading in failure to
   parse packets sent by DHCP servers that put the end of options
   marker after pad options and at an odd offset.
2. We get the DhcpResults vendorInfo from the wrong option type
   (60 instead of 43).

Fix these and add unit tests for the offer packets sent by a few
different DHCP servers.

Bug: 21955617
Bug: 22281295
Change-Id: I5d13f1a6a3ff0b53112f18f3db8792fa32ad2da3
2015-07-06 13:50:53 +09:00
Paul Jensen
45895c802b am 0a99ca6e: am daf6b73b: am 9065b810: Merge "Disallow requesting networks with mutable NetworkCapabilities." into mnc-dev
* commit '0a99ca6e3c15983e91273fbc1c109f84f25ea982':
  Disallow requesting networks with mutable NetworkCapabilities.
2015-06-23 21:31:00 +00:00
Paul Jensen
bb2e0e9816 Disallow requesting networks with mutable NetworkCapabilities.
It's not clear what it means to request a network with a mutable
NetworkCapability like NET_CAPABILITY_VALIDATED or
NET_CAPABILITY_CAPTIVE_PORTAL.  Presently requesting such a network
would fail in a number of different ways:
1. The NetworkFactories would fail to match the request against their
   filter which doesn't include stateful NetworkCapabilities.
2. If the NetworkFactories did match, they'd bring up networks to try
   and satisfy the requests, but the networks would not have any
   mutable NetworkCapabilities initially so they'd be reaped.
Because of these problems it's safest to simply disallow these
requests.

Bug: 21343774
Change-Id: I56303242b81d39b370b8d5d1e32059bfcfc25949
2015-06-23 14:13:10 -04:00
Paul Jensen
764f9294df am f58e1dd3: am 4a451de0: am 8e21d29f: Merge "Don\'t send spurious onAvailable NetworkCallbacks when rematching" into mnc-dev
* commit 'f58e1dd34c5bca555673b08c0f3490c0328ba07a':
  Don't send spurious onAvailable NetworkCallbacks when rematching
2015-06-20 05:43:45 +00:00
Paul Jensen
8e21d29f7e Merge "Don't send spurious onAvailable NetworkCallbacks when rematching" into mnc-dev 2015-06-20 01:12:20 +00:00
Paul Jensen
3d911469a1 Don't send spurious onAvailable NetworkCallbacks when rematching
Bug:21762680
Change-Id: Ia701045dffc666fe75fba0e1771872147e37179a
2015-06-19 00:06:57 +00:00
Chris Wren
8056138a71 am 082314d4: am aeb1205a: am 3d2b6212: Merge "high-frequency notification stats." into mnc-dev
* commit '082314d42ea9ba917fac81a45ea87046523b5856':
  high-frequency notification stats.
2015-06-17 16:18:03 +00:00
Chris Wren
3d2b621204 Merge "high-frequency notification stats." into mnc-dev 2015-06-17 15:43:41 +00:00
Chris Wren
5eab2b72af high-frequency notification stats.
Aggregate and then periodically report stats that are high-frequency
because they are driven by app behavior, not user behavior.

Reuse the NotificationUsageStats facility.
Remove redundant stats.
Lessen memory foot print.
Enable in-memeory aggregates with small, bounded memory footprint.

Bug: 20258744
Change-Id: I87e391419c53917fa13c68a56f8cdb40a7c8e548
2015-06-17 11:42:45 -04:00
dcashman
13ae6679e1 am daccbc0a: am 1208e343: am 2f902959: Merge "Make keysetmgrservice gurantees explicit." into mnc-dev
* commit 'daccbc0a3c34808d5818f2e754b60731c803a14c':
  Make keysetmgrservice gurantees explicit.
2015-06-16 22:17:56 +00:00
dcashman
87f794f0bf Make keysetmgrservice gurantees explicit.
Add exceptions/checks for keysetmgrservice interractions which *should* never
happen, but would result in NPE or invalid metadata.  Also handle mismatches
between package and keyset metadata in packages.xml.

Bug: 20128916
Change-Id: Ia0f63f78d232d9d8d9fbe4cd8e6cc3406e5192a7
2015-06-15 17:14:54 -07:00
Paul Jensen
a4bb8ee39b am b379fdd0: am 49ab026a: am 8a6025fd: Merge "Remove most sleep() calls from ConnectivityServiceTest" into mnc-dev
* commit 'b379fdd0e9fa560e0abfe771acf920bb6aca60ad':
  Remove most sleep() calls from ConnectivityServiceTest
2015-06-15 14:11:20 +00:00
Paul Jensen
0a2823e539 Remove most sleep() calls from ConnectivityServiceTest
Change-Id: I90d2f6811ed1cb84614101200ac377e920bd864a
2015-06-12 10:31:09 -04:00
Robert Greenwalt
de4c947aef am c2a3f75f: am 1ec7d05e: am 3cbad5c1: Merge "Remove network requests properly." into mnc-dev
* commit 'c2a3f75fb60a4a720f07791cfe0730f42cd8eb80':
  Remove network requests properly.
2015-06-11 05:55:20 +00:00
Robert Greenwalt
3cbad5c17f Merge "Remove network requests properly." into mnc-dev 2015-06-11 02:19:17 +00:00
Robert Greenwalt
348e98dba0 Remove network requests properly.
We used to only remove requests that we'd acted on but that's
just wrong.

Also adds test case which exposed the problem but passes with the fix.

bug:20731384
Change-Id: I581a005560cc71167b857abf2452769399a9e1b7
2015-06-10 14:44:34 -07:00
Paul Jensen
de2c37fdce am c05c31a4: am 0fac11a8: am c1e623bb: Merge "Avoid overlapping NetIDs in ConnectivityServiceTest with real NetIDs" into mnc-dev
* commit 'c05c31a4c684f15bacd1908737bf8148d0e6adb3':
  Avoid overlapping NetIDs in ConnectivityServiceTest with real NetIDs
2015-06-10 18:42:59 +00:00