Commit graph android_packages_modules_Co.../core/java/android
Message SHA1
NsdManager: remove duplicated argument validation
This patch simplifies argument validation in NsdManager public api and
regroup duplicated validation into common methods.

This makes stack traces more actionable as now specific errors will
cause the api to throw exception from specific methods, whereas before
IllegalArgumentException would be thrown from inside the same api method
for different reasons.

This patch also includes a couple of other small cleanups.

Test: $ runtest -x frameworks/base/tests/net/../NsdManagerTest.java
Bug: 37013369

(cherry picked from commit f2c64f8725)

Change-Id: Icf047532aa551fbe0a70721cfb95507eaa84d51e

Hugo Benichi   commited 2017-08-03 14:19:43 +09:00
a7e08f91fd
Merge "Add dump info to IpSecService" am: ec5fc4872e am: 5512a43d3a
am: c628b22fe5

Change-Id: I1a5d4c424a3c9e1638d86d177cbf98f0d1bce05d

ludi   authored and   android-build-merger   commited 2017-07-25 03:26:23 +00:00
7777ca3556
Merge "Add dump info to IpSecService"
am: ec5fc4872e

Change-Id: Idd4c051e4536d32504718fdfd201c7effdeb62e3

ludi   authored and   android-build-merger   commited 2017-07-25 03:07:00 +00:00
5512a43d3a
Add dump info to IpSecService
Bug:38350824

Test: runtest frameworks-net

Change-Id: Ifa11d55e9d337016ad865baada627db3aa8c2db3

ludi   commited 2017-07-24 16:03:33 -07:00
89194d6e45
Merge "Add unit test for IpSecService" am: 9e3f886dca am: d1417e713e
am: 345db82674

Change-Id: Ia4d85bcf5c42774d7b48cb1cd648754b6dd16b69

Di Lu   authored and   android-build-merger   commited 2017-07-20 07:50:21 +00:00
664469e449
Merge "Add unit test for IpSecService"
am: 9e3f886dca

Change-Id: I16fb89239e641ac39a8a7adeafd72b7fe03935ed

Di Lu   authored and   android-build-merger   commited 2017-07-20 07:36:19 +00:00
d1417e713e
Add unit test for IpSecService
Test: runtest frameworks-net

Bug:38259578
Change-Id: I4a049d5fdec79e36692e3b12306bd0758c19ad75

ludi   authored and   Di Lu   commited 2017-07-20 04:26:24 +00:00
5e623eaa02
Merge "Annotate @SystemApi with required permissions." into oc-dev am: c1406978a4
am: a35e038274

Change-Id: Ib629e25dbf047c110feaf03e4ff744b5c6df9aeb

Jeff Sharkey   authored and   android-build-merger   commited 2017-06-06 15:48:24 +00:00
d07851a6aa
Merge "Annotate @SystemApi with required permissions." into oc-dev
am: c1406978a4

Change-Id: I305967cad945a807c3f8234efabaad0ef8b591d1

Jeff Sharkey   authored and   android-build-merger   commited 2017-06-05 22:28:21 +00:00
a35e038274
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

Jeff Sharkey   commited 2017-06-05 13:27:11 -06:00
0a47018b06
Merge "Add UDP Encap Socket Support to IpSecManager" am: 4f6ec3d11d am: c530c01744 am: 3c1484c715
am: f3355b6760

Change-Id: Iafed2773a6d32542b051d944341533b2190aa284

nharold   authored and   android-build-merger   commited 2017-06-03 00:15:53 +00:00
8ce316ca1f
Merge "Add UDP Encap Socket Support to IpSecManager" am: 4f6ec3d11d am: c530c01744
am: 3c1484c715

Change-Id: Idc082c1ab2aac63ad61e5fc74be7fa75cf6e686f

nharold   authored and   android-build-merger   commited 2017-06-03 00:04:41 +00:00
f3355b6760
Add UDP Encap Socket Support to IpSecManager
-Implement the UdpEncapsulationSocket
-Convert all ManagedResources to use resourceIds
-Rework ManagedResource to track resourceIds

Bug: 30984788
Test: cts - IpSecManagerTest#testUdpEncapsulation()

Change-Id: I7b1099c487051a8d951c1485791c4b6cef2deb1d

