Commit graph android_packages_modules_Co.../Vcn/tests/unit/java
Message SHA1
Support converting EAP-TTLS to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: I1e338d9c8940636b38f4725787de30fbbc1323ec

Yan Yan   commited 2021-03-01 12:19:36 -08:00
8e1661ba6f
Support converting EAP-SIM, AKA and AKA' to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: Ib4a0ed69b57df10c5ede9524d0b03f4f03d68919

Yan Yan   commited 2021-03-01 12:19:25 -08:00
3e6af4f06c
Support converting EapSessionConfig to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: Iac7077b4ca37dfc07055aac5b3a8118610a27999

Yan Yan   commited 2021-03-01 12:19:15 -08:00
ade4ea3dda
Support converting TunnelModeConfigRequest to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: I9c53d4252edb0e8816c84d280b48c4725bd0edc8

Yan Yan   commited 2021-03-01 12:19:05 -08:00
e5172cd2de
Support converting TunnelModeChildSessionParams to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: I4d27ac37ce750930cefa73de25e5deea74591d0e

Yan Yan   commited 2021-03-01 12:17:42 -08:00
c53e17e38c
Support converting ChildSaProposal to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(new tests added)
Change-Id: I726a29a65b10b23718fe3b1658d70a8b84cfd2de

Yan Yan   commited 2021-03-01 11:14:07 -08:00
768fd7942a
Support converting IkeSaProposal to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(new tests added)
Change-Id: I108e5a946296f65bbe92549464aa68a2ec453659

Yan Yan   commited 2021-03-01 10:53:06 -08:00
34f1561074
Support converting IkeTrafficSelector to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(new tests added)
Change-Id: I7b2613d62fa555c3c1eb125a1d971771b954e9ca

Yan Yan   commited 2021-02-23 10:39:17 -08:00
49f68bcfcc
Merge changes I0cadd145,I3be3cac4,I9ea6e9e8
* changes:
  Correct comment for safe mode alarm in VcnGatewayConnection.
  Implement VCN error callback use.
  Define VcnStatusCallback#onGatewayConnectionError callback.

Cody Kesting   authored and   Gerrit Code Review   commited 2021-02-18 03:07:14 +00:00
efbfb1d2fc
Merge "Add VcnUnderlyingNetworkSpecifier"
Benedict Wong   authored and   Gerrit Code Review   commited 2021-02-18 02:35:12 +00:00
0decfd0404
Implement VCN error callback use.
This CL updates VcnGatewayConnection to notify VcnManagementService
(through Vcn) when errors occur with a gateway. VcnManagementService
then notifies registered, permissioned VcnStatusCallbacks via

Bug: 163433613
Test: atest FrameworksVcnTests
Change-Id: I3be3cac4b591b19a0b0075767fde0ba2eb6e12a2

Cody Kesting   commited 2021-02-17 14:28:34 -08:00
eae271791f
Define VcnStatusCallback#onGatewayConnectionError callback.
This CL updates VcnStatusCallback to have a onGatewayConnctionError()
function. This function will be used to notify callers when Gateway
Connection errors occur, such as authentication failures or the session
unexpectedly dying.

Bug: 163433613
Test: atest FrameworksVcnTests
Change-Id: I9ea6e9e850eb9d8b0d374c5447895f1f04121696

Cody Kesting   commited 2021-02-17 14:28:33 -08:00
6da50c2a83
Store VcnControlPlaneConfig in VcnGatewayConnectionConfig
This CL requires callers to set a VcnControlPlaneConfig for
building VcnGatewayConnectionConfig

Bug: 163604823
Test: FrameworksVcnTests (new tests added)
Change-Id: If45cb2aa866d627f3bb9762309fe8b07bf729ba8

Yan Yan   commited 2021-02-17 11:25:04 -08:00
f3e43b9e9f
Create VcnControlPlaneConfig and VcnControlPlaneIkeConfig
VcnControlPlaneConfig contains control plane configuration for
a VCN gateway connection. VcnControlPlaneIkeConfig is a
subclass that contains IKE configuration.

