Commit Graph

11684 Commits

Author SHA1 Message Date
Lorenzo Colitti
c4d0a33309 Merge "Revert "Refactor setCurrentProxyScriptUrl to a void method"" 2021-02-03 13:05:35 +00:00
Chalard Jean
ab4b0cdccc Merge "[NS] Tests : don't expect a score in NF#acceptRequest" 2021-02-03 08:10:19 +00:00
Lorenzo Colitti
bb4c3ac73f Revert "Refactor setCurrentProxyScriptUrl to a void method"
This reverts commit a42805cd7e.

Reason for revert: Broke HostsideVpnTests

Fix: 177943140
Change-Id: I23924181e46fd1f16a60ec420426d1ed39705050
2021-02-03 07:25:29 +00:00
James Mattis
e004fd3a44 Merge "Adding support for multiple "default" networks" 2021-02-03 04:17:47 +00:00
Jeongik Cha
6003c6110f Merge "Specify version for aidl_interface explicitly" 2021-02-03 02:21:26 +00:00
James Mattis
e3ef1910a8 Adding support for multiple "default" networks
Updating ConnectivityService foundational support for multiple default
networks by extending mDefaultRequest and mDefaultNetworkNai from single
instances to a HashMap to support more than a single default network.

Bug: 176027457
Bug: 172347841
Test: atest FrameworksNetTests
atest NetworkStackTests
atest FrameworksNetIntegrationTests
atest NetworkStackIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: I2f5fa96c2d21ab883499e82afa74e73f3ca606cd
2021-02-02 16:14:36 -08:00
Treehugger Robot
2685347482 Merge "Update frameworks to use unbundled version of BouncyCastle." 2021-02-02 14:37:05 +00:00
Junyu Lai
f0a16c6ad9 Merge "[VCN08] Expose NOT_VCN_MANAGED capability as system API" 2021-02-02 13:57:57 +00:00
Lorenzo Colitti
90345768ae Merge changes I4f38a539,Id4f6c7f4
* changes:
  Add the underlying networks to NetworkAgentInfo#toString.
  Improve testing for network blocking.
2021-02-02 10:06:03 +00:00
Paul Hu
6d86eab235 Merge "Remove ArrayUtils usage in connectivity frameworks classes" 2021-02-02 08:47:04 +00:00
Lorenzo Colitti
3897dedb70 Add the underlying networks to NetworkAgentInfo#toString.
This is useful in debugging VPN networks.

Bug: 173331190
Test: manual
Change-Id: I4f38a53980191a1813c2ef313fedc51af98f18f6
2021-02-02 16:17:22 +09:00
Lorenzo Colitti
57826ec3ee Improve testing for network blocking.
This simplifies the uidNetworkingBlocked method and makes it more
realistic by supporting more combinations of rules than just the
four used by this test.

Also support RULE_ALLOW_METERED, and add test coverage for it.

Test: test-only change
Change-Id: Id4f6c7f41429f3ae7841d3214b3e5e95ec591f85
2021-02-02 16:17:22 +09:00
Treehugger Robot
93e69b3045 Merge "Have connectivity self-register manager classes" 2021-02-02 05:01:04 +00:00
Lucas Lin
efacd37017 Merge "Use function inside NetdUtils instead of NetworkManagementService" 2021-02-02 03:38:38 +00:00
junyulai
10aededf26 [VCN08] Expose NOT_VCN_MANAGED capability as system API
Test: m -j doc-comment-check-docs
Fix: 177299683
Bug: 175662146
Change-Id: Iaa53d21774ea48af5fe339b57bf1235c77f295a0
2021-02-02 11:34:09 +08:00
Jeongik Cha
4295932580 Specify version for aidl_interface explicitly
Bug: 150578172
Test: m
Change-Id: I4c909903521cd8a766dca5312edd98d17b9e1308
2021-02-02 10:11:31 +09:00
Serik Beketayev
f3163aafec Merge "[Mainline] Migrate com.google.android.collect pkg" 2021-02-01 23:11:56 +00:00
Chalard Jean
c251a4ba2f [NS] Tests : don't expect a score in NF#acceptRequest
The score argument is going away, so there no longer
is a need to test it. It's never been used by anybody
and is actually a problem going forward.

