Commit Graph

1071 Commits

Author SHA1 Message Date
Robert Quattlebaum
f1132ede8c NetworkCapabilities: Added support for TRANSPORT_LOWPAN
This change simply adds a new constant, `TRANSPORT_LOWPAN`, for
identifying low-power wireless networks like Thread.

Bug: b/33073713
Test: builds
Change-Id: I50d9b8df1a0270e06c28f001adf6c52a142a85af
Merged-In: Ie4aa77496f8ff466fa1a5fbc556e9c029457a689

(cherry pick from commit 103292d0b7)
2017-07-11 15:52:37 +09:00
Hugo Benichi
50b3fad094 Merge "ConnectivityManager: allow usage of TYPE_NONE" am: d54a27d898 am: 93e1941b43 am: 0278aa4b70
am: 3d2b4e04f3

Change-Id: I1e005686a1de5f2154fbc614ea52ce1a3ff5fc81
2017-07-05 14:54:05 +00:00
Hugo Benichi
3d2b4e04f3 Merge "ConnectivityManager: allow usage of TYPE_NONE" am: d54a27d898 am: 93e1941b43
am: 0278aa4b70

Change-Id: I1707e39308b0cf425b75e1e3f85323743c252c2f
2017-07-05 14:47:56 +00:00
Hugo Benichi
93e1941b43 Merge "ConnectivityManager: allow usage of TYPE_NONE"
am: d54a27d898

Change-Id: I72dbd17db63bd7b8637e82f5cdcfec3bf1482962
2017-07-05 14:33:35 +00:00
Hugo Benichi
ad353f451a ConnectivityManager: allow usage of TYPE_NONE
This patch allows to use TYPE_NONE for the legacy network type variable
of NetworkInfo. This usage is "safe" with respect to legacy APIs using
network types as most of them already returns null or do nothing for
TYPE_NONE.

Of the existing APIs in ConnectivityManager that accept a network type
argument, those which were already returning null or doing nothing for
TYPE_NONE are:
  getNetworkInfo(int)
  getNetworkForType(int)
  stopUsingNetworkFeature(int, String)
  networkCapabilitiesForType(int)
  requestRouteToHostAddress(int, InetAddress)
  reportInetCondition(int, int)
  isNetworkSupported(int)
  getLinkProperties(int)

Only setProvisioningNotificationVisible needs an additional guard
against TYPE_NONE.

Bug: 30088447
Bug: 62844794
Test: runtest frameworks-net
Change-Id: I112596fcd03d3c2cd42a2a84d265adb38e3944bb
2017-07-05 21:30:52 +09:00
Roland Levillain
a383359f01 Merge "Revert "ConnectivityManager: allow usage of TYPE_NONE"" am: a4fcd1a2b7 am: 8ad104e62c am: bdcebe39e6
am: 93caca72db

Change-Id: Ibd1ef362cdc21d57aefb2d1180dc678bb2692f34
2017-07-04 11:53:16 +00:00
Roland Levillain
93caca72db Merge "Revert "ConnectivityManager: allow usage of TYPE_NONE"" am: a4fcd1a2b7 am: 8ad104e62c
am: bdcebe39e6

Change-Id: I428cb473221a403e3c78cbc5d1224d46747ec315
2017-07-04 11:46:56 +00:00
Roland Levillain
8ad104e62c Merge "Revert "ConnectivityManager: allow usage of TYPE_NONE""
am: a4fcd1a2b7

Change-Id: I49221522c1a9a6e7d4ae72529c1a47b736e26a39
2017-07-04 11:31:30 +00:00
Roland Levillain
4bb710cb01 Revert "ConnectivityManager: allow usage of TYPE_NONE"
This CL is breaking some internal builds.

This reverts commit 0b7642a820.

Change-Id: Ie79214808d84c73f54a525f515b4c90a3fb23542
2017-07-04 11:14:03 +00:00
Hugo Benichi
5c8d2693bc Merge changes I90c211dc,I4455f272 am: a5ea99e288 am: 8a73d29f31 am: d0e5f1d280
am: 7c6b8f0138

