Commit Graph

113 Commits

Author SHA1 Message Date
Benedict Wong
ab765e0ebe Merge changes I2d30b75c,I57ecf4f5
* changes:
  Switch to using list of subIds for policy generation
  Switch to using list-of-subIds for VCN selection of underlying networks
2021-03-31 20:59:00 +00:00
Benedict Wong
85c6ad2363 Switch to using list of subIds for policy generation
Bug: 183174340
Test: atest FrameworksVcnTests
Change-Id: I2d30b75c282cf619d81b0f6dc06638566af61a33
2021-03-30 14:21:49 -07:00
Lucas Lin
0b66568d6a Merge "Remove the usage of hidden API and simplify the design" 2021-03-30 08:01:27 +00:00
Benedict Wong
bda63ebd02 Switch to using list-of-subIds for VCN selection of underlying networks
This change switches from primarily using unwanted(NOT_VCN_MANAGED) to
list-of-subIds. This opens the door for a soft-start, predicated on the
VCN-exposed networks not populating their respective subId fields.

Allowing the potential for soft-start means that the VCN can exit safe
mode without carrier app intervention, when all requested configurations
are active.

Bug: 183174340
Test: atest FrameworksVcnTests
Change-Id: I57ecf4f5f04dc5d15589b17d647661674595b872
2021-03-29 10:45:41 -07:00
lucaslin
36705517ed Remove the usage of hidden API and simplify the design
- ConnectivityManager will be a part of mainline module, so its
hidden API cannot be called by external caller.
- There is no need to listen onNetworkSuspended() and
onNetworkResumed() because if the network is suspended, then
NET_CAPABILITY_NOT_SUSPENDED will be removed and
onCapabilitiesChanged() will be called and the network capabilities
will be different from the previous one. And when the network is
resumed, NET_CAPABILITY_NOT_SUSPENDED will be added back to the
network capabilities. So the current design can be simplified.

Bug: 182963397
Test: atest FrameworksVcnTests
Change-Id: Ib8f8ea1c95503c946b8229670512af2db8be3165
Merged-In: Ib8f8ea1c95503c946b8229670512af2db8be3165
  (cherry-picked from ag/13927656)
2021-03-25 10:29:27 +00:00
Benedict Wong
62f01dfbd5 Trigger re-evaluation of privileged apps upon app install/uninstall
This change registers listeners for package installs and uninstalls,
ensuring that changes to app install statuses are reflected in the VCN

Bug: 183465258
Test: atest FrameworksVcnTests
Change-Id: I8d2afd351208cac12392bf945439845cc521b7ec
2021-03-23 17:42:12 -07:00
Benedict Wong
d68c1f6cb2 Check carrier privilege permissions with package name
This change ensures that carrier privileges for the right packages are
always checked.

Bug: 183465199
Test: atest FrameworksVcnTests
Change-Id: If46c660e54870529868a7b4b1e271c9009b81d45
2021-03-23 17:42:12 -07:00
Cody Kesting
c57281504e Rename VcnStatusCallback#onVcnStatusChanged.
Per API Council feedback, VcnStatusCallback#onVcnStatusChanged is
renamed to VcnStatusCallback#onStatusChanged.

Bug: 182345902
Test: atest FrameworksVcnTests CtsVcnTestCases
Change-Id: Ie0277c5f053e1802aa98240618a9d9e8aa6d9d09
2021-03-22 11:59:27 -07:00
Cody Kesting
3a51a7d152 Reevaluate VcnGatewayConnections on receiving new configs.
This CL updates Vcn.java to reevaluate its VcnGatewayConnections when it
receives a new VcnConfig. This may result in VcnGatewayConnections being
torn down (if their VcnGatewayConnectionConfig is not in the updated
VcnConfig) or established (if a NetworkRequest matches a new
VcnGatewayConnectionConfig).

