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
This patch disentangles the creation of NativeDaemonConnector from the
creation of NsdService by introducing a wrapper type DaemonConnection.
This allows to mock this dependency in unit tests.
Test: enhanced previously introduced new tests.
Bug: 37013369, 33298084
Change-Id: I894b7cddfc509f86d0134d214c88c063b81b5e0a
This patch extracts into BitUtils byte manipulation helper methods
and unsigned type manipulation helper methods from ApfFilter into
an independent and reusable structure.
Test: $ runtest frameworks-net
Change-Id: I0f33af10457a63dbde5983f14353a79b8cd877d9
If anything unrestricted is bundled in the whole thing has to be
unrestricted (we can't restrict based on destination or intent)
but the NOT_METERED flag wasn't taken into account.
This wasn't a problem before because telephony set that statically
and late, but a change caused it to be marked NOT_METERED earlier
which exposed this bug.
bug: 37208956
Merged-In: I7b7a1c38621ce0ecde8cf041e82b1ebb7a9c6f15
Test: new NetworkCapabilitiesTest. Fails without fix, works with.
Change-Id: I86c1b2854413a94662aa53e697d32380695ab9ac
Wifi Aware networks are per app - i.e. a requestor gets
a dedicated network. Change verifies that the only the
original requestor matches the created network (using UID).
Bug: 36053921
Test: Integration (sl4a) tests
Change-Id: I4ff3994731dd7ccb88e2bea333d1e6905b136f02
This prepares some refactoring and the addition of a timeout to
resolveService.
Test: new tests pass
Bug: 37013369, 33298084
Change-Id: Ie8277bd5983278507bfa70495b4ce7d13895b24b
This patch changes how callback unregistration works in order to be
consistent with undocumented use cases currently de-facto supported
by the API (although in a buggy way):
- callback recycling: releasing then reregistering a callback again.
- multiple request registrations with the same callback.
The second use case is not desirable but needs to be taken into account
for now for the purpose of correctly releasing NetworkRequests
registered in ConnectivityService.
In order to support request release in both use cases with minimal
amount of complexity for the time being the following changes are done:
- request to callback unmapping is done synchronously at callback
release time.
- all requests associated to a callback are unmapped at callback
release time.
This fixes the following issues:
- a callback stops being triggered as soon as it is released.
Otherwise when recycling the callback immediately, it is possible
the previous request associated with it triggers it, confusing the
app.
- when a callback is registered multiple times, the requests are not
leaked.
- when a callback is registered multiple times and then released, the
N-1 first registrations do not trigger the callback anymore.
In the future it would be desirable to enforce the intended 1:1 mapping
between callbacks and requests at registration time.
Bug: 35921499, 35955593, 20701525
Test: - added new tests in ConnectivityManagerTest to test releasing,
recycling, and a disabled test for no multiple regristration.
- new tests catch regression causing b/35921499, b/35955593.
Change-Id: Ia0917ac322fc049f76adb4743bc745989fed6d26
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).
Test: runtest frameworks-net passes on internal tree
Change-Id: I53cb0c51355fe4b4b30e451fa09fbbf58da39efd
This patch fixes mismatch between current proto compiler and what is
expected in several IP connectivity metrics unit tests.
Test: built, flashed, $ runtest frameworks-net
Bug: 37126521
Change-Id: I1476c923d61f748ecac1146423127f54ba117502