Commit Graph

126 Commits

Author SHA1 Message Date
Benedict Wong
447fbc3788 Merge "Add VCN underlying networks" 2021-07-02 18:42:43 +00:00
Benedict Wong
1bfdfa2754 Add VCN underlying networks
This change declares underlying networks for the VCN for the purposes of
app data accounting

Bug: 190620024
Test: atest FrameworksVcnTests
Change-Id: Ida2cd5975250604064b0baed00bc7c201ea97c5e
2021-07-01 19:49:57 -07:00
Benedict Wong
6ff2b288f6 Merge "Fix dangling NetworkAgent" 2021-06-25 23:02:37 +00:00
Benedict Wong
7207a83ca8 Fix dangling NetworkAgent
This change fixes the potential for a networkAgent to be left dangling,
due to a situation where a VcnGatewayConnection shuts down, but fails to
unregister it's NetworkAgent.

The root cause was that the NetworkAgent was not unregistered when
moving to the DisconnectedState from the RetryTimeoutState, and the new
state assumed that there was no NetworkAgent, and thus failed to close
it when disconnecting.

Thus, this change ensures that the NetworkAgent is closed before moving
to the DisconnectedState. Additionally, it adds safety-checks to
onQuitting(), ensuring that if all else fails, these fields are cleaned
up.

Lastly, this change adds the specific gateway reference to facilitate
future debugging of issues such as this where there is potential for
duplicate networks, or gateway connections.

Bug: 191707296
Test: atest FrameworksVcnTests
Change-Id: I84cd43a0c136662f5c2d229650f1f5f889e6f144
2021-06-25 19:37:17 +00:00
Cody Kesting
0da0fb106e Update Mobile Data State on subscription changes.
This CL ensures that Vcn instances refresh their mobile data state
when they receive a new TelephonySubscriptionSnapshot. A new snapshot
may contain different subId -> subGroup mappings, which can affect
whether a Vcn instance's subGroup has mobile data enabled or not. This
in turn can change which VcnGatewayConnections are brought up by the
Vcn.

Bug: 191394092
Test: atest FrameworksVcnTests CtsVcnTestCases
Change-Id: Ib59b4ed7900a177b17ed4a6e197e271b10937f65
2021-06-17 14:58:45 -07:00
Cody Kesting
705021aa6b Convert VcnNetworkProvider to use NetworkOffers
This change brings VcnNetworkProvider to full functionality in the new
NetworkProvider paradigm, where NetworkProviders offer networks, and are
notified based on NetworkOfferCallbacks.

Bug: 185204197
Test: atest FrameworksVcnTests
Change-Id: I88c69c0be9f6fd81839fb1595ed00341001694a5
Merged-In: I88c69c0be9f6fd81839fb1595ed00341001694a5
2021-06-15 18:13:56 -07:00
Cody Kesting
1fd3dadc22 Allow MANAGE_TEST_NETWORKS to register and get VCN policies.
This CL updates VcnManagementService to allow permission
MANAGE_TEST_NETWORKS to register/unregister VCN policy listers as
well as apply VCN policies. Previously, only permission
NETWORK_FACTORY was allowed to perform this operations.

Bug: 189125789
Test: atest FrameworksVcnTests CtsVcnTestCases
Change-Id: I6ad3a58f4ef87d931917fbd772a810af81b27da1
2021-06-09 11:52:53 -07:00
Benedict Wong
e237e35dff Copy up/downstream bandwidth and TCP buffer sizes from underlying
This change copies the relevant pieces of information used to tune the
system for performance

Bug: 188943592
Test: atest FrameworksVcnTests
Change-Id: I2d5dc5b9000fa9d0da9d34772b3704110694c526
Merged-In: I2d5dc5b9000fa9d0da9d34772b3704110694c526
(cherry picked from commit 9d92b77ad7)
2021-05-25 15:48:40 -07:00
Benedict Wong
b2632543c0 Remove underlying network caps
Bug: 182219992
Test: atest FrameworksVcnTests
Change-Id: Ic2fec8a87fd19a1780333c61759c4092598d349e
2021-05-14 15:28:34 -07:00
Benedict Wong
9028cac4fe Custom network selection
This change adds a basic prioritization framework in the VCN, and signal
strength thresholds for WiFi.