Since removing the argument requires a small re-arch
of the testing tool anyway, rebuild expecting requests
on top of TrackRecord. This simplifies the test a
great deal, as well as (as observed in running the
tests) makes the test faster.

Test: this
Change-Id: If03b9e64f14ac8ffa5398b964939a9a45a74b28d
2021-02-01 23:06:49 +09:00
Lorenzo Colitti
9036c07442 Merge changes Idcc9e32c,I58769bb7
* changes:
  Remove getFilteredNetworkState and add @NonNull in NetworkState.
  Add test coverage for get*NetworkInfo on metered networks.
2021-02-01 10:56:19 +00:00
paulhu
d25af29a20 Remove ArrayUtils usage in connectivity frameworks classes
Instead, use CollectionUtils from frameworks/libs/net.

Bug: 174541037
Test: atest FrameworksNetTests
Change-Id: I610e00302cf76510e9e34ac8a9a5f738e5ecd0c7
2021-02-01 16:30:08 +08:00
Remi NGUYEN VAN
5f40642b58 Have connectivity self-register manager classes
As connectivity services are planned to move to a separate module, move
the manager classes registration from SystemServiceRegistry to
ConnectivityServicesRegistrar, using the registerContextAwareService
APIs.

This follows patterns and naming in WifiFrameworkInitializer.

Bug: 171540887
Test: device boots, connectivity working
Change-Id: I62ced1275750c73f209bac8ec3a3204b95695b83
2021-02-01 17:10:39 +09:00
Lorenzo Colitti
63aaccb9fa Remove getFilteredNetworkState and add @NonNull in NetworkState.
getFilteredNetworkState is only used in two places, both of which
use only small parts of the NetworkState that is returned to
them. Remove the method and replace it with inline code in the
two callers. NetworkState is a fairly expensive object, and this
removes the need to perform lots of defensive copies of data that
the caller does not need.

Also remove the only call to the NetworkState constructor in
ConnectivityService. That leaves only one caller to the
NetworkState constructor, the one in NetworkAgentInfo. This
constructor is called with defensive copies of NetworkInfo,
LinkProperties, and NetworkCapabilities, so mark these three
parameters as @NonNull. It's also called with a non-null
Network, because NetworkAgentInfo is only constructed with
non-null Networks, so mark the network parameter @NonNull as
well.

In order to make the arguments in the NetworkState constructor
@NonNull, introduce a new constructor that sets everything to
null and make NetworkState.EMPTY call it.

Test: atest FrameworksNetTests
Change-Id: Idcc9e32c53533b0cf61494517e62d4c184fa7610
2021-02-01 16:12:04 +09:00
Lorenzo Colitti
24de5525f2 Add test coverage for get*NetworkInfo on metered networks.
Test: test-only change
Change-Id: I58769bb768978d0acff1da6d32c2f6942c43508b
2021-02-01 15:58:12 +09:00
Remi NGUYEN VAN
0f8f6307e7 Move module sources to packages/Connectivity
Files that are planned to be part of the connectivity module are grouped
in packages/Connectivity, so they can be built separately and moved in
one operation with their history into packages/modules/Connectivity.

This places the files in the existing framework-connectivity-sources
filegroup instead of the current framework-core-sources filegroup. Both
are used the same way in framework-non-updatable-sources.

Bug: 171540887
Test: m
Change-Id: I62d9d91574ace6f5c4624035d190260c3126b91e
2021-02-01 11:52:14 +09:00
Junyu Lai
563414b082 Merge "[FUI16] Expose setSubscriberId in NetworkAgentConfig as system API" 2021-01-29 17:15:28 +00:00
junyulai
a04305b528 [FUI16] Expose setSubscriberId in NetworkAgentConfig as system API
The wifi (mainline module) need to set the subscriberId for specific
wifi network.

