Commit Graph

281 Commits

Author SHA1 Message Date
Benedict Wong
42ea9e9dab Merge changes Iaeb1871b,I1687df02
* changes:
  Add restrictions on underlying networks with CarrierConfig
  Support configuring the VCN restriction policy
2022-11-21 20:11:15 +00:00
Yan Yan
29024bfb22 Add restrictions on underlying networks with CarrierConfig
This commit updates the VCN code to use CarrierConfig to
store the restriction policy configuration, and notify
policy listners when the CarrierConfig gets updated.

Bug: 239104955
Test: atest FrameworksVcnTests(new tests)
Test: atest CtsVcnTestCases
Test: manually verified by overriding carrier configs
Change-Id: Iaeb1871b7d9f5c3d1b4e5ec24cfbf79eea58256f
2022-11-18 23:08:28 +00:00
Yan Yan
1e91f8dbad Support configuring the VCN restriction policy
This commit implements the logic to support configuring
VCN restriction policy on the underlying network. This commit
also adds a stub for later CLs to add the configuration interface.

Bug: 239104955
Test: atest FrameworksVcnTests(new tests)
Test: atest CtsVcnTestCases
Change-Id: I1687df029b5bbd8f20e0e4839ba8bd1717051dcf
2022-11-18 19:21:58 +00:00
Cole Faust
7da659bb6c Fix errorprone warnings that should be errors
This commit is part of a large scale change to fix errorprone
errors that have been downgraded to warnings in the android
source tree, so that they can be promoted to errors again.
The full list of changes include the following, but not all
will be present in any one individual commit:

BadAnnotationImplementation
BadShiftAmount
BanJNDI
BoxedPrimitiveEquality
ComparableType
ComplexBooleanConstant
CollectionToArraySafeParameter
ConditionalExpressionNumericPromotion
DangerousLiteralNull
DoubleBraceInitialization
DurationFrom
DurationTemporalUnit
EmptyTopLevelDeclaration
EqualsNull
EqualsReference
FormatString
FromTemporalAccessor
GetClassOnAnnotation
GetClassOnClass
HashtableContains
IdentityBinaryExpression
IdentityHashMapBoxing
InstantTemporalUnit
InvalidTimeZoneID
InvalidZoneId
IsInstanceIncompatibleType
JUnitParameterMethodNotFound
LockOnBoxedPrimitive
MathRoundIntLong
MislabeledAndroidString
MisusedDayOfYear
MissingSuperCall
MisusedWeekYear
ModifyingCollectionWithItself
NoCanIgnoreReturnValueOnClasses
NonRuntimeAnnotation
NullableOnContainingClass
NullTernary
OverridesJavaxInjectableMethod
ParcelableCreator
PeriodFrom
PreconditionsInvalidPlaceholder
ProtoBuilderReturnValueIgnored
ProtoFieldNullComparison
RandomModInteger
RectIntersectReturnValueIgnored
ReturnValueIgnored
SelfAssignment
SelfComparison
SelfEquals
SizeGreaterThanOrEqualsZero
StringBuilderInitWithChar
TreeToString
TryFailThrowable
UnnecessaryCheckNotNull
UnusedCollectionModifiedInPlace
XorPower

See https://errorprone.info/bugpatterns for more
information on the checks.

Bug: 253827323
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I8446f9076a45ebf7e7ffa06cb0d4ddb1001b6c00
2022-11-14 17:57:30 -08:00
Yan Yan
332f738998 Add three new IKE options in IkeSessionParamsUtils
This commit updates IkeSessionParamsUtils to be able
to encode/decode IkeSessionParams with IKE_OPTION_REKEY_MOBILITY,
IKE_OPTION_AUTOMATIC_ADDRESS_FAMILY_SELECTION and
IKE_OPTION_AUTOMATIC_NATT_KEEPALIVES.

This commit can also maintain compatibility with older T IPsec
modules that do not support the two IKE_OPTION_AUTOMATIC_ options

