Commit graph android_packages_modules_Co.../Vcn/tests/unit/java
Message SHA1
Log validated underlying network count that's available for VCN underlying network selection
Flag: EXEMPT METRICS
Test: atest FrameworksVcnTests, CtsVcnTestCases
Bug: 288600040
Change-Id: Ia1b51aa64388bc5c167f3a1081d8683d98fe0bef

Hnin Naing   commited 2025-09-12 22:50:11 +00:00
4ab80490ae
Log when VcnGatewayConnection is torn down, with reason
Flag: EXEMPT METRICS
Test: atest FrameworksVcnTests, CtsVcnTestCases
Bug: 288600040
Change-Id: I23b3edf9a2c128a7f8adabef3853fbe0be4a3193

Hnin Naing   commited 2025-09-11 18:26:04 +00:00
7602406ec8
Log VCN network validated and not validated events.
Flag: EXEMPT METRICS
Test: atest FrameworksVcnTests, CtsVcnTestCases
Bug: 288600040
Change-Id: I574db304dc8377e70500f52f52d9b14934e5182a

Hnin Naing   commited 2025-09-09 16:49:17 +00:00
f0c44cb378
Log VCN Gateway Connection safe mode transitions.
This change adds logging for when a VcnGatewayConnection enters and
exits safe mode.

Flag: EXEMPT METRICS
Test: atest FrameworksVcnTests, CtsVcnTestCases. go/atomtester
Bug: 288600040
Change-Id: I6423b9fe7a1785fe31b363c8acb0b99f8d5f7df3

Hnin Naing   commited 2025-09-04 14:34:38 -07:00
3a3a2376d5
Merge "Use Sdk36ModuleController to ensure VCN UT is only updated on B/B+" into main am: 488a149911 am: 915abab4fd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3534300

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

Yan Yan   authored and   Automerger Merge Worker   commited 2025-03-14 10:48:25 -07:00
cc2a3c838c
Use Sdk36ModuleController to ensure VCN UT is only updated on B/B+
Bug: 396782079
Test: v2/mainline-engprod/apct/mainline/tethering/R/device-all-gce
      test skipped
Test: preubmit
Flag: EXEMPT; test code
Change-Id: I0fb4cfb8ba300bb3d361536377fda5f9f0f8c3d9

Yan Yan   commited 2025-03-10 18:28:43 -07:00
f45dc00cd8
Merge "frameworks/base: remove deprecated Mockito usages" into main
Adrian Roos   authored and   Android (Google) Code Review   commited 2025-03-09 17:20:22 -07:00
9e3555bb97
frameworks/base: remove deprecated Mockito usages
Test: m checkbuild
Flag: TEST_ONLY
Bug: 310268946
Change-Id: Id68adb5ab554a8031f8d03f6158c0e9ffa03604c

Adrian Roos   commited 2025-03-05 06:01:15 -08:00
71f5ad53d9
Skip some VCN unit tests on user builds
Configuring restricted transport types is for experiments purposes and
only allowed on a debuggable build. This patch ensures relevant unit
tests are skipped on user builds.

Since the experimental configurability is no longer needed anymore, there will be followup CLs to remove the feature and the tests.

Bug: 397874808
Test: run mts-user -m FrameworksVcnTests on a BP2A.250218.001 user build
Flag: EXEMPT; test code change
Change-Id: I9ca23b2901d740d3ddc5ba4febba4a300e0812bb

Yan Yan   authored and   Nathan Harold   commited 2025-02-27 11:33:21 -08:00
32fef6574f
Add VCN UT to mts-tethering
This patch adds FrameworksVcnTests to tethering MTS. Consequently,
these tests will be monthly updated and installed with Tethering
module on all Android R/R+ devices. Thus the patch also adds
SDK checks to make sure the mainline updated tests will be skipped
if SDK <= Android V, to avoid compatability issues.

Bug: 376896491
Test: lunch mainline_modules_arm64-mainline-userdebug &&
      m mts && mts-tradefed run mts-tethering;
      Verified on V and B
