Commit graph android_packages_modules_Co.../tests/unit/java/com/android
Message SHA1
Ensure all DatagramPackets with the same destination address
The MdnsSocketclient#sendMdnsPacket() uses the address of the
first packet only. Since there's no guarantee that all packets
have the same address, skip sending packets if any have a
different address.

Fix: 335125073
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: Ief0fd81eacf46b33bb2e8c0fcc4da7981ac2972d

Paul Hu   commited 2024-06-26 14:50:48 +00:00
2bbcc34ea1
Merge changes I76b0a7ba,If7308f1a,Ica8faced,Ia8f42ed0,I975afb45, ... into main
* changes:
  Add some documentation to EthernetInterfaceStateMachine
  Add support for link state tracking
  Add unit test class for EthernetInterfaceStateMachine
  Add missing call to add states to state machine
  Make class testable
  Log.wtf if block times out
  Wait on IpClient#onQuit in StartedState#exit
  Use TAG instead
  Introduce CMD_ON_NETWORK_NEEDED and CMD_ON_NETWORK_UNNEEDED messages
  Clean up and document state lifecycle
  Add convenience method for processMessage with no arguments
  Implement NetworkOffer in EthernetInterfaceStateMachine
  Add boilerplate to represent interface states in state machine
  Fix typo in SyncStateMachineTest
  Move SyncStateMachine to staticlibs

Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-21 19:01:38 +00:00
58526e4d96
Add support for link state tracking
Currently, TetheringState just ignores these callbacks (though it must
return HANDLED, otherwise a wtf is logged). This is in line with what
EthernetTracker currently does.

Test: EthernetInterfaceStateMachineTest
Change-Id: If7308f1aa4b333552a79dfe05864c5cef1621582

Patrick Rohr   commited 2024-06-21 08:25:26 -07:00
0129a7a11e
Add unit test class for EthernetInterfaceStateMachine
This currently just invokes the constructor and does nothing else.
EthernetInterfaceStateMachine does not currently provide a way to
transition out of LinkDownState.

Test: run test
Change-Id: Ica8faced0abe33bb70ec5e3f950bc0af75f78f16

Patrick Rohr   commited 2024-06-21 08:25:26 -07:00
7bd5e6dca6
Merge "Do not display "null" in sign-in note details" into main am: 488d40d122
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3130956

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2024-06-13 09:59:20 +00:00
d700a20d74
Merge "Do not display "null" in sign-in note details" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-13 09:50:15 +00:00
488d40d122
Do not display "null" in sign-in note details
For non-telephony, non-wifi networks, both extraInfo and SSID are likely
to be null, in which case
getString(network_available_sign_in_detailed, null) would be used for
the notification contents, which would just print "null" (by default the
string template is just "%1$s").

Use an empty string instead, as there is no string identifier for the
network. This should still be better than having text that says "null".

Test: atest
Bug: 334926818
Change-Id: I19bdba186d2402b40549b1ad5f97864b7c38ca10

Remi NGUYEN VAN   commited 2024-06-13 17:10:36 +09:00
05aa33ccec
Merge changes I62c990d0,I413bdb76,I020ba48e into main am: 3e07102814
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3036454

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

Motomu Utsumi   authored and   Automerger Merge Worker   commited 2024-06-07 09:45:54 +00:00
20fb6a4061
Merge changes I62c990d0,I413bdb76,I020ba48e into main
* changes:
  Update NetworkRequestTest#testDefaultCapabilities
  Allow default messaging app to use constrained satellite network
  Introduce NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED

Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-06-07 09:29:06 +00:00
3e07102814
Merge "waitForIdle to avoid stubbing mocked bpfNetMaps while CS is accessing" into main am: 65bb6527cd
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3117159

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2024-06-07 04:08:21 +00:00
1e0f207b4e
Merge "waitForIdle to avoid stubbing mocked bpfNetMaps while CS is accessing" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-07 03:51:14 +00:00
65bb6527cd
Allow default messaging app to use constrained satellite network
On V+, there could be satellite network which is not restricted but
bandwidth constrained.
These satellite network has NET_CAPABILITY_NOT_RESTRICTED but does not
have NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED.
Since NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED is set by default, this
CL remove this capability from per-app default network request for the
default messaging app.

Test: CSSatelliteNetworkTest
Bug: 343823469
Change-Id: I413bdb764ead42d67ce1315c365500dbb8508eb3

Motomu Utsumi   commited 2024-06-07 09:26:19 +09:00
ab750abf29
waitForIdle to avoid stubbing mocked bpfNetMaps while CS is accessing
Bug: 343302460
Test: TH
Change-Id: I74683b20ce581206c47a153b0e2f348295363ecb

Motomu Utsumi   commited 2024-06-06 18:04:08 +09:00
986dd36e65
Introduce NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED
On V+, this capability is set by default.
Constrained satellite networks never become the system default network.