The followup CL will store VcnControlPlaneConfig in
VcnGatewayConnectionConfig.

Bug: 163604823
Test: FrameworksVcnTests(new tests added)
Change-Id: If7a85ae44e77fc4477b56ffa50c6e99ee96132d0

Yan Yan   commited 2021-02-17 10:56:48 -08:00
561094bfb1
Merge changes I3242ad0e,I5daced20,Iefd284ae
* changes:
  Notify status callbacks when a VCN enters Safemode.
  Change all 'safemode' references to use 'safe mode'.
  Define VcnStatusCallback register/unregister.

Cody Kesting   authored and   Gerrit Code Review   commited 2021-02-17 18:08:48 +00:00
46f8b7aacb
Notify status callbacks when a VCN enters Safemode.
This CL updates VcnManagementService to notify VcnStatusCallbacks when
the VCN for their specified subscription group enters Safemode. In order
to be notified, the registering app must also have permissions for the
specified permission.

Bug: 163433613
Test: atest FrameworksVcnTests
Change-Id: I3242ad0ee1dc406aef56253f884c2544a994869e

Cody Kesting   commited 2021-02-16 21:41:03 -08:00
118bc92875
Change all 'safemode' references to use 'safe mode'.
Bug: 163433613
Test: atest FrameworksVcnTests
Change-Id: I5daced209e4e6d8d1b87385b3f64660322908fa0

Cody Kesting   commited 2021-02-16 21:41:03 -08:00
11e9b2b781
Define VcnStatusCallback register/unregister.
This CL defines VcnStatusCallbacks, which are callbacks used to register
for status updates to a specific subscription group. These Callbacks may
be registered with VcnManager at any time, but will only be invoked for
the specifies subscription group and only if the registering app has
carrier privileges for that subscription.

Bug: 163433613
Test: atest FrameworksVcnTests
Change-Id: Iefd284ae2d09676d195e2a12bf660be3596da59b

Cody Kesting   commited 2021-02-16 21:33:40 -08:00
b5d7a6d87a
Merge "Implement ChildSessionCallback#onIpSecTransformsMigrated"
Benedict Wong   authored and   Gerrit Code Review   commited 2021-02-17 04:02:40 +00:00
0e4d104865
Implement ChildSessionCallback#onIpSecTransformsMigrated
This change implements the Migrated callback, proxying to
onIpSecTransformCreated

Bug: 180163196
Test: atest FrameworksVcnTests
Change-Id: Ibf07be667882ea35a4d7191b87d1193f38f9db3e

Benedict Wong   commited 2021-02-16 22:10:42 +00:00
67578f56de
Implement Safemode alarm in VcnGatewayConnection.
This CL updates VcnGatewayConnection to use WakeupMessages to support
Safemode detection. Safemode is entered if the VcnGatewayConnection
instance takes more than SAFEMODE_TIMEOUT_SECONDS seconds to a) go from
DisconnectedState to ConnectedState, or b) exit and re-enter
ConnectedState. If this timeout is exceeded, the instance will notify
its managing Vcn via VcnGatewayStatusCallback#onEnteredSafemode.

Bug: 178140973
Test: atest FrameworksVcnTests
Change-Id: Iff40aba639b465c3959ef383f1001be419daba4d

Cody Kesting   commited 2021-02-16 09:46:07 -08:00
f5c74807c4
Add VcnUnderlyingNetworkSpecifier
This change adds a VcnUnderlyingNetworkSpecifier as hidden API, for
internal use only. The purpose of the VcnUnderlyingNetworkSpecifier is to
match the specifiers for ONLY underlying (Telephony|Wifi) networks,
ensuring that the VCN does NOT create a routing loop

Bug: 179439329
Test: atest FrameworksVcnTests
Test: atest android.net.vcn
Change-Id: I0e158e1889d4462c117c46d9038f58d5adcc7e30

