Commit graph android_packages_modules_Co.../service/src/com/android/server/ConnectivityService.java
Message SHA1
Use string for CREATE_APP_SPECIFIC_NETWORK permission
This allows using the permission in 25Q4 before it becomes a
public API in 26Q2.

Flag: android.net.platform.flags.create_app_specific_network_permission
Test: TH
Bug: 435313135
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:60f7743f773b05a98e651c953631e93957291bf5
Merged-In: I8d336a588eddf9a027079e208b2b96bb6c163e86
Change-Id: I8d336a588eddf9a027079e208b2b96bb6c163e86

Motomu Utsumi   authored and   Android Build Coastguard Worker   commited 2025-09-30 03:56:13 -07:00
c4fea9d31c
Merge changes from topics "redact-netcaps", "redact-specifier", "specifier-metrics" into main
* changes:
  [connectivity] rename createWithLocationInfoSanitizedIfNecessaryWhenParceled
  [connectivity] use new redact(RedactionType) for output NetworkSpecifier
  [connectivity] move redaction to createWithLocationInfoSanitizedIfNecessaryWhenParceled
  [connectivity] add permission check on requested NetworkSpecifier
  [connectivity] redact NeworkSpecifier in NetworkCapabilities
  [connectivity] add NetworkCapabilities.RedactionHelper
  [Thread] add REDACT_FOR_THREAD_NETWORK_PRIVILEGED

Kangping Dong   authored and   Android (Google) Code Review   commited 2025-09-12 13:26:22 -07:00
a133acc106
[connectivity] rename createWithLocationInfoSanitizedIfNecessaryWhenParceled
It's already redacting more sensitive information other than just
location info.

This is a follow up CL for https://googleplex-android-review.git.corp.google.com/c/platform/packages/modules/Connectivity/+/34224156/comment/98b93666_a824d7bc/

Bug: 374037595
Flag: EXEMPT PURE_REFACTOR
Change-Id: I6524c4f9ee9b5273e4ab421f54ae3115dea2cc8a

Kangping Dong   commited 2025-09-12 15:06:00 +08:00
6fd0624452
[connectivity] use new redact(RedactionType) for output NetworkSpecifier
This commit replace the existing usage of NetworkSpecifier#redact() to
the new NetworkSpecifier#redact(RedactionType) API.

This doesn't change the existing behavior because redact() is still
called for NetworkSpecifiers which doesn't oevrride
getApplicableRedactions() method.

Bug: 374037595
Flag: NONE can't use simply flag guarding because the code needs to
      maintain compatibility across different mainline and platform versions

Change-Id: I30d7257b8e5880218b315ade60d2d77fed1f89fb

Kangping Dong   commited 2025-09-12 15:06:00 +08:00
997c5651d0
[connectivity] move redaction to createWithLocationInfoSanitizedIfNecessaryWhenParceled
This commit has almost no behavior changes, because:

1. usage of networkCapabilitiesRestrictedForCallerPermissions is
   either wrapped by
   createWithLocationInfoSanitizedIfNecessaryWhenParceled or
   getNetworkCapabilitiesInternal.
2. All usages of getNetworkCapabilitiesInternal is either wrapped by
   createWithLocationInfoSanitizedIfNecessaryWhenParceled or the
   redacted info in the return value is not used by its caller
3. The only exception for getNetworkCapabilitiesInternal is that it is
   used in simulateDataStall() which checks the underlying network but
   underlying network in the NetworkCapabilities can be redacted by
   networkCapabilitiesRestrictedForCallerPermissions. Removing redaction
   from getNetworkCapabilitiesInternal() will loose the current permission
   requirement but this is wanted as the existing implementation has
   stricter permission requirements than the API signature declares and
   this CL fixes it

Bug: 374037595
Flag: NONE no behavior change but only bug fix
Change-Id: I80491d26ed7d11cb3fe1850ef7be9ae7600d5dd5

Kangping Dong   commited 2025-09-12 15:06:00 +08:00
b9c6df36de
[connectivity] add permission check on requested NetworkSpecifier
This commit adds permission check for new NetworkSpecifier subclasses
which override the new redact(long) method. It throws SecurityException
if the caller doesn't hold the permissions to use the sensitive info in
the NetworkSpecifier class.

