Commit Graph

5783 Commits

Author SHA1 Message Date
Cody Kesting
7f60b13ff5 Merge changes I34ef76ec,Icf686c3d
* changes:
  Notify VcnStatusCallback#onVcnStatusChanged for Safe Mode.
  Define VcnStatusCallback#onVcnStatusChanged.
2021-02-23 21:23:17 +00:00
Chiachang Wang
9c92c37f56 Merge "Remove UidRange.createForUser() with userId integers" 2021-02-23 07:17:07 +00:00
Paul Hu
584e907d7a Merge "Use PermissionUtils" 2021-02-23 01:48:58 +00:00
Cody Kesting
fb657c523b Define VcnStatusCallback#onVcnStatusChanged.
This CL defines VcnStatusCallback#onVcnStatusChanged for notifying
VcnStatusCallbacks when the status of their specified subscription group
changes. Specifically, status codes will be provided to notify callbacks
when a VCN is started, stopped, enters Safe Mode, and when there are no
matching VCNs.

Bug: 180659281
Test: atest FrameworksVcnTests
Change-Id: Icf686c3da6c5bdeeab88f60495d2ad438fa15692
2021-02-22 17:28:48 -08:00
Cody Kesting
f74c6031f1 Expose VCN Network policy APIs.
This CL exposes APIs used for a) receiving VCN Network policy updates
and b) applying VCN Network policies to a given Network. Specifically,
these APIs should be used to receive notifications from VcnManager
whenever a VCN Network policy may have changed - generally, following a
VCN starting up, tearing down, or entering Safe Mode.

When a VcnNetworkPolicyListener is notified of a policy change, the
listener should query VcnManager#applyVcnNetworkPolicy to receive the
updated VcnNetworkPolicyResult. This policy result informs the listener
of their resulting NetworkCapabilities and also whether a Network
teardown is required as a consequence of the policy change.

Bug: 177020190
Test: atest FrameworksVcnTests
Change-Id: Ied78a57973a4ceaa7ef4cd9feee64478137497b8
2021-02-22 17:23:40 +00:00
Cody Kesting
c70a7d6258 Merge changes I1ceccedd,Ide2c7302
* changes:
  Change Exception class references to use Class.getName().
  Define VcnNetworkPolicyListener for VCN transports.
2021-02-22 17:23:14 +00:00
Chiachang Wang
66ded137bf Remove UidRange.createForUser() with userId integers
UidRange will be a part of connectivity mainline module.
Mainline modules should use strongly-typed UserHandle arguments.
The method also refer to the hidden UserHandle.PER_USER_RANGE
which is not available after UidRange is moved into module.
Thus, replace the usage and remove the createForUser method that
takes userId parameter.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I3f33ea92c4a24342af9ec4b0367c50bb64ce6450
2021-02-22 18:51:14 +08:00
Paul Hu
7d72edb937 Merge "Expose NetworkWatchlistManager#getWatchlistConfigHash" 2021-02-22 05:23:04 +00:00
Treehugger Robot
6b501d8acf Merge "Use RouteInfo API constructor in VpnService" 2021-02-22 04:05:51 +00:00
Junyu Lai
3237216211 Merge "[FUI15] Remove networkId in NetworkState" 2021-02-20 14:00:19 +00:00
paulhu
5119787a27 Expose NetworkWatchlistManager#getWatchlistConfigHash
Connectivity is becoming a mainline module in S and
ConnectivityService is used this API for getting watch list
configurations. However, Mainline modules are not allowed to use
non-formal APIs. Thus, make this API as module-lib api to support
the usage.

Bug: 172183305
Test: make update-api
Change-Id: I21ce5f158850892926b92cf6347c61a57ac95b72
2021-02-19 15:30:02 +08:00
Remi NGUYEN VAN
09bbad130d Merge "Split parcelable .aidl files to aidl-export" 2021-02-19 02:21:25 +00:00
Cody Kesting
901dc86e4b Define VcnNetworkPolicyListener for VCN transports.
This CL defines VcnNetworkPolicyListener and VCN Network policy
functions for VcnManager. Specifically, VcnNetworkPolicyListeners should
be added and removed by Network factories as they bring up and teardown
data Networks.