Bug: 176396812
Test: TreeHugger
Change-Id: Ib568ce0c2d1b629e1c20e7ac8d8b78579cf4825c
2021-01-29 22:09:10 +08:00
Junyu Lai
2606d64cfc Merge "[FUI04] Refactor VpnInfo" 2021-01-29 13:54:53 +00:00
Junyu Lai
f85d6f3321 Merge "[VCN06] Support request background network" 2021-01-29 11:02:02 +00:00
junyulai
2050bed66e [FUI04] Refactor VpnInfo
As a preparation of exposing system API. This patch does some
harmless refactoring, which includes:
  1. Change raw arrays into lists according to API guidelines.
  2. Write test.
  3. Rename class to UnderlyingNetworkInfo.
  4. Rename vpnIface to iface.
  5. Make underlyingIfaces @NonNull in order to adapt new
     unparceling code.
  6. implement equals and hashCode for testing.

Test: atest android.net.UnderlyingNetworkInfoTest
Bug: 174123988

Change-Id: I405c21e57c4af8a12a9dd0a1749b9e6690f87045
2021-01-29 17:44:32 +08:00
Junyu Lai
a62493f45b [VCN06] Support request background network
This will be mainly used by VCN management service which will
need to hold the networks but preserve the backgrounded-ness
of the networks.

Test: android.net.ConnectivityManagerTest#testRequestType
Test: android.net.cts.ConnectivityManagerTest#testRequestBackgroundNetwork /
      --rerun-until-failure 100
Test: ConnectivityServiceTest#testBackgroundNetworks
Test: m -j doc-comment-check-docs
Bug: 175662146

