Commit Graph

6284 Commits

Author SHA1 Message Date
lesl
b8b282e54e carrier data usage: Use carrier template as default policy
The carrier network means any network which linked with sepcific
subscriberId (for instances: merged Wifi or mobile).
Update default policy to use carrier network template to replace mobile
template.

No impact for current AOSP user because no any wifi network is merged
wifi. (Because the merged wifi network requires to support from the wifi module).

Also this change convert all of the old policies which template is
TYEP_MOBILE to TYPE_CARRIER to match the default policy.

Bug: 176396812
Test: atest -c NetworkPolicyManagerServiceTest
Test: atest -c CtsHostsideNetworkTests
Test: Manual Test with test code (Force wifi to merged wifi).
      The data will limit when using merged wifi.
      And mobile policy also work normally.

Merged-In: I33c10f7549e713c52ce9afd5b8c4cce2abbda616
Change-Id: I33c10f7549e713c52ce9afd5b8c4cce2abbda616
2021-06-01 18:12:56 +08:00
Aaron Huang
fb2b21a167 Remove IntDef annotations from NetworkPolicyManager
@RestrictBackgroundStatus and @MultipathPreference are defined
in connectivity mainline module. Annotate these in non-updatable
platform is not going to be manageable long term. For example,
if the module gets updated and the annotation gets more values
then it's a problem in non-updatable platform. So, it should
not have IntDef cross module boundaries. The javadoc already
document the return type.

Bug: 183972925
Test: build
Change-Id: I371e61fc1ba4d6137139bcfbf1d57fdebe00a257
2021-05-27 15:00:24 +08:00
Yan Yan
ff41121597 Improve IKEv2/IPsec VPN by proposing more IPsec algorithms
This commit allows IKEv2/IPsec VPN to propose more algorithms that
newly added in IpSecAlgorithm. Those new algorithms have stronger
security guarantees and better performances.

This commit also removes algorithm name validation because all
algorithms are URL encoded to ensure no special characters create
problems due to their use by VpnProfile for list or field delimiting
(e.g. rfc7539esp(chacha20,poly1305))

Bug: 185265778
Test: atest FrameworksNetTests, CtsNetTestCases
Test: All new algorithms are manually verified
Change-Id: I1de322c95aacc8924e95bcdbcfdbd1ec441de99c
Merged-In: I1de322c95aacc8924e95bcdbcfdbd1ec441de99c
2021-05-21 23:33:23 +00:00
Treehugger Robot
d621b43a5d Improve documentation of IpSecTunnelInterface#setUnderlyingNetwork
Clarify the consequence of adding IpSecTunnelInterface to the
underlying network.

Bug: 169855650
Test: builds
Change-Id: I2e3c4fe735b3374b2ff6d23850970e36c0aafda5
Merged-In: I2e3c4fe735b3374b2ff6d23850970e36c0aafda5
2021-05-20 21:56:26 +00:00
Les Lee
6fff3df429 Merge "Add metered filter for API: buildTemplateCarrier" into sc-dev 2021-05-19 14:32:29 +00:00
Junyu Lai
b987babf5e Merge changes I3ba50cbd,I970ee365 into sc-dev
* changes:
  [FUI29] Migrate ConnectivityService to use getAllNetworkStateSnapshots
  [FUI27] Fix internal naming of notifyNetworkStatus
2021-05-19 12:36:03 +00:00
lesl
559d4ec575 Add metered filter for API: buildTemplateCarrier
This CL modifies NetworkTemplate#buildTemplateCarrier to force on
metered carrier network and rename to buildTemplateCarrierMetered.
This method was introduced recently and has no callers.

This method will be used in Settings and NetworkPolicyManagerService
to display and manage data usage on carrier metered networks.

Settings/NetworkPolicyManagerService will use it instead of the existing
method buildTemplateMobileAll method, which only matches metered networks.
That code will change from matching metered mobile networks to matching
metered carrier networks.

Note: The carrier metered network includes metered mobile network and
metered "merged carrier wifi network" that is a specific cerrier wifi network
which provides the same user experience as mobile.

