Commit Graph

1499 Commits

Author SHA1 Message Date
Lorenzo Colitti
8e43314ae0 Minor changes to the LinkAddress API docs.
1. Rename getNetworkPrefixLength to getPrefixLength. Update all
   callers in frameworks/base and add a shim method and a TODO
   for the rest.
2. @hide isSameAddressAs. It doesn't add much, and it's just
   one-liner that callers can implement if they want.
3. Fix the alignment of the initial paragraph (<ul> should have
   been </ul>).
4. Remove the documentation that talks about creating
   LinkAddresses, since there's no public API for creating them.

With these changes I think LinkAddress is fine as a public API.

Bug: 15142362
Change-Id: Iaf3b1db577745bb68a9e1dd7f96d666dd3f3ec7c
(cherry picked from commit 9ab53650cfcd91a2a151b44b3fd1381841f76269)
2014-06-11 18:52:19 +00:00
Lorenzo Colitti
b0116bf5bf Minor changes to the LinkAddress API docs.
1. Rename getNetworkPrefixLength to getPrefixLength. Update all
   callers in frameworks/base and add a shim method and a TODO
   for the rest.
2. @hide isSameAddressAs. It doesn't add much, and it's just
   one-liner that callers can implement if they want.
3. Fix the alignment of the initial paragraph (<ul> should have
   been </ul>).
4. Remove the documentation that talks about creating
   LinkAddresses, since there's no public API for creating them.

With these changes I think LinkAddress is fine as a public API.

Bug: 15142362
Change-Id: Iaf3b1db577745bb68a9e1dd7f96d666dd3f3ec7c
2014-06-10 14:46:39 -07:00
Sreeram Ramachandran
887d7b1d5a Add a new IpPrefix class and use it in RouteInfo.
This change uses IpPrefix only in the public API and continues
to use LinkAddress for everything else. It does not change the
callers to use the new APIs, with the exception of changing
all current uses of getDestination to getDestinationLinkAddress
to make room for the new getDestination method that returns an
IpPrefix.

Based on Sreeram's earlier change:
https://googleplex-android-review.git.corp.google.com/#/c/477874/
but a bit simplified and with a bit more documentation.

Bug: 15142362
Bug: 13885501
Change-Id: Ib4cd96b22cbff4ea31bb26a7853989f50da8de4e
2014-06-10 14:30:15 -07:00
Amit Mahajan
93a3aad019 resolved conflicts for merge of 1f65550f to master
Change-Id: I65585939a57c561064d370be131c0197de0f08c3
2014-06-10 10:47:26 -07:00
vandwalle
b112882ab4 Merge "remember and report network score" 2014-06-09 22:30:26 +00:00
vandwalle
fc2e61014a remember and report network score
Change-Id: Iccb2ec603bc9c0d3cf1976d0cc3f343cb1096494
2014-06-09 14:50:47 -07:00
Amit Mahajan
1f65550f8a am d03a49b4: am e5a28d34: am c4418f95: Handle provisioning APN by turning off/on radio.
* commit 'd03a49b4aa1f51408fbfafd34ac5c7b5010c7270':
  Handle provisioning APN by turning off/on radio.
2014-06-09 21:12:43 +00:00
Amit Mahajan
d03a49b4aa am e5a28d34: am c4418f95: Handle provisioning APN by turning off/on radio.
* commit 'e5a28d34f662c469f85590dda28fc02eca12204b':
  Handle provisioning APN by turning off/on radio.
2014-06-09 19:50:09 +00:00
Amit Mahajan
c4418f95e4 Handle provisioning APN by turning off/on radio.
The change is specific to AT&T as they want no signaling from device during provisioning.
I've tested following cases:
- expired AT&T SIM to make sure provisioning flow works as expected.
- airplane mode on/off with both active and expired AT&T SIM.
- wifi <-> mobile transitions work okay.
- LTE with Verizon SIM (basic sanity).

bug: 13190133