Bug: 374037595
Flag: NONE can't use simply flag guarding because the code needs to
maintain compatibility across different mainline and platform versions

Change-Id: Ife8efab3e99adf41d7522fedbde3b4ec80045c77

Kangping Dong   commited 2025-09-12 15:06:00 +08:00
d2c9202a9b
CCT VPN bypass for Android U and below
Implements logic to allow CCT to bypass VPN on Android U (API 34) and
older. On these Android versions, netd's VPN bypass APIs
(networkSetProtectAllow/Deny) operate globally.

Test: TH
Flag: NONE legacy flag protected
Change-Id: I3650c3823d65504046d74cd60485d9cc890937d8

Yuyang Huang   commited 2025-09-12 12:00:35 +09:00
7daab8cc60
Fix VPN bypass by updating VPN filter
This commit addresses an issue where the VPN bypass feature was not
functioning correctly. The VPN filter has been updated to properly
handle bypass rules, ensuring that designated traffic can now bypass the
VPN as intended.

Test: TH, manual
Flag: EXEMPT guarded by default-off legacy flag
Change-Id: Ie6073db4e23a3132042da21c25b696fa3abc4c91

Lorenzo Colitti   authored and   Yuyang Huang   commited 2025-09-11 11:50:05 +09:00
e4f5f85647
Refactor: Use SdkUtil.isAtLeast25Q4 in ConnectivityService
This change simplifies the code by calling `SdkUtil.isAtLeast25Q4()`
instead of having redundant check in
ConnectivityService.Dependencies#isAtLeast25Q4.

Test: Existing tests pass.
Bug: 443099706
Flag: EXEMPT PURE_REFACTOR
Change-Id: I2c581e24982f8f0df0cb023e2e3e4f37015d2f4a

Sarup Dalwani   commited 2025-09-04 19:05:38 +00:00
acaa7ba313
[Thread] add REDACT_FOR_THREAD_NETWORK_PRIVILEGED
This is used for redacting sensitive Thread info in
ThreadNetworkSpecifier (to be added in ag/34224158)

Bug: 374037595
Flag: EXEMPT new code is not used
Change-Id: I606d59fc5259c79bddaa51ca0c270684dd3b674a

Kangping Dong   commited 2025-09-02 21:23:21 +08:00
138e10e3ba
Passing isLocalRoute to netd add,remove and update route.
ConnectivityService would be centralized location for deciding local
network so for this effort passing isLocalRoute parameter to
routecontroller in netd for route addition, removal and modification.

Bug: 394308861
Test: Manually tested.
Test: atest ConnectivityCoverageTests
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivityservice.CSLocalRouteTest
Test: atest netd_integration_test
Flag: EXEMPT Using device config kill-switch
Change-Id: I9f11882665375bba10fa369c2e25f374b5e63661

Sarup Dalwani   commited 2025-08-28 14:59:26 +00:00
169a584691
Merge changes I105ee1d6,I55817132 into main
* changes:
  Update ENABLE_MATCH_NON_THREAD_LOCAL_NETWORKS flag to target sdk 37
  Adopt mainline beta program for local network agent

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-21 10:28:00 -07:00
14debeb714
Update ENABLE_MATCH_NON_THREAD_LOCAL_NETWORKS flag to target sdk 37
The ENABLE_MATCH_NON_THREAD_LOCAL_NETWORKS compatibility flag is
now enabled for apps targeting SDK 37 or higher.

Previously, this flag was configured to enable for
Baklava (SDK 36) or higher. This is no-op because
there is no tethering network agent presents.

While the tethering network agents planned to be enabled in
25Q4, this adjustment allows developers sufficient time
to adapt to the behavior change where NetworkRequests
will match non-Thread local networks.

Flag: com.android.tethering.mainline.beta.tethering_and_p2p_go_local_agent
Test: atest ConnectivityCoverageTests --update-device \
      --test-filter '.*Connectivity.*'
Bug: 420590461
Change-Id: I105ee1d677c6beb12b4dccd109c01ef5ff2717d3