VcnNetworkPolicyListeners are used by VcnManagementService to notify
transports when they should re-query for their updated
VcnNetworkPolicyResults - done via VcnManager#applyVcnNetworkPolicy.
Policy results inform transports what the current NetworkCapabilities
are based on their VCN policy, and also whether the transport should
teardown and restart.

Bug: 177020190
Test: atest FrameworksVcnTests
Change-Id: Ide2c73025f4ffceabf7955f219a79be5a9bdc0d9
2021-02-18 16:31:08 -08:00
Yan Yan
bf16b6d399 Merge "API: Expose VcnControlPlaneConfig" 2021-02-18 23:00:56 +00:00
paulhu
d7a93468a6 Use PermissionUtils
The checking permission methods on NetworkStack has migrated to
PermissionUtils. Let these methods refer to PermissionUtils but
still keep them because lots of frameworks modules are using
NetworkStack methods to check permission.

Also replace the NetworkStack#checkNetworkStackPermission to
PermissionUtils in CS.

Bug: 178352309
Test: atest FrameworksNetTests
Change-Id: Icd38aa17fe471b810978e21ea361c41719e7802d
2021-02-18 23:20:23 +08:00
Remi NGUYEN VAN
6e9ab0553d Use RouteInfo API constructor in VpnService
Instead of using the RouteInfo(destination, gateway) constructor which
is private API, use the RouteInfo(destination, gateway, iface, type)
constructor which is system API.

This separates the VpnService better from internal implementations, and
is necessary to move RouteInfo to the connectivity module.

Bug: 174436414
Test: m

Change-Id: Idc98b2258f3c78bdba40b5fcb97769b5ad99d016
2021-02-18 03:38:34 +00:00
Cody Kesting
4ea84f0b97 Merge changes I0cadd145,I3be3cac4,I9ea6e9e8
* changes:
  Correct comment for safe mode alarm in VcnGatewayConnection.
  Implement VCN error callback use.
  Define VcnStatusCallback#onGatewayConnectionError callback.
2021-02-18 03:07:14 +00:00
Benedict Wong
a7d23702bf Merge "Add VcnUnderlyingNetworkSpecifier" 2021-02-18 02:35:12 +00:00
Yan Yan
afc550f30b API: Expose VcnControlPlaneConfig
Each VcnGatewayConnectionConfig must have a VcnControlPlaneConfig
that contains all connection, authentication and authorization
parameters required to establish a gateway connection.

Bug: 163604823
Test: make update-api && make
Change-Id: If4a58e7b0391b485ee7c4482d422bec5e6ba4148
2021-02-18 02:26:27 +00:00
Remi NGUYEN VAN
4e8639649a Split parcelable .aidl files to aidl-export
The one-line "parcelable X" files need to be imported by targets that do
not build against SDK (the SDK has prebuilt definitions), so prepare a
dedicated directory for them.
This avoids having users of the classes include the whole src/
directory, which could contain definitions for classes that are not part
of the public API, so should not be imported.

Also move back to frameworks/base/core some .aidl definitions that
were separated from their associated class.

Bug: 171540887
Test: m
Merged-In: I7432fe4c87cd3cab04dcb6185c9a4f3f84376549
Change-Id: I7432fe4c87cd3cab04dcb6185c9a4f3f84376549
2021-02-18 01:17:04 +00:00
Cody Kesting
fe0523949b 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
2021-02-17 14:28:33 -08:00
Yan Yan
a9c1bab850 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
2021-02-17 11:25:04 -08:00
Yan Yan
c4fbd6a90c 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
2021-02-17 10:56:48 -08:00
Cody Kesting
f1d78f17c2 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.
2021-02-17 18:08:48 +00:00
Benedict Wong
54e89ebf18 Merge "Expose Basic VCN API surface" 2021-02-17 18:03:08 +00:00
Cody Kesting
f14145e37a 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
2021-02-16 21:33:40 -08:00
Benedict Wong
049c180ae2 Expose Basic VCN API surface
This change exposes the Basics of the VCN API surface, including:
- VCN Configurations
- VCN Gateway Configuration superclass (Builder in subclasses)
- VcnManger with configuration management APIs