Bug: 188104094
Test: atest FrameworksVcnTests
Change-Id: Iee4e3dbecf1102ddc127a8c8daf08a00b6fccbbd
2021-05-13 18:57:05 -07:00
Cody Kesting
576dad4673 Merge changes I4b135749,If4fcaa52
* changes:
  Restructure Test Network requests for VCN connections.
  Correct variable name in VcnManagementService.
2021-05-12 22:55:17 +00:00
Treehugger Robot
b79dcb24d0 Merge changes Icb59b15d,I6fc6a266,I5cc340e5,I94db52a8
* changes:
  Request Test Networks for VCNs when in Test Mode.
  Specify if a VCN is in 'test-mode' in VcnContext.
  Create test-mode for VcnConfig.
  Require MOBIKE for IkeSessionParams in VCN configs.
2021-05-12 16:21:25 +00:00
Cody Kesting
da188b3719 Restructure Test Network requests for VCN connections.
This CL restructures the NetworkRequests used for TestNetworks
in UnderlyingNetworkTracker to clearly show that they only require
TRANSPORT_TEST and the relevant subIds.

Bug: 182291467
Test: atest FrameworksVcnTests CtsVcnTestCases
Change-Id: I4b135749fdde9f91c66b87b1ded921700e6440fd
2021-05-11 19:27:36 -07:00
Cody Kesting
88c5fe5e60 Request Test Networks for VCNs when in Test Mode.
This CL updates UnderlyingNetworkTracker to request Test
Networks for route selection  when the VCN it is tracking
for is in test-mode.

Bug: 182291467
Test: atest FrameworksVcnTests CtsVcnTestCases
Change-Id: Icb59b15df61ec43fe76e250977a985caa6a1dffc
2021-05-11 18:32:32 -07:00
Cody Kesting
5f65a440e2 Specify if a VCN is in 'test-mode' in VcnContext.
This CL updates VcnContext to include whether the VCN instance
it is created for is in test-mode (as specified by the VcnConfig).
This also changes the lifetime of VcnContext to be created uniquely
for each VCN instance (as opposed to a single VcnContext created in
VcnManagementService and used for all VCNs).

Bug: 182291467
Test: atest FrameworksVcnTests CtsVcnTestCases
Change-Id: I6fc6a266bf67ab2aa64202153c3c109ee98a16ca
2021-05-11 18:32:32 -07:00
Cody Kesting
fd57083e39 Create test-mode for VcnConfig.
This CL creates a test-mode for VcnConfig so that they will only
match with Test Networks. This is necessary for CTS testing so
that VCNs can run on test networks and IKE negotiations can be
injected over the Test Networks.

Bug: 182291467
Test: atest FrameworksVcnTests CtsVcnTestCases
Change-Id: I5cc340e5aaa34c5de8efafa52de49185a18d4bd3
2021-05-11 18:32:32 -07:00
Benedict Wong
0c1a3b9db2 Apply transform to FWD policy if configured to provide tethering
This change allows the VCN to trigger the application of IpSecTransforms
as in the FWD path, ensuring that tethering works across interfaces

Bug: 185495453
Test: atest FrameworksVcnTests
Test: manual testing with cross-device tethering
Change-Id: I90fc77226ca971dbd8ac549b96a4828da1079cd5
2021-05-07 15:09:42 -07:00
Cody Kesting
a5786a15e1 Merge changes I01ffdde2,Iecab1226
* changes:
  Set NOT_VCN_MANAGED capability for Networks in VcnMgmtSvc.
  Notify policy listeners when VCN subIds change.
2021-05-05 21:27:09 +00:00
Cody Kesting
2225648d47 Notify policy listeners when VCN subIds change.
This CL updates VcnManagementService to notify policy listeners
when the subIds for any VCN instances change. This is necessary to
ensure that NetworkFactories properly update their Networks in the
event that a Network comes up under an existing VCN are properly
marked as VCN-managed.

Bug: 187112989
Test: atest FrameworksVcnTests CtsVcnTestCases
Change-Id: Iecab1226119c8fd876131c381647267f18339db2
2021-05-04 15:57:32 -07:00
Benedict Wong
9d8fd5d82a Trigger reevaluation of all requests when mobile data state changes
This change ensures mobile data state changes result in the reevaluation
of all NetworkRequests; ensuring that any requests that can be fulfilled
as a result of the mobile data state change start the relevant
GatewayConnections