Bug: 181815405
Test: atest FrameworksVcnTests CtsVcnTestCases
Change-Id: I7da60f60e972bd968e1ff4fe416fb9a1d3309a18
2021-03-22 11:59:27 -07:00
Treehugger Robot
403b7fd0b0 Merge changes from topics "revert-1645768-revert-1626206-replaceUidRange-MSYTKFNGUE-HIUTVTIGIR", "ti_redaction"
* changes:
  TransportInfo: Add a generic redaction mechanism
  Revert "Revert "Expose uids related APIs in NetworkRequest and N..."
  Revert^2 "Replace the usage of UidRange"
2021-03-21 16:41:13 +00:00
Roshan Pius
adee4b7b7e TransportInfo: Add a generic redaction mechanism
This replaces the existing mechanism for redacting location sensitive
fields with a more extensible mechanism. Currently supported redactions
are for the following permissions:
i. ACCESS_FINE_LOCATION
ii. LOCAL_MAC_ADDRESS
iii. NETWORK_SETTINGS

Also, removed WifiInfo from ConnectivityServiceTest to reduce cross
dependencies on wifi code.

Bug: 156867433
Bug: 162602799
Test: atest android.net
Test: atest com.android.server
Change-Id: I2bb980c624667a55c1383f13ab71b9b97ed6eeab
2021-03-19 20:15:21 +00:00
Benedict Wong
d4b7104f7b Merge "Hide required underlying caps APIs" 2021-03-18 17:05:37 +00:00
Benedict Wong
226af1dbfd Hide required underlying caps APIs
VCN underlying network capabilities should be transport-dependent in
order to allow using anything other than the INTERNET capability for
VCN types that support wifi offload. Specifically, if underlying
network capabilities are not transport-dependent, and Wifi only ever
supports the INTERNET capability, the VCN is unable to utilize wifi
offload together with requiring NET_CAPABILITY_IMS or
NET_CAPABILITY_CBS, since the IMS or CBS capability would be required
for both cellular and wifi underlying networks.

Until such time as a per-transport capability set is allowed, hide
the exposedCapability pieces, and document that all underlying networks
MUST have INTERNET capability in order to be used.

Bug: 182219992
Test: atest FrameworksVcnTests
Test: atest CtsVcnTestCases
Change-Id: I50d7f1be42e0e001f1413a3d5fe8aa4b7afec223
2021-03-17 10:26:21 -07:00
Remi NGUYEN VAN
a89a2ae676 Merge "Move LocationPermissionChecker to libs/net" 2021-03-17 00:13:21 +00:00
Chalard Jean
5c4bb91134 [NS01] Add NetworkScore
As attested by numerous TODOs in the code, a new way of
representing network quality and policy is needed instead
of an int.

An int representing the quality of the network requires
all parties using it to know how all other parties are
using it, and implementation details about the decision
algorithm. For all intents and purposes, the selection
is left to individual network factories who try to
achieve a desired result while piecing together all
possible states of the system.

As the number of such cases and desires increases, this
becomes both intractable and unmaintainable. Indeed, at
this time in the codebase nobody can really predict exactly
how a given change in score will affect selection across
the board, and it is essentially impossible to figure out
the behavior of network selection by inspecting the code
because the moving parts are scattered throughout the
entire codebase.

Having an object encapsulating policy and quality values
will let us centralize the selection and make it again
possible to maintain without knowledge of all behaviors
of all network factories. It will also provide better
guarantees of respecting policy, and allow bugfixes that
were not possible before because they'd touch too many
parts of the code.

Test: FrameworksNetTests FrameworksWifiTests NetworkStackTests
Change-Id: I3185a6412b9b659798faf0c6882699e9c63cc115
2021-03-15 09:49:47 +00:00
Cody Kesting
a93e2f9545 Merge "Update Policy Listener API naming." 2021-03-12 21:32:08 +00:00
Cody Kesting
ae3c3593cb Update Policy Listener API naming.
This CL changes the policy listener API to be
VcnNetworkPolicyChangeListener (it was previously
VcnNetworkPolicyListener) per API Council guidance.