Test: CSSatelliteNetworkTest
Bug: 343823469
Change-Id: I020ba48e74f1f180e1807cbe1c066209bedb0454

Motomu Utsumi   commited 2024-06-06 15:49:21 +09:00
154ce6381a
Merge "Add config flag for useDeclaredMethodsForCallbacks" into main am: 9d88333273
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3105881

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

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2024-06-06 02:57:00 +00:00
241f7eaa97
Add config flag for useDeclaredMethodsForCallbacks
Add a DeviceConfig flag that will be used to control whether callbacks
should be sent selectively based on whether the receiving method has
been overridden (will be implemented in a future change).

This adds utilities to allow ConnectivityManager to check whether a
ConnectivityService flag is enabled, as that feature will work across
ConnectivityManager and ConnectivityService. ConnectivityManager runs in
app process and does not necessarily have permissions to use
DeviceConfig. Also if it checked DeviceConfig separately from
ConnectivityService, values may be out-of-sync.

Test: atest, and see change using this
Change-Id: I204fa719cc627e84edc5c1e043d947f5ef3f8dee

Remi NGUYEN VAN   commited 2024-06-05 15:54:49 +09:00
aa355ac875
Merge "Update CSSatelliteNetworkTest to use restricted satellite network" into main am: 08137f6e40
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3109162

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

Motomu Utsumi   authored and   Automerger Merge Worker   commited 2024-06-05 02:16:20 +00:00
48dc4ca0e2
Merge "Update CSSatelliteNetworkTest to use restricted satellite network" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-06-05 01:57:55 +00:00
08137f6e40
Update CSSatelliteNetworkTest to use restricted satellite network
Currently, satellite network should be restricted network.
But CSSatelliteNetworkTest uses non restricted satellite network.
This CL updates CSSatelliteNetworkTest to use restricted satellite
network.
This is a preparation to upcoming CLs that supports non restricted but
constrained satellite network.

Test: CSSatelliteNetworkTest
Bug: 343823469
Change-Id: Ia4f75ad525499bffbedd2f3b5d63edd1c216520e

Motomu Utsumi   commited 2024-06-04 18:43:59 +09:00
1e31ad3dff
Merge changes If3dbe234,Ia1299759 into main am: 67b67908a1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3093805

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

Junyu Lai   authored and   Automerger Merge Worker   commited 2024-06-04 07:11:09 +00:00
6587d6c31f
Merge changes If3dbe234,Ia1299759 into main
* changes:
  Dump current max entries and cache duration even if the flags change
  Check compat change flag for rate-limit cache

Junyu Lai   authored and   Gerrit Code Review   commited 2024-06-04 07:07:21 +00:00
67b67908a1
Merge "Report isKnownService in discovery stop metrics" into main am: 4171348894
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3107621

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

Paul Hu   authored and   Automerger Merge Worker   commited 2024-05-30 09:05:25 +00:00
cda42b8947
Report isKnownService in discovery stop metrics
In the reportServiceDiscoveryStop function, the isKnownService
value is not set. This means that it is not possible to track
how many discovery queries are answered from cache. To track
this information, add the isKnownService to
reportServiceDiscoveryStop.

Fix: 339738663
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: Idf9948826d3b8ffff9bce4f224543af87c653d80

Paul Hu   commited 2024-05-29 08:23:37 +00:00
b771670b5d
Merge "Revert^2 "Add blocked reason for internet permission"" into main am: d86bd6faca
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/3103201

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2024-05-28 00:13:14 +00:00
d6a0223b3a
Merge "Revert^2 "Add blocked reason for internet permission"" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-05-28 00:00:07 +00:00
d86bd6faca
Revert^2 "Add blocked reason for internet permission"
This reverts commit cb74c08979.

Reason for revert: This change is not a cause of b/342557183

Change-Id: Iee8d9b05bbe130a46b627b12da525177b4ee89b2

Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-05-27 02:12:43 +00:00
cfd5a517da
Merge "Merge Android 24Q2 Release (ab/11526283) to aosp-main-future" into aosp-main-future
Xin Li   authored and   Android (Google) Code Review   commited 2024-05-24 21:16:07 +00:00
0e4e76de7b
Merge "Revert "Add blocked reason for internet permission"" into main
Priyanka Advani   authored and   Gerrit Code Review   commited 2024-05-24 18:56:26 +00:00
fb1b1b3773
Revert "Add blocked reason for internet permission"
This reverts commit ee96ba0e60.

Reason for revert: Droidmonitor triggered revert due to b/342557183. Will be verifying through ABTD before submission.

Change-Id: I7e185c3ac11da27c7bb9d95e4221f7dfc22cf48c