Flag: EXEMPT; test code change
Change-Id: Ied3596e0e63d8333c4d1019b96284b1c3547b23b

Yan Yan   commited 2025-02-13 13:25:44 -08:00
f00db40040
Remove Unused 'times' Import
Remove an unused import due to changes in code review.

Bug: 8675309
Test: compilation
Flag: exempt Trivial cleanup
Change-Id: I69b580de6725cad29af6dd17bc10deccf95cdda4

Nathan Harold   commited 2025-01-14 13:37:00 -08:00
3f24d36a3f
Unregister DeviceIdle Receiver in IpSecPacketLossDetector
Ensure that when the IpSecPacketLossDetector cleans up due to the
underlying network changing, that the broadcast receiver it's listening
to is cleaned up. Previously this would leak broadcast receivers.

Based on inspection, all instances that touch the BroadcastReceiver
are done on the same looper, so we shouldn't need to guard the creation
and destruction of the receiver.

Also, stop closing the monitored IpSecTransform. The monitor should not
have been closing the transform in the first place. Most of the time it
isn't an issue; however, in the event of MOBIKE, the transform will
remain open, so this is a functional bug.

Bug: 389208101
Test: atest IpSecPacketLossDetectorTest:testClose
Flag: EXEMPT bugfix
Change-Id: I26245960c36eaa0557d377b1672cc76ab0f70b03

Nathan Harold   commited 2025-01-13 16:48:07 -08:00
08d7eed3d5
Migrate VCN to separate non-updatable libraries
This patch migrates VCN framework code from framework-minus-apex
to framework-connectivity-b, and VCN service code to
service-connectivity-b-pre-jarjar. This patch is part of the work
to move VCN to the Tethering module.

Design doc: go/mainline-vcn-eng-design

Bug: 369703242
Test: FrameworksVcnTests, CtsVcnTestCases, CtsStrictJavaPackagesTestCases
Flag: EXEMPT code refactoring; no functional change
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5abd00b03916d15495a96b25f17f98e6e9a5317b)
Change-Id: I747556281db2efab7115761147842d241fe283de
Merged-In: I747556281db2efab7115761147842d241fe283de

Yan Yan   commited 2024-12-02 16:40:54 -08:00
d5194f1527
Clean up safe_mode_config flag check in the functional code
This patch cleans up the flag check in the functional code. The
flag is already fully released in Android V

At the same time, the flag definition is not removed because it
is an exportable flag

Bug: 380326369
Bug: 276358140
Test: atest FrameworksVcnTests && atest CtsVcnTestCases
Flag: EXEMPT, clean up released flag
Change-Id: I985d37e192c4bc87ebd433f4de3b7fe93b039f7d

Yan Yan   commited 2024-12-02 18:50:17 +00:00
94a895c618
Move VCN utilities from services.jar to framework.jar
This patch moves the VCN utilities from the systemserver classpath
to boot classpath. In this way, the code consumers that do not
have the source code (previously framework.jar and now services.jar)
do not need to statically include the files anymore. It also removes
the burden of class jarjar

Bug: 288465472
Test: presubmit: FrameworksVcnTests, CtsVcnTestCases,
      FrameworksIkeTests, CtsIkeTestCases, VpnTest
Flag: EXEMPT code refactoring; no functional change
Change-Id: I7560a35727d62344c89f9a3b9ec9f0eb0058a1a2

Yan Yan   commited 2024-11-22 17:00:30 -08:00
d8d16c8154
Clean up fix_config_garbage_collection
To mainline VCN, we need to first change the VCN flag host
container to be the tethering module and then use a buid flag to
control whether to include VCN in the non-updatable platform or
the module. After the container changes, when VCN is still in the
platform, the VCN code can only access flags via "exported" mode,
and only API flags are exportable and accessible. Thus the
fix_config_garbage_collection flag needs to be handled

It is safe to clean up this flag because it is a low risk bug fix
and it has been in teamfood for a week with no issue being seen.

Bug: 370862489
Test: FrameworksVcnTests; CtsVcnTestCases
Flag: EXEMPT flag clean up
Change-Id: If38b46735e7b20d918b7483c16b30101416b0a6c