Bug: 242231517
Test: atest IkeSessionParamsUtilsTest
Change-Id: Icadbe98b3df3cf3a80f51dc1467eb99753d82216
2022-08-19 23:52:54 +00:00
Yan Yan
006ba183f6 Revert "Add three new IKE options in IkeSessionParamsUtils"
This reverts commit de1dca7c76.

Reason for revert: This commit will be cherry picked for QPR
release and is accessing new IPsec API constants
that will not be released until mainline October train. This
commit fails to maintain the compatibility with IPsec
module that is older than the October version.
Bug: 242231517
Test: atest IkeSessionParamsUtilsTest
Change-Id: Iff0dcc32025dad3016257655205beaf2e842f24c
2022-08-19 19:08:49 +00:00
Treehugger Robot
15f9600eb6 Merge "Add three new IKE options in IkeSessionParamsUtils" 2022-08-19 02:49:04 +00:00
Yan Yan
de1dca7c76 Add three new IKE options in IkeSessionParamsUtils
This commit updates IkeSessionParamsUtils to be able
to encode/decode IkeSessionParams with IKE_OPTION_REKEY_MOBILITY,
IKE_OPTION_AUTOMATIC_ADDRESS_FAMILY_SELECTION and
IKE_OPTION_AUTOMATIC_NATT_KEEPALIVES

Bug: 242231517
Test: atest IkeSessionParamsUtilsTest
Change-Id: I0ea9fbf1e0c304a5afb563f912d2a8a49b4faad0
2022-08-17 20:37:16 +00:00
Rambo Wang
3a8a004d2a [DO NOT MERGE] Revert "Remove VCN Carrier Privilege grace period"
This reverts commit fb4a590dbc.

This change brings back the grace period built in VCN because
the carrier privileges grace period is turn off.

Bug: 229418673
Test: atest FrameworksVcnTests CtsVcnTestCases
Change-Id: I85738c969c2bf78da33beaebe5863432948b7735
2022-05-19 22:58:29 +00:00
Benedict Wong
1e3c0ae64d Add to/from disk stable format
This change adds a utility to convert persistable bundles to and from
disk-stable byte arrays.

Bug: 192078259
Test: atest FrameworksVcnTests:PersistableBundleUtilsTest
Change-Id: Ifafb7081ec6a34ce3ab8e2aa502d46411405cb6d
(cherry picked from commit 823599b4a8)
Merged-In: Ifafb7081ec6a34ce3ab8e2aa502d46411405cb6d
2022-05-13 10:32:15 +00:00
Benedict Wong
823599b4a8 Add to/from disk stable format
This change adds a utility to convert persistable bundles to and from
disk-stable byte arrays.

Test: atest FrameworksVcnTests:PersistableBundleUtilsTest
Change-Id: Ifafb7081ec6a34ce3ab8e2aa502d46411405cb6d
2022-05-04 01:20:32 +00:00
Benedict Wong
59aeaf29c0 Merge "Add CarrierConfig to TelephonySubscriptionSnapshot" 2022-04-21 17:40:58 +00:00
Benedict Wong
52629838cb Add CarrierConfig to TelephonySubscriptionSnapshot
This change ensures that carrier configs are saved as part of the
snapshot, allowing all entities in the VCN to query telephony
subscription information from the same source.

Test: atest FrameworksVcnTests
Change-Id: I31447d84fe98d6bd2cc78ead41746198728c400b
2022-04-21 01:09:36 +00:00
Yan Yan
6d70c7f36a Merge "Maximize VCN MTU when using IPv6" 2022-04-18 17:30:44 +00:00
Yan Yan
eb00e3c77a Maximize VCN MTU when using IPv6
This commit maximizes VCN MTU by considering IP version. Specifically,
VcnGateWayConnection stores/updates the IkeSessionConnectionInfo passed
out from the IKE library during IKE setup and migration. By looking into
the addresses stored in the IkeSessionConnectionInfo, VCN is able to
know the IP family of the VCN tunnels.