Benedict Wong   commited 2021-02-15 17:39:42 -08:00
90aec2778a
Use WakeupMesage for delayed events in VcnGatewayConnection.
This CL updates VcnGatewayConnection to use WakeupMessages instead of
sendDelayedMessage() for delayed events. This change allows for
VcnGatewayConnection to guarantee that all its messages are processed
while holding WakeLocks.

Bug: 178140973
Test: atest FrameworksVcnTests
Change-Id: If8182378fe2e9dad08df88a84934b21e22e25752

Cody Kesting   commited 2021-02-12 16:27:06 -08:00
4ff7fad22a
Acquire WakeLock while processing Gateway messages.
This CL updates VcnGatewayConnection to acquire a WakeLock when sending
a message to the Handler queue. After every message is processed, the
state will check for additional messages and release the WakeLock if the
queue is empty.

Bug: 178140973
Test: atest FrameworksVcnTests
Change-Id: Ib108c834833cc8feb2c92c9a6c60f218618225ec

Cody Kesting   commited 2021-02-12 16:01:32 -08:00
521b59aad4
Lazy-create IpSecTunnelInterface
With the Network(int) constructor moving to mainline, we cannot use the
constructor, and should just create the IpSecTunnelInterface lazily, at
first use.

Bug: 165827287
Test: atest FrameworksVcnTests
Change-Id: Ic01858e0f9c80d316676cfbae5edca114655c3fe

Benedict Wong   commited 2021-02-09 21:22:27 -08:00
c76951f737
Restrict Carrier Wifi while VCN is configured & privileged
This change removes the NOT_RESTRICTED capability for Carrier Wifi. This
is done even if a VCN is in safe mode, but will ONLY be performed if the
VCN is provisioned, and has the appropriate carrier privileges to run.

This change also fixes a test bug where the NOT_VCN_MANAGED capability
was not present in the query to getUnderlyingNetworkPolicy(), and
therefore was incorrectly passing.

Bug: 163432273
Test: atest FrameworksVcnTests
Change-Id: Iecb827b5341bdeb93ef8692c1d62f0eaf9d416ba

Benedict Wong   commited 2021-02-09 18:43:21 -08:00
a7a3fdf42c
Fix PolicyListener testing surface.
This CL updates VcnManager to provide a test-only method for getting
currently registered VcnUnderlyingNetworkPolicyListeners. This is
preferrable over the current method, which accesses VcnManager's private
Map directly.

Bug: 8675309
Test: atest FrameworksVcnTests
Change-Id: I7afd60ff55868ae44bfa74910ae02daf8a81b107

Cody Kesting   commited 2021-02-09 11:44:41 -08:00
a675ee97fa
Implement RetryTimeout state
This change adds support for retries with incrementally increasing
delays.

Bug: 165827287
Test: atest FrameworksVcnTests
Change-Id: I414dce5882540bbe338d0bc1f40481df424821fe

Benedict Wong   commited 2021-02-05 15:11:39 -08:00
f91e1f57b1
Test Network startup in ConnectedState
Add additional tests based on proxy implementations of
ChildSessionCallback and ChildSessionConfiguration

Bug: 165827287
Test: atest FrameworksVcnTests
Change-Id: I165716a0212da7c06b9723656ffe35921cf81854

Benedict Wong   commited 2021-02-05 15:11:38 -08:00
a25d2a5770
Support Safemode for VCNs.
This CL updates VcnManagementService to support Safemode for VCN
instances. Specifically, VcnGatewayConnections will notify their Vcn
instance when they enter Safemode. Vcn instances will in-turn notify
VcnManagementService, which notifies all registered
UnderlyingNetworkPolicyListeners to update their policies.

Bug: 178140973
Test: atest FrameworksVcnTests
Change-Id: I3336c150e9406b3eb2330d2e86cae2ed835730bb

Cody Kesting   commited 2021-02-04 16:22:55 -08:00
e25e6aca5e
Fix test method naming in VcnManagementServiceTest.
Bug: 175914059
Test: atest FrameworksVcnTests
Change-Id: I03be15d63adfccc357000ee670e373d0359a3c06

