Commit Graph

2157 Commits

Author SHA1 Message Date
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
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
Dianne Hackborn
34300e4bd4 am 18c1d830: Fix build.
* commit '18c1d8301d8f544ae133198459bbf2698d80a14b':
  Fix build.
2015-07-31 19:42:24 +00:00
Dianne Hackborn
18c1d8301d Fix build.
Change-Id: Icdf6fa14e53a1c030d0d90205d3bf2d7610b6196
2015-07-31 10:35:34 -07:00
Lorenzo Colitti
25c1e480f5 am 4024ad11: Merge "Stop supporting legacy ConnectivityManager routing methods in M." into mnc-dev
* commit '4024ad119816ed4c4ab62e8c6252c9d484e74a5f':
  Stop supporting legacy ConnectivityManager routing methods in M.
2015-07-31 05:24:49 +00:00
Lorenzo Colitti
4024ad1198 Merge "Stop supporting legacy ConnectivityManager routing methods in M." into mnc-dev 2015-07-31 05:17:08 +00:00
Hung-ying Tyan
dc7add287d am f049071d: Merge "Revise lockdown check in getLegacyVpnInfo()" into mnc-dev
* commit 'f049071da45bec441813e29593e2bcd323a97bd0':
  Revise lockdown check in getLegacyVpnInfo()
2015-07-31 02:57:19 +00:00
Hung-ying Tyan
f049071da4 Merge "Revise lockdown check in getLegacyVpnInfo()" into mnc-dev 2015-07-31 02:51:32 +00:00
Lorenzo Colitti
2780e4bc0b 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
Hung-ying Tyan
dd494fb2f3 Revise lockdown check in getLegacyVpnInfo()
Return null instead of raising exception in lockdown mode.

BUG=22749146

Change-Id: I0e9e3ded0d189e3fa9e872b7af9fe363799c85d6
2015-07-30 10:52:25 +08:00
Paul Jensen
6995b9e586 am 13156c7d: Merge "Fix missing onLost NetworkCallbacks when network loses capability" into mnc-dev
* commit '13156c7d07e0e1d839b5d54dfe0e983c4f7cb93f':
  Fix missing onLost NetworkCallbacks when network loses capability
2015-07-30 02:20:49 +00:00
Paul Jensen
13156c7d07 Merge "Fix missing onLost NetworkCallbacks when network loses capability" into mnc-dev 2015-07-30 02:10:50 +00:00
Paul Jensen
bbfacbbc96 resolved conflicts for merge of 2813d5ba to mnc-dr-dev
Change-Id: I8b33797528f16596f0d350ad38458baa51fcacf6
2015-07-29 11:31:53 -04:00
Paul Jensen
2813d5ba39 Merge "Disable WiFi autojoin when user decides via "Stay connected?" dialog" into mnc-dev 2015-07-29 13:52:02 +00:00
Robert Greenwalt
91892f5524 am f5a934b6: Merge "Un-remove legacy ConnectivityManager API." into mnc-dev
* commit 'f5a934b60c6ade4f034e3b5222adc1a1be66a9a4':
  Un-remove legacy ConnectivityManager API.
2015-07-28 19:57:31 +00:00
Robert Greenwalt
f5a934b60c Merge "Un-remove legacy ConnectivityManager API." into mnc-dev 2015-07-28 19:39:48 +00:00
Robert Greenwalt
8c160a7614 Un-remove legacy ConnectivityManager API.
These were @removed too soon.  We need to keep them @deprecated until
the bulk of devices support the new API and then we can remove them.

bug:22728205
Change-Id: If1b46ff1878f1778517624112b195c461645ddd1
2015-07-28 11:41:31 -07:00
Paul Jensen
6eb94e6f5f 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
2d2a8d167e 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
05a505c943 Always check off-link connectivity in NetworkDiagnostics.
Currently, NetworkDiagnostics only checks off-link connectivity if
one of the DNS servers is off-link. Make it check off-link
connectivity in all cases by sending probes to Google Public DNS
if off-link DNS servers are not specified.