Yan Yan   commited 2024-11-14 08:58:42 -08:00
a940fde652
Clean up flag safe_mode_timeout_config
Bug: 317406085
Test: atest FrameworksVcnTests && atest CtsVcnTestCases
Flag: EXEMPT flag clean up
Change-Id: I2f838156ffa9a2242747f4782e4d05833674e393

Yan Yan   commited 2024-10-31 11:52:17 -07:00
2860fd1bbf
Clean up flag ipsec_transform_state
Bug: 308011229
Test: atest FrameworksVcnTests && atest CtsVcnTestCases
Flag: EXEMPT flag clean up
Change-Id: I1ebbdbbd5e4d9e17fe05bba8d9d75ffbb7c79699

Yan Yan   commited 2024-10-31 11:28:05 -07:00
f0a2597ba3
Fix VcnConfig garbage collection
The garbageCollectAndWriteVcnConfigsLocked is for removing
configs whose subgroups do not have any subscriptions. This
patch fixes the issue of it in handling race condition when
subscription changes.

Previously the garbage collection checks a subGroup's
subscriptions based on SubscriptionManager. When
SubscriptionManager and TelephonySubscriptionSnapshot are
out-of-synced, the config of an active VCN instance will be
removed. It can cause NPE in getUnderlyingNetworkPolicy. This
patch fixes it by checking subscriptions against the snapshot.

This patch also fixes the safety check in
getUnderlyingNetworkPolicy so that if VCN instance exists but
its config does not, it will not attempt querying data from
the VcnConfig

Bug: 370862489
Test: FrameworksVcnTests(new tests); CtsVcnTestCases
Flag: android.net.vcn.fix_config_garbage_collection
Change-Id: Id54adabcc1910102a2ab20c432b693a8f52c5c95

Yan Yan   commited 2024-10-30 11:16:11 -07:00
a2284ca391
Clean up flag network_metric_monitor
Bug: 282996138
Test: atest FrameworksVcnTests && atest CtsVcnTestCases
Flag: EXEMPT flag clean up
Change-Id: I300d9c391d0aeb26ca6a589960244641de76ac1b

Yan Yan   commited 2024-10-17 11:38:35 -07:00
133d92eb2c
Clean up FLAG_VALIDATE_NETWORK_ON_IPSEC_LOSS
This CL also fixes incorrect code comments

Bug: 329139898
Test: atest FrameworksVcnTests && atest CtsVcnTestCases
Flag: EXEMPT flag cleanup
Change-Id: Ib61dfbf9c3e147766530dbc519a785b8b13fac9d

Yan Yan   commited 2024-10-10 13:15:07 -07:00
56c0b9f0ec
Clean up FLAG_EVALUATE_IPSEC_LOSS_ON_LP_NC_CHANGE
Bug: 323238888
Test: atest FrameworksVcnTests && atest CtsVcnTestCases
Flag: EXEMPT flag cleanup
Change-Id: I18a6c5b32806b6cd20bfa6b5b475d220be975a7c

Yan Yan   commited 2024-10-10 11:53:55 -07:00
aa3971b14c
Clean up FLAG_ENFORCE_MAIN_USER
Bug: 310310661
Test: atest FrameworksVcnTests && atest CtsVcnTestCases
Flag: EXEMPT flag cleanup
Change-Id: I461c4167397608fffbf366c90e4d3bb42e2564f5

Yan Yan   commited 2024-10-10 11:49:41 -07:00
06dc8ecb93
Clean up FLAG_HANDLE_SEQ_NUM_LEAP
Bug: 332598276
Test: atest FrameworksVcnTests && atest CtsVcnTestCases
Flag: EXEMPT flag clean up
Change-Id: I3d0dd6251337d85a4c6f193d9a627e66024a79ab