Bug: 222331693
Test: atest FrameworksVcnTests(new tests), CtsVcnTestCases
Change-Id: I9a2839d7827f1d6451546ec222129f286e94ae36
2022-04-15 12:16:20 -07:00
Benedict Wong
1a8f3e0a14 Allow provisioning package to retrieve subGrp, clear it's own config
This changes the VCN to allow a VCN provisioning package to retrieve
its listing of configured subgroups and clear its own configurations,
regardless of whether it is the active subscription group.

Safety is guaranteed based on the VCN's clearing of packages when app
data is cleared, and when the app is uninstalled. In addition to the
configurations not being retrievable, the clearing of the configs will
ensure that sideloading of an app with the same package name provides
no ability to otherwise impact settings.

Bug: 227248744
Test: atest FrameworksVcnTests
Change-Id: I2c774c00373942f895169a761d4e9a1d5b0b2edb
2022-04-13 22:10:21 +00:00
Benedict Wong
bd14581e6b Merge "Trigger revalidation of VCN, underlying networks" 2022-04-01 22:33:00 +00:00
Michael Groover
068b9f4372 Merge "Revert "Explicitly mark receivers as RECEIVER_NOT_EXPORTED"" 2022-03-25 23:13:28 +00:00
Rambo Wang
73e1555fea Update TelephonySubscriptionTracker to use new CPCallback interface
CarrierPrivilegesListener is renamed as CarrierPrivilegesCallback.
The previous callback onCarrierPrivilegesChanged is also
reshaped to provide Set of package names and UIDs.

This is the minimum change to remove dependency on CPListener. A
follow-up CL can simplify the logic here with the new
onCarrierServiceChanged API if TelephonySubscriptionTracker only cares
about carrier service.

Bug: 216549778
Test: atest TelephonySubscriptionTrackerTest
Change-Id: I58dbbc4b7b135781bc5f4b5bc35b29075fc6a619
Merged-In: I58dbbc4b7b135781bc5f4b5bc35b29075fc6a619
(cherry picked from commit 374f0045ba)
2022-03-22 21:18:00 -07:00
Michael Groover
62c6955c2f Revert "Explicitly mark receivers as RECEIVER_NOT_EXPORTED"
This reverts commit 2e0cba87dd.

Reason for revert: ag/17318348 moved the declaration of the protected-broadcasts from the telephony package to the platform's manifest, so a flag is no longer required when registering for these. In addition, ag/17307852 is syncing the behavior of unexported runtime receivers with that of manifest receivers by limiting the UIDs that can broadcast to these receivers to the root and system UIDs; with the RECEIVER_NOT_EXPORTED flag from this commit, these receivers would no longer be able to receive these broadcasts when sent from the telephony UID.

Bug: 225999840
Change-Id: I86489db999cf8256519fdae13e1b107f2d465edf
2022-03-23 02:06:05 +00:00
Benedict Wong
a8696bc9a3 Trigger revalidation of VCN, underlying networks
This change adds triggers additional revalidation of the VCN and
underlying networks in the following cases:

Triggers VCN Network revalidation after mobility events. This is the
most likely time that the VCN will suddenly fail to validate, this helps
to detect it as quickly as possible.

Triggers underlying network validation if the VCN validation fails; if
the underlying network fails, the VCN will migrate away. When the VCN
fails to validate, it is unclear whether it is a VCN dataplane issue, or
an underlying network issue.

Bug: 222351571
Test: atest FrameworksVcnTests
Change-Id: I4d77e9977ae7dbf0fcc1cccb29b25c57002a6daf
2022-03-03 22:58:51 +00:00
Benedict Wong
0b957a2f89 Merge "Add type string to VCN NetworkAgentConfig" 2022-02-16 21:00:36 +00:00
Benedict Wong
37a6ef1cd6 Add type string to VCN NetworkAgentConfig
This change populates the VCN type string used in NetworkInfo. While
the NetworkInfo API has long been deprecated, some apps apparently still
use this API. Even more unusually, some apps use the NetworkInfo's type
strings, and perform string comparisons on the type string, as opposed
to the type integer/enums to determine network types.

