Commit graph android_packages_modules_Co.../tests/unit/java
Message SHA1
Remove getVpnLockdownUidRanges test api
getVpnLockdownUidRanges acquire lock and access internal state of a
Handler-based class (PermissionMonitor), which is bad practice in
general.

getVpnLockdownUidRanges returns keySet of mVpnLockdownUidRanges.
PermissionMonitor call updateUidLockdownRule and update the bpf map
based on mVpnLockdownUidRanges.
PermissionMonitorTest verifies the args of updateUidLockdownRule call.

So, It's not necessary to verify the mVpnLockdownUidRanges which
is internal states of PermissionMonitor.

Test: atest PermissionMonitorTest
Bug: 262199762
Change-Id: I85b39ab2aff44dcbe809b39560d6bb87fbb0c084

Motomu Utsumi   commited 2023-01-30 17:41:39 +09:00
9a9c11e33e
Remove getVpnInterfaceUidRanges test api
getVpnInterfaceUidRanges acquire lock and access internal state of a
Handler-based class (PermissionMonitor), which is bad practice in
general.

getVpnInterfaceUidRanges returns mVpnInterfaceUidRanges.
PermissionMonitor call add/removeUidInterfaceRules and update the bpf
map based on mVpnInterfaceUidRanges.
PermissionMonitorTest/ConnectivityServiceTest verifies the args of
add/removeUidInterfaceRules call.

So, It's not necessary to verify the mVpnInterfaceUidRanges which
is internal states of PermissionMonitor.

Test: atest ConnectivityServiceTest PermissionMonitorTest
Bug: 262199762
Change-Id: I31cbb9b1dd43eaf0354799a81c9df292fb5f6445

Motomu Utsumi   commited 2023-01-30 17:41:34 +09:00
ff12d34445
Add defer-until-active policy to CONNECTIVITY_ACTION.
This allows deferring the broadcast delivery to apps in
the Cached state.

Bug: 255545931
Test: TH
Change-Id: Idd94ad5f9dbabf88f6070108bdfc8e60f34304a6

Sudheer Shanka   commited 2023-01-24 19:33:06 +00:00
74fe7178af
Merge "Do not return found services on dummy0"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-01-24 04:10:58 +00:00
5fc52a4b2f
Do not return found services on dummy0
When registering and advertising a service on the same device, it is
possible for NsdService to find the service on the dummy0 interface. It
is however unusable and not resolveable.

Skip callbacks on the dummy0 interface as they would confuse apps and
tests.

Bug: 266176036
Test: atest NsdServiceTest
Change-Id: I98cca0135e0f6936187d45707cbdad7a7f263ff1

Remi NGUYEN VAN   commited 2023-01-23 19:14:57 +09:00
643edb6715
Fix a bug where adding a user doesn't update network allow lists
Even if there are no preferences, the allow list needs
to be updated upon adding a new user, because it's set
unconditionally when the network connects.

Adding all existing UIDs would address this issue too
and we probably want to do it, but immediately this
seems simpler.

Bug: 266136779
Test: new test for this
Change-Id: I77091a6c3d3ccf2b80ab0aaa01d09ef0df922501

Chalard Jean   commited 2023-01-23 17:40:01 +09:00
e0abd52557
Merge "[DK2-2]Add flag to control dynamic keepalive mode"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-01-20 11:59:26 +00:00
c795473a80
[DK2-2]Add flag to control dynamic keepalive mode
Add a flag to control dynamic keepalive mode so that this
feature could be dynamically enabled via flag push. Default
is enabled in KeepaliveTracker.

Bug: 259000745
Test: atest FrameworksNetTests
Change-Id: I438de9aefd22229669a9ae4da5fd109fdfa73b10

chiachangwang   authored and   Chalard Jean   commited 2023-01-20 17:47:11 +09:00
a38b723fb9
Merge "Implement conflict detection"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-01-20 06:00:54 +00:00
3c42e517ac
Implement conflict detection
On each received packet, query MdnsRecordRepository to detect any
conflicting service, and report it though onServiceConflict.