Nathan Harold   authored and   nharold   commited 2017-06-02 03:18:56 +00:00
8086539071
Merge "NsdServiceInfo: move test to tests/net" am: 48859e01d5 am: 1b0f4bf606 am: e8c2700519
am: 427d7699f8

Change-Id: I11af75ab8ebc4081cc90d29b83d8a1742f00a3ab

Hugo Benichi   authored and   android-build-merger   commited 2017-05-25 01:18:45 +00:00
c6a4fd70f2
Merge "NsdServiceInfo: move test to tests/net" am: 48859e01d5 am: 1b0f4bf606
am: e8c2700519

Change-Id: I44cae417fcddad72c13938b6fb751de6ed784046

Hugo Benichi   authored and   android-build-merger   commited 2017-05-25 01:12:51 +00:00
427d7699f8
NsdServiceInfo: move test to tests/net
This patch also
  - adds a license plate to NsdServiceInfoTest
  - fixes some formatting and style issues
      package name
      uses of canonical junit asserts
  - update NsdServiceInfoTest to not use the deprecated AndroidTestCase

Bug: 62044295
Bug: 32561414
Test: $ runtest frameworks-net passes
Change-Id: Ie5ebb00172aef4eec19e6ecd2b41c4467901b93d

Hugo Benichi   commited 2017-05-24 16:03:43 +09:00
298ac9487e
NsdService: test coverage for client requests.
Adding coverage for:
  - NsdManager client disconnection
  - in-flight request GC

Test: new test passes
Bug: 37013369, 33298084
Bug: 38503832

(cherry picked from commit 4dd4db7720)

Change-Id: I02aca772d88306acae09db739ced7a2b1119b72b

Hugo Benichi   commited 2017-05-23 12:53:55 +09:00
a086cac905
Be resilient to restoring unintelligible network templates
Some OEMs have introduced incompatible network bookkeeping.  We now
detect and ignore those network definitions at restore time.

In addition, we now

  * log when an undefined network match type is used to construct a
    NetworkTemplate instance, and
  * quietly refuse to match such a NetworkTemplate against any known
    network identifier, rather than crashing the inquiring app.

Bug 38151335
Test: manual

Change-Id: I565b6f6b87df1f13a8c0c01ae6049bda270b1e48

Christopher Tate   commited 2017-05-17 10:33:01 -07:00
bad59112f5
Merge changes I4872f8ba,I92039f29,Iaad13e13 am: 767ac317e2 am: 717238a614
am: 44e9b81c54

Change-Id: I9c38d1254f82b50f4d1e953e72bf15a46562d3b8

Hugo Benichi   authored and   android-build-merger   commited 2017-05-09 06:30:48 +00:00
3612be9d9b
NsdService: test coverage for client requests.
Adding coverage for:
  - NsdManager client disconnection
  - in-flight request GC

Test: new test passes
Bug: 37013369, 33298084
Change-Id: I92039f297cf99352bbf4196797933d89c0b819ff

Hugo Benichi   commited 2017-05-09 10:49:33 +09:00
4dd4db7720
NsdManager: remove duplicated argument validation
This patch simplifies argument validation in NsdManager public api and
regroup duplicated validation into common methods.

This makes stack traces more actionable as now specific errors will
cause the api to throw exception from specific methods, whereas before
IllegalArgumentException would be thrown from inside the same api method
for different reasons.

This patch also includes a couple of other small cleanups.

Test: $ runtest -x frameworks/base/tests/net/../NsdManagerTest.java
Bug: 37013369
Change-Id: Iaad13e13976e9bf8f508d7188f823f8184ac414b

Hugo Benichi   commited 2017-05-09 10:49:33 +09:00
f2c64f8725
Merge "NsdManager: add test coverage for discoverServices()" am: 3e21b1745c am: 60182dbe4e
am: 27b0eebb4d

Change-Id: I46acfd104ac3457126c3ccef5041788e4146321c

Hugo Benichi   authored and   android-build-merger   commited 2017-05-02 09:04:59 +00:00
c3ac39565c
Merge "NsdManager: unit test coverage for servive registration" am: b0e408450c am: bc57faa1ac
am: 9a3e69d9b6

Change-Id: Ideabb1c929ddd4307e66831cddb20e2feac2c6d9