Yan Yan   commited 2024-10-10 11:01:37 -07:00
87c094581d
Merge "Add VcnUtils to easily get WifiInfo and subId from NetworkCapabilities" into main
Yan Yan   authored and   Gerrit Code Review   commited 2024-10-02 21:19:51 +00:00
c7409c81ab
Add VcnUtils to easily get WifiInfo and subId from NetworkCapabilities
This is a preparation CL for mainlining VCN. This patch adds utility
methods for callers to easily get WifiInfo and subId. It also adds
a Builder class that will be exposed as a @SystemApi in a followup
CL.

Bug: 369710077
Test: atest FrameworksVcnTests(new tests) && atest CtsVcnTestCases
Flag: Exempt low risk utilities for pure refactoring
Change-Id: I257b031dabfc48286e8bae2a0854c81aca2f189c

Yan Yan   commited 2024-10-01 17:28:04 -07:00
1f76313177
Expose getPackagesWithCarrierPrivileges as @SystemApi
This is a preparation CL for moving VCN to mainline

Bug: 366598445
Bug: 367831385
Test: atest CtsTelephonyTestCases:TelephonyManagerTest
Flag: android.os.mainline_vcn_platform_api
Change-Id: Ic6098978f034678e6f42f1777ae93d3973bc099e

Yan Yan   commited 2024-09-26 15:15:36 -07:00
c24356e348
Merge "VCN: Remove Telephony hidden API usages" into main
Yan Yan   authored and   Gerrit Code Review   commited 2024-09-16 21:04:36 +00:00
c03f2215a5
VCN: Remove Telephony hidden API usages
This patch removes three hidden API usages for moving
VCN to a mainline module. They are:
- TelephonyManager#getNetworkTypeName(int)
- TelephonyNetworkSpecifier(int)
- SubscriptionManager#isValidSlotIndex

Bug: 288465472
Test: atest FrameworksVcnTest && atest CtsVcnTestCases
Flag: EXEMPT pure refactoring
Change-Id: I09e68006461ac9c5a69eddd27f801f9ed40d15fa

Yan Yan   commited 2024-09-13 16:34:08 -07:00
895cc94d89
Clean up flag fix_crash_on_getting_config_when_phone_is_gone
Flag fix_crash_on_getting_config_when_phone_is_gone has been advanced to
next for a while and no regression is observed. Clean it up for now to
keep code healthy.

Bug: 319791612
Test: atest TelephonySubscriptionTrackerTest
Flag: EXEMPT flag clean up only
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4078c0f51a1d7d3f27534bc9026778859b7442bd)
Merged-In: I8d02430b70c1ed432826e02bc5938c6772ff1f95
Change-Id: I8d02430b70c1ed432826e02bc5938c6772ff1f95

rambowang   authored and   Android Build Cherrypicker Worker   commited 2024-09-12 02:17:44 +00:00
8e55800e9a
Clean up allow_disable_ipsec_loss_detector flag
Bug: 336638836
Test: atest FrameworksVcnTests && atest CtsVcnTestCases
Flag: EXEMPT flag clean up
Change-Id: Ifbeaf7c4baa31a782a0632345af9016f6b6456fb

Yan Yan   commited 2024-09-05 18:56:40 -07:00
e07e82c4d4
Merge "Make VCN HSUM compatible" into main
Yan Yan   authored and   Gerrit Code Review   commited 2024-05-08 21:57:42 +00:00
472ec212b1
Make VCN HSUM compatible
Require VCN to be used by a "main user" instead of a "system user"
since "system user" will no longer be a full user on HSUM devices

Bug: 310310661
Test: FrameworksVcnTests, CtsVcnTestCases on non-hsum and hsum devices
Flag: android.net.vcn.enforce_main_user
Change-Id: I5abfa7ba82055cd953083b1ab3f83e61bafd8a55

Yan Yan   commited 2024-05-07 18:40:04 +00:00
0468b73169
Support disabling IPsec packet loss detector
Allow disabling detector for better configurability

Bug: 336638836
Test: atest FrameworksVcnTests(new tests) && atest CtsVcnTestCases
Flag: android.net.vcn.allow_disable_ipsec_loss_detector
Change-Id: Icd7183d12fb287399a500ea9c0ee4125c749275c