This CL also requires permission NETWORK_FACTORY for removing registered
policy listeners.

Bug: 181562364
Test: atest FrameworksVcnTests
Change-Id: I026eaefa62d8f64b9180fc182a7cf0605d83bf97
Merged-In: I026eaefa62d8f64b9180fc182a7cf0605d83bf97
(cherry picked from commit a96ec13821)
2021-03-11 09:48:22 -08:00
Benedict Wong
03c0059bb1 Merge changes Iad296830,I826711bb,Ieb2a9b20,I6b688b00
* changes:
  Declare VCN exposed networks as NOT_VCN_MANAGED
  Allow underlying cell without unwanted NOT_VCN_MANAGED capability
  Override network and use config IKE session
  Remove usage of hidden Connectivity APIs
2021-03-10 21:53:01 +00:00
Benedict Wong
de1f0c3edb Declare VCN exposed networks as NOT_VCN_MANAGED
This change marks VCN-exposed networks as generic use, NOT_VCN_MANAGED
networks. This is the result of changes to the default NetworkCapability
set, where NOT_VCN_MANAGED was removed from the default capabilities.

Bug: 182212201
Test: atest FrameworksVcnTests
Change-Id: Iad296830201d7317537fac6bea53c79d4e41cae3
2021-03-10 10:27:23 -08:00
Yan Yan
a8d51aac66 Merge changes from topic "ike-params"
* changes:
  Support converting VcnControlPlaneIkeConfig to/from PersistableBundle
  Support converting IKE Options to/from PersistableBundle
  Support converting IkeConfigRequest to/from PersistableBundle
  Support converting IkeAuthEapConfig to/from PersistableBundle
  Support converting IkeAuthDigitalSignConfig to/from PersistableBundle
  Support converting IkeAuthConfig to/from PersistableBundle
  Support converting IkeSessionParams to/from PersistableBundle
2021-03-10 02:31:36 +00:00
Benedict Wong
dc1efbb3b2 Allow underlying cell without unwanted NOT_VCN_MANAGED capability
This change updates the UnderlyingNetworkTracker to rely on the
TelephonyNetworkSpecifier for selecting underlying networks. This
ensures that there is always a cellular NetworkRequest filed for
Cellular to bring up an underlying Network.

Bug: 182211364
Test: FrameworksVcnTests
Change-Id: I826711bb671440054c2090793315a5f1d57596c0
2021-03-09 17:58:39 -08:00
Benedict Wong
033a4308ce Override network and use config IKE session
This change ensures the IKE configs are used with the correct network

Bug: 163604823
Test: FrameworksVcnTests
Change-Id: Ieb2a9b202204577f6e6969ef30245baed6382aa6
2021-03-09 15:07:57 -08:00
Cody Kesting
cdc4d4adae Specify exposed capabilities for VCN gateway connection errors.
This CL updates VCN error callbacks to return the exposed capabilities
for a gateway connection for identification purposes. Previously, the
required underlying capabilities were returned (which are not meaningful
to the caller for identification purposes).

Bug: 182281888
Test: atest FrameworksVcnTests
Change-Id: Ic62bd0b524f24f2577d9abc7635112a6419d35ed
2021-03-09 11:22:46 -08:00
Remi NGUYEN VAN
0c4e4a2059 Move LocationPermissionChecker to libs/net
LocationPermissionChecker was written to be used by multiple
connectivity modules, so it belongs in the frameworks/libs/net library.

The file is moved as-is with minor modifications in the test to avoid
usage of the privileged ActivityManager.getCurrentUser API.

Bug: 181837977
Test: atest NetworkStaticLibTests
Change-Id: I63bce35ba87c45138b3aaf6244367e982dfec455
2021-03-09 17:00:39 +09:00
Cody Kesting
df8455eae2 Exit Safe Mode when a VCN gets new configs.
This CL updates VCN instances to exit Safe Mode when they receive a
new VcnConfig. When a VCN exits Safe Mode, they will re-register a
request listener to receive all cached requests and start the
needed VcnGatewayConnections.