Priyanka Advani   authored and   Gerrit Code Review   commited 2024-05-24 18:11:45 +00:00
cb74c08979
Merge Android 24Q2 Release (ab/11526283) to aosp-main-future
Bug: 337098550
Merged-In: I50f3d3b8205a5a9ee8154a649318a2c175edbb71
Change-Id: I744085a52a290ba39beec9df7c27247ee5cc007f

Xin Li   commited 2024-05-24 08:25:30 -07:00
a9c4e57fd0
Destroy sockets of apps under background firewall chain restriction
Currently, CS destroys sockets of apps under firewall chain restriction
only when the firewall chains get enabled by setFirewallChainEnabled.

This CL updates CS to also destroy sockets of apps when the
setUidFirewallRule and replaceFirewallChain update uid rule and apps
lose network access due to FIREWALL_CHAIN_BACKGROUND.
This socket destruction is delayed until the cell modem is up in the
same way that CS destroys sockets of frozen apps.

Test: CSSocketDestroyTest
Bug: 300681644
Change-Id: I6a6fb5d6d7b71c0949a4195b84d30efef95bff37

Motomu Utsumi   commited 2024-05-24 13:47:21 +09:00
ff555a709c
Add blocked reason for internet permission
Currently, even if apps don't have INTERNET permission and can not use
network, network access is considered not blocked and
ConnectivityService send onBlockedStatusChanged callback with
blocked=false.
This CL introduced BLOCKED_REASON_NETWORK_RESTRICTED and consider
network access from apps targetting W+ on V+ releases is blocked if apps
don't have INTERNET permission.
Permission is set when the user is added or package is installed and
permission is removed when the user is removed or packages is
uninstalled.
So ConnectivityService does not need to monitor permission change to
send onBlockedStatusChanged callback by permission change.

Test: CSBlockedReasonsTest
Bug: 339559837

Change-Id: I58d2a4eddc714e205f5b96219f95b637f2826c58

Motomu Utsumi   commited 2024-05-24 13:45:51 +09:00
ee96ba0e60
Send onBlockedStatusChanged callback based on bpf map contents
Currently, CS receives the blocked status change from
NetworkPolicyCallback.
This CL update CS to generate blocked status based on bpf map contents
on V+.
When the data saver and firewal chain status is updated, CS generate new
blocked reasons based on bpf map contents.
U- keeps listening to NetworkPolicyCallback.

Bug: 328732146
Test: testNetworkCallbackMaximum, CSBlockedReasonsTest
Change-Id: I6fa3f1a44eadc67d9cff17133905ef69203c044a

Motomu Utsumi   commited 2024-05-24 13:45:41 +09:00
d20727f3cc
Move perUidCounter increment to outside NetworkRequestInfo constructor
This CL moves mPerUidCounter.incrementCountOrThrow from
NetworkRequestInfo constructor to the caller of NetworkRequestInfo
constructor and stop incrementing counter for internal NetworkRequestInfo
(e.g. per-app default requests).
Also, this CL update CS not to modify perUidCounter when CS updates
apps' track default network request when the per-app default request is
updated since this does not change the number of request for each uids.

Test: testNetworkCallbackMaximum
Bug: 339106399
Change-Id: I82dbeb82b1c762c2c277d5794d54997b57009b6a

Motomu Utsumi   commited 2024-05-24 13:27:27 +09:00
b16f75c3eb
Enable delay destroy socket as default
delay_destroy_frozen_sockets_version is rolled out to public 100%.
So this CL enables this flag as default with kill switch.
This flag is no-op if destroy_frozen_sockets_version is disabled, and
destroy_frozen_sockets_version is also rolled out to public 100%.
So this CL does not change any behabior on the production devices.

Upcoming CLs will update CS to destroy sockets of apps that are under
FIREWALL_CHAIN_BACKGROUND restriction as well.
So this CL renames flag name from delay_destroy_frozen_sockets_version
to delay_destroy_sockets which is not specific to frozen apps.

Bug: 300681644
Test: TH
Change-Id: Icb9edff4e517fca57408d7d690fe9e172754c35e

Motomu Utsumi   commited 2024-05-22 13:35:44 +09:00
390be06f64
Merge "Inform the DNS resolver of the interfaces in a network." into main
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2024-05-21 06:45:37 +00:00
19fd149d8e
Add support to restore original values
In current design, this class is risky because developers might
assume that it's safe to set real device flags with it. This is
unsafe because the class does not restore the previous value.

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest
Fix: 339154394
Change-Id: I2a12e7892eaf66e7572928de39e00de3faf5fa60

Junyu Lai   commited 2024-05-21 02:16:21 +00:00
a8ba04b132
Check compat change flag for rate-limit cache
This allows apps built against V but run on older platform
can adopt this feature. This keep compatibility for older
apps which does not built against newest platform.

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest
Fix: 339154075
Change-Id: Ia12997595579190ae0d65ad36ce39d011dde37ce