Change-Id: I8a07b60112df37a63804454b356b4838c3a24965
2017-07-04 09:54:57 +00:00
Hugo Benichi
7c6b8f0138 Merge changes I90c211dc,I4455f272 am: a5ea99e288 am: 8a73d29f31
am: d0e5f1d280

Change-Id: Ia79936c51ec8236d5c92c19a8d2a3dff34f0e1a1
2017-07-04 09:49:06 +00:00
Hugo Benichi
8a73d29f31 Merge changes I90c211dc,I4455f272
am: a5ea99e288

Change-Id: I502d978ff636a00979d2083c39381bf600d3d6da
2017-07-04 09:35:51 +00:00
Hugo Benichi
0b7642a820 ConnectivityManager: allow usage of TYPE_NONE
This patch allows to use TYPE_NONE for the legacy network type variable
of NetworkInfo. This usage is "safe" with respect to legacy APIs using
network types as most of them already returns null or do nothing for
TYPE_NONE.

Of the existing APIs in ConnectivityManager that accept a network type
argument, those which were already returning null or doing nothing for
TYPE_NONE are:
  getNetworkInfo(int)
  getNetworkForType(int)
  stopUsingNetworkFeature(int, String)
  networkCapabilitiesForType(int)
  requestRouteToHostAddress(int, InetAddress)
  reportInetCondition(int, int)
  isNetworkSupported(int)
  getLinkProperties(int)

Only setProvisioningNotificationVisible needs an additional guard
against TYPE_NONE.

Bug: 30088447
Bug: 62844794
Test: runtest frameworks-net
Change-Id: I4455f2726d06406047086368628c1f253d854d8d
2017-07-04 16:22:59 +09:00
Udam Saini
f1c244ddf3 Merge "Adds necessary permissions to system apis" 2017-06-27 17:59:21 +00:00
Udam Saini
8f7d6a7ece Adds necessary permissions to system apis
adds privileged permission for getCaptivePortalServerUrl
adds tether privileged permission for
startTethering,isTetheringSupported

bug:62348162

Test: make and manual testing
Change-Id: I8eb8e3c9dcd7201abe9ea303ee57fe99073d67eb
2017-06-26 17:27:36 -07:00
Robert Quattlebaum
b4ddb16892 NetworkCapabilities: Added support for TRANSPORT_LOWPAN
This change simply adds a new constant, `TRANSPORT_LOWPAN`, for
identifying low-power wireless networks like Thread.

Bug: b/33073713
Merged-In: Ie4aa77496f8ff466fa1a5fbc556e9c029457a689

(cherry pick from commit 103292d0b7)

Change-Id: I21f9b41b8b31c63ceeb1bc9c965f6da2614c356a

Test: runtest frameworks-net (not in original commit message)
2017-06-23 16:08:45 +09:00
Hugo Benichi
cbe178fa80 Connectivity metrics: serialize networkId, transports, ifname
This patch adds translation from ConnectivityMetricsEvent to
IpConnectivityEvent of recently added fields:
 - top-level network id
 - top-level ifname
 - transports

Also adds inference of link layer from transports or ifname.

At the moment these new fields are not populated in
ConnectivityMetricsEvent. Follow-up patches will fill this gap for
the events of the android.net.metrics package.

Test: new unit tests, $ runtest frameworks-net passes
Bug: 34901696
Merged-In: I563a6a3183470bdfaabb7c781a1beaf6b1058bf0

(partial cherry pick from commit 45f6ef836d)

Change-Id: I6a00270e73a1bd07f23c367f2394d90a43ced47a

Test: runtest frameworks-net (not in original commit message)
2017-06-23 16:07:38 +09:00
Hugo Benichi
dd05bd6dbe Merge "ConnectivityManager: fix style issue" am: e74f3adba5 am: ec54a40339
am: 84e0cbf218

Change-Id: Iecf5399d77ae742cc66ac7a3cab4570464c4e95f
2017-06-22 19:46:28 +00:00
Hugo Benichi
84e0cbf218 Merge "ConnectivityManager: fix style issue" am: e74f3adba5
am: ec54a40339

