Commit graph android_packages_modules_Co.../framework-t
Message SHA1
Merge "Drop the redundant type and caller uid checks for TrafficStats" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-11-06 08:58:27 +00:00
6258c4482f
Drop the redundant type and caller uid checks for TrafficStats
This commit removes the redundant type and caller uid
checks in TrafficStats to address the review feedback at
aosp/3313055.

Test: TH
Bug: 343260158
Change-Id: I0ed6e850835136c9a324efd7271dd80a34160aa6

Junyu Lai   commited 2024-11-06 13:17:23 +08:00
739d200d35
Merge "Disable debug log by default" into main
Jaewan Kim   authored and   Gerrit Code Review   commited 2024-11-05 02:18:48 +00:00
555bbc4844
Merge "Add config for client-side traffic stats rate-limit cache." into main
Junyu Lai   authored and   Gerrit Code Review   commited 2024-10-31 07:22:36 +00:00
30ff675df5
Merge changes Ia7ea051f,I38bdfe00 into main
* changes:
  Fix system caller cannot query stats for other uids
  Use device config to enable/disable the rate-limit cache feature

Treehugger Robot   authored and   Gerrit Code Review   commited 2024-10-31 06:23:58 +00:00
05be25b8ba
Merge "Address review comments at aosp/3249945" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-10-31 06:23:56 +00:00
457b54a1ae
Add config for client-side traffic stats rate-limit cache.
This is a no-op change since the config is not used yet, and
the feature flag will be gradually rolled out instead of enabled
by default.
However, this change is necessary for follow-up changes to enable
toggling the feature and configuring its behavior through device
configuration flags.

This change includes:

 1. Disable the service-side cache flag if the client-side flag
    is enabled.
 2. Since the apps don't have enough permission to check the
    feature flag from DeviceConfig. Provides a binder interface
    for returning per-UID config,
    which only returns cache enabled if the SDK level is V+
    or the app's target SDK is V+.

Test: atest FrameworksNetTests:android.net.connectivity.android.net.TrafficStatsTest \
      FrameworksNetTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest \
      CtsNetTestCases:android.net.cts.NetworkStatsBinderTest \
      FrameworksNetIntegrationTests:com.android.server.net.integrationtests.NetworkStatsIntegrationTest
Bug: 343260158
Change-Id: Id9761e4aea65fabe6466c875b787e178317a1da2

Junyu Lai   commited 2024-10-30 23:02:59 +08:00
b9071f8512
Fix system caller cannot query stats for other uids
Follow-up from aosp/3249945. If the system caller queries stats
for other UIDs, the caller would get UNSUPPORTED.
This follows the official documentation, where the API would
not return stats for all other UIDs.

However, partners or other legacy callers might already depend
on this undocumented behavior. Changing this behavior might
damage existing apps.

Thus, this change reverts the behavior change introduced at
aosp/3249945 and allows a system caller to query stats for
other UIDs.

Test: atest ConnectivityCoverageTests:android.net.connectivity.android.net.TrafficStatsTest
Bug: 372851500
Change-Id: Ia7ea051f7b0b6349ffcb890c300362bbfbdee3dc

Junyu Lai   commited 2024-10-30 23:02:55 +08:00
e51bae6bdc
Address review comments at aosp/3249945
This change includes:
  1. Rename binder interfaces.
  2. Use a dedicated class to pass the result of
     get{Total|Iface|Uid}Stats, as it is 25% faster than passing
     a NetworkStats object through the binder interface.
  3. Remove the binder interface only used by the test.
  4. Remove NetworkStatsBinderTest on R and S, since the binder
     interface is removed, the mainlined service does not run on
     those versions and the chance of breaking these tests on
     R and S is low.
  5. Remove useless TODO comments.

Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest \
      CtsNetTestCases:android.net.cts.NetworkStatsBinderTest \
      FrameworksNetIntegrationTests:com.android.server.net.integrationtests.NetworkStatsIntegrationTest
Bug: 372851500
Bug: 343260158

Change-Id: Ibd79a17218f54f0117d8ef5d7b9ec6073356f923

Junyu Lai   commited 2024-10-28 10:59:35 +08:00
9fb574d0c3
Disable debug log by default
Prevent verbose log (15k logs in 3s) by default

Change-Id: I13fdd0ecfcff8f9f5de59ba91fd9f0b4abf02f7f

Jaewan Kim   commited 2024-10-24 06:39:48 +00:00
531a9f0a9b
[Thread] Mark ThreadConfiguration#isDhcpv6PdEnabled() as @hide
This CL marks ThreadConfiguration#isDhcpv6PdEnabled() as @hide because
there's no way yet to set it as enabled. When PD is implemented, we'll
expose this API as System API.