Change-Id: I215963174ae6000ae71d1dda693f95413f3d6e81
2014-06-09 17:55:27 +00:00
Robert Greenwalt
dc69ebdf94 Merge "Apply API review to android.net.Network:" 2014-06-08 23:41:27 +00:00
Robert Greenwalt
69aceaf7f2 Fix public API of LinkProperties.
bug:15142362
Change-Id: I1457111da7d3bd09998f7e010febb8bb4c45c8bc
2014-06-08 12:54:23 -07:00
Paul Jensen
8cdda64b9c Apply API review to android.net.Network:
- socketFactory() renamed to getSocketFactory()
- Make sure bindProcess() documentation points developers to getSocketFactory() as the preferred approach
- Move bindProcess() and unbindProcess() to ConnectivityManager.setProcessBoundNetwork() -- passing null clears it.
- Move getProcessBoundNetwork() to ConnectivityManager.getProcessBoundNetwork().

Bug:15142362
Bug:13885501

Change-Id: Ia55c59d52e1ec8bf10dd0d9d037bd04c0998bc71
2014-06-08 12:09:18 -07:00
Robert Greenwalt
4a52c697d2 Fix the marking of restricted network requests
Need to realized that the NOT_RESTRICTED bit is set by
default, so if looking at what bits are set to decide if
we want NOT_RESTRICTED cleared, we need to ignore the
bit itself.

bug:15456019

Change-Id: Iecae598f47ec7306d475e2262bb1c452ddf0fc75
2014-06-05 23:59:48 +00:00
Robert Greenwalt
84e2f28f33 am d060ac14: (-s ours) Merge "DO NOT MERGE Report new network scores back to factories." into lmp-preview-dev
* commit 'd060ac1433cec943e915b026cb5c76bd6615538e':
  DO NOT MERGE Report new network scores back to factories.
2014-06-04 21:32:34 +00:00
Robert Greenwalt
b344398404 am 02006632: Merge "Call a network restricted only if all capabilities are restricted" into lmp-preview-dev
* commit '02006632ef34d70e196a47a3b11ff344005acbb1':
  Call a network restricted only if all capabilities are restricted
2014-06-04 20:52:50 +00:00
Robert Greenwalt
63d11e519f DO NOT MERGE Report new network scores back to factories.
This is a first order approx of what we want - should probably be good enough in most cases.

bug:15277751

Change-Id: I10e3b25f6ad5c7e022ba966ed514d4e6a999180d
(cherry picked from commit 94a5c61cb82401dd777d0a7ac43183d92d955323)
2014-06-04 19:15:17 +00:00
Robert Greenwalt
879bd9484d Merge "Report new network scores back to factories." 2014-06-04 18:48:44 +00:00
Lorenzo Colitti
33920d2516 am 7a3077a9: Merge "Make requests for restricted networks not require unrestricted access." into lmp-preview-dev
* commit '7a3077a9a7405048b9cd28452efbc28a857acb25':
  Make requests for restricted networks not require unrestricted access.
2014-06-04 18:46:31 +00:00
Robert Greenwalt
b5a1be98de am cffe6d73: Merge "Fix legacy APIs." into lmp-preview-dev
* commit 'cffe6d7315bc364d913e6a7daf1b62b7d173bfb7':
  Fix legacy APIs.
2014-06-04 18:44:59 +00:00
Robert Greenwalt
85230629df Report new network scores back to factories.
This is a first order approx of what we want - should probably be good enough in most cases.

bug:15277751

Change-Id: I10e3b25f6ad5c7e022ba966ed514d4e6a999180d
2014-06-04 18:38:01 +00:00
Robert Greenwalt
6f82b6b568 am e8f910c6: Fix Legacy NetworkInfo API
* commit 'e8f910c635710e4b2d7f299ba33f6205cc4371e3':
  Fix Legacy NetworkInfo API
2014-06-04 17:03:25 +00:00
Robert Greenwalt
903141778b am ead9aa35: Merge "Refactor NetworkFactory." into lmp-preview-dev
* commit 'ead9aa35d4f5b94d9d602247826ba97afe2b6791':
  Refactor NetworkFactory.