Change-Id: I5a420534268a0daec19f1f0677dcfe7abd8faf73
2017-06-22 08:03:46 +00:00
Hugo Benichi
c436380ebf Merge "Better errors from unregisterNetworkCallback" am: 04e89ad631 am: ca6ebb0f39
am: 3ff91f42c1

Change-Id: Ia959388c875c22e56f5f2867f33a7329ce4b3535
2017-06-20 05:26:40 +00:00
Hugo Benichi
3ff91f42c1 Merge "Better errors from unregisterNetworkCallback" am: 04e89ad631
am: ca6ebb0f39

Change-Id: Ib380ee7c3fc85db353682ee7abfe97842eaeeb29
2017-06-20 05:19:46 +00:00
Hugo Benichi
7ab07a36c9 ConnectivityManager: fix style issue
Simple style fix flagged by linter.

Test: no functional change.
Change-Id: I2cb19912cba149eeaffdd157616d210259d42959
2017-06-20 14:11:57 +09:00
Hugo Benichi
412a2ee8a1 Better errors from unregisterNetworkCallback
This patch changes the validation of unregisterNetworkCallback in
ConnectivityManager so that the caller can better distinguish the case
of a callback that was never registered from the case of a callback that
has already been unregistered.

Bug: 62497809
Test: runtest frameworks-net passes
Merged-In: I58eda22725dd4e67dc4b64207e38cf482032df10

(cherry picked from commit 605b295011be74c786a2eef586d31ccb07160422)

Change-Id: I4d2be5d9037cfec03218b702d707f50808ee0694
2017-06-20 10:06:44 +09:00
Hugo Benichi
bee30fe597 Better errors from unregisterNetworkCallback
This patch changes the validation of unregisterNetworkCallback in
ConnectivityManager so that the caller can better distinguish the case
of a callback that was never registered from the case of a callback that
has already been unregistered.

Bug: 62497809
Test: runtest frameworks-net passes
Change-Id: I58eda22725dd4e67dc4b64207e38cf482032df10
2017-06-19 22:11:50 +09:00
Robert Quattlebaum
103292d0b7 NetworkCapabilities: Added support for TRANSPORT_LOWPAN
This change simply adds a new constant, `TRANSPORT_LOWPAN`, for
identifying low-power wireless networks like Thread.

Bug: b/33073713
Change-Id: Ie4aa77496f8ff466fa1a5fbc556e9c029457a689
2017-06-06 18:38:31 +00:00
Jeff Sharkey
53d8c2b663 Merge "Annotate @SystemApi with required permissions." into oc-dev
am: c1406978a4

Change-Id: I305967cad945a807c3f8234efabaad0ef8b591d1
2017-06-05 22:28:21 +00:00
Jeff Sharkey
9b39e9abdb Annotate @SystemApi with required permissions.
Most @SystemApi methods should be protected with system (or higher)
permissions, so annotate common methods with @RequiresPermission to
make automatic verification easier.

Verification is really only relevant when calling into system
services (where permissions checking can happen on the other side of
a Binder call), so annotate managers with the new @SystemService
annotation, which is now automatically documented.

This is purely a docs change; no logic changes are being made.

Test: make -j32 update-api && make -j32 offline-sdk-docs
Bug: 62263906
Change-Id: I2554227202d84465676aa4ab0dd336b5c45fc651
2017-06-05 13:27:11 -06:00
Hugo Benichi
0b379f7f69 Merge "ConnectivityManager: simplify callback handler" am: 5e6af581e4 am: 7bce658dd6
am: a67fb638fa

Change-Id: I3934666df4a02101351993f7f83fb0a42124a2f5
2017-05-23 06:37:24 +00:00
Hugo Benichi
ea0c83ccb7 Merge "ConnectivityManager: improve argument validation" am: 3ca6c89b37 am: 0187514f74
am: b800e8520e

