Commit graph android_packages_modules_Co.../tests/unit/java
Message SHA1
Merge "Rename BpfNetMapsReader to NetworkStackBpfNetMaps" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-03-19 04:13:17 +00:00
7bfcd30e89
Rename BpfNetMapsReader to NetworkStackBpfNetMaps
BpfNetMapsReader is loaded to bootclasspath. So this class should not
contain unnecessary codes.
To make this clear, this CL renames to NetowrkStackBpfNetMaps and add
comments

Bug: 328732146
Test: TH
Change-Id: I557627c9fae087eb6119c2ae31d46526fa9e5d7e

Motomu Utsumi   commited 2024-03-19 04:12:29 +00:00
fc504042f6
Merge "Remove VpnProfileStore dependency from CSTest" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2024-03-19 01:21:10 +00:00
d02c00867e
Remove VpnProfileStore dependency from CSTest
The last dependency in the vpn-jarjar-rules can be removed
after refactoring the test as the test does not really
rely on the content of VpnProfileStore.

Test: atest FrameworksNetTests
Change-Id: Ib665dd7c05cca1eae77bf4100c43911686aac0ea

Chiachang Wang   commited 2024-03-18 11:40:58 +00:00
3f87ba4def
Drop packets to VPN address ingressing via non-VPN interface
When there are addresses that are used by a single VPN interface,
ConnectivityService sets ingress discard rules to drop packets to this
address from the non-Vpn interfaces

Test: FrameworksNetTests
Bug: 295800201
Change-Id: I089d01a38eff3f37a851627fa9e4acefb8d9ad5e

Motomu Utsumi   commited 2024-03-15 15:23:50 +09:00
b4772b1e5d
Merge "Make the subscriptionIds and allowedUids public" into main
Ying Xu   authored and   Gerrit Code Review   commited 2024-03-14 14:33:38 +00:00
a37386a6b6
Merge "Mock SubscriptionManager in CSTest" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-03-14 08:44:33 +00:00
bac8aab474
Mock SubscriptionManager in CSTest
KeepaliveStatsTracker calls addOnSubscriptionsChangedListener from the
constructor.
And KeepaliveStatsTracker is instantiated from ConnectivityService
constructor.
So using actual SubscriptionManager leaked listener and tests started
failing.

Bug: 329365833
Test: atest ConnectivityCoverageTests
Change-Id: I65ac34e4bc6b5fd86a290706be844914d09918a5

Motomu Utsumi   commited 2024-03-14 16:23:43 +09:00
23d9c73511
Merge "Ignore no permission calls for CaptivePortal.appRequest" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2024-03-14 06:48:06 +00:00
4cd5b9e2d2
Merge "Share NetworkInterfaceProvider between MdnsSockets" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-03-14 05:36:30 +00:00
df0a16ccf4
Merge "Use LruCache to limit the amount of entries" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-03-14 05:03:11 +00:00
f07efd7832
Ignore no permission calls for CaptivePortal.appRequest
This enforceNetworkStackPermission() should be adopted to check
the required permission but this may be break OEM captive portal
apps. Simply ignore the request if the caller does not have
permission.

This commit also fixes the format issues that is auto-fixed by
ktlint.

Fix: 329385091
Test: ates FrameworksNetTests
Change-Id: Ia973a1078eda3134fc8ff261d3954cd050767880

Chiachang Wang   commited 2024-03-14 04:32:11 +00:00
73be9a0933
Share NetworkInterfaceProvider between MdnsSockets
Instead of creating one NetworkInterfaceProvider for each MdnsSocket,
create one in MdnsSocketClient and use it for each MdnsSocket.

MdnsSocket only calls getMulticastNetworkInterfaces and
getAvailableNetwork on MulticastNetworkInterfaceProvider, which are
thread-safe (the first one is synchronized). There is no need to have
multiple MulticastNetworkInterfaceProvider tracking the same state.

This allows reducing the number of callbacks filed to
ConnectivityManager, which is a resource usage improvement and can be
beneficial for huge apps that have many components which may
collectively reach the MAX_NETWORK_REQUESTS_PER_UID limit in
ConnectivityService (100).

MdnsSocketClient is unused in AOSP so this is a no-op in the platform.
It is only used by users of the unbundled mdns library.

Bug: 322049918
Test: atest
Change-Id: I515459beaee6aacc99c7c0c2a05c3c9c41473b62

Remi NGUYEN VAN   commited 2024-03-14 13:21:43 +09:00
0a9dbc9d12
Merge "[mdns] fix race conditions in MdnsAdvertiser" into main
Kangping Dong   authored and   Gerrit Code Review   commited 2024-03-13 12:41:56 +00:00
51648211ee
Use LruCache to limit the amount of entries
This change also implement a getOrCompute method, if the entry
is not found in the cache or has expired, computes it using the
provided supplier and stores the result in the cache.

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.TrafficStatsRateLimitCacheTest
Bug: N/A
Change-Id: I60f07e84b7d2c754548b7cd431bd079b0d808c0a