Junyu Lai   commited 2025-08-19 14:16:23 +08:00
1c513a6a6f
Merge "Allow app-specific network creation with a new permission" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-14 23:04:19 -07:00
6f57c71c68
Allow app-specific network creation with a new permission
If an app registers a network agent and doesn't have NETWORK_FACTORY or
PERMISSION_MAINLINE_NETWORK_STACK, but does have
CREATE_APP_SPECIFIC_NETWORK, ConnectivityService will:
- Allow it to create a network
- Force the capabilities to contain only the app's UID
- Force the network to be restricted
- Ignore attempts to change the UID or make the network non-restricted

Test: TH
Flag: android.net.platform.flags.create_app_specific_network_permission
Bug: 435313135
Change-Id: I5a9517515e64f799c88aca4a51636b1a08e15817

Motomu Utsumi   commited 2025-08-15 12:54:49 +09:00
72d4b516c9
Merge "Use mainline beta flag for NetworkAgent event queueing" into main
Junyu Lai   authored and   Android (Google) Code Review   commited 2025-08-14 01:19:15 -07:00
0c6b14587b
Merge changes I69ad789f,I5954b196 into main
* changes:
  Fix mobile data preferred on multi-user devices.
  Support multi-user SettingsObservers in ConnectivityService

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-14 00:33:06 -07:00
4c516ffd67
Use mainline beta flag for NetworkAgent event queueing
Add `queue_network_agent_events_in_system_server` as a mainline beta
flag. This flag replaces the previous check for
`mQueueNetworkAgentEventsInSystemServer`, allowing the feature to be
controlled and enabled on all Android versions via mainline beta program.

Flag: com.android.tethering.mainline.beta.queue_network_agent_events_in_system_server
Test: atest ConnectivityCoverageTests --update-device \
      --test-filter '.*NetworkAgent.*'
Test: atest ConnectivityCoverageTests --update-device \
      --test-filter '.*Connectivity.*'
Fix: 428098184
Change-Id: I96b0443bd4c55c28d482349738bbdc4798f0c7f9

Junyu Lai   commited 2025-08-14 14:53:06 +08:00
c9890408bf
Fix mobile data preferred on multi-user devices.
The mobile data preferred feature stores the list of UIDs in
Settings.Secure, which is per-user. But the code only sets, reads
and observes the setting for the current user instead of for all
users. This does not work on HSUM or automotive.

Fix this as follows:
- Register the ContentObserver on UserHandle.ALL
- Any time the observer fires, read the setting on all current
  users, and operate on the merged result.
- Ensure that the code gets called on ACTION_USER_ADDED and
  ACTION_USER_REMOVED.

Because the code now aggregates the setting for all UIDs, it
should just work on single-user devices. It should also work if
there are OEM devices that store all UIDs (for all users) in
Settings.Secure for user 0.

Because the bug is fixed, re-enable the test on automotive.

Also fix style nits.

Fix: 404186833
Flag: EXEMPT bug fix
Test: covered by existing CTS tests
Change-Id: I69ad789f1c7c7f3bab04ab8789dfb93ee0de553d

Lorenzo Colitti   commited 2025-08-08 15:36:55 +09:00
2139fcf345
Support multi-user SettingsObservers in ConnectivityService
ConnectivityService uses SettingsObservers to detect when
settings change. These are all set on user zero. This is fine
for most settings, which are in Settings.Global, but some
settings are per-user, such as MOBILE_DATA_PREFERRED_UIDS, which
is in Settings.Secure.

This CL adds the ability to register SettingsObservers on all
users. These observers will fire any time the setting changes
for any current user, and any time a user is added or removed.

This CL does not add or change any SettingsObservers and should
cause no behaviour changes.

Bug: 404186833
Flag: EXEMPT refactor
Test: covered by existing tests
Change-Id: I5954b196eea776414098f1ce4441eb02065438ef