Junyu Lai   commited 2024-05-20 14:37:09 +08:00
f53e9cf3a1
Merge "Reorder clatStart() to setup 464xlat sockets before tun interface" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2024-05-19 13:38:40 +00:00
fe3dd9a23f
Update APIs that depends on isUidNetworkingBlocked to follow compat flag
NETWORKINFO_WITHOUT_INTERNET_BLOCKED compat flag only changed the
behavior of getActiveNetworkInfo that depends on
bpfNetMaps#isUidNetworkingBlocked.
But isUidNetworkingBlocked is used from other APIs(e.g. getActiveNetwork)
This CL update all APIs that depends on isUidNetworkingBlocked to follow
the compat flag to make behavior consistent between APIs.

aosp/3079290 will update onBlockedStatusChanged callback to follow this
compat flag.

Bug: 340773991
Bug: 339780435
Test: TH
Change-Id: If64ec800f21c2adc613884838202e2dece4a8d95

Motomu Utsumi   commited 2024-05-16 16:54:17 +09:00
b15be228d2
Reorder clatStart() to setup 464xlat sockets before tun interface
Modified the execution sequence within ClatCoordinator.clatStart() to
configure the local 464xlat read/write sockets before configuring and
bringing up the tun interface. This ensures that upon receiving an
RTM_NEWLINK message for the tun interface up event, the anycast address
is already configured on the physical interface.

Test: TH, manual test on physical device
Change-Id: I558cd370456091b8a61e1137a53305527fb651fd

Yuyang Huang   commited 2024-05-14 21:17:27 +09:00
584a5136a1
[mdns] Skip conflict check for incoming mDNS answer records which are
probed in the repository

There's a scenario where an undesired conflict happens:
1. Register a service and custom host with addresses and public key.
2. Register another service using the same hostname and public key.

While the second registartion is being probed, its KEY RR is considered
as conflicting with the address record of the first registraiton. This
shouldn't be a reasonable behavior because the address record itself is
from the repository itself.

Bug: 336936158
Bug: 336967571
Test: atest CtsNetTestCases:NsdManagerTest FrameworksNetTests:android.net.connectivity.com.android.server.connectivity.mdns.MdnsRecordRepositoryTest

Change-Id: Ibe6c8dd845540eba8f08152be6693be1dbc42ce9

Handa Wang   commited 2024-05-13 09:58:48 +00:00
034705d7a8
Add compat flag for ActiveNetworkInfo blocked state
Before aosp/3001087, getNetworkActiveInfo did not return network info
with blocked state for apps without PERMISSION_INTERNET even if the
network is actually blocked.
aosp/3001087 updated getNetworkActiveInfo to return correct blocked
state on V+.
However, this broke some apps that use getNetworkActiveInfo in wrong way
and depends on the previous behavior.
So this CL introduces the compat flag to keep previous behavior for apps
targeting U or older releases.

Test: TH
Bug: 333340911
Change-Id: I0e0950f2148de0ffdb45495903a5a87e0d4c1c0b

Motomu Utsumi   commited 2024-05-08 21:08:35 +09:00
0b4be79e52
Reapply "Use bpf map based isUidNetworkingBlocked on V+"
This reverts commit a658220234.

Change-Id: I53acd7ff4821a65583b2ad936e22efaa21965a14

Maciej Żenczykowski   authored and   Motomu Utsumi   commited 2024-05-08 14:50:38 +09:00
a08692f7c7
Use Bpf map based isUidRestrictedOnMeteredNetworks on V+
Bug: 328732146
Test: BpfNetMapsTest
Change-Id: I2d3820bf4dd82649941eef2995ad237276937ba9

Motomu Utsumi   commited 2024-05-07 18:36:39 +09:00
e55bcd578b
Add bpf map based getUidNetworkingBlockedReasons
Bug: 328732146
Test: NetworkStackBpfNetMapsTest BpfNetMapsTest
Change-Id: Ie802b3d18463e2b7e8a2b953088cbbcc117a841e

Motomu Utsumi   commited 2024-05-07 18:36:36 +09:00
eb92054f91
Merge "Fix DO check on headless devices" into main
Kholoud Mohamed   authored and   Gerrit Code Review   commited 2024-04-25 09:51:23 +00:00
45f71b0b3d
[mdns] service implementation for public key
Bug: 317946010
Bug: 333232582

Change-Id: Iab66bf0a1af14878c7b18a7a3015c2de7a6514c8

Handa Wang   commited 2024-04-24 07:17:00 +00:00
52497d66cc
Merge "Add firewall chains for HAPPY_BOX and user/admin PENALTY_BOX" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-04-24 03:51:09 +00:00
c04493234e
Merge "Use helper function getIndexForValue in MulticastRoutingCoordinator." into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-04-23 12:58:39 +00:00
173ffb9278