Hugo Benichi   authored and   android-build-merger   commited 2017-05-02 06:49:52 +00:00
e890494b7c
NsdManager: add test coverage for discoverServices()
Test: added new tests
Bug: 37013369, 33298084
Change-Id: If6c1113ee1bd4690db90abd5a61c3e229c827aec

Hugo Benichi   commited 2017-05-02 15:26:33 +09:00
287730e764
NsdManager: unit test coverage for servive registration
This patch adds test coverage for NsdManager#registerService() and
NsdManager#unregisterService(). This test shows a potential defect in
the api: if unregisterService() fails, the associated listener is always
unregistered from NsdManager. If the service initially registered is
still registered, this potentially make it impossible to unregister.

Test: added new unit test
Bug: 37013369, 33298084
Change-Id: Ia089b6d2f2a349907a8b29d9a3acd7f59e177887

Hugo Benichi   commited 2017-05-02 13:31:24 +09:00
3ec710f6f0
Merge "Hide IpSecManager, IpSecTransform, and IpSecAlgorithm" am: 01e368f26d am: 939528045a
am: 52dab83f7a

Change-Id: I3bf240b35c3d509c4e016ffe20519c1bda5ab0b3

nharold   authored and   android-build-merger   commited 2017-04-26 17:38:58 +00:00
553641a85d
Hide IpSecManager, IpSecTransform, and IpSecAlgorithm
These classes, originally planned to be part of the
public API, are not ready for public consumption.
They are planned to be un-hidden in a future release.

Bug: 37681043
Test: make update-api and make
Change-Id: I8caccd3f8455341cb56a2256354eacbadedff047

Nathan Harold   authored and   nharold   commited 2017-04-26 06:50:54 +00:00
185f2ccd1c
Hide IpSecManager, IpSecTransform, and IpSecAlgorithm
These classes, originally planned to be part of the
public API, are not ready for public consumption.
They are planned to be un-hidden in a future release.

Bug: 37681043
Test: make update-api and make
Merged-In: I8caccd3f8455341cb56a2256354eacbadedff047
Change-Id: I8caccd3f8455341cb56a2256354eacbadedff047
(cherry picked from commit e38565fc74ee19e27175782be3cf2f0dffefd3a6)

Nathan Harold   commited 2017-04-25 16:53:50 -07:00
faf8a91917
Merge "NsdManager: add unit tests" am: dc54ad7fc3 am: 40ab8401b2
am: d2181235b9

Change-Id: I7a5202be0e6a6274f3bd11737f30fee0ef947235

Hugo Benichi   authored and   android-build-merger   commited 2017-04-22 00:57:48 +00:00
f77ee64951
NsdManager: add unit tests
This prepares some refactoring and the addition of a timeout to
resolveService.

Test: new tests pass
Bug: 37013369, 33298084
Change-Id: Ie8277bd5983278507bfa70495b4ce7d13895b24b

Hugo Benichi   commited 2017-04-21 05:16:37 +00:00
0b1540e40d
Merge changes Ic029cc9f,Id917f3a2 into oc-dev
* changes:
  NsdService: minor cleanups
  Nsdmanager/NsdService: add logging

Hugo Benichi   authored and   Android (Google) Code Review   commited 2017-04-20 04:27:50 +00:00
dea8edcbbb
Merge changes from topic 'ipsec-hide-overloads' am: fe358c6adf am: 8508bc52d2
am: 6eab2ee093

Change-Id: Iaa713ba4b20bab12331bd996288ed2440c349db2

nharold   authored and   android-build-merger   commited 2017-04-18 22:12:54 +00:00
078e0ad3cd
Consistenly Throw IOExceptions from IpSecManager am: a64b019f94 am: 5db180bbb7
am: 7883c5d460

Change-Id: I04198299d43da4c9c91f705acc5520f734ad9249

Nathan Harold   authored and   android-build-merger   commited 2017-04-18 22:11:18 +00:00
9255a43d49
Hide Socket+DatagramSocket IpSecTransform methods
These methods do not currently work for IPv4 sockets,
so they need to be hidden until the underlying kernel
code can be made to work properly in a dual-stack
environment.

Bug: 36073210
Test: compilation
Merged-In: Idce367f638a42da374a7f1dc5ebb8931c9555e06
Change-Id: Idce367f638a42da374a7f1dc5ebb8931c9555e06
(cherry picked from commit da18b028f85e9a2c969c636aea6abf7f4bac3922)

