This is a no-op refactoring, which renames several methods and
variables to more accurately reflect their functionality and
follow the naming style.
Flag: EXEMPT flagged with a kill switch
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.SatelliteAccessControllerTest \
--update-device
Bug: 410731080
Change-Id: I84b9eca60f2b8543b8bdb7cf972103b79105e670
For maintaining constrained data satellite opt-in apps, this is
needed for tracking apps installed on the storage.
Flag: EXEMPT flagged with a kill switch
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.SatelliteAccessControllerTest \
--update-device
Bug: 410731080
Change-Id: I2a686a5a37747de97dcee6b78f66965cb4fd9942
This feature will be controlled by the caller.
Cronet calls the register/unregisterQuicConnectionClosePayload APIs only
when the Chromium experiment flag is enabled
(http://crrev.com/c/6421621/).
This CL also updates testRegisterQuicConnectionClosePayload
to be skipped on U or older releases since FIREWALL_CHAIN_BACKGROUND is
supported on V or higher releases.
Flag: EXEMPT guarded by chromium flag
Bug: 311792075
Test: TH
Change-Id: Ib008e63c585cfe8775b25783cd55b0873bb5e2f0
This patch adds EthernetPort class which is used to track configuration
of ethernet networks internally.
Bug: 397536853
Test: atest ConnectivityCoverageTests:android.net.connectivity.
com.android.server.ethernet.EthernetPortTest
Flag: EXEMPT mainline
Change-Id: Iba1c4461ae7d666aa31c076baa33c32c2c1f7603
Update it to follow the latest conventions and add support for
eventuallyExpect.
Test: ConnectivityCoverageTest
Flag: EXEMPT test-only change
Change-Id: Iabc2fad051b874e3e18a0645361409f0427891fb
This is needed for tracking the applications which opted-in to
use the constrained data satellite network as its default by
adding the following property to the <application> tag of its
manifest:
<property
android:name="android.telephony.PROPERTY_SATELLITE_DATA_OPTIMIZED"
android:value="<package name>" />
Flag: EXEMPT flagged with a kill switch
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.SatelliteAccessControllerTest \
--update-device
Bug: 410731080
Change-Id: I00c0ce5e0d7aac1192272e79a19fbab4e3a5e6f1
* changes:
Add light-weight DefferedBroadcastReceiver for handling broadcast events
Move user intent reception out of SatelliteAccessController
Move user/package intent reception out of PermissionMonitor
Jean Chalardauthored and Android (Google) Code Reviewcommited 2025-04-23 21:50:19 -07:00
The PackageManager#getInstallPackagesAsUser method is time
consuming (30~200ms) and blocks boot time while it executes.
This change moves the getInstallPackagesAsUser
method from PermissionMonitor. This is a performance-focused
refactoring to allow for efficient sharing of package enumeration
results in subsequent changes, avoiding redundant time-consuming
operations.
Flag: EXEMPT refactor
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.SatelliteAccessControllerTest \
ConnectivityCoverageTests: android.net.connectivity.com.android.server.ConnectivityServiceTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.PermissionMonitorTest \
ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.BroadcastReceiveHelperTest \
--update-device
Bug: 410731080
Change-Id: I3929fa28ff9419329622f3abdf10336289730607
This commit introduces the DeferredBroadcastReceiver class, which
defers received Intent handling using a Handler. It prevents
Application Not Responding (ANR) errors by offloading potentially
time-consuming or blocking operations triggered by broadcast
event handling, even if `onReceive` takes a long time on the
handler thread.
Flag: EXEMPT refactor
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.PermissionMonitorTest \
ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest \
ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.BroadcastReceiveHelperTest \
--update-device
Bug: 410731080
Change-Id: Id6191d5ad9ae9f17fca3236110573340aa713048
This is a no-op refactoring that moves the reception of
user-related intents in SatelliteAccessController to
ConnectivityService.
It then dispatches these events to the SatelliteAccessController.
Flag: EXEMPT refactor
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.SatelliteAccessControllerTest \
ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest
Bug: 410731080
Change-Id: I9ace3ed09a161446dc92d40bc0d400e32051de32
This is a no-op refactoring that moves the reception of
package and user-related intents in PermissionMonitor to
BroadcastReceiveHelper.
It then dispatches these events to the PermissionMonitor.
This change is necessary to centralize intent receivers
from other subclasses to ConnectivityService in
subsequent modifications.
This reverts the design change introduced in aosp/2183343, which
had PermissionMonitor listening to user change events instead
of ConnectivityService.
Flag: EXEMPT refactor
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.PermissionMonitorTest \
ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest \
ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.BroadcastReceiveHelperTest \
--update-device
Bug: 410731080
Change-Id: Ic79afc18a6e8603ddf8d48a1f78cf8d98f2447ae
- Also verify the netd operations that add and remove UID ranges.
- Don't set the network to keep connected, since that is not
representative of what happens on a real device.
Test: test-only change
Bug: 410731080
Flag: TEST_ONLY
Change-Id: Ib4305748b5f1627546b7a63fb9596308b14155e0
Lorenzo Colitticommited 2025-04-23 12:03:57 +09:00
This adds two new shell commands to ConnectivityService that sets
a given UID to fall back to a given transport type if there is no
system default network. The syntax is:
cmd connectivity set-debug-fallback-network-for-uid <uid> <transport>
cmd connectivity clear-debug-fallback-network-for-uid <uid>
This works only on debug builds and should be used only for
manual testing.
Test: none yet
Bug: 410731080
Flag: TEST_ONLY
Change-Id: I9e0ac0713dbb95e59b22faa7cd45bdc8c1070f08
Lorenzo Colitticommited 2025-04-22 22:46:34 +09:00
This makes the code clearer, and also fixes a bug: currently, a
TRACK_DEFAULT request in a multilayer request can cause a network
to remain needed. This is incorrect: only requests should be able
to keep a network up.
This prevents satellite networking from disconnecting when the
default network reappears (see changes in unit test).
This CL removes the code before the loop that special-cases
non-multilayer listens because it is not very useful. Any
non-multilayer listen will either:
- Immediately return false, if it's the active request, or:
- Cause the code to continue (because it's not the active
request), and because mRequests only has one element, will
hit the "return false" statement after the loop.
Flag: EXEMPT bug fix
Test: covered by existing tests
Change-Id: I7295ce469335af924aa20b7976cc4a9136ef5d61
Lorenzo Colitticommited 2025-04-22 22:02:40 +09:00
This change ensures that the Message object is created and
obtained within RealtimeScheduler, preventing modification
by the caller.
Fix: 386274963
Test: atest ConnectivityCoverageTests NetworkStaticLibTests
Flag: EXEMPT bug fix
Change-Id: I4c919857bcaa2d49717859dca9c88a243cbb7a41
This commit modifies the mDNS advertising process to ignore IPv6
temporary addresses. These addresses are ephemeral and can lead to large
advertising packets and negatively impact mDNS offload(as RAM for doing
mDNS offload is limited), especially on devices with long internet
connections and multiple temporary addresses. Ignoring them provides a
more stable and efficient mDNS advertising
experience.
Flag: EXEMPT mainline
Test: TH
Change-Id: I79c7f331eb29ecdd7ade4ccde1d1a22d0dbf1400
On V+, ConnectivityService uses uid blocking state in BpfMap instead of
asking NetworkPolicyManager.
But, there was one behavior difference because NetworkPolicyManager
considers the network is always not blocked for apps without Internet
permission.
To ensure backward compatibility, the
NETWORK_BLOCKED_WITHOUT_INTERNET_PERMISSION flag was introduced in
aosp/3076606, aosp/3088285.
This CL updates enforceMeteredApnPolicy to respect this flag for
backward compatibility.
Test: CSEnforceMeteredApnPolicy
Bug: 404428733
Bug: 370383309
Flag: EXEMPT bugfix
Change-Id: I631f4f840818e1d40f20fccae1ec1a2cbbb6a166
The method above this one (connect) unregisters the callback, but
disconnect doesn't. Looks like it was just missed in code review.
Flag: TEST_ONLY
Test: test-only change
Change-Id: Id3a9d3748554275fd28d8bf2ff2b6fa42be24ddc
Lorenzo Colitticommited 2025-04-21 11:20:24 +09:00
CSTest already has an Agent function helper. Instead of using a new
function to create a network agent based on the given parameters,
it's better to overload the existing Agent function.
Flag: EXEMPT test-only change
Bug: 368416967
Test: atest ConnectivityCoverageTests
Change-Id: I134a96f564111ba65ddd5f8ec7878aeeab340dee
For clarity, as it doesn't support wrapping any fd. If the fd is a
connected socket, it must be shutdown() to interrupt blocking
operations. Tun doesn not require shutdown(), so TunWrapper is a better
name.
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I2f7af95ef8d9ebceefdfc479c04e0272b2cb7311
For some reason, I used to believe shutdown() was required for tun
interface fds. As it turns out, it isn't and throws an error every time
it is called:
shutdown failed: ENOTSOCK (Socket operation on non-socket)
This change removes all calls to shutdown() including the shutdownRead()
and shutdownWrite() interface methods.
Test: TH
Flag: EXEMPT mainline
Bug: 1000001
Change-Id: I5a1716f82426b24db9e05367f82dc4080762e288
Previously, non VPNs would not be created when updateVpnUids()
is called inside handleRegisterNetworkAgent. Because the network
is not created, netd would refuse to set the UIDs with an error.
Now that networks are created immediately with the
QUEUE_NETWORK_AGENT_EVENTS_IN_SYSTEM_SERVER flag,
the network is created and netd does set the UID for any
network as if they were a VPN. This results in the UID having
the wrong default network, which in turns prevents it from
accessing Internet.
Test: new test in this patch
Bug: 408717088
Flag: EXEMPT bugfix
Change-Id: If68ea7d60919c0c7e177480f6167196381e00f35
When updating errorprone to 2.27.0, it finds new issues that cause the build to fail.
Flag: EXEMPT refactor
Bug: 253827323
Test: RUN_ERROR_PRONE=true m javac-check
Change-Id: I9c70d64e1f1e43be3bc1d9af8413548d10c8d490
TextStrings was kept for backwards compatibility when the code was used
outside of Android, but is not necessary in the Android version as only
TextEntries are used.
Test: atest
Flag: EXEMPT refactor
Change-Id: If70fe1512570dd55019eac06cfce91639fd04b11
When MdnsMultinetworkSocketClient stops using a socket (when
isSocketActive starts returning false), the packet handler should be
removed from that socket. The code only removed it from the
mSocketPacketHandlers map without clearing it from the socket.
This caused packets to be handled potentially many times, affecting
performance.
Bug: 406623719
Bug: 408324621
Test: atest
Flag: EXEMPT bugfix
Change-Id: I3d1117a4b847f3b95a01fc8a5997a53655ef608a