Bug: 176396812
Test: atest -c NetworkTemplateTest
Change-Id: I7196d62bb60844458a6c4b1d94e2baccb71e15cd
Merged-In: I7196d62bb60844458a6c4b1d94e2baccb71e15cd
2021-05-19 02:53:39 +00:00
Aaron Huang
d2d8fa6c17 Merge "Add ConnectivityAnnotations class" into sc-dev 2021-05-17 14:07:45 +00:00
junyulai
0c7c578433 [FUI27] Fix internal naming of notifyNetworkStatus
Test: TH
Bug: 174123988
Merged-In: I970ee365ca221956ee85788005d331374b5fa71a
Change-Id: I970ee365ca221956ee85788005d331374b5fa71a
  (cherry-picked from aosp/1620539)
2021-05-17 14:07:00 +08:00
Benedict Wong
e0ee346120 Merge "Make VcnTransportInfo unparcel to null if no data contained" into sc-dev 2021-05-14 23:00:21 +00:00
Benedict Wong
d9695aced3 Make VcnTransportInfo unparcel to null if no data contained
When VcnTransportInfo is redacted, it contains no useful information. In
order to preserve the abstraction, the VcnTransportInfo should be
unparcelled to null


Bug: 8675309
Test: atest VcnTransportInfoTest
Change-Id: Ia9dbb9f259027acc74004eb1207e0a13cea56088
2021-05-14 22:53:51 +00:00
Benedict Wong
d9c05c23e6 Merge "Custom network selection" am: bc3638ce5d am: b3f0495383 am: 2a86eae65e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1706226

Change-Id: Icdf319d564e4eab468d9d4e722716a2ef7d2c3cd
2021-05-14 05:25:38 +00:00
Aaron Huang
4a9f988934 Add ConnectivityAnnotations class
This change is to address API review, add respective
@IntDef for network policy API.

Typedef cannot be exposed as SystemApi so add
ConnectivityAnnotations class and add an annotation library
so that it can be used in module and platform.

Bug: 183972925
Test: m, build doc target framework-doc-stubs_annotations.zip
      and check the APIs have an attribute IntDef annotation
Change-Id: Ie3ec40cf48818edd422a4550377774eae387d3b2
2021-05-14 10:30:49 +08: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
Lorenzo Colitti
1ad18702f1 Immediately redact VcnTransportInfo.
Redaction of NetworkCapabilities is changing from redacting at
parcel time to redacting immediately when makeCopy() is called.
Update VcnTransportInfo redaction accordingly.

Bug: 183938194
Test: atest VcnTransportInfoTest
Change-Id: I0c9406f426b66fd36b47d11799955def531c16ba
2021-05-13 20:24:20 +09:00
Ken Chen
92bc335785 Merge "Add testVpnTypesEqual to verify consistency" am: 785dc4871c am: 3ae939569e am: 233682e675
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1705385

Change-Id: I53d58c5b2277ba2d88a848ed3e6d6269b4b886b3
2021-05-13 03:00:17 +00:00
Ken Chen
2216da85aa Merge "Switch from networkCreate[Physical/Vpn] to networkCreate" am: c9d5cd9fbc am: 62258932ff am: a4d53bfa6d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1669648

Change-Id: I3475e674c3914c4c61fd0a4246c9ee3e7e02c4fb
2021-05-13 02:59:30 +00:00
Ken Chen
785dc4871c Merge "Add testVpnTypesEqual to verify consistency" 2021-05-13 01:22:08 +00:00
Ken Chen
c9d5cd9fbc Merge "Switch from networkCreate[Physical/Vpn] to networkCreate" 2021-05-13 01:20:39 +00:00
Lorenzo Colitti
79d74a6448 Merge changes from topic "transportinfo-explicit-redaction" into sc-dev
* changes:
  Immediately redact VcnTransportInfo.
  Do not automatically redact TransportInfo objects.
2021-05-12 22:46:36 +00:00
Treehugger Robot
1761a873cb Merge changes Icb59b15d,I6fc6a266,I5cc340e5,I94db52a8 am: b79dcb24d0 am: 5804521e8c am: 32c2d34383
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1700309

Change-Id: Ifab0469fb2687cae7b361b5009abe152a35048c5
2021-05-12 17:16:19 +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
Ken Chen
bf8bf735d6 Add testVpnTypesEqual to verify consistency
VPN types are defined in both VpnManager.java and NativeVpnType.aidl.
The definitions on both sides should match (except TYPE_VPN_NONE).

VpnManager.java:
TYPE_VPN_NONE = -1
TYPE_VPN_SERVICE = 1
TYPE_VPN_PLATFORM = 2
TYPE_VPN_LEGACY = 3
TYPE_VPN_OEM = 4