Nathan Harold   commited 2017-04-17 20:23:51 -07:00
238b78c2aa
Consistenly Throw IOExceptions from IpSecManager
Bug: 36073210
Test: api-update
Change-Id: Ia3825e85b09b6330f1326a26cf9e1cadf9dacf71
Merged-In: Ia3825e85b09b6330f1326a26cf9e1cadf9dacf71
(cherry picked from commit c2fd6cfdc9dce33d57a3c2780e0527dd4b1bfeb9)

Nathan Harold   commited 2017-04-17 20:23:34 -07:00
1bcfebf971
Hide Socket+DatagramSocket IpSecTransform methods
These methods do not currently work for IPv4 sockets,
so they need to be hidden until the underlying kernel
code can be made to work properly in a dual-stack
environment.

Bug: 36073210
Test: compilation
Change-Id: Idce367f638a42da374a7f1dc5ebb8931c9555e06

Nathan Harold   commited 2017-04-17 19:41:08 -07:00
4b909c85f6
Consistenly Throw IOExceptions from IpSecManager
Bug: 36073210
Test: api-update
Change-Id: Ia3825e85b09b6330f1326a26cf9e1cadf9dacf71

Nathan Harold   commited 2017-04-17 17:57:41 -07:00
a64b019f94
Nsdmanager/NsdService: add logging
This patch adds basic logging to NsdManager and NsdService, and improves
the facilities for pretty printing the event ids defined in NsdManager.

It also includes a few minor cleanups:
  - adding 'final' on effectively final instance variables of NsdManager
  and NsdService.
  - similarly, adding 'static' on effectively static class fields.
  - regrouping instance variables together.

Test: no functional changes
Bug: 33074219

(cherry picked from commit 2183ba9b5f8eb54c74cd198a7506b21319794e99)

Merged-In: I360d539e73cc8e4b45d4e0d20b2e345455fdb10c
Change-Id: Id917f3a2085d17f277850af36a2cf859e3614a0f

Hugo Benichi   commited 2017-04-17 10:07:05 +09:00
f56c5ebe81
Add FileDescriptor Versions of applyTransportModeTransform()
Because there is no way using the Java sockets API to actually
get a socket of AF_INET on mode machines, it is necessary to
provide a way to apply transforms to sockets made using the
native wrapper API, which uses POSIX APIs and will create a
socket that is AF_INET.

Bug: 36073210
Test: b/34811227
Change-Id: I28ac7cc4f36045ce523a54111e5be975b0331356

Nathan Harold   commited 2017-04-13 15:05:13 -07:00
04a11e02a9
IpSecManager and IpSecAlgorithm API Tweaks
-Add a reserveSecurityParamterIndex() function that allows the
 system to select an SPI.
-Disallow INVALID_SECURITY_PARAMETER_INDEX from being passed as
 an explicit SPI request.
-Remove the ALGO_ prefix from constants in IpSecAlgorithm

Bug: 36073210
Test: Updated CTS tests still pass on bullhead
Change-Id: Ic94809996076b0718f153f550b82192fe7048a2e

Nathan Harold   commited 2017-04-13 15:04:47 -07:00
0560678b89
Merge changes from topic 'ipsec-api-tweaks' am: fddf677b8b am: 176bfb58c6
am: a237a34085

Change-Id: Ie868985d20535f35b869730a4ddaa00dc88a352d

nharold   authored and   android-build-merger   commited 2017-04-12 20:53:17 +00:00
b011a456a4
IpSecManager and IpSecAlgorithm API Tweaks am: 0540679eb4 am: 9c2428ad4d
am: 99c50add4f

Change-Id: I49641308cd0f2ce3e8a7545c8b03108d69287c64

Nathan Harold   authored and   android-build-merger   commited 2017-04-12 20:51:41 +00:00
fbf807e60a
Add FileDescriptor Versions of applyTransportModeTransform()
Because there is no way using the Java sockets API to actually
get a socket of AF_INET on mode machines, it is necessary to
provide a way to apply transforms to sockets made using the
native wrapper API, which uses POSIX APIs and will create a
socket that is AF_INET.

Bug: 36073210
Test: b/34811227
Change-Id: I28ac7cc4f36045ce523a54111e5be975b0331356