Test: atest FrameworksVcnTests
Change-Id: I442ca2ee0fc8b9ad962a2491ddc3818535d9e042
2021-04-30 23:29:20 +00:00
Benedict Wong
c6fe30068d Merge "Update set|getRetryIntervalsMs to Millis" 2021-04-29 04:35:45 +00:00
Benedict Wong
e7f06d9eb9 Update set|getRetryIntervalsMs to Millis
Bug: 184612525
Test: atest FrameworksVcnTests
Change-Id: I696854960ca9488ae2c8a0c569c57a8563998ac8
2021-04-27 22:28:43 +00:00
Benedict Wong
44629199de Set safe mode alarm when validation reports NOT_VALID
Bug: 186257328
Test: atest FrameworksVcnTests
Change-Id: I80f37d42e4d61026b3521a4133257cd472c22f1a
2021-04-27 22:20:15 +00:00
Yan Yan
de7222cba5 Remove TunnelConnectionParams interface
To avoid exposing empty interface.

Test: atest FrameworksVcnTests
Bug: 180664474
Change-Id: Ia33e75b77f1563a1c3d31e0145b7ec2be728b6db
2021-04-26 10:47:05 -07:00
Yan Yan
bc545c8a8a Merge changes from topics "encrypted-tunnel-interface", "iketunnelparams", "vcn-encrypted-tunnel"
* changes:
  Replace VcnControlPlaneConfig with TunnelConnectionParams
  Convert TunnelConnectionParams to/from PersistableBundle
  Create TunnelConnectionParams interface
2021-04-22 08:39:20 +00:00
Yan Yan
4eaa894d84 Replace VcnControlPlaneConfig with TunnelConnectionParams
Use the more generic object TunnelConnectionParams in VCN.
TunnelConnectionParams may also be used in VPN in the future.

Test: atest FrameworksVcnTests
Bug: 180664474
Change-Id: Ie433f9df614e1f51cdff200d915b68b61e5ca35e
2021-04-21 22:52:22 -07:00
Treehugger Robot
a2da3ebb16 Merge "[VCN19] Rename get/setSubIds to get/setSubscriptionIds" 2021-04-22 04:43:26 +00:00
Benedict Wong
80afe1eeee Merge changes I64b56575,I40553a7b
* changes:
  Expose API for retrieval of subscription groups with VCN configured
  Add support for retrieval of configured VCNs by carrier privilege
2021-04-22 01:31:11 +00:00
Benedict Wong
6e8c1d6da7 Add support for retrieval of configured VCNs by carrier privilege
This change adds support for retrieval of a list of subscription groups
that have a VCN configured.

Bug: 184612525
Test: atest FrameworksVcnTests
Change-Id: I40553a7bb45d9b1f948c7d0a791f1b22a422d55c
2021-04-21 13:49:14 -07:00
Benedict Wong
85d294282c Rename get/setRetryInterval to get/setRetryIntervalsMs
Per API feedback, the get/set methods for retry intervals are renamed to
be plural, and have time units

Bug: 184612525
Test: atest FrameworksVcnTests
Test: atest CtsVcnTestCases
Change-Id: I51b3ffcfa44f72805f359e56b263da2558325372
2021-04-21 00:44:37 +00:00
Benedict Wong
78f9acd7e7 Switch to using NetworkScore instead of legacy integer
This change switches the VcnNetworkAgent from using the legacy score
integer, and switches to using the new NetworkScore, using the legacy
integer as a internal representation.

Bug: 185204197
Test: FrameworksVcnTests
Merged-In: Ib0690243f176a2f074358fcc8430f1fd7c3d0d3c
Change-Id: Ib0690243f176a2f074358fcc8430f1fd7c3d0d3c
(cherry picked from commit ffc912dace)
2021-04-19 13:13:05 -07:00
Benedict Wong
39659bf29a Remove use of network scores, and provider IDs in VcnNetworkProvider
This change updates the VcnNetworkProvider and associated
requestListeners to no longer use the network score and provider IDs, in
order to match the new NetworkProvider APIs.