This change ensures maximum backward compatibility.

Bug: 219287843
Test: atest FrameworksVcnTests
Change-Id: I059dbc997f97482f7355fdc29d464d5452933ce3
2022-02-16 19:06:16 +00:00
Robert Horvath
2e0cba87dd Explicitly mark receivers as RECEIVER_NOT_EXPORTED
The intent actions registered for here are only marked as protected
broadcasts if the telephony package is present. In its absence,
receivers *must* specify either RECEIVER_EXPORTED or
RECEIVER_NOT_EXPORTED.

Since these Intents are sent from Telephony, which runs with a system
UID less than the first application UID (10000), the system_server can
receive these broadcasts without exporting the receivers.

Bug: 218831939
Test: build & run on ATV device
Test: atest TelephonySubscriptionTrackerTest
Change-Id: I3fed2a1772fccea611f68e9425755b0c9aa9051e
2022-02-10 22:57:32 +00:00
Benedict Wong
ab7f5b533d Merge "Revert "Revert "Listen for individual subscription mobile data toggles""" 2022-01-19 16:51:09 +00:00
Benedict Wong
e0606dfb49 Revert "Revert "Listen for individual subscription mobile data toggles""
This reverts commit f598641d7f.

Reason for revert: Build breakage could not possibly have been th caused by the initial CL. Cause was a String index overflow "Caused by: com.android.tools.r8.internal.du: String-index overflow."

Tested with local build of aosp-master/full-eng, completes successfully.
Change-Id: I207372c9513b450cf246874ba1d1e98dbd147f27
2022-01-14 02:20:59 +00:00
Joseph Jang
f598641d7f Revert "Listen for individual subscription mobile data toggles"
This reverts commit 66896667a6.

Reason for revert: <Suspect cause the build break report by b/214340258>

Change-Id: If8ddbfe8a0a8d445c4971572cf3301ebbb816347
2022-01-13 10:40:45 +00:00
Benedict Wong
ee22e0d57d Add minimum required bandwidth to network templates
This change adds a minimum required bandwidth to the VCN network
templates, ensuring that a minimum bar of throughput can be required of
underlying networks.

Bug: 211008106
Test: atest FrameworksVcnTests
Change-Id: I929428f75e5e543966a03061d13f300dd8b0956f
2022-01-13 05:35:50 +00:00
Benedict Wong
66896667a6 Listen for individual subscription mobile data toggles
This change ensures that the VCN listens for changes on a
per-subscription basis. In the DSDS case, the
Settings.Global.MOBILE_DATA toggles is insufficient, as the toggles for
individual subscriptions are changed instead of the global toggle.

Without this patch, the VCN may ignore changes in the user toggles, and
continue providing data service even after user data is disabled.
Similarly, it may fail to bring up a VCN when user data is re-enabled.

Bug: 214247774
Test: atest FrameworksVcnTests
Change-Id: I1e84c25f48eab90dca163eda809fc11d5d21bc31
2022-01-13 01:58:01 +00:00
Benedict Wong
179826efdc Merge changes Ib7d51cf1,I92bd2831
* changes:
  Expose APIs to configure underlying network priority
  Update setter/getters to configure underlying network priority
2022-01-12 05:21:03 +00:00
Benedict Wong
bdbdbe19f8 Merge changes Ia5022310,Ia4529d08
* changes:
  Remove VCN Carrier Privilege grace period
  Update TelephonySubscriptionTracker to use CarrierPrivilegesListener
2022-01-08 01:43:17 +00:00
Benedict Wong
fb4a590dbc Remove VCN Carrier Privilege grace period
This change removes the grace period after the VCN is notified that a
provisioning app is no longer carrier privileged. This is due to the
switch to use CarrierPrivilegesTracker, which inherently has the
identical grace period.