Junyu Lai   commited 2024-03-13 18:13:46 +08:00
2ed701f162
[mdns] fix race conditions in MdnsAdvertiser
There is a race condition in MdnsAdvertiser when removing the last
service:
1. When the last service is removed, it will call the destroyNow()
   to tear down the interface advertiser and schedule a onDestroyed()
   callback for MdnsAdvetiser to do further cleanup
2. If another serivce is registered after removing the last service but
   before onDestroyed() is invoked, then onAdvertiserDestroyed() will
   return false and the InterfaceAdvertiserRequest is kept in the map in
   MdnsAdvertiser. This is because the newly registered service is in
   the mPendingRestionstrations.
3. The problem is that InterfaceAdvertiserRequest now have no
   InterfaceAdvertiser (because the only advertiser has already
   destroyed) and cause the newly registered service can't be
   advertised.

It needs to schedule onDestroyed() on the handler thread because we
can't do modify-during-iteration, but this introduces the race condition
here.

The fix in this commit changes to not destroy the InterfaceAdvertiser
immediately when the last service is removed but destroy when there are
no pending registrations in the InterfaceAdvertiserRequest.

Test: atest --iterations 100 CtsNetTestCases:android.net.cts.NsdManagerTest#testRegisterService_registerImmediatelyAfterUnregister_serviceFound
Change-Id: I6b6f01e6ddf103d16a8b0296af000dc8262ea65b

Kangping Dong   commited 2024-03-13 17:28:35 +08:00
36f8b3f6ad
Merge "Add CompatChange for local network matching" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-03-13 02:34:57 +00:00
d2c103ea14
Merge "Fix wrong request_count in connectivityStateSample and add tests" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-03-12 13:38:22 +00:00
94a79994cd
Fix wrong request_count in connectivityStateSample and add tests
This CL updates CSTest to use mocked appOpsManager to bypass
checkPackage enforcement so that test can file network request as
SYSTEM_UID

Bug: 314627716
Test: atest ConnectivitySampleMetricsTest
Change-Id: I0a5f3b1bf2c343644e6f5e2a4ec1b0460e2645c4

Motomu Utsumi   commited 2024-03-12 19:07:08 +09:00
e08de4d322
Merge "follow up comments in custom TTL CLS (aosp/2870274 and aosp/2606573)" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-03-11 11:18:27 +00:00
96f6a077e6
Merge "Use Service handler thread for NetworkStatsObservers" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2024-03-08 07:41:08 +00:00
1ffd5dcbc1
Merge "Merge Android 14 QPR2 to AOSP main" into main
Xin Li   authored and   Gerrit Code Review   commited 2024-03-07 06:41:03 +00:00
612de50da2
Use Service handler thread for NetworkStatsObservers
This change includes:
  1. Use service handler looper when initializing the observers
     to simplify the structure.
  2. Make the handler variable final in the observers class.
  3. Remove misleading comments, where the callback events
     are actually dispatched on the oneway binder thread,
     which does not block handler thread.
  4. Update tests accordingly.

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest
Test: atest FrameworksNetIntegrationTests:com.android.server.net.integrationtests.NetworkStatsIntegrationTest
Test: atest CtsNetTestCases:NetworkStatsManagerTest
Bug: N/A
Change-Id: I5be92853b5bbc795a36bf774956bdac33d79099b

Junyu Lai   commited 2024-03-06 18:09:03 +08:00
8b1d824ad2
Revert "Log bpf rc file if it differs from the template files."
This reverts commit 41557553f6.

(this is no longer needed, as it rolled out with January module,
while the May module this is targetting already includes an rc,
thus eliminating the need for this warning)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I90c8abad2f70d65d142f55c18ad2f34018da6615

Maciej Å»enczykowski   commited 2024-03-05 19:49:20 -08:00
cf3d20011c
Merge "Move platform VPN related test to FrameworksVpnTests" into main am: e190bf783d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2984200

Change-Id: I359387a0d92869b37733b97ad908dcd88c402823
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Chiachang Wang   authored and   Automerger Merge Worker   commited 2024-03-06 00:50:38 +00:00
d803048da2
Merge "Move platform VPN related test to FrameworksVpnTests" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2024-03-06 00:41:19 +00:00
e190bf783d
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
Make the subscriptionIds and allowedUids public
This CL allows everyone to see the subscriptionIds and the network owner
to see the allowedUids from the NetworkCapabilities.

Bug: 324357121
Test: atest ConnectivityManagerTest
      atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest
Change-Id: I91e360827d2a9a64625f1d6ae0f808aa327c7d22

Ying Xu   commited 2024-03-04 14:51:20 -08:00
611b80456a
Add CompatChange for local network matching
Apps that target an SDK before V will not see networks with
NET_CAPABILITY_LOCAL_NETWORK unless they explicitly set this capability
in their network requests.

Bug: 319212206
Test: CSLocalAgentTests
Change-Id: I414b03dfea9a8aac83304c6be501f03d637739b4

Motomu Utsumi   commited 2024-03-04 17:50:27 +09:00
ad480e0c58
Merge "Update the imports to androidx.test.filters.*" into main am: 64a8fa9d13
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2983295