Bug: 342519412

Change-Id: I6b8f7b83bd01c0ba045c777e6f613bc4a74d9dfb

Handa Wang   commited 2024-10-22 07:33:00 +00:00
7616fdd777
[Thread] make ThreadNetworkController#setConfiguration a system API
This CL turns setConfiguration into a system API, including the
ThreadConfiguration#Builder
and the #setNat64Enabled method.

Bug: 368456504

Change-Id: I0ff2ed81271dcceea295d169a46a02f05aeda5d6

Handa Wang   commited 2024-10-10 05:36:11 +00:00
651bfdaaf7
[Thread][API] add API for ephemeral key.
This CL adds the API for starting/stopping the ephemeral key mode, and
subscribing to the ephemeral key state changes.

Ephemeral key mode is started with a limit amount of time to allow
Thread credential sharing.

Bug: 348323500
Test: atest CtsThreadNetworkTestCases
Change-Id: I540c88ec4668291358fbe87a678d8f9d31a67e54

Yang Sun   commited 2024-09-29 02:35:44 +00:00
b8aa8bb47f
Merge "No-op refactoring for TrafficStats APIs" into main
Yun-Chen Cheng   authored and   Gerrit Code Review   commited 2024-09-11 01:56:42 +00:00
05fb57ea97
No-op refactoring for TrafficStats APIs
Prepare for implementation of client side
TrafficStats rate limit cache.

1. Write Typeless versions of getIfaceStats,
getUidStats, getTotalStats in INetworkStatsService.aidl
that returns NetworkStats instead of Long.
This is needed because in follow-up changes,
the NetworkStats instead of indiviual numbers will
be stored as a cache entry

2. Move some utils from NetworkStatsService
to TrafficStats. This is needed because in the follow-up
changes, these utils would be both accessed by TrafficStats
and NetworkStatsService.

Test: CtsNetTestCases:android.net.cts.TrafficStatsTest
Test: CtsNetTestCases:android.net.cts.NetworkStatsBinderTest
Test: FrameworksNetIntegrationTests:com.android.server.net.\
		integrationtests.NetworkStatsIntegrationTest
Test: FrameworksNetTests:android.net.connectivity.com.android.\
		server.net.NetworkStatsServiceTest
Test: FrameworksNetTests:android.net.connectivity.\
		android.net.TrafficStatsTest
Test: ConnectivityCoverageTests:android.net.connectivity.\
	android.net.TrafficStatsTest
Bug: 343260158
Change-Id: Iace251e1495fd3b81e072526e92ca97cbc7246eb

Yun-Chen Cheng   commited 2024-09-10 14:36:25 +00:00
69b83606ca
Make java_sdk_library dependencies explicit
modules should specify the submodule of java_sdk_library that the module
actually depends on

Test: CI
Bug: 358613520
Change-Id: I0367068c901df98483f6cf95160d3e7801881b0a

Jihoon Kang   commited 2024-09-10 00:01:31 +00:00
8401b6a9f0
changes the API setChannelMaxPowers from hide API to system API
This CL changes the hiden API `setChannelMaxPowers` to system API
to allow the privilege app to set the max power of each Thread channel.

Bug: b/346686506
Test: atest CtsThreadNetworkTestCases
Change-Id: I1089a4a315971c3bca8ec688a02143ddec93d039

Zhanglong Xia   commited 2024-08-26 10:07:36 +08:00
5bbfd91b04
Use java_aconfig_library for nearby and thread flags
Connectivity repo now can use java_aconfig_library since this target is
available on all downstream branches.

Bug: 345121279
Test: TH
Change-Id: I6d267ddac89731a8efbef2ee98a3baa1df754ff5

Motomu Utsumi   commited 2024-08-16 16:59:08 +09:00
dbb82c0581
Use java_aconfig_library for android_core_networking flags
Connectivity repo now can use java_aconfig_library since this target is
available on all downstream branches.

This CL removes framework-connectivity-t-mdns-standalone-build-sources.
Files in this target use flags which won't be available in the
out-of-tree build but the next out-of-tree library import will not use
the classes in that filegroup anymore.
So the standalone build rule will still match the out-of-tree build.

Bug: 345121279
Test: TH
Change-Id: I2a9aa02bd0c9aa00d460f98cd51d5dec4098fb89

Motomu Utsumi   commited 2024-08-16 16:57:29 +09:00
2fc115491a
Support NetworkStats#addEntries API
Currently, NetworkStats#addEntry creates a new instance
containing the requested result instead of mutating the
original object. This creates a heavy memory footprint
when the caller invokes it in a loop because a new NetworkStats
instance is created whenever an addEntry is called.