Lorenzo Colitti   commited 2025-08-08 15:36:54 +09:00
aad9267493
Merge "Make callers of RoutingCoordinatorService pass in RouteInfoParcel" into main
Sarup Dalwani   authored and   Android (Google) Code Review   commited 2025-08-06 07:45:24 -07:00
a4f34a8836
Merge "Use reported satellite suspended and roaming state" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-08-06 00:29:17 -07:00
2d94e180e7
Make callers of RoutingCoordinatorService pass in RouteInfoParcel
RoutingCoordinatorService's {add,remove,update}Route methods
all end up calling netd's *RouteParcel methods.

Make callers explicitly generate and pass in the parcel to the
manager class instead of having them pass in a RouteInfo and
having the service class convert the RouteInfo to a parcel.

Also remove the {add,remove,update}Route methods from
RoutingCoordinatorManager since they are unused.

This is a no-op refactor that simplifies upcoming changes.

RoutingCoordinator is not a stable interface and is not used
across the platform/mainline boundary, so there are no version
skew considerations.

Bug: 394308861
Test: atest ConnectivityCoverageTests
Flag: EXEMPT no-op refactor
Change-Id: Iedf4c9bc28c3fc8c289db421857acddc8c694990

Lorenzo Colitti   commited 2025-08-06 15:57:36 +09:00
8f8e59abf7
Use reported satellite suspended and roaming state
Bug: 431296970
Test: TH
Flag: EXEMPT mainline
Change-Id: I4d828bad6419aa2d12bff6f1855314c0060af3f7

Motomu Utsumi   commited 2025-08-06 09:53:30 +09:00
f9065b8898
Use FakeSettingsProvider callbacks to simplify CS tests.
Because FakeSettingsProvider and other test infrastructure did
not support settings observers, the tests called internal
ConnectivityService methods to cause the settings to be re-read.
Now that FakeSettingsProvider supports callbacks, use
ContentResolverWithFakeSettingsProvider in the CS tests and just
use the callbacks.

Bug: 397521796
Flag: TEST_ONLY
Test: test-only change
Change-Id: I26d8e98706fec99aa423721bf1474af2f9b60099

Lorenzo Colitti   commited 2025-08-05 18:02:02 +09:00
6e3afc7dc6
Use beta flag for bluetoothTetheringRandomizedAddress
Bug: 287177081
Test: TH
Flag: com.android.tethering.mainline.beta.bluetooth_tethering_randomized_address
Change-Id: I1de9f4bb15c8423f09381a0c7513f0d7ebf80856

Motomu Utsumi   authored and   Hao Liu   commited 2025-07-17 21:30:07 +00:00
4b4f3018a5
Disconnect a network if it's suspended for 5 minutes for wear
The suspension state is designed to be a transient state. Implement an
enforcement to disconnect the network after staying at this state for 5
minutes. This can avoid apps unnecessarily waking up the device for
network activities even when there's no network actually connected.

Test: unit tests. Locally tested with a signal blocking bag.
Bug: 404570281
Flag: EXEMPT mainline
Change-Id: I1427a72402f7ec64eda537a89c86768466a72328

Hongyi Zhang   commited 2025-07-15 09:39:37 -07:00
3dcb3c5890
Pass bluetoothUseRandomAddress via RoutingCoordinator constructor
This refactoring changes how the bluetoothUseRandomAddress flag is
accessed.

PrivateAddressCoordinator is in a library used by multiple mainline
modules(Tethering, NetworkStack, CaptivePortal, WiFi) and cannot
directly read a Tethering mainline beta flag.

To fix this, the flag's value is now passed down through constructors.

An alternative solution would be to split the Java library for each module,
but with this solution, a single utility class cannot be shared.

This commit is a no-op as the passed value is hardcoded to false.

Test: TH
Flag: EXEMPT refactor
Bug: 287177081
Change-Id: I5f2174ee94b55e7a7298b9742221d6e6c3c5cac5

Motomu Utsumi   commited 2025-07-15 11:20:01 +09:00
323d22a497
Merge "ArrayMap for mIpToNetworksMap" into main
Sewook Seo   authored and   Android (Google) Code Review   commited 2025-07-07 04:49:48 -07:00
adfbfab056
Merge "[connectivity] refactor ensureSufficientPermissionsForRequest()" into main
Kangping Dong   authored and   Android (Google) Code Review   commited 2025-07-07 01:02:40 -07:00
ffe9cfb209
[connectivity] refactor ensureSufficientPermissionsForRequest()
This a pure refactor commit that it adds two more parameters to the
existing ensureSufficientPermissionsForRequest() method to prepare it
for permission checking on NetworkSpecifiers.

