11570 Commits

Author SHA1 Message Date
Benedict Wong
b2632543c0 Remove underlying network caps
Bug: 182219992
Test: atest FrameworksVcnTests
Change-Id: Ic2fec8a87fd19a1780333c61759c4092598d349e
2021-05-14 15:28:34 -07:00
Nathan Harold
e0f865d554 Update VCN Owners Post-Initial-Development
Owners files update for VCN now that primary development
is complete and the codebase is stable.

Bug: 8675309
Test: compilation
Change-Id: Ie686729b33f0a7e1c3414374ce4bf3d7ef514a22
2021-05-14 15:05:26 -07:00
TreeHugger Robot
d285109ef2 Merge "Close FDs even when throwing SecurityException." into sc-dev 2021-05-14 16:40:14 +00:00
Kohsuke Yatoh
d3275de48e Close FDs even when throwing SecurityException.
Bug: 187879195
Test: atest UpdatableSystemFontTest
Change-Id: I34d04f152210fe2f89f4d96e920978dde21d06c8
2021-05-13 23:08:33 -07: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
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
Kohsuke Yatoh
048d4b1788 Close FDs / mmap handles promptly.
Currently we rely on GC to close them.
This may cause system_server crash depending on the timing of GC.

Bug: 187879195
Test: atest UpdatableSystemFontTest
Change-Id: I09ac3f349e5ec100e4164320cbf27977474cc4bb
2021-05-13 16:23:55 +00:00
Nikita Iashchenko
87e9624648 Move IoUtils#deleteContents from CorePlatformApi set to framework
As a part of internal core libraries cleanup move usages of
IoUtils#deleteContents from CorePlatformApi set to framework.

Bug: 154796679
Test: m update-api
Change-Id: If7037029026b6753ab64be09aa52c40e04d5c7b1
2021-05-13 14:23:54 +01:00
Lorenzo Colitti
34748be150 Make VcnTransportInfoTest pass on AOSP.
AOSP contains the core networking redaction changes, but not the
wifi redaction changes, so the tests that depend on wifi S
behaviour will not pass on AOSP.

Fix testApplicableRedactions by checking that the applicable
redactions are the same ones as returned by the underlying
WifiInfo object.

Fix testMakeCopyRedactForAccessFineLocation by testing the wifi
redaction code iff Build.VERSION.SDK_INT is S or later. This is
different from SdkLevel.isAtLeastS, because the latter returns
true in AOSP.

Bug: 183938194
Test: atest VcnTransportInfoTest
Change-Id: Ia5bc896c92be19f570638f8051492e0f2d7342f9
2021-05-13 20:24:20 +09: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
Remi NGUYEN VAN
1665a3d634 Move net unit tests to packages/Connectivity
Move the tests together with packages/Connectivity code, so both can be
moved to packages/modules/Connectivity together.

Also reorganize unit tests in a unit/ directory, as other tests
(integration/, common/ etc.) have been added in tests/net since they
were created. This makes the directory structure consistent.

Test: atest FrameworksNetTests
Bug: 187814163
Merged-In: I254ffd1c08ec058d594b4ea55cbae5505f8497cc

Change-Id: I254ffd1c08ec058d594b4ea55cbae5505f8497cc
2021-05-13 08:30:33 +00:00
Remi NGUYEN VAN
007a886baf Move net unit tests to packages/Connectivity
Move the tests together with packages/Connectivity code, so both can be
moved to packages/modules/Connectivity together.

Also reorganize unit tests in a unit/ directory, as other tests
(integration/, common/ etc.) have been added in tests/net since they
were created. This makes the directory structure consistent.

Test: atest FrameworksNetTests
Bug: 187814163
Ignore-AOSP-First: needs per-branch move for merge conflicts
Change-Id: I254ffd1c08ec058d594b4ea55cbae5505f8497cc
2021-05-13 05:55:44 +00: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
Cody Kesting
be6088d11c Merge changes I4b135749,If4fcaa52 am: 576dad4673 am: cd4e6ae6d6 am: 5cdc27d2ac
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1704175