Implement restartProbingForConflict and renameServiceForConflict which
may be called when that callback is dispatched.

Bug: 266151066
Test: atest MndsInterfaceAdvertiserTest MdnsRecordRepositoryTest
Change-Id: I5434b00879e0c8f7fc1e4769455b688c3bd7a9b5

Remi NGUYEN VAN   commited 2023-01-20 12:53:32 +09:00
c8db64bdb1
Merge "New API to listen service update"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-01-19 15:25:23 +00:00
93587f609b
New API to listen service update
Currently, the resolution is a one shot query, it only notifies
the first finding service information. There is no way to listen
the service update. Thus, add a new API that can register a
callback to listen to the service updates continuously.

Bug: 245369943
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I0e9d92b9028375feb3e344ab6c4acb515c5b2be9

Paul Hu   authored and   Remi NGUYEN VAN   commited 2023-01-19 20:16:03 +09:00
18aecccc9d
[DK2-0]Create AutomaticOnOffKeepaliveTracker
Add a new AutomaticOnOffKeepaliveTracker class between
ConnectivityService and KeepaliveTracker to handle the automatic
on/off keepalive. This commit only creates this new class and
move the TCP polling code to the new class as a preparation for
the following commit.

The original test file was created for testing the TCP polling
mechanism, so rename it to match the new class.

Bug: 259000745
Test: m ; atest FrameworksNetTests
Change-Id: I1b229f906283c0f5ef7a3efdb0572fcbfc5df72b

chiachangwang   authored and   Chalard Jean   commited 2023-01-19 13:17:54 +09:00
3d60bacfa0
Merge "New API to stop service resolution"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-01-19 01:51:50 +00:00
fd02056713
Merge "Optionally use MdnsAdvertiser for advertising"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-01-18 15:53:03 +00:00
55bb102b2d
Merge "Update VpnManagerServiceTest to work with lockdown VPN main user changes."
Oli Lan   authored and   Gerrit Code Review   commited 2023-01-18 15:32:14 +00:00
f738c40e8c
Optionally use MdnsAdvertiser for advertising
Based on a flag, use MdnsAdvertiser for advertising instead of the
legacy mdnsresponder implementation.

Bug: 241738458
Test: atest NsdServiceTest
Change-Id: I2d5069097c11f2959e3792cac326d179a3116479

Remi NGUYEN VAN   commited 2023-01-18 23:23:43 +09:00
5b9074cf7e
New API to stop service resolution
Resolve service may take long time due to network issue or
using wrong service information, but users are not able to stop
it. They can only wait for the callback of resolveService to end,
which sometimes takes a long time. Thus, add the new API that
users can stop the service resolution.

Bug: 245369943
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I6b6183c8c73f8db981b9afa51fbc73bf886d9ed3

Paul Hu   commited 2023-01-18 10:10:25 +00:00
b58deb706c
Merge "Implement service resolved callback"
Paul Hu   authored and   Gerrit Code Review   commited 2023-01-18 01:43:28 +00:00
38f5d4661b
Merge changes I69128db9,I13db22f8
* changes:
  Implement onServiceConflict
  Add replying to queries

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-01-18 01:13:35 +00:00
aa15a8ea5d
Merge "Factor out response decoding into MdnsPacket"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-01-18 01:12:58 +00:00
fe73104cc1
Merge changes I298816ac,I3f41b4fe,Ibd782029
* changes:
  Implement service lost callback
  Implement service found callback
  Use MdnsDiscoveryManager for discovery

Paul Hu   authored and   Gerrit Code Review   commited 2023-01-17 15:51:54 +00:00
f71485f351
Implement service resolved callback
Service resolved should be notified when receive the
onServiceFound callbacks from MdnsServiceBrowserListener

Bug: 254166302
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I681720065084bf3449c5b1ab44cd4ed6a659dcdb