The new parameters are not used in this CL and there are behavior
changes.

Bug: 374037595
Flag: EXEMPT pure refactor, no behavior changes
Change-Id: Ieb747794e250df9454b21f7c5a68fff590b70338

Kangping Dong   commited 2025-07-07 14:31:45 +08:00
1bc657fa4b
ArrayMap for mIpToNetworksMap
Use ArrayMap for mIpToNetworksMap instead of HashMap
for better memory efficiency and performance.

Bug: 429496715
Flag: EXEMPT trivial chage
Test: atest ConnectivityCoverageTests
Change-Id: I7a988ce16ef5d6c8fbd6b88ea0a2e932de07ad98

Sewook Seo   commited 2025-07-06 17:13:45 +00:00
4a56e548dd
Merge "Address review comment at ag/34147135" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-07-03 23:56:09 -07:00
fd334b90f7
Address review comment at ag/34147135
This includes:
1. Fix Race Condition: The call to `logRequest` is moved before
   `trackUidAndRegisterNetworkRequest`. This prevents a race condition
   where the `NetworkRequest` object could be modified on the handler
   thread before its initial state was logged.

2. Clear Metrics on Pull: The metrics map is now cleared after the
   data is pulled. This changes the atom from a cumulative
   counter to a periodic one, simplifying server-side aggregation.

Bug: 406172997
Flag: EXEMPT controlled by the `satisfied_by_local_network_metrics`
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSSatisfiedByLocalNetworkMetricsTest \
  ConnectivityCoverageTests:android.net.connectivity.com.android.metrics.SatisfiedByLocalNetworkMetricsTest \
  --update-device
Change-Id: Ia3b74088183c95173ab07a4f72393065bca2bafe

Junyu Lai   commited 2025-07-03 17:18:47 +08:00
cf8688deab
Merge "Use NETWORK_STACK permission for broadcast receivers" into main
Junyu Lai   authored and   Android (Google) Code Review   commited 2025-07-01 22:58:04 -07:00
18e2c70d3b
Add metrics for requests satisfied by local networks
This change introduces `SatisfiedByLocalNetworkMetrics` to count the
number of `NetworkRequest`s per UID that can be satisfied by a
local-only network.

The purpose is to gather data on how many applications register callbacks
that would match non-thread local network connectivity.
This data helps in understanding app behavior and can inform
future development of local-only network features particularly
for the backward compatibility of existing NetworkRequests.

- A new class `SatisfiedByLocalNetworkMetrics` handles the counting and
  logging logic.
- `ConnectivityService` calls into this class upon `NetworkRequest`
  registration.
- Counts are logged to statsd.

Sample dumpsys output:
  SatisfiedByLocalNetworkMetrics: {LISTEN={10217=2}}

Bug: 406172997
Flag: EXEMPT controlled by the `satisfied_by_local_network_metrics`
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSSatisfiedByLocalNetworkMetricsTest \
      ConnectivityCoverageTests:android.net.connectivity.com.android.metrics.SatisfiedByLocalNetworkMetricsTest \
      --update-device
Test: m statsd_testdrive && statsd_testdrive -e 10247
Test: Manual: atest dumpsys connectivity

Change-Id: I62f6299a1c726537b373e3e80d41a494323f3cf2

Junyu Lai   commited 2025-07-01 16:01:28 +08:00
c00cf63e8a
Use NETWORK_STACK permission for broadcast receivers
Use the NETWORK_STACK permission instead of null when registering
broadcast receivers in ConnectivityService, PermissionMonitor and
BroadcastReceiveHelper.
This ensures that only components with the NETWORK_STACK permission
can send these protected broadcasts, improving system security.
Tests were updated to reflect the new permission requirement.

Flag: EXEMPT trivial change
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.BroadcastReceiveHelperTest \
      ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.PermissionMonitorTest \
      --update-device