Cody Kesting   commited 2021-02-03 20:28:51 -08:00
3af8ca1b62
Notify PolicyListeners to refresh their policy on VCN changes.
This CL updates VcnManagementService to notify all registered
VcnUnderlyingNetworkPolicyListeners to refresh their
UnderlyingNetworkPolicy when any VCN is added or removed.

Bug: 175914059
Test: atest FrameworksVcnTests
Change-Id: Ie87f4aa3401c6c4ba9f932130a1d475e35f59d4e

Cody Kesting   commited 2021-02-03 20:28:51 -08:00
39b8220108
Unit test TelephonySubscriptionSnapshot changes for VCNs.
This CL adds unit testing for TelephonySubscriptionSnapshot updates in
UnderlyingNetworkTracker, Vcn, and VcnManagementService.

Bug: 177364490
Test: atest FrameworksVcnTests
Change-Id: I244744194a1360c7c7dee062a302e04f9b5efc32

Cody Kesting   commited 2021-02-03 20:28:43 -08:00
e6006cd68e
Notify UnderlyingNetworkTracker for Subscription changes.
This CL updates VcnManagementService to notify active VCNs when it is
notified of subscription changes by TelephonySubscriptionTracker. These
subscription changes are passed down to each VCN's
UnderlyingNetworkTracker, which determines whether it needs to register
or unregister bringup NetworkRequests based on subIds within that VCN's
Subscription Group.

Bug: 177364490
Test: atest FrameworksVcnTests
Change-Id: I15bc9aaf3d5f97046d0ce9fcf1e12c9b1e0e1446

Cody Kesting   commited 2021-02-03 19:04:01 -08:00
834b60e367
Implement ConnectedState
This change implements the Connected state, ensuring that relevant
capabilities are mirrored from the underlying networks.

Bug: 165827287
Test: atest FrameworksVcnTests
Change-Id: Iedf6d879b4577d7efd40cce41cc1d5fd5021124f

Benedict Wong   commited 2021-02-03 10:26:36 -08:00
6fbf23e095
Implement Network policy in VcnManagementService.
This CL implements #getUnderlyingNetworkPolicy() for
VcnManagementService. Specifically, it takes the provided
NetworkCapabilities and checks for a corresponding VCN. If one exists,
a VcnUnderlyingNetworkPolicy will be returned with a copy of the
original NetworkCapabilities without the capability NOT_VCN_MANAGED and
with the unwanted capability NOT_VCN_MANAGED.

Any NetworkCapabilities without a corresponding VCN will be returned a
VcnUnderlyingNetworkPolicy with the original NetworkCapabilities intact.

Bug: 175914059
Test: atest FrameworksVcnTests
Change-Id: Icdffc4f586f58a0e5b6290d5c6449e2bbed5cab0

Cody Kesting   commited 2021-02-01 14:46:58 -08:00
83c7639dfc
Unit test UnderlyingNetworkTracker.
Bug: 177364490
Test: atest FrameworksVcnTests
Change-Id: I681b0bef27cdd1974a574e81b4b435578cd6e9cd

Cody Kesting   commited 2021-02-01 14:46:57 -08:00
2214eef353
Register NetworkCallbacks in UnderlyingNetworkTracker.
This CL updates UnderlyingNetworkTracker to register NetworkCallbacks.
UnderlyingNetworkTracker uses two types of NetworkCallbacks:
  - bringup requests
  - selection requests

Bringup requests ensure that VCN-managed Networks are not reaped.
Separate bringup requests are filed for wifi and cell Networks. One cell
request is filed for each subscription ID (subId) in the VCN's
subscription group.

Selection requests are used to allow ConnectivityService to perform
Network selection for the VCN's selected underlying Network (the Network
that VCN traffic will be routed through).

Bug: 177364490
Test: atest FrameworksVcnTests
Change-Id: Ic4dc13a3f7acf08589ddb25b343af2677cd7cf65