Change-Id: I7d636497dbc26008e659495e4236f161c90599ab
2021-05-12 23:40:05 +00: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
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
Lucas Lin
1742bf024c Merge "Update PrivateDnsMode from StringDef to IntDef" 2021-05-12 17:09:50 +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
Paul Hu
47d38bc76c Merge "Add MATCH_ANY_USER flag to PackageInfo queries" am: 68301eb7cb am: 2b0351ce1e am: 168172c2c0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1689207

Change-Id: Ie3dd72aa4b8166198884f348f59c77befc229dc0
2021-05-12 10:19:57 +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
Chiachang Wang
6a6fa67d58 Merge "Remove sendNetworkConditionsBroadcast" 2021-05-12 09:24:02 +00:00
Lorenzo Colitti
5a31cd4f84 Merge "Rename unwanted capabilities to forbidden capabilities." 2021-05-12 09:00:17 +00:00
Paul Hu
68301eb7cb Merge "Add MATCH_ANY_USER flag to PackageInfo queries" 2021-05-12 07:13:17 +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
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
Lorenzo Colitti
58250b2032 Do not automatically redact TransportInfo objects.
Currently, NetworkCapabilities always redacts the TransportInfo
objects it contains whenever a defensive copy is made. This makes
it impossible to make a defensive copy on a TransportInfo
parcelled from another process without redacting it.

Stop redacting by default; instead rely on ConnectivityService
explicitly calling NetworkCapabilities' redacting constructor
when it returns a NetworkCapabilities object to an app via a
callback or synchronous call. This is currently done by
- createWithLocationInfoSanitizedIfNecessaryWhenParceled, which
  is called from callCallbackForRequest, getNetworkCapabilities,
  and getDefaultNetworkCapabilitiesForUser.
- getNetworkCapabilitiesWithoutUids, which is used when sending
  ConnectivityDiagnosticsManager callbacks. In this method,
  unconditionally redact all information, which is what the code
  did previously due to the default redaction setting for empty
  NetworkCapabilities objects being REDACT_ALL.

Bug: 183938194
Test: atest NetworkCapabilitiesTest
Test: atest FrameworksNetTests CtsNetTestCases HostsideVpnTests
Change-Id: I3108ee94cb0930958e071ba678c3554525b0db82
2021-05-11 22:47:03 +09:00
Lorenzo Colitti
1d4fb5b91c Rename unwanted capabilities to forbidden capabilities.
Addresses API council feedback.

Bug: 184890428
Test: atest FrameworksNetTests CtsNetTestCases
Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest on R device
Change-Id: Id7c68fbf56ee08fcad8e8e3aacf037fa1885936b
2021-05-11 17:46:13 +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
lucaslin
bfb3e5088f Remove sendNetworkConditionsBroadcast
sendNetworkConditionsBroadcast is removed, so
TestNetworkStackService.kt cannot override it anymore,
otherwise there will be a build break when running this
test.
Also add a comment for NETWORK_CONDITIONS_MEASURED in
AndroidManifest.xml.

Bug: 124415874
Test: atest FrameworksNetIntegrationTests
Change-Id: I7b43940dc32826c70fa82f471b35bc5cb8394aad
Merged-In: I7b43940dc32826c70fa82f471b35bc5cb8394aad
2021-05-11 09:25:54 +08:00
TreeHugger Robot
ec6c6835ca Merge "Promote stable flicker tests" into sc-dev 2021-05-10 13:39:52 +00:00
Nataniel Borges
4f741f2e89 Promote stable flicker tests
Move:
- Stable postsubmit to presubmit
- Stable flaky to postsubmit

Bug: 186115871
Test: atest FlickerTests WMShellFlickerTests
Change-Id: Ia4b1a4868595d6f9c5134e92851664137d79098e
2021-05-10 14:05:15 +02:00
Lorenzo Colitti
fd653deee6 Merge "Rename unwanted capabilities to forbidden capabilities." into sc-dev 2021-05-09 16:12:56 +00: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
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
Ady Abraham
dd85a79ed0 Merge "TouchLatency: upgrade to gradle 4.8.1" into sc-dev 2021-05-07 17:54:38 +00:00
Ady Abraham
9e2eb4ccb3 TouchLatency: upgrade to gradle 4.8.1
Fixes: 187524665
Test: Build using Android Studio 4.2
Change-Id: If43e09099d5077804d12c44b6c23ed4f81cbeff1
2021-05-07 17:54:29 +00:00
Lorenzo Colitti
c7bbe93a36 Rename unwanted capabilities to forbidden capabilities.
Addresses API council feedback.