Nathan Harold   commited 2017-04-11 10:14:11 -07:00
0072e19c8e
IpSecManager and IpSecAlgorithm API Tweaks
-Add a reserveSecurityParamterIndex() function that allows the
 system to select an SPI.
-Disallow INVALID_SECURITY_PARAMETER_INDEX from being passed as
 an explicit SPI request.
-Remove the ALGO_ prefix from constants in IpSecAlgorithm

Bug: 36073210
Test: Updated CTS tests still pass on bullhead
Change-Id: Ic94809996076b0718f153f550b82192fe7048a2e

Nathan Harold   commited 2017-04-11 10:14:10 -07:00
0540679eb4
Merge changes I9ad4ce81,I360d539e am: f34d09ac30 am: 4062ac81be
am: 84c878ecc8

Change-Id: Ieeb3222246c63292a75ad91e9c867eaedcad8f90

Hugo Benichi   authored and   android-build-merger   commited 2017-04-06 02:13:07 +00:00
a4a9125349
Add Initial IPsec APIs to IpSecService
-Plumb IpSecManager APIs to NetD
-Add Resource Management to IpSecService

Bug: 30984788
Test: b/34812052, b/34811227
Change-Id: Ic43965c6158f28cac53810adbf5cf50d2c54f920
(cherry picked from commit 93962f34ce21f5aac825afbcebf2f3e8c7a30910)

Nathan Harold   commited 2017-04-05 10:24:45 -07:00
2af3baeddc
IpSecManager and IpSecTransform API Cleanup
-Remove Int-based SPI usage from the IpSecTransform.Builder
 This is essentially a less-safe method overload, and it is both
 unnecessary and difficult to implement: the cross-validation
 between SPI and Transform is actually useful, and the kernel
 requires two different mechanisms to use an unreserved vs a
 reserved (alloc'd) SPI: CREATESA vs UPDATESA, which makes this
 hard to support. API Council has questioned the value of this,
 and they are right: everything points to "remove this". In the
 future, if we find that SPI reservation is overhead, we can
 always add it back.

-Hiding the TunnelMode builder method and application/remove
 methods. These will not land by the time the next API
 stabilizes, so better to hide them now that this is a
 near-certainty. Expectation is to un-hide them in the subsequent
 API bump.

Bug: 36073210
Test: Compilation, verified nobody is calling these stubs
Change-Id: Ic1a3f2cf7128633318ac175d6b56b45eb8d21cab
(cherry picked from commit 48b566557d5a66d4476008b3c59b815eb78cb373)

Nathan Harold   commited 2017-04-05 10:24:23 -07:00
4ee4a82e7d
Change reserveSecurityParameterIndex() to take a remoteAddress
To make the SPI reservation more semantically consistent with the
transform creation API, and to ensure that we always create SPI
reservations relative to a well-known remote, we should take the
SPI request relative to a remote (rather than to a destination).
This necessitates that we now consider direction separately, which
is used for keying the SA-Id.

Bug: 36073210
Test: compilation
Change-Id: I81e955c20128c1f8e04fd68eb26669561f827a78
(cherry picked from commit 909d66e80a)

Nathan Harold   commited 2017-04-05 10:24:03 -07:00
b9feffd1dd
Add a Skeleton IpSecService
-Add IpSecService with the necessary glue to connect to netd
-Add code to retrieve IpSecService from System Server

Bug: 30984788
Test: b/34812052, b/34811227
Change-Id: I4cdcb643421141202f77a0e2f87a37012de0cd92
(cherry picked from commit 28084d89ec136b56f5012be33a0dea147962f9f6)

Nathan Harold   commited 2017-04-05 10:23:27 -07:00
8ea66052f2
Nsdmanager/NsdService: add logging
This patch adds basic logging to NsdManager and NsdService, and improves
the facilities for pretty printing the event ids defined in NsdManager.

It also includes a few minor cleanups:
  - adding 'final' on effectively final instance variables of NsdManager
  and NsdService.
  - similarly, adding 'static' on effectively static class fields.
  - regrouping instance variables together.

Test: no functional changes
Bug: 33074219
Change-Id: I360d539e73cc8e4b45d4e0d20b2e345455fdb10c

Hugo Benichi   commited 2017-04-05 15:05:44 +09:00
32be63d083