This both simplifies the code, as well as removes some edge cases. As
such, tests for the delay before VCN tears down are no longer necessary.

Bug: 183554244
Test: atest FrameworksVcnTests
Change-Id: Ia50223108e45eeaedc860adf5e29a6ea459d956f
2022-01-07 22:11:26 +00:00
Benedict Wong
31d56f8298 Update TelephonySubscriptionTracker to use CarrierPrivilegesListener
This change adds use for CarrierPrivilegesListener to use the callbacks
as triggers to re-check carrier privileges. For simplicity, the carrier
privileges returned by the callback are not used, as it requires an
additional layer of caching. Instead, a query is performed, which
should hit a cache in the CarrierPrivilegesTracker, thus not be
performance-sensitive.

Bug: 183554244
Test: atest FrameworksVcnTests
Change-Id: Ia4529d087ee7f0deca7101c6849183ba7267c067
2022-01-07 22:11:22 +00:00
Yan Yan
451df7d904 Expose APIs to configure underlying network priority
This commit expose VcnUnderlyingNetworkTemplate classes
and methods to configure those objects in VcnGatewayConnectionConfig.

Those APIs allow callers to configure the underlying network priority
for VCN gateway when VCN is doing route selection. Callers can
construct VcnUnderlyingNeworkTemplate with network requirements and
then set VcnUnderlyingNeworkTemplate list from most preffered to least
preffered in VcnGatewayConnectionConfig.

Bug: 205343355
CTS-Coverage-Bug: 209498272
Test: atest FrameworksVcnTests, CtsVcnTestCases
Test: make update-api
Change-Id: Ib7d51cf1ce562a1acbcb767ec569d7e11c861a1d
2022-01-06 14:51:54 -08:00
Yan Yan
1161a591e7 Update setter/getters to configure underlying network priority
- Update setters for configuring meteredness, roaming and
  opportunistic to take an int instead of a boolean
- Update NetworkPriorityClassifier and tests accordingly

Bug: 206044122
Test: atest FrameworksVcnTests, CtsVcnTestCases
Change-Id: I92bd2831cc42d634d73b842c42d18fa93a4ed46c
2022-01-06 10:52:39 -08:00
Yan Yan
a9eec89e4b Rename VcnUnderlyingNetworkPrioirty to VcnUnderlyingNetworkTemplate
Rename the classes' names as well as the test files.

Bug: 206044122
Test: atest FrameworksVcnTests, CtsVcnTestCases
Change-Id: I19d13acf0e46921a7254a39dff2af332c36ab2b2
2022-01-06 10:52:26 -08:00
Treehugger Robot
1a0f225c83 Merge "Support parsing VcnGatewayConnectionConfig without UnderlyingNetworkPriorities" 2021-12-09 01:56:52 +00:00
Yan Yan
eae9b5d0c4 Support parsing VcnGatewayConnectionConfig without UnderlyingNetworkPriorities
This commit fixes the NullPointerException issue in converting a
PersistableBundle without UnderlyingNetworkPriorities to a
VcnGatewayConnectionConfig, by adding a null check and building
the VcnGatewayConnectionConfig with the default
UnderlyingNetworkPriority list.

Bug: 209142575
Test: atest FrameworksVcnTests (new tests), CtsVcnTestCases
Change-Id: I888d2994c86ba250c3fc9ee1851dccb5e6ef3e77
2021-12-08 12:23:28 -08:00
Yan Yan
9df3f48cb0 Merge "Update #hashCode & #equals with mUnderlyingNetworkPriorities" 2021-12-08 20:15:08 +00:00
Yan Yan
d3a7de1333 Update #hashCode & #equals with mUnderlyingNetworkPriorities
Update VcnGatewayConnectionConfig to consider
mUnderlyingNetworkPriorities in #hashCode and #equals methods