Bug: 184890428
Test: atest FrameworksNetTests CtsNetTestCases
Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest on R device
Change-Id: Id7c68fbf56ee08fcad8e8e3aacf037fa1885936b
2021-05-08 01:48:01 +09:00
Lucas Lin
0e768c90f5 Merge "Remove sendNetworkConditionsBroadcast" into mainline-prod am: 8a9e884d02
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14271579

Change-Id: I394ab3ceee1685c4fdabd27f8377a2f3227c33be
2021-05-07 08:59:26 +00:00
TreeHugger Robot
1b03d2057b Merge "Don't include stretch overscroll in benchmark." into sc-dev 2021-05-07 05:48:40 +00:00
Siarhei Vishniakou
b3ea67fa42 Check mInputEventReceiver before sending timeline -- 2
Try to submit the 'Check mInputEventReceiver' patch again.

This reverts commit 35fccc4535dd8eedd5e60af21651e20215ef4768.

Reason for revert: Added a check to ensure that only valid data is
getting sent. Now, the InputChannel will not be closed because all
InputMessages will always be valid.
Added logging to help investigate the reason why the present time is in
the past of the gpuCompletedTime.

Original commit message:

Previously, it was possible to receive a FrameMetrics callback after the view was already detached from window. In that situation, the mInputEventReceiver is set to null and the object is disposed.

But InputMetricsListener used to store another reference to mInputEventReceiver. So it's own object was never set to null. We would then try to send the timeline to native input receiver, and crash because the native object has already be deleted by the earlier dispose() call.

So the sequence of events was:

dispatchDetachedFromWindow
mInputEventReceiver.dispose()
native input receiver is deleted
InputMetricsListener::onFrameMetricsAvailable
mInputEventReceiver.reportTimeline
try to access a native object using a null pointer
crash

A few options to fix this were investigated:

1) Unregister the observer when mAttachInfo.mThreadedRenderer is set to null.

This is good to do, but it's not sufficient. The problem is that the native call to RenderProxy 'removeObserver' is not serviced immediately, but is posted to be completed sometime in the future. Therefore, the crash would not be fixed by it.
Still, we should always register the observer for the active threadedRenderer, which is done in this CL.

2) Keep a weak reference to mInputEventReceiver inside InputMetricsListener. This would allow InputMetricsListener to check on the status of mInputEventReceiver. When it's disposed, it would be also set to null, so the weak reference resolution would fail.

Unfortunately, 'mInputEventReceiver' is not the only reference to the object of WindowInputEventReceiver. It turns out that the receiver is also stored inside the queued events (see class QueuedInputEvent { private InputEventReceiver mReceiver }). From reviewing ag/153113, it should be OK to remove the receiver from QueuedInputEvent and simply keep track of whether the event is synthesized or not.
But, that change would be too significant to make in this CL. Also, weak references have performance impact, so this may not be desirable anyways.

3) Do not store mInputEventReceiver in InputMetricsListener
The chosen option is to simply use the variable mInputEventReceiver from the outer class. If the receiver is null, we don't notify about the metrics.

Bug: 169866723
Bug: 184255546
Bug: 184771626
Bug: 185015591
Bug: 186664409
Test: verified on fold 2 device, open/close the phone, touch remains
operational
Test: atest InputEventSenderAndReceiverTest
Change-Id: I01076d771e9432f08a3b5f8426c14759b56f3e12

Change-Id: Ie71c9ed38051e3e5ec9cb089951d759f52937fdd
2021-05-06 19:46:37 -07:00
Lucas Dupin
b73fa47929 Merge "Adding force-dark support to RippleDrawable" into sc-dev 2021-05-07 01:08:43 +00:00