Commit Graph

2199 Commits

Author SHA1 Message Date
Tobias Thierer
852f2e2ec0 Changes for upgrade to OkHttp 2.7.5
- Use com.android.okhttp.Dns in place of com.android.okhttp.internal.Network
 - Specify TimeUnit.MILLISECONDS for timeouts which 2.7.5 allows and
   brings us closer to 3+

Change-Id: I95b5d72a94ebe1389f7c2e8d95903aa1aadd944b
2016-06-29 17:41:32 +01:00
Elliott Hughes
ee04c535f0 Make android_net_NetUtils include what it actually uses.
Bug: http://b/28519060
Change-Id: I49dcd358d3fc8e0ba5c5e0b50a0f5dcc63281d22
2016-05-11 15:18:13 -07:00
zhangshuxiao
421545c845 When the applicantion is removed, reset network permission of this uid.
Probably not a portal: exception java.net.SocketException: Binding socket to network 102 failed: EPERM (Operation not permitted)

If there are SYSTEM permissions, then the original is SYSTEM permissions,
do not update. If other app of this uid have network permissions, the same
as before do not update, or update permissions. If all app of this uid
do not have any network permission to remove permissions.

Change-Id: I304d22b37de38d8b182639c0d7d7200adfcf715d
Signed-off-by: zhangshuxiao <zhangshuxiao@xiaomi.com>
2016-03-11 16:45:59 +08:00
Sreeram Ramachandran
d6832351c9 Don\'t use framework permission strings for netd permissions. am: 2c4e4c95e0 am: a40a3e6bf4 am: e55b156581 am: d3b6e2d790 am: 934b45022a am: 8b05ea51ad am: 4d2ed63c65 am: 6d983179a0 am: 5d41bd8d1a am: c1552f0caf
am: 38a3b2154c

* commit '38a3b2154c7ee5d75b5670abaa4c154edd3c36eb':
  Don't use framework permission strings for netd permissions.
2015-11-20 01:52:25 +00:00
Sreeram Ramachandran
4d2ed63c65 Don\'t use framework permission strings for netd permissions. am: 2c4e4c95e0 am: a40a3e6bf4 am: e55b156581 am: d3b6e2d790 am: 934b45022a
am: 8b05ea51ad

* commit '8b05ea51adab2a057ed0367472d194c2dc29a0bc':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:50:11 +00:00
Sreeram Ramachandran
8b05ea51ad Don\'t use framework permission strings for netd permissions. am: 2c4e4c95e0 am: a40a3e6bf4 am: e55b156581 am: d3b6e2d790
am: 934b45022a

* commit '934b45022aaaee96a43768ac1c498c6a49f7b2cd':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:40:35 +00:00
Sreeram Ramachandran
934b45022a Don\'t use framework permission strings for netd permissions. am: 2c4e4c95e0 am: a40a3e6bf4 am: e55b156581
am: d3b6e2d790

* commit 'd3b6e2d790f95f2fb3d85f0993b90bb8708a6114':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:30:59 +00:00
Sreeram Ramachandran
e55b156581 Don\'t use framework permission strings for netd permissions. am: 2c4e4c95e0
am: a40a3e6bf4

* commit 'a40a3e6bf4c3de9119812d854bf53923a68131ed':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:10:19 +00:00
Sreeram Ramachandran
a40a3e6bf4 Don\'t use framework permission strings for netd permissions.
am: 2c4e4c95e0

* commit '2c4e4c95e011bc4dd54c71c341b1f7ff83a53842':
  Don't use framework permission strings for netd permissions.
2015-11-19 15:59:42 +00:00
Sreeram Ramachandran
2c4e4c95e0 Don't use framework permission strings for netd permissions.
These framework permission strings were being used as arbitrary labels
that mapped to netd permissions that have completely different meaning.
This leads to confusion, so use different strings.

This is being cherry picked from lmp-mr1-dev to lmp-dev to fix failures
when creating restricted networks due to prior back-port e46a802.