This change introduces a new API that allows callers to
add a set of entries to a NetworkStats instance. This new
API will clone the instance only once, return the newly
created (and modified) instance, and ensure that the original
instance remains immutable.

Additionally, the change adopts config libraries for flagging
the API and corresponding CTS tests, since Android U-based
branches are no longer downstream of current development branches.

Test: atest FrameworksNetTests:android.net.connectivity.android.net.netstats.NetworkStatsApiTest
Test: atest CtsNetTestCases:NetworkStatsApiTest
Bug: 335680025
Fix: 357772271
API-Coverage-Bug: 357772271
Change-Id: I58513844e681c0621a6107ec4b198cd3957f289d

Junyu Lai   commited 2024-08-09 14:19:38 +08:00
d0e049455c
[Thread] Make ThreadConfiguraiton a system API
This CL adds 3 things as @SystemApi:
- The ThreadConfiguration class except the Builder nested class.
- The ThreadNetworkController#registerConfigurationCallback method.
- The ThreadNetworkController#unregisterConfigurationCallback method.

Bug: 342519412
Test: CtsThreadNetworkTestCases

Change-Id: I8d3e48b73d471af1515f251451a1259a4bde69af

Handa Wang   commited 2024-07-29 08:07:17 +00:00
5fc74b9fd8
[mdns] Update doc for NsdServiceInfo
This CL updates the javadoc for NsdServiceInfo to make it clearer that a client must contain all the desired address records for the hostname, and all the other registrations must not have any address records for the same hostname.

Bug: 344799768
Test: None

Change-Id: I8eea39adf870a75de23bcafaf8e13d78ee330da4

Handa Wang   commited 2024-06-24 06:27:21 +00:00
0f5ae1fd08
Baseline Lint FlaggedApi violations
The Lint FlaggedApi checks are currently configured as warnings. Add
existing violations to baselines files to prepare for turning the
FlaggedApi checks into errors.

Bug: 303434307
Test: treehugger
Flag: EXEMPT not possible to flag baseline changes
Merged-In: I990ce57cd5cdac44ee8b93565b45aa15790ad697
Change-Id: I990ce57cd5cdac44ee8b93565b45aa15790ad697

MÃ¥rten Kongstad   commited 2024-06-20 09:05:51 +02:00
4ece737f4f
[mdns] simplify the validation check
This CL simplifies the code for validating the service by reducing a
level of indention.

Bug: 342954618

Change-Id: I8a239c3ea39560e4c2bc3b42e5be0a757a737fdd

Handa Wang   commited 2024-05-28 10:58:23 +00:00
bbd732596e
Fix a Rare Race In Clearing ResourceId
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

Nathan Harold   commited 2024-05-06 22:27:19 +00:00
98b708d5a2
[mdns] add hidden API for public key
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

Handa Wang   commited 2024-04-24 07:02:42 +00:00
364aa570e2
Merge changes from topic "rate-limit-trafficstats" into main
* 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 Robot   authored and   Gerrit Code Review   commited 2024-04-11 07:26:14 +00:00
47c819640d
Merge "[mDNS] pretty print txt values in log" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-04-02 08:15:34 +00:00
777b9ba0ca
Rate-limit on TrafficStats#get*[Bytes|Packets] API calls
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

Junyu Lai   commited 2024-04-02 15:25:10 +08:00
3c9089c1d1
[mDNS] pretty print txt values in log
Without this commit, the Thread service logs look like:

```
03-27 14:50:07.033   739  1924 I NsdPublisher: Registering service. Listener ID: 1, serviceInfo: name: Android Thread Border Router #2CF8, type: _meshcop._udp, subtypes: , hostAddresses: , hostname: null, port: 49152, network: null, expirationTime: null, txtRecord: id=֞�"ҽD���.�j���nn=OpenThreadrv=1sb=������tv=1.3.0
03-27 14:50:07.033   739  1924 I NsdPublisher: vn=Android
                                                         xa=Q�;�P,�
                                                                   xp=ޭ��������

```

With this commit, the Thread service logs look like:

```
03-27 13:37:31.672   741  1925 I NsdPublisher: Registering service. Listener ID: 1, serviceInfo: name: Android Thread Border Router #7CE8, type: _meshcop._udp, subtypes: , hostAddresses: , hostname: null, port: 49152, network: null, expirationTime: null, txtRecord: {id=0x70A5AE087668D7522919F40D1684D182, mn=Thread Border Router, nn=OpenThread, rv=1, sb=0x00000021, tv=1.3.0, vn=Android, xa=0x06EC93E283A47CE8, xp=0xDEAD00BEEF00CAFE}
```