Paul Hu   commited 2023-01-17 23:25:08 +08:00
75069ed47e
Implement onServiceConflict
Implement the onServiceConflict callback in MdnsAdvertiser, refactoring
the conflict detection to reuse it both in onServiceConflict (when a
conflict is detected on the network after add) and at service add time.

Bug: 241738458
Test: atest MdnsAdvertiserTest
Change-Id: I69128db936296bd2c5e90e9f00df19fd881e1748

Remi NGUYEN VAN   commited 2023-01-17 23:21:28 +09:00
b1b7fab156
Add replying to queries
MdnsInterfaceAdvertiser registers to receive incoming packets, and
sends replies to queries as built by MdnsRecordRepository.

Bug: 241738458
Test: atest
Change-Id: I13db22f8efc870b6e0747d105f6bc8f759910f81

Remi NGUYEN VAN   commited 2023-01-17 23:10:42 +09:00
46676497eb
Factor out response decoding into MdnsPacket
Factor out generic packet decoding into MdnsPacket, out from
MdnsResponseDecoder.

This allows reusing the same decoding code for replies, and other kinds
of MdnsPackets.

Bug: 241738458
Test: atest MdnsResponseDecoderTests MdnsPacketTest
Change-Id: I4380f80240ed5a367accfc1b0c595967ee475578

Remi NGUYEN VAN   commited 2023-01-17 23:00:34 +09:00
5fbaea55d8
Implement service lost callback
Service lost should be notified when receive the
onServiceNameRemoved callbacks from
MdnsServiceBrowserListener.

Bug: 254166302
Test: atest FrameworksNetTests
Change-Id: I298816ac186efeda85cea4cd11f3beab6b341bc5

Paul Hu   commited 2023-01-17 21:26:26 +08:00
319751a572
Merge "[DK1]Add TCP polling mechanism"
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-01-17 13:04:04 +00:00
c42f1adfd5
Implement service found callback
Service found should be notified when receives the
onServiceNameDiscovered callbacks from
MdnsServiceBrowserListener.

Bug: 254166302
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I3f41b4fe85cd85ad356fa764663187a88914412c

Paul Hu   commited 2023-01-17 20:07:22 +08:00
019621e070
Use MdnsDiscoveryManager for discovery
Register/Unregister the listener to/from MdnsDiscoveryManager
when discovery started/stopped.

Bug: 254166302
Test: atest FrameworksNetTests CtsNetTestsCases
Change-Id: Ibd782029826ac5856c608165928cd942e46dd9a4

Paul Hu   commited 2023-01-17 19:16:50 +08:00
23fa202478
Merge "Rename mXXXNetworkAgent to mXXXAgent"
Jean Chalard   authored and   Gerrit Code Review   commited 2023-01-17 08:12:31 +00:00
76ee573dda
Merge "Remove dev recorder from NetworkStatsService"
Aaron Huang   authored and   Gerrit Code Review   commited 2023-01-17 07:27:35 +00:00
a3ed25924e
Merge "Import CallbackEntries in ConnectivityServiceTest"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-01-17 07:24:53 +00:00
6366d7c2db
[DK1]Add TCP polling mechanism
Add TCP polling mechanism in KeepaliveTracker to understand if
there are any TCP sockets in the target network. This is a
preparation commit for dynamically control keepalive based on
the existence of TCP sockets. This is non-functional now since
there is no caller to retrieve the information now.

Bug: 259000745
Test: atest FrameworksNetTests
Test: Manually test by creating TCP sockets on the target network
      in device and check if deisgn works.
Change-Id: I355ac340cad2fac618bb9d65fb1b1539ea644959

chiachangwang   commited 2023-01-17 07:24:48 +00:00
6a9f0db983
Merge "Create the MdnsDiscoveryManager"
Paul Hu   authored and   Gerrit Code Review   commited 2023-01-17 07:05:13 +00:00
1b81be6de6
Rename mXXXNetworkAgent to mXXXAgent
In the context of ConnectivityServiceTest this is plenty
clear, so terser is better.

