Commit Graph

2191 Commits

Author SHA1 Message Date
Hugo Benichi
d55ff11c4b DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission
am: 849682f5a0  -s ours

Change-Id: I2ba3b591df623298f41e92e6f0d067a6fcf30533
2016-11-10 18:04:26 +00:00
Hugo Benichi
849682f5a0 DO NOT MERGE ANYWHERE Add CONNECTIVITY_USE_RESTRICTED_NETWORKS permission
This patch creates a new permission used by ConnectivityService to give
access to restricted networks without the NET_CAPABILITY_NOT_RESTRICTED
capability bit on.

Bug: 24497316
Change-Id: I5b6c8a9ef14395b2f1ab26cb17b24d7876ec79f1
2016-11-09 19:08:30 -08:00
Lorenzo Colitti
ac136a020f Debug logging for when getActiveNetworkInfo returns BLOCKED.
Bug: 26488100
Change-Id: I991581732d35aed18392bed2f3d69ca8fb231f5e
2016-01-22 05:21:34 +09:00
Sreeram Ramachandran
26b435dfe1 Don\'t use framework permission strings for netd permissions. am: 5c36486ea0 am: f51479864b am: e7267a355d am: d3b6e2d790 am: c987320b4a
am: 992bfeab73

* commit '992bfeab73c940cda7afe10af2d669d297218af5':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:50:11 +00:00
Sreeram Ramachandran
992bfeab73 Don\'t use framework permission strings for netd permissions. am: 5c36486ea0 am: f51479864b am: e7267a355d am: d3b6e2d790
am: c987320b4a

* commit 'c987320b4ad1a6fea7bb948cf045e6afb768d339':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:40:35 +00:00
Sreeram Ramachandran
c987320b4a Don\'t use framework permission strings for netd permissions. am: 5c36486ea0 am: f51479864b am: e7267a355d
am: d3b6e2d790

* commit 'd3b6e2d790f95f2fb3d85f0993b90bb8708a6114':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:30:59 +00:00
Sreeram Ramachandran
e7267a355d Don\'t use framework permission strings for netd permissions. am: 5c36486ea0
am: f51479864b

* commit 'f51479864b9ef8c82e4250cc972f1adee5a142d6':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:10:19 +00:00
Sreeram Ramachandran
f51479864b Don\'t use framework permission strings for netd permissions.
am: 5c36486ea0

* commit '5c36486ea0a01f8e11ce2c365e435c7968293de7':
  Don't use framework permission strings for netd permissions.
2015-11-19 15:59:42 +00:00
Sreeram Ramachandran
5c36486ea0 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 e203d89.

Bug: 21900139
Bug: 18194858
Change-Id: Ib3ec377ab26ce904d3d4678f04edec6cb1260517
(cherry picked from commit d9bf64ba1d)
2015-11-18 17:04:18 +00:00
Lorenzo Colitti
0b40c87afc 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
5d3203086b 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
d37059e6aa 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
60f1e8cbb4 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
114f3fe265 Merge "Push firewall rules up to ConnectivityService." into mnc-dr-dev 2015-10-12 16:34:19 +00:00
Paul Jensen
9f22f069e6 am 2c183a0f: am d2287312: am 4cbfe331: am d7d3affa: am f5118c89: am ece4ac21: Merge "Don\'t mark NetworkRequests restricted when they don\'t have restricted caps" into lmp-dev
* commit '2c183a0f849f97eda4f441fac7994d8e8234344b':
  Don't mark NetworkRequests restricted when they don't have restricted caps
2015-09-23 14:50:45 +00:00
Paul Jensen
be6f0f5f09 am 7ba4015c: am 96a44308: (-s ours) am 10a7d744: am 734a54f6: am 9f99bc6c: am a9e98343: Merge "Fix NOT_RESTRICTED network capability and enforce it." into lmp-dev
* commit '7ba4015c955f2ecd9433093d948e37686ef8f91a':
  Fix NOT_RESTRICTED network capability and enforce it.
2015-09-23 14:50:40 +00:00
Paul Jensen
2c183a0f84 am d2287312: am 4cbfe331: am d7d3affa: am f5118c89: am ece4ac21: Merge "Don\'t mark NetworkRequests restricted when they don\'t have restricted caps" into lmp-dev
* commit 'd2287312c6ce3ed99b411a6ec86c0333bfd3ae65':
  Don't mark NetworkRequests restricted when they don't have restricted caps
2015-09-23 14:42:02 +00:00
Paul Jensen
7ba4015c95 am 96a44308: (-s ours) am 10a7d744: am 734a54f6: am 9f99bc6c: am a9e98343: Merge "Fix NOT_RESTRICTED network capability and enforce it." into lmp-dev
* commit '96a44308b69c1f098c5e5aaae01cab87ea9e10aa':
  Fix NOT_RESTRICTED network capability and enforce it.