Bug: 22569331
Bug: 22641669
Bug: 22748900
Change-Id: I6cb0dd8491bc0c1a488631deca56722b9c1d2b3f
2015-07-27 16:41:44 +09:00
Erik Kline
8d59d1c718 Pass signal strength thresholds inside a Bundle
Bug: 21407651
Change-Id: I2c80e89441e2eb15a246cb1fa9347f886cefa80f
2015-07-18 17:28:52 +00:00
Lorenzo Colitti
5d2656c181 Support NetworkCallbacks based on signal strength.
Bug: 21405941
Change-Id: I2ed8a5aeb8dac464a4305671ed22abcacb485bc9
2015-07-18 17:28:26 +00:00
Lorenzo Colitti
0b798a8331 ConnectivityManager API for for packet keepalives.
Bug: 21405946
Change-Id: Ie1f8f8bee684fe2bb1092a9f1bc9f5dc29b1defc
2015-07-18 17:00:13 +00:00
Lorenzo Colitti
6b56e9e1c0 Make immutable NetworkCapabilities more explicit.
Bug: 21405941
Change-Id: Iafd738c31747b0f5f9356bed1c97f5f282830af1
2015-07-18 16:59:47 +00:00
Paul Jensen
57e65708a8 Disable WiFi autojoin when user decides via "Stay connected?" dialog
If the user selects "No" in the "Stay connected?" dialog box:
1. Disable autojoining that network in the future, and
2. Disassociate from that network.

Bug:22187193
Change-Id: I14dc9236c57e3ab7d3ec95edc906787cbfbf3c9f
2015-07-16 14:41:18 +00:00
Erik Kline
204b77ac87 Merge "Log NetworkRequestInfo to get more detailed history" into mnc-dev 2015-07-14 04:09:29 +00:00
Erik Kline
edf878bedb Log NetworkRequestInfo to get more detailed history
Bug: 21641983
Bug: 22235775
Bug: 22299819
Bug: 22358164
Change-Id: I48a2d162dd499a3590f06d805267a63822856969
2015-07-14 11:46:51 +09:00
Robert Greenwalt
3df86c6974 Fix filter on CONNECTIVITY_ACTION updates
Only send for network types which the network supports.

bug:22411968
Change-Id: I97765544eb653caf0ea4fc5d3feec5742d5d88dc
2015-07-10 16:26:40 -07:00
Robin Lee
718df19ed0 Merge "Legacy VPN calls to require a userID" into mnc-dev 2015-07-10 19:05:38 +00:00
Robert Greenwalt
4ab39690aa Merge "Enable EMERGENCY mobile connections." into mnc-dev 2015-07-10 18:23:24 +00:00
Paul Jensen
8079795a7b Fix build break.
Automatic merge commit caused breakage due to someone else's
intervening change adding a call site of a function whose last
parameter I removed.  Function in question is
ConnectivityService.rematchAllNetworksAndRequests.
Changes that merged badly are d2a43f9 and 7fb8adc.

Change-Id: I8fd32e1a187236a65c1b7c0ecdf17b817d108fd0
2015-07-10 12:29:23 -04:00
Paul Jensen
4387ed3583 Merge "Fallback to Cellular if WiFi fails to validate" into mnc-dev 2015-07-10 15:51:38 +00:00
Paul Jensen
e40da7fc3b Merge "Prepare some ConnectivityService logic for fallback to Cellular change" into mnc-dev 2015-07-10 15:51:23 +00:00
Paul Jensen
f2479b9d50 Merge "Add android.net.CaptivePortal class for captive-portal-handling-app callbacks" into mnc-dev 2015-07-10 14:57:13 +00:00
Robert Greenwalt
b1f7f75874 Enable EMERGENCY mobile connections.
Hooks the ConnectivityManager.TYPE_MOBILE_EMERGENCY,
PhoneConstants.APN_TYPE_EMERGENCY, and NetworkCapabilities.NET_CAPABILITY_EIMS
together so carrier apps can request connections to this APN.

bug:21785357
Change-Id: Id92a5e28d19407cc7a8f8b5478b23457f2f7f89d
2015-07-09 14:49:35 -07:00
Paul Jensen
75e0adb220 Add android.net.CaptivePortal class for captive-portal-handling-app callbacks
This new class replaces the awkward string token and ConnectivityManager APIs
used by apps handling captive portals.

Bug:21343774
Change-Id: I1a2c69edb17322715bf8422bb4216b0ea60bfd59
2015-07-09 10:47:34 -04:00