Cody Kesting   commited 2021-02-01 14:46:57 -08:00
56a8ca7f9f
Allow system components to request underlying network policies.
This CL updates VcnManager to allow system components with permission
NETWORK_FACTORY to request the current VcnUnderlingNetworkPolicy for a
specific Network's NetworkCapabilities and LinkProperties.

Bug: 175900686
Test: atest FrameworksVcnTests
Change-Id: I16416e619bdb03630582f5660260b0090730e9eb

Cody Kesting   commited 2021-01-28 19:38:06 -08:00
64de6994fc
Merge "Implement ConnectingState"
Benedict Wong   authored and   Gerrit Code Review   commited 2021-01-28 18:24:43 +00:00
0ed869f3ac
Merge "Implement DisconnectingState"
Benedict Wong   authored and   Gerrit Code Review   commited 2021-01-27 18:13:10 +00:00
a7fbca545a
Implement ConnectingState
This change implements the Connecting state, where the gateway
connection will be established. In the event of a network switch during
connection, the existing connection attempt will be aborted and
restarted on the new network in an attempt to avoid the case where the
old network is completely lost (eg wifi to cell switch), and IKE stalls
for the entire retry period.

Bug: 165827287
Test: atest FrameworksVcnTests
Change-Id: Id1c6337e8ba4cc1b97c6c20977153c230bd07723

Benedict Wong   commited 2021-01-26 18:24:02 -08:00
8fa7f56d97
Prep VCN files for exposing APIs
Add @hide to methods to clearly show what is being exposed and cleanup
some visibilty/final modifiers.

Bug: 168833866
Test: atest FrameworksVcnTests
Test: atest android.net.vcn
Change-Id: I8e03133053b59fd5b8df640e4b22761f572f9548

Benedict Wong   commited 2021-01-26 15:28:24 -08:00
92ed6cb3f3
Implement DisconnectingState
This change implements the Disconnecting state, which provides facility
to attempt to gracefully close IKE sessions, and kill it after a few
seconds.

Bug: 165827287
Test: atest FrameworksVcnTests
Change-Id: I0d179085726b8125f2021679def75824cf71bd08

Benedict Wong   commited 2021-01-25 18:37:21 -08:00
da60ff3a38
Merge "Implement Disconnected state"
Benedict Wong   authored and   Gerrit Code Review   commited 2021-01-25 22:41:08 +00:00
3776ddde9c
Implement Disconnected state
This change implements the signal handling for the Disconnected state.

Bug: 165827287
Test: atest FrameworksVcnTests
Change-Id: I4853b0801b82fddc4ef9e9c6e6a659f9b81e2ac3

Benedict Wong   commited 2021-01-20 12:01:10 -08:00
c0f9d053a7
Implement Policy Listener add/remove in VcnService.
This CL updates VcnManagementService to implement
VcnUnderlyingNetworkPolicyListener add and remove operations. It also
adds functionality to remove any listeners if the registering app dies
without unregistering.

Bug: 175739863
Test: atest FrameworksVcnTests
Change-Id: I9db2729d404f232b84577d2d90909b9152d53b5a

Cody Kesting   commited 2021-01-19 13:38:22 -08:00
eb7badf1c9
Merge changes I61dd789f,I57c73264
* changes:
  Define add and remove for VCN policy listeners.
  Define VcnUnderlyingNetworkPolicy.

Cody Kesting   authored and   Gerrit Code Review   commited 2021-01-19 19:37:53 +00:00
aab7cacca8
Define add and remove for VCN policy listeners.
Bug: 175729529
Test: atest FrameworksVcnTests
Change-Id: I61dd789fe4a4ebd1ca95866494d0e42e97c202cc

Cody Kesting   commited 2021-01-15 09:21:59 -08:00
230f02c272
Define VcnUnderlyingNetworkPolicy.
Bug: 175729529
Test: atest FrameworksVcnTests
Change-Id: I57c732640d6d21db1f4d68c69ff320918e7891c3

Cody Kesting   commited 2021-01-15 07:55:18 -08:00
2d69257902