Bug: 179429339
Test: atest FrameworksVcnTests
Change-Id: Id1c2dc287e1ec56f37821cf0ae77f066f22d22bb
2021-03-08 11:14:25 -08:00
Cody Kesting
212c06aaa6 Notify VcnStatusCallbacks for VCN start/stop.
This CL updates VcnManagementService to notify VcnStatusCallbacks when a
VCN is started or stopped. VcnStatusCallbacks will also be notified for
config changes that cause a VCN to exit Safe Mode.

Bug: 180659281
Test: atest FrameworksVcnTests
Change-Id: I4168c868185880621333855dfcb51e46cb662741
2021-03-08 11:14:25 -08:00
Yan Yan
f8bce7ede4 Support converting VcnControlPlaneIkeConfig to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(new tests added)
Change-Id: I38d066949d1543dc6b53a9e00ab6c1d1bd820c5f
2021-03-04 14:19:42 -08:00
Yan Yan
3d9908aa99 Support converting IKE Options to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: I28cad3cf4d8ccccb8233f76c631db3a302eb320b
2021-03-04 14:15:57 -08:00
Yan Yan
85414c1c24 Support converting IkeConfigRequest to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: I9a0f7ad91de41749fdf05629bf86bdb010ba13fb
2021-03-04 14:15:42 -08:00
Yan Yan
c3da07fb9c Support converting IkeAuthEapConfig to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: Ifaddd113d9267664404d75b7e4e5410622bf5d7b
2021-03-04 14:13:32 -08:00
Yan Yan
848568a3ce Support converting IkeAuthDigitalSignConfig to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: I62cdf4cb0297a394e0c97973e621b5c051ab0192
2021-03-04 13:30:48 -08:00
Yan Yan
2f0f6b575c Support converting IkeAuthConfig to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: I97d9a7db423711dbccea412b96f069fe1dbd2779
2021-03-04 12:37:43 -08:00
Yan Yan
067b3dffa4 Merge changes I65dbc509,I1e338d9c,Ib4a0ed69,Iac7077b4,I9c53d425, ...
* changes:
  Support converting IKE ID to/from PersistableBundle
  Support converting EAP-TTLS to/from PersistableBundle
  Support converting EAP-SIM, AKA and AKA' to/from PersistableBundle
  Support converting EapSessionConfig to/from PersistableBundle
  Support converting TunnelModeConfigRequest to/from PersistableBundle
  Support converting TunnelModeChildSessionParams to/from PersistableBundle
  Support converting ChildSaProposal to/from PersistableBundle
  Support converting IkeSaProposal to/from PersistableBundle
2021-03-04 18:30:17 +00:00
Cody Kesting
f38b347ca8 Call VcnStatusCallback#onVcnStatusChanged on register.
This CL updates VcnMangementService to notify VcnStatusCallbacks on
registration with the current status of the VCN for the specified
subscription group.

Bug: 180659281
Test: atest FrameworksVcnTests
Change-Id: Id2c74e855fa12d21d292ee94a72ad047f2d56aca
2021-03-03 14:06:55 -08:00
Cody Kesting
5d623992e9 Remove VcnStatusCallback#onEnteredSafemode().
This CL removes VcnStatusCallback#onEnteredSafeMode(). This method was
previously used to notify callbacks when their VCN entered Safe Mode.
However, this is not needed now that
VcnStatusCallback#onVcnStatusChanged(int) is defined.

Bug: 1597023
Test: atest FrameworksVcnTests
Change-Id: I8e47de9bf6763cd38025a552bee710673dddf843
2021-03-03 10:08:50 -08:00
Benedict Wong
a3fab46d7b Merge changes Ib439bde4,I5bc0fe94,I72abf1e2,Id1813bcb
* changes:
  Call setUnderlyingNetwork to complete VCN MOBIKE
  Rename isRunning to isQuitting, and flip all booleans
  Notify Vcn of VcnGatewayConnection quits
  Allow NETWORK_LOST disconnections to retry