Bug: 329366417
Change-Id: I6b15e93ad117f4ebb5762df85e359a705bd65b7d

Kangping Dong   commited 2024-04-02 14:47:57 +08:00
aca202e4d9
Merge "Changes to support satellite stats appear as TYPE_MOBILE" into main
Nagendra Prasad Nagarle Basavaraju   authored and   Gerrit Code Review   commited 2024-04-01 14:33:37 +00:00
ad48c49ee0
Changes to support satellite stats appear as TYPE_MOBILE
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

Nagendra Prasad Nagarle Basavaraju   commited 2024-04-01 10:53:02 +00:00
756ca07f80
Improve documentation of addEthernetStateListener
The existing documentation was not clear at all about how this API
behaves.

Test: TH
Change-Id: I408f32c1e7b6c910aaaa197b6774865e79a03579

Patrick Rohr   commited 2024-03-21 11:26:07 -07:00
e762554170
follow up comments in custom TTL CLS (aosp/2870274 and aosp/2606573)
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

Kangping Dong   commited 2024-03-05 20:04:48 +08:00
c6622e02b7
Merge "Move VpnManagerServiceTest and VpnTest to frameworks" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2024-03-01 00:58:31 +00:00
0df28d82be
Move VpnManagerServiceTest and VpnTest to frameworks
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

Chiachang Wang   commited 2024-02-29 07:48:02 +00:00
a5d9875823
[mdns] add service-side impl for NSD service TTL support
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

Kangping Dong   commited 2024-02-28 21:42:37 +08:00
cd35018bc6
[mdns] add API for setting/getting TTL value
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

Kangping Dong   commited 2024-02-28 15:53:51 +08:00
2ffe82dab5
[Thread] add Thread aconfig_declaration to java_sdk_library
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

Kangping Dong   commited 2024-02-26 11:18:03 +08:00
8fb80dd075
Merge "Move Nearby flags to common and add specify it in java_sdk_library" into main
Yahav Nussbaum   authored and   Gerrit Code Review   commited 2024-02-22 12:37:57 +00:00
c92872e3d5
Move Nearby flags to common and add specify it in java_sdk_library
Bug: 324993608
Test: TH
Change-Id: I1dc79353e9bae3d977db88e572e871cd459fc7fc

Yahav Nussbaum   commited 2024-02-22 06:49:15 +00:00
259be7bd4e
Merge "IpSecTransformState: Rename API methods and improve docs" into main
Yan Yan   authored and   Gerrit Code Review   commited 2024-02-16 01:12:21 +00:00
69171c6ca5
IpSecTransformState: Rename API methods and improve docs
Rename API methods and update API docs as per API
council feedbacks

Bug: 316603231
Test: make update-api && make
Change-Id: Ibb1f58792d2e40ef1084c2b532e999a516a87b37

Yan Yan   commited 2024-02-15 20:17:30 +00:00
1db3feeed7
Merge changes I57b37ea7,I00772535 into main
* changes:
  Introduce Powered Off Finding API
  Add Powered Off Finding operations to NearbyService

Yahav Nussbaum   authored and   Gerrit Code Review   commited 2024-02-13 14:34:22 +00:00
c412fd3987
Introduce Powered Off Finding API
Bug: 307898240
Test: atest CtsNearbyFastPairTestCases
Test: atest NearbyIntegrationPrivilegedTests
Test: atest NearbyIntegrationUntrustedTests
Change-Id: I57b37ea796c0791d72fec931f731a0143e816dac

Yahav Nussbaum   commited 2024-02-13 09:23:00 +00:00
c712a571dc
Allow more characters in subtypes
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

Remi NGUYEN VAN   commited 2024-02-08 19:59:14 +09:00
629234ce68
Merge "Rename check*Permission* to has*Permission" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2024-02-02 07:07:31 +00:00
ef58a8a33a
Rename check*Permission* to has*Permission
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

Junyu Lai   commited 2024-02-01 15:24:35 +08:00
71b5153898
[DON'T BLOCK] Test ownership migration rules
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

Aditya Choudhary   commited 2024-01-31 12:34:50 +00:00
01b5ede2b2
Enrich javadoc for queryDetailsForUid
Test: TH
Fix: 299876562
Change-Id: I347a269889ea6cf39218b6322dcba92a14535e9c

Junyu Lai   commited 2024-01-30 11:25:59 +08:00
f3797e0c97