Commit Graph

5731 Commits

Author SHA1 Message Date
James Mattis
f76916a1c9 Merge changes Iabad7300,I85363e28
* changes:
  Stubbed setOemNetworkPreference in Connectivity
  Update OemNetworkPreferences to use 1:1 Map
2021-02-06 04:33:51 +00:00
Treehugger Robot
577fd4a912 Merge "Add @Nullable to Object#equals()" 2021-02-05 09:36:41 +00:00
Roman Kalukiewicz
9b9af7777d Add @Nullable to Object#equals()
This is a partial cherry-pick of change:
I5eedb571c9d78862115dfdc5dae1cf2a35343580

for connectivity classes.

Bug: 170883422
Test: m
Merged-In: I5eedb571c9d78862115dfdc5dae1cf2a35343580
Change-Id: I7dc661863b73f4198ddb4f3a1566583d0f07db3c
2021-02-05 07:28:44 +00:00
Paul Hu
830e1e9576 Merge "Replace NPMI#isUidNetworkingBlocked()" 2021-02-05 06:38:02 +00:00
Sarah Chin
1c600eed49 Merge "Update setSubscriptionOverride API to allow network types" 2021-02-05 05:14:50 +00:00
James Mattis
0a815ee292 Update OemNetworkPreferences to use 1:1 Map
Updated OemNetworkPreferences to use a Map instead of an Array of Arrays
(SparseArray<List<String>>). This is for two reasons: to make the API
simpler and also prevent issues with duplicate entries for packages
mapped to more than one preference which is not supported.

Bug: 176597181
Bug: 176494815
Test: atest FrameworksNetTests
Change-Id: I85363e28b46b89ae60a85219313c2a45bd5e7dd5
2021-02-04 20:12:40 -08:00
paulhu
b4fc12eda7 Replace NPMI#isUidNetworkingBlocked()
ConnectivityService is going to become a mainline module which
will not able to access hidden APIs. NetworkPolicyManagerInternal
is a internal serivce that CS can't be access after be a mainline
module. Thus, create NPM#checkUidNetworkingBlocked to replace it.

Bug: 170598012
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases
Test: atest CtsHostsideNetworkTests
Test: atest FrameworksCoreTests:NetworkPolicyManagerTest
Test: atest FrameworksServicesTests:NetworkPolicyManagerServiceTest
Change-Id: I7bee37522dc5c55c255b159fda9481eff663655a
2021-02-04 19:28:57 +08:00
Junyu Lai
f6c7f61d27 Merge "[FUI21] Move scrubSubscriberId to utils class" 2021-02-03 08:52:17 +00:00
Junyu Lai
75b50a5c73 Merge "[FUI20] Expose UnderlyingNetworkInfo as system Api" 2021-02-03 02:57:10 +00:00
Cody Kesting
e980914d42 Merge changes from topic "vcn-network-policy"
* changes:
  Implement Network policy in VcnManagementService.
  Unit test UnderlyingNetworkTracker.
  Register NetworkCallbacks in UnderlyingNetworkTracker.
2021-02-02 20:33:50 +00:00
junyulai
c59f67a79c [FUI21] Move scrubSubscriberId to utils class
This patch also removes the functionality of returning
original subscriberId in eng build since it is not really useful.

Test: atest NetworkIdentityUtilsTest
Bug: 174123988
Change-Id: I721457e571aa9403a2200b3e4261b4895e4f7a3e
2021-02-02 23:45:54 +08:00
junyulai
755356f449 [FUI20] Expose UnderlyingNetworkInfo as system Api
Test: atest android.net.UnderlyingNetworkInfoTest
Bug: 174123988
Change-Id: Id602fbe744669f472d27fb466d00dcc601bd8f17
2021-02-02 23:12:10 +08:00
Treehugger Robot
19547685bb Merge "Update frameworks to use unbundled version of BouncyCastle." 2021-02-02 14:37:05 +00:00
Sarah Chin
58fe38182d Update setSubscriptionOverride API to allow network types
Allow 5G unmetered override via a different API than
setSubscriptionPlans. OVERRIDE_UNMETERED can be set without defining
SubscriptionPlans, but OVERRIDE_CONGESTED behavior remains the same.
Both the unmetered and congested case of setSubscriptionOverride take in
networkTypes as an additional parameter

