If the IpSecTransform is being manipulated in
multiple threads, there is a race between the
clearing of the resource id (setting it to
INVALID_RESOURCE_ID and making binder calls
with it. This wasn't a significant problem before
becasue the only side effect was that it could
occasionally cause an IAE instead of an ISE when
the caller was doing something weird. Unfortunately
the exception type now matters because it is being
relied upon to provide a callback rather than a
throw in the event of an error. Accordingly reads of
mResourceId have to be synchronized against the
the possibility of close() of that resourceId to
ensure that the right exception is thrown on the
service side of the binder.
Bug: 336897538
Test: atest CtsNetTestCases:IpSecManagerTest
Change-Id: I21c893034efa7f322ae2aa81d6c7e00dc9ef8d2f
This commit adds support of registering a public key for a host/service.
This is required to enable Advertising Proxy feature for Thread devices.
For example:
```
NsdServiceInfo info = new NsdServiceInfo();
info.setServiceName("My Service");
info.setServiceType("_test._tcp");
info.setHostname("MyHost");
info.setHostAddresses(List.of(address1, address2));
info.setPublicKey(/* KEY RDATA */);
nsdManager.registerService(info, PROTOCOL_DNS_SD, listener);
```
Bug: 317946010
Change-Id: I367ebff8119d5c1dff0410c85e6fb86dca6c66b8
* changes:
Make cache duration and max entries configurable
Create TestRule: SetFeatureFlagsRule
Rate-limit on TrafficStats#get*[Bytes|Packets] API calls
Clear TrafficStats cache before getting readings from TrafficStats
Treehugger Robotauthored and Gerrit Code Reviewcommited 2024-04-11 07:26:14 +00:00
This change put a rate-limit on TrafficStats getter APIs to
reduce the need of accessing bpf map. For any caller who calls
this method within 1 second, a stale result will be returned.
One expected outcome is this change would break any test which
relies on immediate change of the result of TrafficStats after
making network traffic. Thus, related tests are fixed in the
counter part CL accordingly.
Test: atest CtsNetTestCases:android.net.cts.TrafficStatsTest --rerun-until-failure 100
Test: atest CtsNetTestCases:android.net.cts.NetworkStatsManagerTest
Test: atest NetworkStackIntegrationTests:android.net.NetworkStatsIntegrationTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest
Bug: N/A
Change-Id: Ibd6ae92d7c806481bb8a5124dd231f8f5aa206f2
With satellite transport supported at device and satellite
network to appear under type mobile, considers cellular or
satellite, or combination of both interfaces under mobile interfaces.
Note: getUidStatsForTransport(TRANSPORT_SATELLITE) is not supported,
considering the same interface name could be used by cellular as well,
supporting this might lead to double counting problem.
Bug: 329003473
Test: atest FrameworksNetTests
Change-Id: I85465cedcc5550fa0555dc36b3be364ac90aade1
Summary of major changes in this CL:
1. update javadoc in AdvertisingRequest to start with one line
2. update ttl API document to ve clearer that values smaller than 1
second is discarded
3. Remove redundant constructors of MdnsServiceInfo
4. add tests for MdnsRecordRepository to verify that addService works
with non-null TTL
Other comments needs more consideration and relatively larger change, so
tracked in separated child issue of b/327619631
Bug: 327619631
Change-Id: I040b8451337d88d96da7120455c228cef204f768
These unit tests are closely tied to the source code in
frameworks/base and were incorrectly placed in the connectivity
module. Also update the libraries visibility that are used by
the tests.
Test: atest FrameworksNetTests
Change-Id: I196c33a8bd5b5cdb9d42aea381e900681ff6d25e
This is the service-side implementation of the custom service TTL
support added in aosp/2606573.
Bug: 284903641
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: I35246dae37b9fd1710b99cdda10068928e418457
To support Thread Border Router use case, an Android device needs to act
as a mDNS service discovery (RFC 8766) & advertising proxy (
https://datatracker.ietf.org/doc/draft-ietf-dnssd-advertising-proxy).
This means it needs to advertise and discover DNS-SD services of custom
TTL value on behalf of other devices.
This commit fulfills this requirement by adding TTL getter/setter to
NsdServiceInfo. When registering a service, the specified TTL will be
used for corresponding resource records.
Bug: 284903641
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: I23837834847dc3a0fb452c5929a1b36e3fc1fb3f
This commit also moves Thread flags to Connectivity/common to ease
maintenance.
Test: m framework-connectivity-t
Bug: 317290555
Merged-In: I50f3d3b8205a5a9ee8154a649318a2c175edbb71
Merged-In: I8a71f4ee49cc68a9512f432e454469200f2a5058
Change-Id: I8a71f4ee49cc68a9512f432e454469200f2a5058
Rename API methods and update API docs as per API
council feedbacks
Bug: 316603231
Test: make update-api && make
Change-Id: Ibb1f58792d2e40ef1084c2b532e999a516a87b37
Allow all printable ASCII characters in subtypes, instead of only the
set of characters allowed in service types.
This is still more restrictive than what the spec allows, but allowing
random bytes would be harder to manage (especially when displaying the
subtypes in logs for example) and there is no known use-case for it.
Having the NsdManager API impose more restrictions is probably also best
for apps to minimize interoperability problems.
Bug: 324377460
Test: atest
Change-Id: Id75879a1c3ea6af8d7995b0e8e0dcc06e7160a0a
The check*Permission methods are a bit error-prone because people
can forget to check the return value and expect that they behave
like the enforce* methods. This was pointed out before in some bugs.
This change adds @CheckResult annotation to enforce linter warning
and rename methods accordingly.
Test: TH
Fix: 279691948
Change-Id: Ibb0df6540fe0ed40289bb190b790130daaa2f763
This CL is created as a best effort to migrate test targets
to the new android ownership model. If you find incorrect or unnecessary
attribution in this CL, please create a separate CL to fix that.
For more details please refer to the link below,
<add g3 doc link>
Bug: 304529413
Test: N/A
Change-Id: I243f17b3f0ad7af9ffa15ca242456e36688733f5
Merged-In: I243f17b3f0ad7af9ffa15ca242456e36688733f5
This commit adds support of regsitering a service with a custom
hostname. This is required to enable Advertising Proxy feature for Thread
devices.
For example:
```
NsdServiceInfo info = new NsdServiceInfo();
info.setServiceName("My Service");
info.setServiceType("_test._tcp");
info.setHostname("MyHost");
info.setHostAddresses(List.of(address1, address2));
nsdManager.registerService(info, PROTOCOL_DNS_SD, listener);
```
This CL also adds two new error codes for service/host registration
conflict: `FAILURE_SERVICE_NAME_CONFLICT` and
`FAILURE_HOST_NAME_CONFLICT`.
Bug: 284904661
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: I2fb974c38d851ba99144a18c7047084bbd61b938
setEnabled API is added to ThreadNetworkController, this
can be used by applications with privileged permission to set
Thread to enable/disabled state.
The Thread enabled state can be subscribed with
ThreadNetworkController#registerStateCallback.
When Thread is disabled, the join/scheduleMigration APIs will
fail with ERROR_THREAD_DISABLED.
When Thread is disabling, all commands will fail with ERROR_BUSY.
Bug: 299243765
Test: atest CtsThreadNetworkTestCases:android.net.thread.cts.ThreadNetworkControllerTest
Change-Id: Ifa7845bf1d5664ecd31ce74e24b3a839f92bba13
This commit adds support of discovering services with explicit subtype.
With this change, a service can be discovered with subtype with:
```
nsdManager.discoverServices(
new DiscoveryRequest.Builder("_http._tcp", PROTOCOL_DNS_SD)
.setSubtype("_printer").build(),
executor, listener);
```
Bug: 265095929
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: Iba76283a003cf2d52a8c26e1de872c3e8e433350
java_sdk_library modules should specify the aconfig_declarations modules
in order to generate the exportable stubs (i.e. the stubs that exclude
the disabled aconfig flags) by providing the information about the
aconfig flag values.
The exportable stubs will be used when generating the module sdk
snapshots and to generate the hiddenapi flags, in order to prevent
exposing the disabled apis in runtime.
Test: m framework-connectivity-t
Bug: 317290555
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:60b21f877f88a6848ee6d0f0e5316362714b9d25)
Merged-In: Ieb8f41921054ed6f62db2edfc7d695ba0a2a0055
Change-Id: Ieb8f41921054ed6f62db2edfc7d695ba0a2a0055
Jihoon Kangauthored and Android Build Cherrypicker Workercommited 2024-01-25 02:17:28 +00:00
Some callers of openSessionInternal could have null package name.
Update nullability annotations accordingly.
Test: TH
Bug: N/A
Change-Id: Ifafafcd64612c99e5174364a010ec95415702b0d
This is per the go/android-api-guidelines#return-error:
```
Make sure your chosen error handling option gives you the
flexibility to introduce new error types in the future. For
@IntDef, that means including an OTHER or UNKNOWN value - when
returning a new code, you can check the caller's targetSdkVersion
to avoid returning an error code the application doesn't know
about. For exceptions, have a common superclass that your
exceptions implement, so that any code that handles that type will
also catch and handle subtypes.
```
Bug: 320403080
Change-Id: I2ee663b75107dac6d84fa697f449fa0424128fde
NsdService switched from Netd native solution to Java solution on
Android U. MDNS service provided by Netd will be removed from Android V.
1. Stop registering native mdns service from V.
2. Stop startDaemon() in NsdManager from V.
3. As a double safety, return early in NsdService methods that call the
native mdns service when platform version is V+.
4. Modify NsdManagerTest to cover V+ behavior.
Bug: 298594687
Test: Build. Presubmit.
Change-Id: Ifdac8f7a44aa57d93d453ba482ec473a2b531452
FastDataInput for reading persistent data is currently disabled
by default. This functionality will be gradually enabled through
A/B experiments to assess its impact.
One-shot boot time increase up to 10 second is one expected
outcome in worst case. Currently, the persistent data was loaded
when the first caller query it, but in this change it will be
done twice in the boot stage due to the needs of doing comparison.
Test: adb shell dumpsys netstats
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest
Test: manual test against data points under benchmark/assets/dataset
Bug: 313841499
Change-Id: Ia927bd115de5453ca3ee22104f3efbf44a55c2b8
This implements a basic border routing test case (ping) and demonstrates a
valid test environment for Thread Border Router test cases.
Later we can add more packet verifications and more test cases.
Bug: 295843010
Test: atest android.net.ThreadBorderRouterTest
Change-Id: Ifb9b6d45539143a227c2bc0ed69b5c3167ef9acd
This commit builds upon CL aosp/2817455 by adding a new NsdManager API to
update registered services directly, eliminating the need for exit and
re-announcement messages. This preserves compatibility with existing
apps without requiring an API bump. If an app registers a service with
the same listener and NsdServiceInfo, it's treated as an update request.
Bug: 309372239
Test: TH
Change-Id: Ib84ddf0d92e757eaef225f3e32f5223bc50c8fd6
Yuyang Huangauthored and Remi NGUYEN VANcommited 2023-12-26 13:09:00 +09:00
This increased reading performance by 35% while running
benchmark tests. But the feature is not enabled in the production
code until the service turns it on.
Test: atest ConnectivityBenchmarkTests
Test: atest ConnectivityCoverageTests:android.net.connectivity.android.net.NetworkStatsCollectionTest
Bug: 313841499
Change-Id: Ic827e6c4848cc31d46d62aa93993b483114a1f12
This is the servide-side impl of the subtypes advertising added in
aosp/2608627. See that CL for more backgrounds.
Bug: 265095929
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: I3d6f96822ac89d12fe29c00f688d848297c25787
This commit adds support of advertising and discovering services
with subtypes.
With this change, client can publish a new service with subtypes with
code:
```
NsdServiceInfo info = new NsdServiceInfo();
info.setServiceName("My Service");
info.setServiceType("_meshcop._udp");
info.setSubtypes(Set.of("_abc"));
nsdManager.registerService(info, PROTOCOL_DNS_SD, listener);
```
Bug: 265095929
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: Ia83182e2d43002243d1ef4357d14a8056d7da14b