Change-Id: I7d523f2e4ab8303725df05c33d66049e0824facc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Ram Peri   authored and   Automerger Merge Worker   commited 2024-03-01 17:22:19 +00:00
7e6d34064a
Merge "Update the imports to androidx.test.filters.*" into main
Ram Peri   authored and   Gerrit Code Review   commited 2024-03-01 16:38:04 +00:00
64a8fa9d13
Move platform VPN related test to FrameworksVpnTests
These VPN related tests are considered as non-connectivity-module
tests as the corresponding sources are inside the platform
code instead of module. From architecture point of view, these
test would be better to place together with their sources in the
same git so that the tests do not need to restrictions(e.g. SDK
check) to fit into the module tests.

Test: atest FrameworksNetTests FrameworksVpnTests
Change-Id: I10e00c2b52262f23aa8ca38e545196bf93612e51

Chiachang Wang   commited 2024-03-01 07:03:14 +00:00
4529ba8255
Merge "Move VpnManagerServiceTest and VpnTest to frameworks" into main am: 0df28d82be
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2981695

Change-Id: I467c5567f18762ef0cdbceb89e725e5c34dbb2c2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Chiachang Wang   authored and   Automerger Merge Worker   commited 2024-03-01 01:40:56 +00:00
04e109be0d
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
Merge changes from topic "mdns-ttl" into main am: 0520e26936
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2870274

Change-Id: I9cda2e567946000894917e5cf5b451da24028d6e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2024-02-29 21:43:03 +00:00
feb96d866d
Merge changes from topic "mdns-ttl" into main
* changes:
  [mdns] add service-side impl for NSD service TTL support
  [mdns] add API for setting/getting TTL value

Treehugger Robot   authored and   Gerrit Code Review   commited 2024-02-29 21:00:27 +00:00
0520e26936
Update the imports to androidx.test.filters.*
Bug: 316941721
Test: mmma .
Change-Id: I113714afaeb99bf76ff4dc19304371ad0ec097e0

Fangqiu Su   commited 2024-02-29 17:56:14 +00:00
61a14ca475
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
Merge "De-duplicate questions with multiple listeners" into main am: d4b802064b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2632298

Change-Id: Ie5f565a9f230d96cbf19491fded57d73ef2d6143
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2024-02-28 16:18:43 +00:00
935f568351
Merge "De-duplicate questions with multiple listeners" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-02-28 15:45:55 +00:00
d4b802064b
[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
Merge "Fix flaky testSampleConnectivityState" into main am: 2124217588
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2981692

Change-Id: I8e54039ad4b04756015e310325f2dae47370fc4e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Motomu Utsumi   authored and   Automerger Merge Worker   commited 2024-02-28 11:55:20 +00:00
5512762a50
Merge "Fix flaky testSampleConnectivityState" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-02-28 11:05:01 +00:00
2124217588
[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
Fix flaky testSampleConnectivityState
testSampleConnectivityState was flaky since sometimes networks were
disconnected before ConnectivityService#sampleConnectivityState
generates metrics
This CL fixes this issue by adding setKeepConnectedReason to prevent
networks are disconnected

Bug: 318546530
Test: TH
Change-Id: I824f5cd379c8144b48341cc0fd18eb976a4b1cde

Motomu Utsumi   commited 2024-02-28 12:18:57 +09:00
e7a9ef8c0f
Merge "SatelliteAccessController enhancements to handle Multiple User" into main am: 63ff28ed54
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2954926

Change-Id: Ic696199bfc6996d3a92a42deb76380e3421087cc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Nagendra Prasad Nagarle Basavaraju   authored and   Automerger Merge Worker   commited 2024-02-26 17:22:44 +00:00
bc55087fc2
Merge "SatelliteAccessController enhancements to handle Multiple User" into main
Nagendra Prasad Nagarle Basavaraju   authored and   Gerrit Code Review   commited 2024-02-26 16:44:08 +00:00
63ff28ed54
SatelliteAccessController enhancements to handle Multiple User
- onRoleHoldersChanged & onRoleSmsChanged handling for multiple Users
- Different satelliteNetworkFallbackUids cache for each user.
- Merging uid of each user cache and sending for Multi Layer request
- check SATELLITE_COMMUNICATION permission based package manager
  context at different UserHandle

Bug: 324347502
Test: atest FrameworksNetTests
Change-Id: If98524ec7846909d70db3e962e2a11c912768551

Nagendra Prasad Nagarle Basavaraju   commited 2024-02-26 11:24:01 +00:00
f63e6d8e67
Merge "Correct the method used for permission check" into main am: c91b22be98
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2950126

Change-Id: I06a492a0299277a3d16e37b122bd28f3f5b85bc0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Chiachang Wang   authored and   Automerger Merge Worker   commited 2024-02-26 06:31:35 +00:00
9553538169
Merge "Add methods to support verifying captive portal launch" into main am: 3023965cf8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2967207

Change-Id: I2aeb3e6760c6240992be711bad14966460b57fb3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Chiachang Wang   authored and   Automerger Merge Worker   commited 2024-02-26 06:31:22 +00:00
2acee58a78