Bug: 168833866
Test: atest FrameworksVcnTests
Test: atest android.net.vcn
Change-Id: Ia1b3597d903dd84267f66546a90437f9ac45b2de
2021-02-16 21:31:00 -08:00
Lorenzo Colitti
438ac4a7f2 Use UserHandles instead of userId integers.
userId integers are not public API and code should use UserHandle
instead.

Bug: 170598012
Test: passes existing tests
Change-Id: Ic27b93ccfe6bbc97e7419293ce165fee6cd51e6d
2021-02-16 08:06:23 +00:00
Benedict Wong
53abcd3c86 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
2021-02-15 17:39:42 -08:00
Lorenzo Colitti
4e82e55794 Move the VPN code out of packages/Connectivity.
Bug: 173331190
Test: atest FrameworksNetTests HostsideVpnTests CtsNetTestCases
Change-Id: Idc6ed1a544e744f8661d1e387da278736d407489
2021-02-15 12:05:40 +00:00
Kholoud Mohamed
4338d7f97a Merge "Exposed some testAPIs in NetworkPolicyManager" 2021-02-15 11:12:27 +00:00
Treehugger Robot
4a7e41a6e6 Merge "Expose VpnTransportInfo as module-lib API." 2021-02-15 04:54:13 +00:00
Lorenzo Colitti
d92d403e76 Expose VpnTransportInfo as module-lib API.
This information originates in non-mainline system server code
and needs to be passed to the connectivity mainline code.

Bug: 173331190
Test: already covered by CTS tests
Change-Id: Ic612b6a51f7ec13e2213c8754312cf716130c876
2021-02-15 09:34:19 +09:00
Lorenzo Colitti
45ec3191a7 Merge changes Ia68f482a,I4911e214,Ied379654,I66d18512,Ie8e1bd63
* changes:
  Check registering system default callback needs NETWORK_SETTINGS.
  Move VPN code from ConnectivityService to VpnManagerService.
  Add a skeleton VpnManagerService, and start it on boot.
  Convert LockdownVpnTracker to NetworkCallbacks.
  Minor fixes to VpnTransportInfo.
2021-02-15 00:00:47 +00:00
James Mattis
601d16a336 Merge changes from topics "pans", "pans-permission"
* changes:
  Marking setOemNetworkPreference as @SystemApi
  Adding permission for OEM managed preferences
  Implementation of setOemNetworkPreference
2021-02-13 20:54:57 +00:00
Yan Yan
8d659bb1ec Merge changes Ifc8ad902,I6d1b8d0e
* changes:
  [API] Expose IpSecTunnelInterface#setUnderlyingNetwork
  Update underlying network of IpSecTunnelInterface
2021-02-12 21:23:29 +00:00
James Mattis
0846b40040 Marking setOemNetworkPreference as @SystemApi
Marking setOemNetworkPreference in ConnectivityManager as @SystemApi.

Bug: 176496438
Bug: 176494815
Test: atest FrameworksNetTests
atest FrameworksNetIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: I4681c88dc3a83f71c387b29610c33594e57cb43f
2021-02-11 20:38:21 -08:00
James Mattis
82da6ad33d Implementation of setOemNetworkPreference
Main implementation of ConnectivityService.setOemNetworkPreference. This
covers the main requirements of this method including listener
functionality.

Bug: 176495594
Bug: 177101287
Bug: 176494815
Test: atest FrameworksNetTests
atest NetworkStackTests
atest FrameworksNetIntegrationTests
atest NetworkStackIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: I8d318ab07785e52dd84d6261fdea8f318dce9bc5
2021-02-11 20:38:18 -08:00
Lorenzo Colitti
3dc6dbe80f Move VPN code from ConnectivityService to VpnManagerService.
ConnectivityService itself does not depend on mVpns or the Vpn
class any more. Most of this CL is simply moving code from one
class to another:

- Move the AIDL calls from IConnectivityManager to IVpnManager.
- Move the implementation from ConnectivityService to
  the new VpnManagerService.
- Move the APIs from ConnectivityManager to VpnManager, but
  temporarily maintain some shims in ConnectivityManager for the
  moved calls so that existing callers do not have to be modified
  in this CL.