Change-Id: Idfc0938025c633c89f5bfddd88b3721876d085ef
2017-05-23 03:41:52 +00:00
Hugo Benichi
b6c2406c4c ConnectivityManager: simplify callback handler
Bug: 36701874
Test: $ runtest frameworks-net
Change-Id: I4d5f08903a54f8dced7cb6ae86703847b908b784
2017-05-23 10:39:46 +09:00
Hugo Benichi
bc1104b465 ConnectivityManager: improve argument validation
Using Preconditions and dedicated static methods for checking arguments
to improve error stack traces without error messages.

Test: covered by previously added unit test
Bug: 36701874
Change-Id: Id872b2c887a4bca43a8c3644622add1c2ee57c6d
2017-05-23 10:39:45 +09:00
Hugo Benichi
85c5572cc2 Merge "Address ConnectivityManager API comments." am: 37c09c96b9 am: b57db6ef97
am: 08ab9ea526

Change-Id: I8e5e44043bb7efde3e21650e7edf3f121aff1e6e
2017-05-19 23:36:09 +00:00
Hugo Benichi
37c09c96b9 Merge "Address ConnectivityManager API comments." 2017-05-19 23:05:57 +00:00
Lorenzo Colitti
de1e515306 Add a method to start the captive portal login app.
Bug: 36203355
Bug: 36656914
Test: ConnectivityServiceTest (including new test) passes
Change-Id: Ide82858af67024623560ab79beea27c201b63447
Merged-In: I82a9a9a8da47870ba3f1bbef5941b37e970c844f

(cherry picked from commit 500dbae1b5)
2017-05-19 00:58:41 +00:00
Hugo Benichi
5ac64c51f5 Address ConnectivityManager API comments.
This patch is a cherry pick of the two following commits:
  - 139a48c83c which addresses several
    issues in the public api of ConnectivityManager.
  - 4c11db0fdd which fixes the documentation
    of several methods in ConnectivityManager public api.

Because the first commit change the public api that is referenced in
the documentation fixed by the second commit, it is not possible to one
without the other. In both cases trying to cherry pick only one of them
results in a build error.

The first commit was submitted successfully on an internal branch before
the checks done in the built got stricter.

Bug: 36370941
Test: marlin builds and boots
Change-Id: I86dcf056e6b165e527c3ee88dbabc2764ac09a08
Merged-In: I693ee5270bf186c88c7c5056293519f7237504ff

(cherry picked from commit 139a48c83c)
2017-05-17 21:48:05 +09:00
Hugo Benichi
216aae5188 Merge "Remove unused import in ConnectivityManager" am: db6fc1afe8 am: fe098f8207
am: e13c192d0f

Change-Id: Ib8368c5a8538914cba2723368c03618401ac159f
2017-05-16 13:25:09 +00:00
Hugo Benichi
5d426da614 Remove unused import in ConnectivityManager
This makes the pre-upload verification pass.

Test: no functional change.
Change-Id: I6beccea10ccfcb39d975cb8f6f34fc9d79f1e170
2017-05-16 11:39:08 +09:00
Hugo Benichi
39294ce0cd Merge changes Ie762ce75,I611fd791 am: 21a57f263f am: cc9f695ba0
am: 164854bde2

Change-Id: I1495249f1ced84438dbd5dd0ad6678e2ee4062cb
2017-05-11 14:28:23 +00:00
Hugo Benichi
a590ab8373 ConnectivityManager: uses service error codes and exceptions
This patch introduces between ConnectivityManager and
ConnectivityService a mechanism for propagating back to clients
informative errors in the form of error codes and associated custom
runtime exceptions.

Without error code, the service can only throw a limited number of
different exceptions over Binder. Furthermore the throw site stack
traces are always loss. Although for individual instances of a throw,
the error message can be inspected, aggregations of stack traces from
app crashes sanitize error messages and only leaves the stack traces.

This makes debugging dificult for some service calls such as
requestNetwork that can have a variety of failure modes.

In this patch only one failure mode is codified. More can be added later
at a light cost by: 1) defining an error code, 2) defining an
associated exception, 3) mapping the code to the exception. This patch
can serves as a template for doing so.

Test: $ runtest frameworks-net,
      #testNetworkRequestMaximum() detects the new exception type.