NativeVpnType.aidl:
SERVICE = 1
PLATFORM = 2
LEGACY = 3
OEM = 4

Bug: N/A
Test: atest android.net.VpnManagerTest#testVpnTypesEqual
Change-Id: Ie618e227d861100c5318da696140e486af1093a0
2021-05-12 17:34:34 +08:00
Aaron Huang
8a520d604e Merge "Add return type javadoc to NetworkStateSnapshot#getLegacyType" into sc-dev 2021-05-12 05:11:45 +00: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
Cody Kesting
92959d6774 Require MOBIKE for IkeSessionParams in VCN configs.
This CL updates VcnGatewayConnectionConfigs to require
IkeTunnelConnectionParams with MOBIKE enabled for the
IkeSessionParams. This is necessary for VCNs - without it,
they do not support IPsec mobility (one of the main features
of the VCN).

Bug: 187851560
Test: atest FrameworksVcnTests CtsVcnTestCases
Change-Id: I94db52a8c42d9fa4681fefb8f787f006933caa18
2021-05-11 16:40:56 -07:00
Lorenzo Colitti
327cff1969 Immediately redact VcnTransportInfo.
Redaction of NetworkCapabilities is changing from redacting at
parcel time to redacting immediately when makeCopy() is called.
Update VcnTransportInfo redaction accordingly.

Bug: 183938194
Test: atest VcnTransportInfoTest
Change-Id: I0c9406f426b66fd36b47d11799955def531c16ba
2021-05-11 22:47:34 +09:00
Ken Chen
8dbaacfe45 Switch from networkCreate[Physical/Vpn] to networkCreate
networkCreatePhysical and networkCreateVpn are non-extensible. In order
to pass OEM requested VPN type to Netd, we need to migrate to
networkCreate API.

Modify test code accordingly since networkCreatePhysical and
networkCreateVpn have been deprecated on Netd.

Bug: 171872481
Test: atest FrameworksNetTests
atest atest HostsideVpnTests

Change-Id: I50ab8615346c49559c16e815482e7804a1e765c8
2021-05-11 16:06:54 +08:00
Benedict Wong
275bf90709 Merge changes from topic "vcn-fwd" am: d7d2d2a15b am: f980436b32 am: 600401154a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1682047

Change-Id: I745687f69366657dc33bfdacd878e06affd6a8ec
2021-05-11 06:10:32 +00:00
Benedict Wong
d7d2d2a15b Merge changes from topic "vcn-fwd"
* changes:
  Apply transform to FWD policy if configured to provide tethering
  Add internal support for IPsec forward policies
2021-05-11 01:30:31 +00:00
Benedict Wong
a91e5123fc Merge "Add additional logging to improve debugability of VcnManagementService" am: 3996048bad am: 30b760733b am: 4182201ae9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1692661

Change-Id: I24973d2eff043af411460df6227954e55249f2ec
2021-05-10 22:21:30 +00:00
Aaron Huang
f5755c2919 Add return type javadoc to NetworkStateSnapshot#getLegacyType
Add javadoc to document the return type is the legacy network
type in getLegacyType.

Bug: 183972826
Test: only update javadoc
Change-Id: I7757253af5955f7d489d6349c090dcba146cfd7f
2021-05-10 23:18:41 +08:00
Benedict Wong
1d9c19a635 Add additional logging to improve debugability of VcnManagementService
Test: atest FrameworksVcnTests
Change-Id: I23af20ea655e11934f6ac679c1bfc0943d5a148f
2021-05-07 17:18:21 -07:00
Benedict Wong
7f5a2fe728 Add internal support for IPsec forward policies
This change adds support for IPsec forward policies, which are necessary
for packets to be allowed to be forwarded to another interface, as is
the case with tethering. This is necessary and useful only within the
system server, and as such is not exposed as a public API.

This change is safe, since the addition of a FWD policy on IPsec tunnel
interfaces will by default block forwarded traffic (as would be the case
without this patch). In the event that the (system) owner of the tunnel
requires support for forwarded packets (eg tethering), this patch allows
application of transforms in the FWD direction as well.

This will be used to ensure that the VCN can be used as the underlying
network for the purposes of tethering.