Bug: 185204197
Test: atest FrameworksVcnTests
Merged-In: I0cabce702cfd8457fd1a152af07a847b87d67028
Change-Id: I0cabce702cfd8457fd1a152af07a847b87d67028
(cherry picked from commit fff0f8ba33)
2021-04-19 13:13:04 -07:00
Benedict Wong
061c84ba27 Disable INTERNET/DUN when mobile data toggled off
This change disables INTERNET and DUN capabilities once the mobile data
toggle is turned off. Additionally, when the toggle is flipped, any
existing networks advertising either of those two capabilities will be
restarted in order to remove the capabilities.

Bug: 184864726
Test: atest FrameworksVcnTests
Merged-In: I81efeaa4b129443b08a597ff45e0037ddefeb414
Change-Id: I81efeaa4b129443b08a597ff45e0037ddefeb414
(cherry picked from commit fcacb06752)
2021-04-19 13:12:43 -07:00
Chiachang Wang
580fda2670 Remove hidden connectivity method access in FrameworksVcnTests
Due to connectivity modularization work, hidden connectivity
methods and members are not accessible outside the module.
Remove the corresponding usage.

The test case in VcnNetworkProviderTest are not able to create
NetworkRequests with request id assigned. The loop to create
different request is removed. After that, the test does not
provide more test coverage than other tests. Thus, Remove the
test case directly.

Bug: 182859030
Test: atest FrameworksVcnTests
Merged-In: I488f62089d1dbe93c232f892885d944bef896df6
Change-Id: I488f62089d1dbe93c232f892885d944bef896df6
(cherry picked from commit 18f3a26efa)
2021-04-19 13:12:43 -07:00
Yan Yan
3022c5437c Merge "Use #setNetwork and #getNetwork for IkeSessionParams" 2021-04-19 17:04:25 +00:00
junyulai
d6b1d4b355 [VCN19] Rename get/setSubIds to get/setSubscriptionIds
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215036
Merged-In: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7
Change-Id: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7
  (cherry-picked from ag/14198665)
2021-04-19 17:41:01 +08:00
junyulai
c219d421eb [VCN20] Change requestBackgroundNetwork argument order
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215095
Merged-In: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
Change-Id: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
  (cherry-picked from ag/14198667)
2021-04-16 00:16:21 +08:00
Yan Yan
66a9973b9d Use #setNetwork and #getNetwork for IkeSessionParams
This pacth changes VCN to call #setNetwork and #getNetwork instead
of #setConfiguredNetwork and #getConfiguredNetwork because the
later two methods will not be APIs.

This patch also changes VCN unit tests to build an IkeSessionParams
without a Context because the constructor requring a Context
is deprecated.

Bug: 180521384
Test: FrameworksVcnTests, CtsVcnTestCases
Change-Id: I971d0d1b6824890c58263a1960f3b8d0e66fe7d1
2021-04-13 21:46:53 -07:00
Yan Yan
c9884a144e Use IkeProtocolException#getErrorType() to identify a specific error
AuthenticationFailedException and TemporaryFailureException
will not be System APIs. This patch changes VCN to use
IkeProtocolException#getErrorType to identify a specific
protocol error.

Test: atest FrameworksVcnTests
Bug: 175091931
Change-Id: Iaf3c1c9bd34957b0efdbfd7595c2838b56449308
2021-04-09 15:00:01 -07:00
Cody Kesting
7910a79651 Merge "Remove location-permission check from VcnStatusCallbacks." 2021-04-09 16:35:43 +00:00
Benedict Wong
8fac2ea3f3 Dynamically set MTU based on proposed algorithms
This change adds the relevant utilities and plumbing to ensure that MTUs
are set dynamically based on the underlying network's MTU.

Bug: 184697651
Test: atest FrameworksVcnTests
Change-Id: I77e34a92eb4e81e83d20fe6019b38ea5f1af4765
2021-04-08 11:58:58 -07:00
Cody Kesting
5b6355a09f Remove location-permission check from VcnStatusCallbacks.
This CL updates VcnManagementService to not require location permissions
for receiving VcnStatusCallback invocations. This change is safe to make
because these callbacks are not capable of leaking any location-related
information.