Yan Yan   commited 2024-05-06 19:10:07 +00:00
d978bdcffa
Merge "Check the existence of IpSecTransformState API with try catch" into main
Yan Yan   authored and   Gerrit Code Review   commited 2024-04-17 23:37:38 +00:00
1329b275e7
Check the existence of IpSecTransformState API with try catch
IpSecTransformState is a new API that exposed from a mainline module.
Ideally before SDK finalization, platform should check the API flag
com.android.net.flags.ipsec_transform_state before calling the API.
However the flag is defined in mainline module is not accessible from
the platform. Thus previously a placeholder flag was used.

This patch removes the usage of the placeholder flag. Instead the
code will check the availability of the API with a try catch block

Bug: 328844044
Test: atest FrameworksVcnTests && atest CtsVcnTestCases
Flag: NONE mainline API flag not accessible; using try catch
      block to gate the behavior
Change-Id: Ibbcb14817a6d714cdc99cf0894f1fc935a602a2c

Yan Yan   commited 2024-04-17 18:36:32 +00:00
95d50c97ef
VCN: Ignore packet loss detection when there is too few traffic
When the expected received packet number is smaller than 10, the
packet loss detection result will be ignored because the sample
size is too small to ensure a reliable result.

This patch also fixes the bug where the detector does not update
ths packet loss threshold when carrier config updates

Bug: 332598276
Test: atest FrameworksVcnTests && atest CtsVcnTestCases
Change-Id: Iccc47e83c48699d139029420572e2a2616c357cd

Yan Yan   commited 2024-04-13 03:06:33 +00:00
aab9cbd2a5
VCN: Handle sequence number leap in packet loss detector
This pacth enables IPsec packet loss detector to handle the case when
there is an intentional sequence number leap on the server's downlink.

Previously the detector assumes that sequence number will always
increase consecutively, which is not true. During load balancing the
server might add a big leap on the sequence number intentionally. In
such case a high packet loss rate does not always indicate a lossy
network. At the same time, a low loss rate does mean the network is
not lossy

Bug: 332598276
Test: atest FrameworksVcnTests (new tests) && atest CtsVcnTestCases
Change-Id: I163cb274d293a305499fd60f7ad6eed394af5a4d

Yan Yan   commited 2024-04-13 02:40:54 +00:00
7e52cc07b1
VCN: Refactor getPacketLossRatePercentage to return an object
Refactor getPacketLossRatePercentage to return an object instead of
an integer. This is for extending the Packet Loss Detector's ability
to handle inbound sequence number leap

This patch does not include any behavior changes

Bug: 332598276
Test: atest FrameworksVcnTests && atest CtsVcnTestCases
Change-Id: Ied42e581fb331ab0603225865236779f50cc4881

Yan Yan   commited 2024-04-12 17:57:14 +00:00
3a3b3fc2a4
Re-evaluate IPsec packet loss on LP/NC change
Bug: 323238888
Test: atest FrameworksVcnTests(new tests)
Change-Id: I83f2da42fe0ffed5d4403429e968510c7eeabec1

Yan Yan   commited 2024-03-22 01:51:32 +00:00
2434557b2a
Re-evaluate network when IPsec loss exceeds the threshold
Bug: 329139898
Test: atest IpSecPacketLossDetectorTest (new tests)
Change-Id: Icc31fe7f1b76e7849c910b3cd1c300bcf4c1f3a3

Yan Yan   commited 2024-03-21 19:51:54 +00:00
4e057c24f0
Fix VCN crash when retrieving carrier config while phone is gone
This CL calls CarrierConfigManager.getCarrierConfigSubset instead of
getConfigForSubId to guard against crashing when phone process has gone.

The former method is designed for system components to retrieve carrier
configs with consideration of phone process may be gone (e.g. during
rebooting from previous crash).

Bug: 319791612
Test: atest TelephonySubscriptionTrackerTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ee3f52163f38d541e089b379ac50405fc07da672)
Merged-In: I784610b243db2a666c1fe89b1438950a2f6a1478
Change-Id: I784610b243db2a666c1fe89b1438950a2f6a1478