2014-06-04 17:01:56 +00:00
Robert Greenwalt
7beba3f55c am 5fc756c3: (-s ours) Merge "Rewrite startUsingNetworkFeature for new API" into lmp-preview-dev
* commit '5fc756c3f4b7203d53834b9750332325ebf4e92d':
  Rewrite startUsingNetworkFeature for new API
2014-06-04 16:45:02 +00:00
Lorenzo Colitti
2606df8790 Call a network restricted only if all capabilities are restricted
When guessing whether a network is restricted or not (e.g., when
constructing a NetworkCapabilities object from an APN type, or
when constructing a request using startUsingNetworkFeature),
only assume the network is restricted if all the capabilities it
provides are typically provided by restricted networks (e.g.,
IMS, FOTA, etc.).

Previous code would conclude a network was restricted even if it
supported one "restricted" capability, so for example an APN
that provides both Internet connectivity and FOTA was marked as
restricted. This caused it to become ineligible to provide the
default Internet connection, because that must be unrestricted.

Also expand the list of restricted APN types a bit.

Bug: 15417453
Change-Id: I8c385f2cc83c695449dc8cf943d918321716fe58
2014-06-04 20:04:38 +09:00
Lorenzo Colitti
21c178d0a6 Make requests for restricted networks not require unrestricted access.
Currently, calling startUsingNetworkFeature for a restricted APN
type (e.g., IMS or FOTA) will create a request that requires
NET_CAPABILITY_NOT_RESTRICTED. Because these APNs are restricted,
when we bring them up we conclude that it does not match the
unrestricted requirement, and we tear them down.

1. Clear the NET_CAPABILITY_NOT_RESTRICTED capability when
   creating requests in startUsingNetworkFeature.
2. Refactor the code to a common function so this cannot happen
   again.

Bug: 15191336
Change-Id: Id1ec79c58ff79b1a83457ffaecc57d50b61ed4e4
2014-06-04 12:20:06 +09:00
Robert Greenwalt
ae5370cab5 Fix legacy APIs.
Two fixes.  First make sure we mark the request as handled by the network handling it.
Second, convert ensureRouteToHostForAddress to use the new legacyNetworkForType.

bug:14993207
Change-Id: I230968938ca0ed91f834b36a2af60caff2eab682
2014-06-03 17:22:11 -07:00
Robert Greenwalt
802c11080e Fix Legacy NetworkInfo API
Make the connectivity changed broadcasts send correct NetworkInfos.
Also update the results of getNetwork.

bug:15290306
bug:15191336
bug:14993207
Change-Id: Ie99ad25f3ebb90d18348e7013761b139e7481866
(cherry picked from commit 16fe1c18289de200d2249e51db8c0986619f487b)
2014-06-03 14:00:56 +00:00
Robert Greenwalt
03f23bfe91 Fix Legacy NetworkInfo API
Make the connectivity changed broadcasts send correct NetworkInfos.
Also update the results of getNetwork.

bug:15290306
bug:15191336
bug:14993207
Change-Id: Ie99ad25f3ebb90d18348e7013761b139e7481866
2014-06-03 19:58:54 +09:00
Robert Greenwalt
06c734e52e Refactor NetworkFactory.
Make NetworkFactory a concrete class and divide responsibilites between it and NetworkAgent.
Factory will track requests and by default give a single connect/disconnect api for ease
of use.  Then NetworkAgent is created and destroyed as needed with very simple logic.

Change-Id: I401c14a6e5466f2fc63b04219b97ff85bb9af291
(cherry picked from commit 9a17b9c5a256cb4bb14821c5ee89b03b99c045e8)
2014-06-03 01:26:48 +00:00
Robert Greenwalt
3dc73e576b Rewrite startUsingNetworkFeature for new API
bug:14993207
Change-Id: I041a80faa07bf3094af13a6c606f3b15aa03f789
(cherry picked from commit 09fe5e618b09965183cf53fba87c39025a19e8d1)
2014-06-02 23:29:20 +00:00
Robert Greenwalt
70cf11649e Refactor NetworkFactory.
Make NetworkFactory a concrete class and divide responsibilites between it and NetworkAgent.
Factory will track requests and by default give a single connect/disconnect api for ease
of use.  Then NetworkAgent is created and destroyed as needed with very simple logic.