Bug: 21900139
Bug: 18194858
Change-Id: Ib3ec377ab26ce904d3d4678f04edec6cb1260517
(cherry picked from commit d84f7f863c)
2015-11-18 17:04:18 +00:00
Lorenzo Colitti
c41cfe3335 Merge "Reinstate CHANGE_NETWORK_STATE as a normal permission." into mnc-dr-dev am: 809dcade99 am: bdc458048a
am: bb8f652372

* commit 'bb8f652372f261edd2083103d4300a9173993706':
  Reinstate CHANGE_NETWORK_STATE as a normal permission.
2015-10-22 06:28:24 +00:00
Lorenzo Colitti
91de63b074 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
2015-10-22 08:33:45 +09:00
Lorenzo Colitti
aea9258396 Merge "Don\'t buzz when automatically connecting to captive portals" into mnc-dr-dev am: d214496319 am: 5c09f31e49
am: 18ec0b5187

* commit '18ec0b518741dc5ac32c52ae9681efec3e73a23c':
  Don't buzz when automatically connecting to captive portals
2015-10-21 02:19:15 +00:00
Lorenzo Colitti
c22996447c 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
2015-10-21 09:59:31 +09:00
Erik Kline
bc68bc37c4 am 9c8abd1d: am f23eece2: am f90627d4: Merge "Don\'t crash if an invalid always-on VPN profile is configured." into mnc-dr-dev
* commit '9c8abd1d7ab205047a7e0f131eca24b2f3019d5d':
  Don't crash if an invalid always-on VPN profile is configured.
2015-10-14 17:55:13 +00:00
Erik Kline
f90627d40b Merge "Don't crash if an invalid always-on VPN profile is configured." into mnc-dr-dev 2015-10-14 17:37:57 +00:00
Lorenzo Colitti
f5e2883d41 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
2015-10-13 15:29:14 +09:00
Jeff Sharkey
a8f0bb0ff1 am 75051c3a: am 7f6d8754: am 22d9b51c: Merge "Push firewall rules up to ConnectivityService." into mnc-dr-dev
* commit '75051c3a62123b4668231d0243ba11462e02ac5a':
  Push firewall rules up to ConnectivityService.
2015-10-12 16:55:58 +00:00
Jeff Sharkey
22d9b51ce0 Merge "Push firewall rules up to ConnectivityService." into mnc-dr-dev 2015-10-12 16:34:19 +00:00
Elliott Hughes
26c330a424 am ccffea7a: resolved conflicts for a884d81e to stage-aosp-master
* commit 'ccffea7a3d4ab33a1fed5648bb5926c65dea15b6':
  constify JNINativeMethod function pointer tables
2015-09-24 17:14:10 +00:00
Elliott Hughes
ccffea7a3d resolved conflicts for a884d81e to stage-aosp-master
Change-Id: Ice485967fa96f13786024b6939b826638e906ff0
2015-09-24 10:01:32 -07:00
Paul Jensen
7724cffc30 am 06cf7c44: am 4e0d6dbd: am 4cbfe331: am 46a36218: am 5eff98f8: am ece4ac21: Merge "Don\'t mark NetworkRequests restricted when they don\'t have restricted caps" into lmp-dev
* commit '06cf7c44af0953ae0ee107c05992a9b6975360ef':
  Don't mark NetworkRequests restricted when they don't have restricted caps
2015-09-23 14:50:45 +00:00
Paul Jensen
477302fede am d2af51fa: am bfff9435: (-s ours) am 10a7d744: am 21087892: am 334c6e9a: am a9e98343: Merge "Fix NOT_RESTRICTED network capability and enforce it." into lmp-dev
* commit 'd2af51fabf49e7bdea23e4da79b5fd0aa0957edc':
  Fix NOT_RESTRICTED network capability and enforce it.
2015-09-23 14:50:40 +00:00
Paul Jensen
06cf7c44af am 4e0d6dbd: am 4cbfe331: am 46a36218: am 5eff98f8: am ece4ac21: Merge "Don\'t mark NetworkRequests restricted when they don\'t have restricted caps" into lmp-dev
* commit '4e0d6dbdb4b739baa4925e0087eb5ef5de65f66e':
  Don't mark NetworkRequests restricted when they don't have restricted caps