Test: atest FrameworksTelephonyTests
Test: atest SubscriptionManagerTest
Bug: 175723642
Change-Id: Ie196db5e236e478f1c29c3dfd1ca31acc205c54b
Merged-In: Ie196db5e236e478f1c29c3dfd1ca31acc205c54b
2021-02-01 18:36:19 -08:00
Cody Kesting
a382c9ca0c Register NetworkCallbacks in UnderlyingNetworkTracker.
This CL updates UnderlyingNetworkTracker to register NetworkCallbacks.
UnderlyingNetworkTracker uses two types of NetworkCallbacks:
  - bringup requests
  - selection requests

Bringup requests ensure that VCN-managed Networks are not reaped.
Separate bringup requests are filed for wifi and cell Networks. One cell
request is filed for each subscription ID (subId) in the VCN's
subscription group.

Selection requests are used to allow ConnectivityService to perform
Network selection for the VCN's selected underlying Network (the Network
that VCN traffic will be routed through).

Bug: 177364490
Test: atest FrameworksVcnTests
Change-Id: Ic4dc13a3f7acf08589ddb25b343af2677cd7cf65
2021-02-01 14:46:57 -08:00
Lorenzo Colitti
5a700b2725 Merge "Revert "Expose IPsec tunnel APIs from @SystemApi to public APIs"" 2021-02-01 15:33:11 +00:00
Lorenzo Colitti
d4caba4daf 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
Lorenzo Colitti
0053756e78 Revert "Expose IPsec tunnel APIs from @SystemApi to public APIs"
This reverts commit c92a798ee8.

Reason for revert: not necessary, since VCN already has access to system APIs