Change-Id: I401c14a6e5466f2fc63b04219b97ff85bb9af291
2014-06-02 16:19:08 -07:00
Robert Greenwalt
857436debf Merge "Rewrite startUsingNetworkFeature for new API" 2014-06-02 23:12:29 +00:00
Sreeram Ramachandran
36a3584cc6 am 5a734bd7: Merge "Support legacy routes added by apps via ensureRouteToHost()." into lmp-preview-dev
* commit '5a734bd78e83afeee5833b56f04ac99113b97542':
  Support legacy routes added by apps via ensureRouteToHost().
2014-05-30 21:39:09 +00:00
Sreeram Ramachandran
9052fa125a Support legacy routes added by apps via ensureRouteToHost().
Change-Id: I0ee1ca89fdc859d75a89021ca8c1902811b1e4a9
(cherry picked from commit fb17b32550de624b7f476b70b7a2fc77f31dde7d)
2014-05-30 18:21:34 +00:00
Sreeram Ramachandran
898d27e7c3 Merge "Support legacy routes added by apps via ensureRouteToHost()." 2014-05-30 03:29:39 +00:00
Sreeram Ramachandran
1e459f2365 Support legacy routes added by apps via ensureRouteToHost().
Change-Id: I0ee1ca89fdc859d75a89021ca8c1902811b1e4a9
2014-05-29 19:00:37 -07:00
Paul Jensen
d4fbd78bb0 am 4477d6aa: Merge "Adjust Network\'s SocketFactory to restrict host name resolution to that Network" into lmp-preview-dev
* commit '4477d6aaadcdf583420b706065cc0753fb91cf3c':
  Adjust Network's SocketFactory to restrict host name resolution to that Network
2014-05-30 01:49:49 +00:00
Paul Jensen
78af47b1a8 am 7df1decc: (-s ours) Merge "Implement bind-to-network functionality of android.net.Network." into lmp-preview-dev
* commit '7df1deccfee0a98234960fa76bd0357f84a614c4':
  Implement bind-to-network functionality of android.net.Network.
2014-05-29 19:23:20 +00:00
Paul Jensen
c3c5babcb1 Adjust Network's SocketFactory to restrict host name resolution to that Network
bug: 13885501

Change-Id: Iab9a5a2e060fe261f4be9ba974c1a55fb6b9c98b
(cherry picked from commit 92064edf55ee11967d9cc7529125236ee8e469b2)
2014-05-29 19:17:06 +00:00
Paul Jensen
80504dbd74 Implement bind-to-network functionality of android.net.Network.
This is implemented by calling through to netd_client.
Included are functions to bind-to-network-for-process strictly for DNS to
facilitate startUsingNetworkFeature() reimplementation.

bug: 13885501

Change-Id: Ib22c7d02ea81d251bdfeeb0f64a47ce32eefcb1b
(cherry picked from commit dbf76f898f1f57eb74722358087c926d2f529bda)
2014-05-29 18:53:57 +00:00
Robert Greenwalt
cff4966327 am 67cf4bad: Merge "Don\'t break things if a network goes back to CONNECTED." into lmp-preview-dev
* commit '67cf4bad7bad05ff0a3a0704305c9eed4c92a338':
  Don't break things if a network goes back to CONNECTED.