Bug:  36556809, 36701874
Change-Id: I611fd7915575c9e418f7149fcdc8a879d2a3716d
2017-05-11 14:15:15 +09:00
Lorenzo Colitti
f7ffa460e4 Move some NetworkStats tests to tests/net.
This groups them together with the rest of the networking unit
tests. It also speeds up compile/test cycles ("runtest -x" of one
file goes from 1m15s to 30s).

Bug: 33681750
Test: runtest frameworks-net passes on internal tree
Merged-In: I53cb0c51355fe4b4b30e451fa09fbbf58da39efd
Change-Id: I5ae5dbf74c94feb0fe3759681e5e6d6fba62fa32

(cherry picked from commit c86013be936f36c61fa0cdfad95141f6de3c6ef7)
2017-05-08 08:38:08 +00:00
Lorenzo Colitti
d388cbb9e4 Merge "Add a method to start the captive portal login app." into oc-dev
am: 5555b1e3d1

Change-Id: Ic7c14bd3dfd07f97c04901f043ed1cd3b1eee6e4
2017-05-02 04:44:31 +00:00
Lorenzo Colitti
500dbae1b5 Add a method to start the captive portal login app.
Bug: 36203355
Bug: 36656914
Test: ConnectivityServiceTest (including new test) passes
Change-Id: I82a9a9a8da47870ba3f1bbef5941b37e970c844f
2017-05-01 16:01:15 +09:00
Lorenzo Colitti
a75dc7e122 Merge "Address ConnectivityManager API comments." into oc-dev
am: 2121eeec48

Change-Id: I7024b4fe23ab12760fb452a59929df886912b104
2017-04-28 04:04:21 +00:00
Lorenzo Colitti
139a48c83c Address ConnectivityManager API comments.
Bug: 36370941
Test: marlin builds and boots
Change-Id: I693ee5270bf186c88c7c5056293519f7237504ff
2017-04-28 00:58:00 +09:00
Hugo Benichi
8e8532c8f3 NetworkCapabilities: remove duplicated TRANSPORT_NAMES
Due to multi-branch automerging issue, TRANSPORT_NAMES got inserted
twice into NetworkCapabilities both by commits 45670bb37d and
21665ac809. This patch deletes one of the copy.

Test: no functionality change. Build is fixed.
Change-Id: I2adec1a9cb1ee6f1d61dfeec2d0b92b8141eed88
2017-04-25 16:31:06 +09:00
Jeff Sharkey
1ee1487e29 Merge "Even more auto-doc work." into oc-dev
am: 880f4f4cc2

Change-Id: I78199f8366fbda65a4b4917675291d946e29285c
2017-04-24 21:38:03 +00:00
Jeff Sharkey
656584aa8d Even more auto-doc work.
Update docs based on what new lint detector found.  Add new @IntDef
to parameters or methods returning constants or flags, and add
@RequiresPermission to methods mentioning permissions.

Test: make -j32 offline-sdk-docs
Bug: 37526420
Change-Id: I7f640f7883fcb66b911a52ae93b83f77306571ec
2017-04-24 13:20:46 -06:00
Hugo Benichi
b22a842978 Merge "Add BitUtils bit packing methods (Connectivity metrics: add transports pretty printing)" am: 10b5024d5e am: 23d41ee68e
am: 876ebaa8e1

Change-Id: I0dfcea2b92287115c385f1b7678034f643d5daba
2017-04-24 19:06:20 +00:00
Hugo Benichi
21665ac809 Add BitUtils bit packing methods (Connectivity metrics: add transports pretty printing)
This patch is a partial cherry-pick from commit
cf83a3f4da for the BitUtils and
NetworkCapabilities classes.

Bug: 34901696
Test: none

(cherry picked from commit cf83a3f4da)

Merged-In: Id04f9080e7f75608deeb49306aec34941e71794c
Change-Id: I64eae49f646365b7cd1683a689315fe03bf0bdd9
2017-04-22 09:58:42 +09:00
Treehugger Robot
a6a4f5589c Merge "Mark Restricted APN connections as restricted." 2017-04-21 23:12:52 +00:00