Change-Id: I463c7a3139a286e50ea71e674060975ce228caa9
2021-01-29 14:42:32 +08:00
Junyu Lai
fbd9e43516 Merge "[VCN01] Add NOT_VCN_MANAGED capability" 2021-01-28 13:04:59 +00:00
Daulet Zhanguzin
9a357a92a2 Update frameworks to use unbundled version of BouncyCastle.
Previously BouncyCastle methods were exposed as libcore APIs (@CorePlatformApi), which no longer possible when ART is updatable module (and can't guarantee BouncyCastle API stability)

Bug: 154796679
Test: Treehugger

Change-Id: I908681841a6766de88761767c77c4e2d4b5f56d5
2021-01-28 07:51:22 +00:00
Treehugger Robot
bff61ec586 Merge "Note network interfaces based on transport" 2021-01-28 07:45:20 +00:00
Lorenzo Colitti
61a13bb86d Merge "Fix legacy APIs when VPN switches to suspended underlying network." 2021-01-28 07:07:37 +00:00
Chiachang Wang
32f8bec5ae Merge "Replace hidden getFileDescriptor$()" 2021-01-28 06:36:11 +00:00
Remi NGUYEN VAN
df5f311617 Note network interfaces based on transport
Instead of classifying interfaces by network type in BatteryStats,
classify them based on the transports array provided by the
NetworkAgent.

Network types are deprecated and transports should be used instead. This
change allows BatteryStats to stop depending on unstable APIs such as
isNetworkTypeMobile.

This change also updates nullability annotations in ConnectivityService
and NetworkAgentInfo to show that the NetworkCapabilities are non-null
(as provided by the network agent) when calling
noteNetworkInterfaceTransports.

Bug: 174436414
Test: atest
  atest ConnectivityServiceTest#testBatteryStatsNetworkType \
      --rerun-until-failure 40

Merged-In: I4e928fac8a57a9b1fc758a44af2a5719b8c871b8

Change-Id: I4e928fac8a57a9b1fc758a44af2a5719b8c871b8
2021-01-28 15:10:54 +09:00
Treehugger Robot
e23650d908 Merge "[Mainline] Migrate TextUtils#emptyIfNull" 2021-01-28 06:05:08 +00:00
Lucas Lin
ea79623351 Merge "Use createStringArray instead of readStringArray" 2021-01-28 04:04:10 +00:00
lucaslin
20f95d44c2 Use createStringArray instead of readStringArray
To prevent ProxyInfo calling hidden API, use public one -
Parcel#createStringArray() instead.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I1a5376872d743e1863982bb95d579aeba7159d33
2021-01-28 04:03:59 +00:00
Lucas Lin
03a5e10406 Merge "Check if NetworkSpecifier is an instance of MatchAllNetworkSpecifier" 2021-01-28 04:01:49 +00:00
Chiachang Wang
3a00681825 Replace hidden getFileDescriptor$()
It's the preparation for the incoming ConnectivityService
mainline. The mainline modules can not access hidden APIs.
Thus, the hidden APIs usage should be removed.

The getFileDescriptor$() in Socket or DatagramSocket is
hidden for internal usage. It should be used in a module and
not prefer to expose as an API. Thus, replace it with
ParcelFileDescriptor APIs to get the fd via
ParcelFileDescriptor.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I05b31a48315e7e6d95e22123103e544a7136a449
2021-01-28 11:33:13 +08:00
Treehugger Robot
2b5f970529 Merge "[FUI03] No-op refactoring of VpnInfo" 2021-01-27 11:47:34 +00:00
Junyu Lai
800373bdba [VCN01] Add NOT_VCN_MANAGED capability
Add new capability to indicate whether a network is
managed by Virtual Carrier Network (VCN). This is needed
to identify networks between VCN managed network and
others. And this capability will be:
  1. mutable
  2. requestable
  3. set by default for network agents and requests
  4. allowed for test networks

Note that this commit is identical to aosp/1529959 except the
capability remains hidden to address the javadoc problem first.
And this CL also needs to be bound with the counter part change
to prevent build breakage.

Test: 1. atest FrameworksNetTests CtsNetTestCases
      2. adb shell dumpsys connectivity
      3. atest ConnectivityServiceTest#testLoseMutableAndRequestableCaps
Bug: 175662146

Change-Id: I37a6f492c2aba72836e36851b50b67398f8bdd36
2021-01-27 16:13:01 +08:00
lucaslin
22f9b9f64b Check if NetworkSpecifier is an instance of MatchAllNetworkSpecifier
To prevent mainline module related file to access a hidden API,
check whether the NetworkSpecifier is an instance of
MatchAllNetworkSpecifier by itself.

Bug: 172183305
Test: atest FrameworksNetTests
Change-Id: I4d49cb70ff3c8a7e1ffa32e38207c74a6375e51a
2021-01-27 15:32:43 +08:00
Remi NGUYEN VAN
89eee28942 Merge "Move connectivity-sources to frameworks/base" 2021-01-27 07:15:05 +00:00
junyulai
acb3297bd0 [FUI03] No-op refactoring of VpnInfo
As a preparation of exposing system API. This patch does some
harmless refactoring, which includes:
  1. Move VpnInfo to android.net
  2. Add nullability annotations
  3. Make members final

Bug: 174123988
Test: TH
Change-Id: I1530bb45d0e84c28c6deac33596bc686058afc0d
2021-01-27 15:03:06 +08:00
James Mattis
bf013320a6 Merge changes Ic67cff95,Id7a6175c,I3d6896f5,Iaff727e7
* changes:
  Updates to handler logic for multilayer requests
  Update to sendAllRequestsToProvider for Multilayer
  Multilayer request updates to request callbacks
  Multilayer support when NAI requests are updated
2021-01-27 04:50:43 +00:00
James Mattis
f7027321e0 Updates to handler logic for multilayer requests
Updates to ConnectivityService network request handler's logic to support
(or disallow support of) multilayer network requests.

Bug: 175239920
Bug: 171991028
Test: atest FrameworksNetTests
atest NetworkStackTests
atest FrameworksNetIntegrationTests
atest NetworkStackIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: Ic67cff950d72745d6508a0a037bd33f932d5132c
2021-01-26 18:44:45 -08:00
James Mattis
f8b661d084 Update to sendAllRequestsToProvider for Multilayer
Updates to ConnectivityService.sendAllRequestsToProvider to support
Multilayer requests.

Bug: 175051182
Bug: 171991028
Test: atest FrameworksNetTests
atest FrameworksNetIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: Id7a6175cee28d2de1f6194cd0fc8c739d667427d
2021-01-26 18:44:32 -08:00
Chiachang Wang
9c490ea98b Merge "Update jni to get int descriptor in native layer" 2021-01-27 02:44:29 +00:00