Bug: 180556279
Test: atest FrameworksVcnTests CtsVcnTestCases
Change-Id: I38600aeb2489f139b3479b07de77facc2ae838c5
2021-04-07 15:27:45 -07:00
Benedict Wong
7087a4ac87 Create proxy NetworkAgent for testing
This change adds a proxy NetworkAgent to facilitate testing, adding the
ability to test final methods such as sendNetworkCapabilities() and
sendLinkProperties(), which would otherwise call a real implementation,
and throw a null pointer while trying to access internal fields.

Bug: 184579891
Bug: 184697651
Test: atest FrameworksVcnTests
Change-Id: I8f13159bd266bf488f095a13d6ffe444bec65f38
2021-04-07 11:37:07 -07:00
Benedict Wong
a4f28edac3 Ensure teardown() only triggered on the right NetworkAgent.
This change ensures that teardown() is only ever triggered when the
NetworkAgent matches the one that the unwanted() callback is triggered
on. This ensures that in cases where the unwanted() is called as a
result of unregister(), or even after a new NetworkAgent is created (and
stored in the mNetworkAgent field), the teardown does not occur.

Bug: 184304972
Test: atest FrameworksVcnTests
Change-Id: Ic8ab66ff1e48d43be784974cda7574d0191e557f
2021-04-07 11:37:01 -07:00
Benedict Wong
0906d6bc1b Don't process dup unwanted() when unregistering NetworkAgent
In cases where the NetworkAgent is unregistered (eg. Safe mode), but the
VCN is not shut down, the NetworkAgent.unwanted() call should not
trigger a teardown.

Test: atest FrameworksVcnTests
Change-Id: Icf32cb464bce2aae2846448d5a6a53a97f558398
2021-04-06 00:42:55 +00:00
Benedict Wong
f78c3512df Add/remove internal addresses from IpSecTunnelInterface
This change corrects a bug where IpSecTunnelInterface was not removing
old addresses, and resulted in EEXIST when trying to re-add an address
to a given interface.

Test: atest FrameworksVcnTests
Change-Id: I43434c801354483a7c7d0092891799bf86da23eb
2021-04-05 15:47:45 -07:00
Benedict Wong
7d6b4907cc Populate legacy type in VCN NetworkAgentConfig
This change ensures that the VCN populates the legacy type field,
otherwise ConnectivityService crashes on an unknown legacy type.

Bug: 184304972
Test: atest FrameworksVcnTests
Change-Id: I59dc46dc34d2812a6c8f73c72d208fa735791d74
2021-04-05 15:32:16 -07:00
Benedict Wong
134c10d9c6 Add TRANSPORT_CELLULAR to VCN filter
This change adds the CELLULAR transport to the filter used by the Vcn to
determine if a configuration can satisfy a given NetworkRequest

Bug: 184101137
Test: atest FrameworksVcnTests
Change-Id: I7df3f14b5ef66551728b398fd4a9e233d1df4706
2021-04-05 11:27:29 -07:00
Benedict Wong
80056e834e Allow soft-start and opportunistic safe mode
This change adds support for opportunistic safe mode, where the VCN will
continue to provide networks, but not restrict underlying networks.
Similarly, this change allows for soft-starting of the VCN, where VCN
underlying networks can be selected without restricting them directly.

Additionally, this change ensures networks are torn down when
VcnGatewayConnections enter safe mode. This change is required due to
changes in the lifecycle of the VcnGatwayConnection, where in safe mode
they are NOT torn down, but allowed to continue retrying. During these
broken-connectivity windows, the VCN network should be torn down to
prevent blackholing traffic.

Bug: 183174340
Test: atest FrameworksVcnTests
Change-Id: I50f2c0e92552281731c843db89e9a9a1ccff5346
2021-04-05 10:34:25 -07:00
Benedict Wong
f8db8d8c43 Prevent changes to immutable capabilities for carrier wifi
This change prevents carrier wifi from having changes to the RESTRICTED
network capability, which is an immutable capability.

Bug: 184101137
Test: atest FrameworksVcnTests
Change-Id: I802d36a754d961c9928a2e642e25f1b25b8be12d
2021-04-01 16:37:33 -07:00