2015-09-23 14:42:02 +00:00
Paul Jensen
d2af51fabf am bfff9435: (-s ours) am 10a7d744: am 21087892: am 334c6e9a: am a9e98343: Merge "Fix NOT_RESTRICTED network capability and enforce it." into lmp-dev
* commit 'bfff94358e4f35de82d3f564a3b4dcffcb8c411a':
  Fix NOT_RESTRICTED network capability and enforce it.
2015-09-23 14:41:57 +00:00
Paul Jensen
4e0d6dbdb4 am 4cbfe331: am 46a36218: am 5eff98f8: am ece4ac21: Merge "Don\'t mark NetworkRequests restricted when they don\'t have restricted caps" into lmp-dev
* commit '4cbfe3316fd1105b697a9838ef7bafaebf5080a2':
  Don't mark NetworkRequests restricted when they don't have restricted caps
2015-09-23 11:33:18 +00:00
Paul Jensen
bfff94358e am 10a7d744: am 21087892: am 334c6e9a: am a9e98343: Merge "Fix NOT_RESTRICTED network capability and enforce it." into lmp-dev
* commit '10a7d7449dae2aabf4f22f980e7efabf274a939a':
  Fix NOT_RESTRICTED network capability and enforce it.
2015-09-23 11:33:13 +00:00
Paul Jensen
46a3621883 am 5eff98f8: am ece4ac21: Merge "Don\'t mark NetworkRequests restricted when they don\'t have restricted caps" into lmp-dev
* commit '5eff98f8f6b90432e4d005c0939c85c05109fe6c':
  Don't mark NetworkRequests restricted when they don't have restricted caps
2015-09-23 11:13:48 +00:00
Paul Jensen
21087892f8 am 334c6e9a: am a9e98343: Merge "Fix NOT_RESTRICTED network capability and enforce it." into lmp-dev
* commit '334c6e9a5d22094eccdc199c7d6061e27206c3e7':
  Fix NOT_RESTRICTED network capability and enforce it.
2015-09-23 11:13:40 +00:00
Paul Jensen
5eff98f8f6 am ece4ac21: Merge "Don\'t mark NetworkRequests restricted when they don\'t have restricted caps" into lmp-dev
* commit 'ece4ac2105d18d8d7b6296d6de3fdd5641c35258':
  Don't mark NetworkRequests restricted when they don't have restricted caps
2015-09-23 11:06:32 +00:00
Paul Jensen
334c6e9a5d am a9e98343: Merge "Fix NOT_RESTRICTED network capability and enforce it." into lmp-dev
* commit 'a9e98343146244b71e236d82c95a8d0fa30a41c1':
  Fix NOT_RESTRICTED network capability and enforce it.
2015-09-23 11:06:27 +00:00
Daniel Micay
6d5e7fa0c5 constify JNINativeMethod function pointer tables
Change-Id: I4036c924958221cbc644724f8eb01c5de3cd7954
2015-09-22 17:10:35 -04:00
Lorenzo Colitti
71ec67ddf7 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
2015-09-15 16:00:39 +09:00
Jeff Sharkey
baefe062f7 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
2015-09-14 15:49:36 -07:00
Lorenzo Colitti
db30ceba87 NetworkDiagnostics: ping default router from all global addreses.
This will hopefully allow us to determine if the router does not
have our global addresses in its neighbour cache.

Bug: 23661687
Change-Id: I46734c3c719003939cfccf038457ec309a9ff967
2015-09-10 15:49:54 +09:00
Lorenzo Colitti
520287e881 Require the new PACKET_KEEPALIVE_OFFLOAD permission.
Bug: 23884210
Change-Id: I50a1a647a69deaba92e73021ee7d6cc0f3eb1eee
2015-09-09 00:16:57 +09:00
Lorenzo Colitti
2aab71871c Add an error code for generic hardware error.
This is necessary because currently the wifi code just returns
whatever hardware-specific integer it gets back from the HAL,
which is bad because that will be interpreted by the caller as
one of the error codes defined in this class.