2014-05-29 15:20:50 +00:00
Lorenzo Colitti
47f597dfbf Don't break things if a network goes back to CONNECTED.
Currently, if a network goes from CONNECTED to some other "live"
state (e.g., CONNECTING, because it's VERIFYING_POOR_LINK) and
back, ConnectivityService treats it as if a new network had
connected.  This causes it to attempt to create the network
(which fails, since a network with that netid already exists), to
trigger verification, and if the verification succeeds, to tear
down the network because the request it's satisfying is already
satisfied by the network itself.

Instead, if creating the network fails, assume it's because the
network had already been created, and bail out.

Also, when validation completes, ignore NetworkRequests that were
being served by the same NetworkAgent as before.

Bug: 15244052

(cherry picked from commit cfff026ec47afc7e31f60f80e3deea7f4e2f9be5)

Change-Id: I52c2220e8f1d98fca765880be3040593e92722ed
2014-05-29 21:36:07 +09:00
Lorenzo Colitti
9cfd04b64a Merge "Don't break things if a network goes back to CONNECTED." 2014-05-29 12:25:46 +00:00
Lorenzo Colitti
f28fd3d850 Don't break things if a network goes back to CONNECTED.
Currently, if a network goes from CONNECTED to some other "live"
state (e.g., CONNECTING, because it's VERIFYING_POOR_LINK) and
back, ConnectivityService treats it as if a new network had
connected.  This causes it to attempt to create the network
(which fails, since a network with that netid already exists), to
trigger verification, and if the verification succeeds, to tear
down the network because the request it's satisfying is already
satisfied by the network itself.

Instead, if creating the network fails, assume it's because the
network had already been created, and bail out.

Also, when validation completes, ignore NetworkRequests that were
being served by the same NetworkAgent as before.

Bug: 15244052
Change-Id: Ifd73558e5be452d9ef88c64cca429d5f302bf354
2014-05-29 19:19:54 +09:00
Lorenzo Colitti
2bd5d2d8f1 am d925573a: (-s ours) Merge "DO NOT MERGE - Support disconnecting while trying to connect." into lmp-preview-dev
* commit 'd925573af1ceab0d4a447e738f1d8830e552edd1':
  DO NOT MERGE - Support disconnecting while trying to connect.
2014-05-28 21:44:50 +00:00
Paul Jensen
34648fc64d Merge "Adjust Network's SocketFactory to restrict host name resolution to that Network" 2014-05-28 18:26:29 +00:00
Lorenzo Colitti
892331dc08 DO NOT MERGE - Support disconnecting while trying to connect.
Currently, once a NetworkAgent has decided to connect, there's
no way to disconnect without first connecting and having
ConnectivityService tear down the connection. This is suboptimal
because it causes the transport to keep retrying even if it knows
that it will not be able to connect.

Instead, allow the transport to abort a connection request that's
in progress, as long as the agent is not yet registered with
ConnectivityService.

Also add locking to evalScores. evalScores should already have
been taking a lock, because it accesses member variables that are
also accessed by the send*methods.

Bug: 15295359
Change-Id: I913c341bdfc50be9c23b632399f53168e754c1c0
(cherry picked from commit 081e99c3ac341734467b65458f94adc160f50d6c)
2014-05-28 09:29:07 +00:00
Lorenzo Colitti
57a0aba819 Merge "Support disconnecting while trying to connect." 2014-05-28 07:40:50 +00:00
Lorenzo Colitti
0640cdd9fa Support disconnecting while trying to connect.
Currently, once a NetworkAgent has decided to connect, there's
no way to disconnect without first connecting and having
ConnectivityService tear down the connection. This is suboptimal
because it causes the transport to keep retrying even if it knows
that it will not be able to connect.

Instead, allow the transport to abort a connection request that's
in progress, as long as the agent is not yet registered with
ConnectivityService.

Also add locking to evalScores. evalScores should already have
been taking a lock, because it accesses member variables that are
also accessed by the send*methods.

Bug: 15295359
Change-Id: I913c341bdfc50be9c23b632399f53168e754c1c0
2014-05-28 07:35:24 +00:00
Dave Langemak
b1adc41e9a am 4a6a8e5e: Merge "Move dis/enable of mobile data to Telephony" into lmp-preview-dev
* commit '4a6a8e5e3cce491064d6836b59c23fd076de56f2':
  Move dis/enable of mobile data to Telephony
2014-05-27 22:24:21 +00:00