Fix: 425828059
Change-Id: I9761f9f454751761b346e255aac0d1c7d7a7e30c

Junyu Lai   commited 2025-06-28 06:40:14 +08:00
ca5a062321
Do not try to send updated allowed ranges for destroyed networks
Test: TH
Bug: 420229020
Flag: EXEMPT bugfix
Change-Id: Ibc1c4cf2d94afe86f22b515ac0b91c85f6506f8e

Chalard Jean   commited 2025-06-17 13:53:42 +09:00
4d2887b593
Compare InetAddress to update mIpNetworksMap
Since we update network lists mapped to InetAddress(mIpNetworksMap) for
socket destruction, compareAllAddresses should compare InetAddress list
instead of LinkAddress one.

Bug: 373280981
Flag: android.net.platform.flags.connectivity_service_destroy_socket
Test: atest ThreadNetworkIntegrationTests
Change-Id: I2ea0cce3cc2be648b142e3e9b17e9260f0d4ef96

Sewook Seo   commited 2025-06-10 09:14:45 +00:00
af5eba5be2
Test refactoring of DefaultNetworkRematchMetrics
This change includes:
 1. addEvent Parameter Update: Added satisfied duration to
    addEvent, making duration testable in CSTest.
 2. CSDefaultNetworkRematchMetricsTest Refactor: Tests now use
    expectAddEvent with argThat and InOrder for more deterministic
    verification.
 3. New Unit Test: Added a test to demonstrate a metrics reporting
    issue during per-app default network request updates.

Test: atest ConnectivityCoverageTests --test-filter 'DefaultNetworkRematch*' \
      --update-device
Flag: EXEMPT Test only refactoring
Bug: 419123367
Change-Id: I3c73b445674991f85e37b3f980fa80fb918713ac

Junyu Lai   commited 2025-06-06 16:45:51 +08:00
d4c521ab43
Fix SatisfiedTime initialization
mSatisfiedTime now initializes with the current time upon NRI
creation, or copied when the copy constructor is called.

Test: atest ConnectivityCoverageTests --test-filter 'NetworkRequestInfo*' --update-device
Flag: EXEMPT controlled by kill switch
Bug: 419123367
Change-Id: If707b96bf6ce5c6cb0287d5c2d6056591dd6769f

Junyu Lai   commited 2025-06-06 16:04:03 +08:00
1ff0c98745
Report DefaultNetworkRematch for satellite network
This change introduces the `DefaultNetworkRematchMetrics`
class to collect and log data about default network reassignments.

The primary motivation is to monitor the behavior of satellite
networks when they act as a default network fallback. This class
records an event whenever a default network request with the
`PREFERENCE_ORDER_SATELLITE_FALLBACK` preference is moved from
one network to another.

For each reassignment, a `DEFAULT_NETWORK_REMATCH` atom is logged
to ConnectivityStatsLog. This atom includes detailed `NetworkDescription`
protos for the old and new networks, capturing their transport
types, capabilities, and metered/validated states. It also logs
the duration the device spent on the previous network.

Sample metrics:
event_metrics {
  data {
    aggregated_atom_info {
      atom {
        default_network_rematch {
          session_id: 1099094483789245667
          rematch_reason: RMR_UNKNOWN
          default_network_rematch_info_list {
            default_network_rematch_info {
              old_network {
                transport_types: 1
                metered_state: METERED_YES
                validated_state: VS_VALID
                score_policies: -4575657221408423932
                capabilities: 137711448064
                enterprise_id: 0
              }
              time_duration_on_old_network_sec: 9
              uid_ranges {
                uid_range {
                  begin: 10137
                  end: 10137
                }
              }
            }
          }
        }
      }
      elapsed_timestamp_nanos: 73821951490
    }
  }
}

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.metrics.DefaultNetworkRematchMetricsTest  \
      --update-device
Test: Manual:
   1. Change code to use TRANSPORT_CELLULAR
   2. m statsd_testdrive && statsd_testdrive -e 525
   3. Turn off mobile data.
Flag: EXEMPT controlled by kill switch
Bug: 419123367
Change-Id: I40ba78d81cd30b2dc783e855aa76e776f76ace98