In parallel we'll also modify the wifi code to return this new
error code if the hardware returns an error.

Bug: 21405946
Change-Id: Ic9fa1193ced69a4e7ff543e397221c89b10a5a13
2015-09-09 00:16:57 +09:00
Lorenzo Colitti
f99389f155 Fix bugs and crashes in PacketKeepalive API.
Bug: 22606153
Bug: 23820819
Bug: 23884210
Change-Id: I1bf82094ec664baed345e9fb137fada0cbf4b7a0
2015-09-09 00:16:56 +09:00
Lorenzo Colitti
b793d607a5 Add tests for the PacketKeepalive API.
This currently fails in many different ways, but it tells us what
to fix.

Bug: 22606153
Bug: 23884210
Change-Id: If2e5ee0a8d7b26cad67d3d566ed5b1383e0db096
2015-09-09 00:16:56 +09:00
Lorenzo Colitti
221dace9cc Use a CountDownLatch instead of sleep() in NetworkFactory tests.
This makes testNetworkFactoryRequests 2-3 times faster.

Bug: 22606153
Change-Id: I9657b6929e77f23ec811d0ab57b2ba974f0b6a69
2015-09-08 16:41:47 +09:00
Lorenzo Colitti
1b8b5cdfad Get rid of shortSleep() in ConnectivityServiceTest.
Instead, use IdleHandler to wait for things to become idle.

Bug: 22606153
Change-Id: Ic6ab93ad4d336b40962f9be1096629a44b63ee2f
2015-09-08 16:41:47 +09:00
Lorenzo Colitti
5629741caa Make ConnectivityServiceTest a bit more readable.
1. Make TestNetworkCallback a bit smarter and rename it to
   SingleUseNetworkCallback. This allows us to get rid of all the
   calls to TestNetworkCallback#getConditionVariable.
2. Delete the commented out code that used to test a
   ConnectivityService model that has not been used since KK.
3. Remove unused imports, etc.

Bug: 22606153
Change-Id: I81a2d0b970d19e5f4515490d8c2f88d416445fa1
2015-09-07 20:41:51 +09:00
Robert Greenwalt
9b33077561 Cut down some logs.
bug:23623327
Change-Id: I737d4e6c384bf4da62c65ad2abe0c9b5dca0067a
2015-09-03 17:53:42 -07:00
Robert Greenwalt
e577c8181d Add SUPL-specific network bcast
Move SUPL CONNECTIVITY_ACTION bcasts to a different, hidden intent
to reduce the churn of apps when SUPL comes/goes.

Short term hack until SUPL moves to use the new APIs and there's
no bcast.

bug:23350688
Change-Id: I3dc14b42afa72465260aa41ccedfe1df27baabd9
2015-09-01 15:06:04 -07:00
Robert Greenwalt
76ba16e7aa am e3bcde94: Merge "Reduce CONNECTIVITY_CHANGE bcasts" into mnc-dev
* commit 'e3bcde94caf8440d5e3958a340b3d276d03f7691':
  Reduce CONNECTIVITY_CHANGE bcasts
2015-08-28 21:36:39 +00:00
Robert Greenwalt
051e641346 Reduce CONNECTIVITY_CHANGE bcasts
If an app uses the new api (requestNetwork) to bring up MMS, don't
mark it as a legacy request.  This was done because the messaging
service had to use a combination of new API and old
(requestRouteToHost) due to api problems.  This has been resolved
so don't mark these as legacy requests anymore.

The general stuff is still in for other types due to lack of testing
time but this should be removed altogether in the future.

bug:23350688
Change-Id: I41c27efb253c39d8af1357ae7916ed5315c716db
2015-08-28 12:37:54 -07:00
Paul Jensen
4fd9190492 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
(cherry picked from commit e8f0b4b312)
2015-08-28 12:50:09 -04:00
Paul Jensen
e46a802db1 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
(cherry picked from commit bc99fc7d96)
2015-08-28 12:48:11 -04:00
Lorenzo Colitti
4286e7590d 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
Paul Jensen
e8f0b4b312 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