2015-09-23 14:41:57 +00:00
Paul Jensen
d2287312c6 am 4cbfe331: am d7d3affa: am f5118c89: 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
96a44308b6 am 10a7d744: am 734a54f6: am 9f99bc6c: 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
d7d3affab9 am f5118c89: am ece4ac21: Merge "Don\'t mark NetworkRequests restricted when they don\'t have restricted caps" into lmp-dev
* commit 'f5118c89e004156082966518f379c8ac7e065d7f':
  Don't mark NetworkRequests restricted when they don't have restricted caps
2015-09-23 11:13:48 +00:00
Paul Jensen
734a54f6f4 am 9f99bc6c: am a9e98343: Merge "Fix NOT_RESTRICTED network capability and enforce it." into lmp-dev
* commit '9f99bc6c0ec14b6962f02d10d0611bfa6b728f2d':
  Fix NOT_RESTRICTED network capability and enforce it.
2015-09-23 11:13:40 +00:00
Paul Jensen
f5118c89e0 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
9f99bc6c0e 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
Lorenzo Colitti
0a6477ed3c 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
f866a7077d 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
cf6717cbfe 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
b7993df3ba Require the new PACKET_KEEPALIVE_OFFLOAD permission.
Bug: 23884210
Change-Id: I50a1a647a69deaba92e73021ee7d6cc0f3eb1eee
2015-09-09 00:16:57 +09:00
Lorenzo Colitti
723f82f17f 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
bdaaf14f96 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
f25beee872 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
fe66316765 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
0891bc4f09 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
c8d52c6993 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
72877c2493 Cut down some logs.
bug:23623327
Change-Id: I737d4e6c384bf4da62c65ad2abe0c9b5dca0067a
2015-09-03 17:53:42 -07:00
Robert Greenwalt
6803efe7ee 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
325c15dfe3 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
1bb9827d76 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
d3e8d7b4ce 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 5d87922526)
2015-08-28 12:50:09 -04:00
Paul Jensen
e203d89de7 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 1b2d980e40)
2015-08-28 12:48:11 -04:00
Lorenzo Colitti
3e4966ed21 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
5d87922526 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
Adam Lesinski
daf7e5befd am 886e7a63: Merge "Change default cellular activity timeout to 10" into mnc-dev
* commit '886e7a63b122a30c69c663d32e3e5f880a07593e':
  Change default cellular activity timeout to 10
2015-08-19 00:53:35 +00:00
Adam Lesinski
6d4ebd786f Change default cellular activity timeout to 10
LTE radios take 10 seconds to power down, so we should set the
activity timeout to 10 seconds.

Bug:23294704
Change-Id: I7478b77f134b0fe2d82e39acd5c370add12735ca
2015-08-18 11:47:07 -07:00
Billy Lau
a0984c71a1 am 0ed58c3f: Merge "Bug: 21588539 Move CHANGE_NETWORK_STATE to be in SYSTEM_SETTINGS" into mnc-dev
* commit '0ed58c3f002db531fa499913f8ba047a62f39df3':
  Bug: 21588539 Move CHANGE_NETWORK_STATE to be in SYSTEM_SETTINGS
2015-08-07 22:22:24 +00:00
Billy Lau
0ed58c3f00 Merge "Bug: 21588539 Move CHANGE_NETWORK_STATE to be in SYSTEM_SETTINGS" into mnc-dev 2015-08-07 22:16:03 +00:00
Billy Lau
ce3f9dc328 Bug: 21588539 Move CHANGE_NETWORK_STATE to be in SYSTEM_SETTINGS
Merge the CHANGE_NETWORK_STATE permission with WRITE_SETTINGS.

AndroidManifest.xml:
Raised the protection level of CHANGE_NETWORK_STATE permission from
normal to signature|appops and pre23|preinstall for compatibility

provider/Settings:
Wrote new helper methods to check if app is allowed to change network
state.

ConnectivityManager.java & ConnectivityService.java:
Replace enforcement checks for CHANGE_NETWORK_STATE with
checkAndNoteChangeNetworkStateOperations instead.

Change-Id: If8c2dd3c76a5324ca43f1d90fa17973216c2bcc5
2015-08-07 19:29:51 +01:00
Paul Jensen
4f74dbe114 resolved conflicts for merge of f5b01767 to mnc-dr-dev
Change-Id: I3a8624b2b375e0d174983d7690082e0e6932c4de
2015-08-05 07:07:24 -04:00
Paul Jensen
f5b0176786 Merge "Fix NOT_RESTRICTED network capability and enforce it." into mnc-dev 2015-08-05 10:03:47 +00:00
Paul Jensen
1b2d980e40 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