2021-03-03 06:02:20 +00:00
Benedict Wong
e145e06681 Call setUnderlyingNetwork to complete VCN MOBIKE
This change updates the underlying network for the VCN in order to
ensure full MOBIKE switches are handled.

Bug: 169788130
Test: atest FrameworksVcnTests
Change-Id: Ib439bde4217beeb28f425c08ed9f3376dfe0033c
2021-03-02 00:13:28 +00:00
Benedict Wong
6adf88b074 Rename isRunning to isQuitting, and flip all booleans
Per code reviews, this may increase readability

Bug: 179944275
Test: atest FrameworksVcnTests
Change-Id: I5bc0fe946b8da870a8e89f6e07b1d1ade5865710
2021-03-02 00:09:56 +00:00
Benedict Wong
685c909718 Notify Vcn of VcnGatewayConnection quits
This change updates the Vcn when any GatewayConnection StateMachine
quits, removing it from the map of active GatewayConnections, and
triggering a re-evaluation of all existing NetworkRequests. This may (in
the event of a updated policy) result in an immediate restart.

Bug: 179944275
Test: atest FrameworksVcnTests
Change-Id: I72abf1e270a772760a17a03173d5a110e15bd01d
2021-03-01 15:44:52 -08:00
Benedict Wong
75a32b9401 Allow NETWORK_LOST disconnections to retry
This change adds the ability for disconnection requests to specify
whether the full VcnGatewayConnection should be torn down. This is
useful in cases where the cause is an ephemeral failure, and can be
restarted at some later point (eg an underlying network appears, or a
new NetworkRequest is filed that brings the VCN up.)

Bug: 179944275
Test: atest FrameworksVcnTests
Change-Id: Id1813bcbbb80541be97cc383ea9d1fe08554b7ae
2021-03-01 15:36:24 -08:00
Yan Yan
6a6a6349a7 Merge "Support converting IkeTrafficSelector to/from PersistableBundle" 2021-03-01 22:31:24 +00:00
Yan Yan
b8a6b4ef85 Support converting IKE ID to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: I65dbc509f23334df2f22d6c4658e31acc9bef787
2021-03-01 12:22:12 -08:00
Yan Yan
a3d6e04d27 Support converting EAP-TTLS to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: I1e338d9c8940636b38f4725787de30fbbc1323ec
2021-03-01 12:19:36 -08:00
Yan Yan
3344f916bd Support converting EAP-SIM, AKA and AKA' to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: Ib4a0ed69b57df10c5ede9524d0b03f4f03d68919
2021-03-01 12:19:25 -08:00
Yan Yan
63db000ae0 Support converting EapSessionConfig to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: Iac7077b4ca37dfc07055aac5b3a8118610a27999
2021-03-01 12:19:15 -08:00
Yan Yan
ca4e2a4041 Support converting TunnelModeConfigRequest to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: I9c53d4252edb0e8816c84d280b48c4725bd0edc8
2021-03-01 12:19:05 -08:00
Yan Yan
32fed8965b Support converting TunnelModeChildSessionParams to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(add new tests)
Change-Id: I4d27ac37ce750930cefa73de25e5deea74591d0e
2021-03-01 12:17:42 -08:00
Yan Yan
6ce7d0db64 Support converting ChildSaProposal to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(new tests added)
Change-Id: I726a29a65b10b23718fe3b1658d70a8b84cfd2de
2021-03-01 11:14:07 -08:00
Yan Yan
f14e3e03a6 Support converting IkeSaProposal to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(new tests added)
Change-Id: I108e5a946296f65bbe92549464aa68a2ec453659
2021-03-01 10:53:06 -08:00
Yan Yan
2a9bfb281f Support converting IkeTrafficSelector to/from PersistableBundle
Bug: 163604823
Test: FrameworksVcnTests(new tests added)
Change-Id: I7b2613d62fa555c3c1eb125a1d971771b954e9ca
2021-02-23 10:39:17 -08:00