Bug: 185495453
Test: atest IpSecServiceTest
Test: atest IpSecServiceParameterizedTest
Test: manual testing with tethering over VCN
Change-Id: I74ecea71f1954029f6fbdbe34598c82e0aac386b
2021-05-07 15:09:42 -07:00
Treehugger Robot
2f83b6a72d Merge "Add getters to NetworkStateSnapshot" 2021-04-29 09:20:34 +00:00
Treehugger Robot
e2e8b9ce88 Merge "Add getters to UnderlyingNetworkInfo" 2021-04-29 07:29:08 +00:00
Benedict Wong
795d43d31d Merge "Update set|getRetryIntervalsMs to Millis" am: c6fe30068d am: 058149884f am: 33d2807b02
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1688783

Change-Id: Ica36f177bcb4a1d6625a0bf14288f6acd3ea4224
2021-04-29 05:44:56 +00:00
Benedict Wong
c6fe30068d Merge "Update set|getRetryIntervalsMs to Millis" 2021-04-29 04:35:45 +00:00
Aaron Huang
a10cc3aa60 Rename *Iface* APIs to *Interface*
Address API review feedback, other APIs have been refering to
these as "interface" instead of "iface" so migrate the APIs named
*Iface* to *Interface*.

Bug: 183972554
Test: atest android.net.UnderlyingNetworkInfoTest
Change-Id: I38b476e762fb57fa88c4a789092d0af6f5330d80
2021-04-28 17:57:32 +08:00
Benedict Wong
3de56b2ee0 Merge "Allow VcnTransportInfo to be parcelled" am: eecd1d9ca5 am: 3e633b7822 am: 13ffa97a76
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1686985

Change-Id: If4f26b60f10be868ae0763a4fcccb61695d39151
2021-04-28 02:50:12 +00:00
Benedict Wong
913ae2b89b Allow VcnTransportInfo to be parcelled
Allows VCN transport info to be parcelled for purposes of sysUI

Bug: 186025257
Test: atest FrameworksVcnTests
Change-Id: I5a5d9b88659c8dcaa9ded16d491b2bac0529169a
2021-04-27 17:35:44 -07: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
Yan Yan
e1d6b0872f Merge "Remove TunnelConnectionParams interface" am: b8f67d1bd7 am: b1578de55a am: 92154c7465
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1684427

Change-Id: I546b7eecca41d2a745b65f67961a2634be29609f
2021-04-27 19:51:26 +00:00
Yan Yan
b8f67d1bd7 Merge "Remove TunnelConnectionParams interface" 2021-04-27 18:34:08 +00:00
Lorenzo Colitti
bd446384c8 Remove EXTRA_PROXY_INFO.
This has been deprecated since M because it very error-prone, and
there are documented replacements.

Test: m
Bug: 171872228
Change-Id: Ide9846a26fc440b3ec5b4e4b444a046e738de3d6
2021-04-27 20:01:22 +09:00
Les Lee
ba1e643715 Merge "wifi data usage: support to get carrier merged wifi network." am: bef2f5be94 am: debea981d9 am: 638b67a58f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1538743

Change-Id: Ie55770f885bf3c917ad485d2bd8c025b676f12b6
2021-04-27 06:00:48 +00:00
Les Lee
bef2f5be94 Merge "wifi data usage: support to get carrier merged wifi network." 2021-04-27 02:13:32 +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
Aaron Huang
7511be401e Add getters to UnderlyingNetworkInfo
Address API review feedback, add getters to UnderlyingNetworkInfo
instead of exposing fields.

Instead of wasting memory by converting this into an array, have
migrateTun take a List<String>. In turn, tunAdjustmentInit should
also take a List<String>.

(cherry picked from ag/14211075)
Bug: 183972554
Test: atest android.net.UnderlyingNetworkInfoTest
Merged-In: Id59744097208d91298a25ef110ade91a9cf291a1
Change-Id: Id59744097208d91298a25ef110ade91a9cf291a1
2021-04-22 22:30:42 +08:00
Aaron Huang
a3ae9b1c38 Add getters to NetworkStateSnapshot
Address API council feedback, add getters to NetworkStateSnapshot
instead of exposing the bare fields directly.

(cherry picked from ag/14233655)
Bug: 183972826
Test: FrameworksNetTests
Merged-In: Id1707753b42ae88d2b95e4bd00a792609434e4f5
Change-Id: Id1707753b42ae88d2b95e4bd00a792609434e4f5
2021-04-22 18:21:00 +08:00