rambowang   authored and   Android Build Cherrypicker Worker   commited 2024-03-20 18:41:14 +00:00
c81d89f71f
Merge "VCN: Adopt the API name changes of IpSecTransformState" into main
Yan Yan   authored and   Gerrit Code Review   commited 2024-02-16 01:12:21 +00:00
bb7ce6ac6c
Remove aconfig flags for Connectivity FlaggedAPI annotations
Split flags.aconfig to platform flags and module flags.
Platform flags are used from platform code.
Module flags are used for FlaggedAPI annotations in modules.

Bug: 321624552
Test: TH
Merged-In: Ie8e0f911d0f7d7e81d108b8e8ab539b29a255ad0
Change-Id: Ic868b70b3be10d4e394f005cd55a858acc7ba14d

Motomu Utsumi   commited 2024-01-25 17:05:25 +09:00
a564eb57ac
VCN: Adopt the API name changes of IpSecTransformState
Update VCN to adopt the API changes that include:
- getIpSecTransformState -> requestIpSecTransformState
- getTimestamp -> getTimestampMillis

Bug: 316603231
Test: atest FrameworksVcnTests; atest CtsVcnTestCases
Change-Id: I2498154c37ec2d8f8906a10cb3392326123619e8

Yan Yan   commited 2024-01-17 00:40:48 +00:00
7dc0edd143
Enable NetworkMetricMonitor and support penalizing networks
This CL integrates the IpSecPacketLossDetector into VCN
route selection. With this change, when a data stall is
reported, the network candidate will be penalized and
then deprioritized during network selection. A network
candidate will stop being penalized until it hitting a timeout
or passing the validation.

Bug: 282996138
Test: atest FrameworksVcnTests(new tests), CtsVcnTestCases
Change-Id: Ifabd6fdea1d5a4fea40cf929dbab7c26d37274ac

Yan Yan   commited 2024-01-11 22:50:30 +00:00
ddcf238d5e
Support IPsec packet loss detector
This CL creates an abstract class NetworkMetricMonitor and a
subclass IpSecPacketLossDetector. IpSecPacketLossDetector
is responsible for continuously monitoring IPsec packet loss
and reporting to the caller when the data loss rate surpass
a threshold. This detector allows the VCN to switch from
the underlying network that has bad quality.

This CL also defines new carrier configs that specify the
data loss threshold and detecting frequency

Bug: 282996138
Test: atest FrameworksVcnTests(new tests), CtsVcnTestCases
Change-Id: I5f4b8e1821bdbb37f0a6de6e1584f8e3c87273f3

Yan Yan   commited 2024-01-10 23:08:40 +00:00
421db12030
Merge "Refactor VCN route selection with UnderlyingNetworkEvaluator" into main
Yan Yan   authored and   Gerrit Code Review   commited 2024-01-10 22:55:43 +00:00
471203d40f
Refactor VCN route selection with UnderlyingNetworkEvaluator
This is a preparation CL that allows followup CLs to add network
metric monitors. This CL does a pure refactoring without
introducing any behavior changes

Specific changes include:
- UnderlyingNetworkEvaluator now encapsulates the calculation of
  mPriorityClass
- mIsSelected is moved from UnderlyingNetworkRecord to
  UnderlyingNetworkEvaluator
- UnderlyingNetworkListener is simplified by moving the network
  candidate out to the UnderlyingNetworkController
- NetworkPriorityClassifier now takes a "isSelected" boolean
  instead of the currently selected network candidate

Bug: 282996138
Bug: 315858972
Test: atest FrameworksVcnTests, CtsVcnTestCases
Change-Id: I8461a68f1c4260b253d84d3efed2b09c41116656

Yan Yan   commited 2024-01-10 00:12:19 +00:00
5db198824b
Support adjustable VCN safe mode timeout
Bug: 317406085
Test: atest FrameworksVcnTests(new tests), CtsVcnTestCases
Change-Id: I8f5b6cb4e8286331626d4d39b864f0298657cab6

Yan Yan   commited 2024-01-03 23:19:05 +00:00
f9532ffdbb