Bug: 174606949
Test: revert with no conflicts
Change-Id: Ife2d0fc08c540265d52cdf930d0b6df005990ac8
2021-02-01 08:13:32 +00:00
Lorenzo Colitti
d8cc12a87b 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
Remi NGUYEN VAN
a31d729863 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
Cody Kesting
ba04ef8481 Merge "Allow system components to request underlying network policies." 2021-01-29 18:58:00 +00:00
Junyu Lai
6194d765d2 Merge "[FUI16] Expose setSubscriberId in NetworkAgentConfig as system API" 2021-01-29 17:15:28 +00:00
junyulai
0ee85f3bf8 [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
561626b20d Merge "[FUI04] Refactor VpnInfo" 2021-01-29 13:54:53 +00:00
Junyu Lai
7e0d8315d1 Merge "[VCN06] Support request background network" 2021-01-29 11:02:02 +00:00
junyulai
d242947ae2 [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
15f4a9cd7c [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
Cody Kesting
7de2e8443c Allow system components to request underlying network policies.
This CL updates VcnManager to allow system components with permission
NETWORK_FACTORY to request the current VcnUnderlingNetworkPolicy for a
specific Network's NetworkCapabilities and LinkProperties.

Bug: 175900686
Test: atest FrameworksVcnTests
Change-Id: I16416e619bdb03630582f5660260b0090730e9eb
2021-01-28 19:38:06 -08:00
Lucas Lin
6a5d57c2ee Merge "Remove unused method from MatchAllNetworkSpecifier" 2021-01-29 02:47:00 +00:00
Junyu Lai
ce07556044 Merge "[VCN01] Add NOT_VCN_MANAGED capability" 2021-01-28 13:04:59 +00:00
Daulet Zhanguzin
59444d5be7 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
Chiachang Wang
842319b819 Merge "Replace hidden getFileDescriptor$()" 2021-01-28 06:36:11 +00:00
lucaslin
31d270a4d7 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
ec3f650de7 Merge "Check if NetworkSpecifier is an instance of MatchAllNetworkSpecifier" 2021-01-28 04:01:49 +00:00
Chiachang Wang
b219ee2cde 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
lucaslin
63ff5c3b51 Remove unused method from MatchAllNetworkSpecifier
checkNotMatchAllNetworkSpecifier is a hidden method inside
MatchAllNetworkSpecifier, and the callers have implemented
the logic by themselves to prevent calling hidden method.
Remove it because there is no one using it.

Bug: 172183305
Test: atest FrameworksNetTests
Change-Id: I22a3a99f2b4ec6f4b57ef8867b72d48db2f0c1f6
2021-01-27 17:17:36 +08:00
Junyu Lai
a125e1a6cc [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
eb1c486ab9 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
junyulai
fa528b2d20 [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
Chiachang Wang
8dc248c84a Merge "Expose UdpEncapsulationSocket.getResourceId()" 2021-01-27 04:41:18 +00:00
Chiachang Wang
db2cec6024 Update jni to get int descriptor in native layer
ConnectivityService is going to become a mainline module which
can not access the hidden APIs. The int descriptor of a
FileDescriptor is hidden for internal use only. The Network and
NetworkUtls will be parts of CS module. The corresponding usage
should be removed. There is no way in a module to access the
descriptor, so update the jni to set a FileDescriptor to native
to get the int descriptor inside the platform.

Also, update the other references in android_net_NetUtils for
getting fd to use the NDK functions in the libnativehelper.

Bug: 170598012
Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk
Test: manually connect to a VPN
Change-Id: I2143c079feac53917a6e7bf7422f3180f51437fb
2021-01-27 02:44:14 +00:00
Benedict Wong
f0aa57318d Merge "Prep VCN files for exposing APIs" 2021-01-27 02:34:09 +00:00
Chiachang Wang
5e26cc8c56 Expose UdpEncapsulationSocket.getResourceId()
ConnectivityManager.createSocketKeepalive() will need to get
the socket resource ID as a parameter for creating a new
NattSocketKeepalive. ConnectivityManager is a part of incoming
ConnectivityService mainline, so expose getResourceId() as an
API since the hidden APIs are not accessible for a mainline
module. This API should not be exposed to apps, so make it a
MODULE_LIBRARIES system API.

Bug: 172183305
Test: make update-api
Change-Id: Ic0722352ea186fcb18a2d91cc3969f771fde9e86
2021-01-27 09:27:26 +08:00
Benedict Wong
44192ee464 Prep VCN files for exposing APIs
Add @hide to methods to clearly show what is being exposed and cleanup
some visibilty/final modifiers.

Bug: 168833866
Test: atest FrameworksVcnTests
Test: atest android.net.vcn
Change-Id: I8e03133053b59fd5b8df640e4b22761f572f9548
2021-01-26 15:28:24 -08:00
Treehugger Robot
3795a7d1d2 Merge changes I713bc2ec,Ib9ab07c9
* changes:
  [FUI05] Remove wimax data usage unit test
  [FUI14] Get SSID from NetworkCapabilities
2021-01-26 13:13:24 +00:00
Yan Yan
5b8a0c8d89 Merge "Expose IPsec tunnel APIs from @SystemApi to public APIs" 2021-01-26 02:19:58 +00:00
junyulai
78e0f545a0 [FUI14] Get SSID from NetworkCapabilities
This allows subsequent patches to remove the need of exposing
SSID in NetworkState.

Test: atest NetworkStatsServiceTest
Bug: 174123988
Change-Id: Ib9ab07c9610954c9a5de035a3aefbf6d0bb0b53b
2021-01-22 23:58:14 +08:00
Daniel Bright
c947317a4b Add method to match address \ port with QosFilter
* The match method is only for local address and port since we have
no other use case.

Bug: 155176305
Test: Added new test
Change-Id: I7b45f9912af6a192fc60606f5e0b4cc479aea93f
2021-01-22 06:24:41 -08:00
Paul Hu
ce1b5d00d9 Merge "Replace NetworkPolicyManagerInternal#isUidRestrictedOnMeteredNetworks()" 2021-01-22 14:18:47 +00:00
Chalard Jean
8e39c04b56 Merge "Add Qos Callback support" 2021-01-22 13:09:24 +00:00