Junyu Lai   commited 2025-06-05 02:22:03 +08:00
7516d81c87
Report satellite coarse usage
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.metrics.SatelliteCoarseUsageMetricsCollectorTest \
      --update-device
Test: atest ConnectivityCoverageTests --test-filter 'CSTest*' --update-device
Test: atest ConnectivityCoverageTests --test-filter 'ConnectivityService*' --update-device
Test: Manual:
  1. Change code to use TRANSPORT_CELLULAR
  2. m statsd_testdrive && statsd_testdrive -e 1102
  3. Turn off mobile data.
Flag: EXEMPT controlled with kill switch
Bug: 419123367
Change-Id: I264efa6802612809fdbff22901f31447f370bbe5

Junyu Lai   commited 2025-05-31 16:37:59 +08:00
bb589cf33c
Merge changes from topic "destroy_socket_at_cs" into main
* changes:
  Destroy sockets lacking permission at CS.
  Destroy sockets with nlmsg RTM_DELADDR
  Destroy sockets with NetworkAgent update event
  Add a Map to NetworkAgent list for IP address
  Add socket destroying methods to InetDiagMessage.

Sewook Seo   authored and   Android (Google) Code Review   commited 2025-05-30 16:00:11 -07:00
13e6742742
Destroy sockets lacking permission at CS.
Move destroying socket logic for lacking permission to CS from netd

Bug: 373280981
Bug: 331139818
Flag: android.net.platform.flags.connectivity_service_destroy_socket
Test: atest ConnectivityCoverageTests
Test: device test

Change-Id: Id933d51d6175958a1b78443360858db577319622

Sewook Seo   commited 2025-05-29 20:15:47 -07:00
34ef7dbd1b
Destroy sockets with nlmsg RTM_DELADDR
Destroy sockets that matched to netId less than MIN_NET_ID for the non
link local address in RTM_DELADDR.
Destroy sockets on link local address with the corresponding interface
ID.

Bug: 373280981
Bug: 331139818
Flag: android.net.platform.flags.connectivity_service_destroy_socket
Test: atest ConnectivityCoverageTests
Test: device test
Change-Id: I4d8127fc693f8b32f815c5cddbae0b64deeb23e5

Sewook Seo   commited 2025-05-29 20:14:13 -07:00
fe1f5cbf32
Destroy sockets with NetworkAgent update event
Destroy platform managed sockets on the removed IP address based on NetworkAgent update.

Bug: 373280981
Bug: 331139818
Flag: android.net.platform.flags.connectivity_service_destroy_socket
Test: atest ConnectivityCoverageTests
Test: device test
Change-Id: I6a1d2d0c25c130c2747d66bee203b0408e2fa0da

Sewook Seo   commited 2025-05-30 03:10:38 +00:00
1af98cb493
Add a Map to NetworkAgent list for IP address
Keeping a map from IP addresses to the list of NetworkAgentInfos that have
that IP address in their LinkProperties.

Bug: 373280981
Bug: 331139818i
Flag: android.net.platform.flags.connectivity_service_destroy_socket
Test: atest ConnectivityCoverageTests
Test: device test
Change-Id: I1e39ce00d8bc49252df8088efc768804ae9ee0a8

Sewook Seo   commited 2025-05-27 22:59:43 +00:00
720ccd2b32
Fill Opt-in uid count in ConnetivityStateSample
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.metrics.ConnectivitySampleMetricsTest \
  --update-device
Flag: EXEMPT controlled with kill switch
Bug: 419123367
Change-Id: I95376e30e160b4db00d018a0919be98b37d44e5e

Junyu Lai   commited 2025-05-27 17:41:47 +08:00
5b061066c9
Add atom definition for satellite access info
These fields are needed to answer:
  1. Opt-in uid count in the device
  2. How often do apps get on the satellite network

Test: TH
Flag: EXEMPT atom definition only change
Bug: 419123367
Change-Id: Iefebaa0d54b4b616e1b2a64a3357a0102ef61c1d

Junyu Lai   commited 2025-05-24 11:35:19 +08:00
0c5d445486