- Update VpnService to call IVpnManager instead of
  IConnectivityManager.
- Move the code that registers the VpnManager service from
  ConnectivityFrameworkInitializer to SystemServiceRegistry.

Bug: 173331190
Test: atest HostsideVpnTests FrameworksNetTests CtsNetTestCases
Change-Id: I4911e2144df721a94fa00da9edf0dc372a7091c2
2021-02-12 01:12:24 +09:00
Lorenzo Colitti
f83d22b77d Add a skeleton VpnManagerService, and start it on boot.
This adds a lot of unused code but this should make it easier to
review subsequent CLs.

Bug: 173331190
Test: builds, boots, "dumpsys vpnmanager" succeeds
Change-Id: Ied379654a0c3ab6242d3125661fe30f322395059
2021-02-12 01:07:29 +09:00
kholoud mohamed
c5616b51d1 Exposed some testAPIs in NetworkPolicyManager
Exposed setRestrictBackground, getRestrictBackground,
and resolveNetworkId as testAPIs.

Bug: 179476736
Test: Verified that CTS tests can access the APIs.
Change-Id: Ida4603d55a30187c03e23c7af6ff229065597bab
2021-02-11 13:58:31 +00:00
Yan Yan
8cd28adbc5 [API] Expose IpSecTunnelInterface#setUnderlyingNetwork
This API is required to perform MOBIKE. This API allows an IPsec
peer to change the underlying network of its established IPsec
tunnel without re-establishing the tunnel.

Bug: 169855650
Test: atest IpSecManagerTunnelTest (new tests added)
Change-Id: Ifc8ad902cbfbe4ad07e715f2fef0faa1bf9d68f3
2021-02-10 14:52:18 -08:00
Yan Yan
b2d0ef2dd4 Update underlying network of IpSecTunnelInterface
Bug: 169855650
Test: atest IpSecManagerTunnelTest
Change-Id: I6d1b8d0e49f89c67ddc2caf4ba63fb0b1eb062c0
2021-02-10 14:51:43 -08:00
Serik Beketayev
80f8c777e1 [Mainline] android.system package APIs migration
By removing Int32Ref.

Bug: 177619520
Bug: 179703584
Test: mma
Change-Id: I9b63146ae563ed977f3112c9910f7a7c575de0b8
Merged-In: I9b63146ae563ed977f3112c9910f7a7c575de0b8
(cherry picked from commit 63be514478)
2021-02-10 12:34:46 +00:00
Lorenzo Colitti
250855cb84 Merge changes from topics "vpnmove-getconnectionowneruid", "vpnmove-systemdefaultcallback", "vpnmove-vpntransportinfo"
* changes:
  Stop using mVpns in getConnectionOwnerUid.
  Add a VpnTransportInfo object.
  Add a registerSystemDefaultNetworkCallback method.
2021-02-10 06:38:41 +00:00
Cody Kesting
c5bc3bcd8f Merge "Fix PolicyListener testing surface." 2021-02-09 23:03:25 +00:00
Cody Kesting
fecc2a3361 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
2021-02-09 11:44:41 -08:00
Lorenzo Colitti
76e8a43e68 Add a VpnTransportInfo object.
This currently stores the VPN type and a session name, but can be
extended in the future.

Bug: 173331190
Test: added coverage in VpnTest
Test: added coverage in ConnectivityServiceTest
Test: added coverage in NetworkAgentTest
Change-Id: I450858a9fa332c8d896dbdb4c14337d5ec23677f
2021-02-10 02:52:16 +09:00
Junyu Lai
c2d6240642 Merge changes from topic "removeNI"
* changes:
  [FUI07] Stop making NetworkState with NetworkInfo from external callers
  [FUI06] Stop using NetworkInfo in NetworkState from external callers
2021-02-09 03:37:59 +00:00
junyulai
7c06b064cf [FUI15] Remove networkId in NetworkState
Follow-up from aosp/1542748. networkId is unused and it is
safe to remove them now.

Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: Ifc9cdad79a3d772035c73116de3f64dd6237b747
2021-02-08 22:16:08 +08:00