Test: ConnectivityServiceTest
Change-Id: Id20afc8a81a6c00c932ffae3b8dbc2919773d35b

Chalard Jean   commited 2023-01-17 14:44:31 +09:00
dda2fd4883
Import CallbackEntries in ConnectivityServiceTest
This is not ambiguous so less verbose is a lot simpler

Test: ConnectivityServiceTest
Change-Id: I47cc689441a20fa5409268e133f9e5ca59216a5d

Chalard Jean   commited 2023-01-17 14:44:29 +09:00
cc231ceed2
Merge changes I3b1ad1be,Id4c2e610
* changes:
  Implement exit announcements
  Implement announcements on probing success

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-01-17 01:36:05 +00:00
fa94865739
Create the MdnsDiscoveryManager
Create the MdnsDiscoveryManager for mdns discovery and resolution
if the feature is enable.

Bug: 254166302
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I4d7591b50cb06f0efcc0dde9834b775c513cceff

Paul Hu   commited 2023-01-17 00:26:01 +08:00
4bd98ef68e
Implement exit announcements
Build ExitAnnouncementInfo in MdnsRecordRepository.exitService. Use a
separate class for AnnouncementInfo and ExitAnnouncementInfo, so
announcement callbacks can differentiate each case.

Bug: 241738458
Test: atest
Change-Id: I3b1ad1bef3dc1514479d7c789ef06b6a7de02e59

Remi NGUYEN VAN   commited 2023-01-16 19:20:36 +09:00
e4bd27f919
Implement announcements on probing success
Once probing succeeds, the advertiser sends announcements for its
records as per RFC6762 8.3.

Implement MdnsRecordRepository.onProbingSucceeded to return the
AnnouncementInfo which will be sent.

Bug: 241738458
Test: atest
Change-Id: Id4c2e610911fdf471a6d6ae08c2127fbf1530dc7

Remi NGUYEN VAN   commited 2023-01-16 17:33:54 +09:00
bdc2d50c49
Merge "Remove *_WILDCARD constants from NetworkTemplate"
Aaron Huang   authored and   Gerrit Code Review   commited 2023-01-16 07:56:09 +00:00
2500069488
Merge "Remove mSubscriberId from NetworkTemplate"
Aaron Huang   authored and   Gerrit Code Review   commited 2023-01-16 07:55:26 +00:00
99348b1664
Merge "Move mDNS code to service-connectivity-t"
Paul Hu   authored and   Gerrit Code Review   commited 2023-01-13 12:33:28 +00:00
2bb41be9d3
Move mDNS code to service-connectivity-t
Instead of using a separate service-mdns library, move the code to
service-connectivity-t.

service-connectivity-t is chosen because it has access to hidden API of
classes that were made updatable in T, such as NsdServiceInfo and
NsdManager. mdns code can be there as it is only loaded on T+.

Bug: 241738458
Test: atest
Change-Id: I7eb6c9ab8bf0e0a614ea2994c6ed80a1a780241f

Paul Hu   commited 2023-01-13 16:42:48 +08:00
03a51d5674
Merge "Cleanup TestableNetworkCallback#assertNoCallback"
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-01-13 07:41:06 +00:00
18967e69f2
Merge "Add unit tests for probing"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-01-13 04:05:46 +00:00
73990178e5
Merge "Add MdnsMultinetworkSocketClient"
Paul Hu   authored and   Gerrit Code Review   commited 2023-01-13 03:58:19 +00:00
6ea0c1d05b
Merge "Remove PacketRepeater destinationsSupplier logic"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-01-13 01:51:07 +00:00
65df28291a
Add unit tests for probing
Add tests for MdnsRecordRepository and MdnsInterfaceAdvertiser
implementations of probing.

Bug: 241738458
Test: atest
Change-Id: If41a387f14e805e81b6d0d8217d081ca053e340f

Remi NGUYEN VAN   commited 2023-01-12 19:36:43 +09:00
5e5393ffde