Rename #setAllowedPlmnIds and #getAllowedPlmnIds
to #setAllowedOperatorPlmnIds and #getAllowedOperatorPlmnIds

Bug: 206044122
Test: atest FrameworksVcnTests(new tests), CtsVcnTestCases
Change-Id: Id16d88024bbb7ef275da0304f2dde1413a18de10
2021-12-07 19:18:05 -08:00
Yan Yan
36a25527b4 Merge "Calculate priority based on caller configurations" 2021-12-07 18:10:47 +00:00
Yan Yan
738ed7b7b2 Calculate priority based on caller configurations
Update NetworkPriorityClassifier to calculate priority
according to the VcnUnderlyingNetworkPriority list
configured in VcnGatewayConnectionConfig

Bug: 206044122
Test: atest FrameworksVcnTests(new)
Test: atest CtsVcnTestCses
Change-Id: I55afa916af44db655a568aae2488877f2c177d59
2021-12-06 18:52:23 -08:00
Benedict Wong
4bfa0ebc53 Merge "Immediately tear down VCN network when entering Airplane Mode" 2021-12-03 21:26:06 +00:00
Benedict Wong
c0e108a497 Immediately tear down VCN network when entering Airplane Mode
This change immediately tears down the VCN network if all underlying
networks are lost, and the device is in airplane mode. This ensures
consistency where other components may not understand the lingering
behavior of the VCN network

Bug: 207014742
Test: atest FrameworksVcnTests
Change-Id: Ib05f0c4255e847eed7d8623b35c5a7dfedd920d6
2021-12-03 01:48:21 +00:00
Yan Yan
fee736f47c Support configuring VcnUnderlyingNetworkPriority in VcnGatwayConnectionConfig
Bug: 206044122
Test: atest FrameworksVcnTests(new tests)
Test: atest CtsVcnTestCases
Change-Id: I5cd2982fcbfe5ce4ee36edb91f1f9f9b55d28d9a
2021-12-01 10:34:02 -08:00
Yan Yan
0376684dea Create VcnCellUnderlyingNetworkPriority
Create VcnCellUnderlyingNetworkPriority to allow VCN callers
to configure network prioritization.

Bug: 206044122
Test: atest FrameworksVcnTests(new tests)
Test: atest CtsVcnTestCases
Change-Id: Ia7f44c5f956ff75c39e20d9761f1bd5c987644ee
2021-12-01 10:33:49 -08:00
Yan Yan
629cb6935e Create VcnUnderlyingNetworkPriority and the subclass for Wifi
Create VcnUnderlyingNetworkPriority and VcnWifiUnderlyingNetworkPriority
to allow VCN callers to configure network prioritization.

Bug: 206044122
Test: atest FrameworksVcnTests(new tests)
Test: atest CtsVcnTestCases
Change-Id: I540f826176c7085780be93e42fdbc3ff0ad537d7
2021-11-30 16:55:55 -08:00
Yan Yan
3628ecb45f Split out NetworkPriorityClassifier and UnderlyingNetworkRecord
Move UnderlyingNetworkRecord to a spearate file, and
move calculatePriorityClass to a new class NetworkPriorityClassifier.

This is a preparation CL to support vcn routeselection with
configurable network priority classes and network metric
monitors.

Bug: 206044122
Test: atest FrameworksVcnTests, CtsVcnTestCases
Change-Id: I88aa9e8dcf01524ddce9f913f40a4c712f8c878d
2021-11-23 18:11:50 -08:00
Yan Yan
3d20aa2cf8 Rename UnderlyingNetworkTracker to UnderlyingNetworkController
Bug: 206044122
Test: atest FrameworksVcnTests, CtsVcnTestCases
Change-Id: I6b4888f8252999446a29076937d9695278ff6a66
2021-11-23 18:08:26 -08:00
Benedict Wong
5fcdfc99f1 Merge "Pull underlying network MTU using Java APIs" 2021-11-09 18:08:14 +00:00