Commit Graph

2527 Commits

Author SHA1 Message Date
Lorenzo Colitti
ec960a86ce Merge changes Idcc9e32c,I58769bb7 am: e73a36ba21 am: 203c72f86c am: 910fb03907
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552503

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3d15c00910467d51531a25c025efb491b446b6a4
2021-02-01 12:41:24 +00:00
Remi NGUYEN VAN
a8780c8ea1 resolve merge conflicts of bff19645ef to sc-dev
Bug: None, merge conflict
Change-Id: Id07440d6a55111a1a7ddbf3df306f4466073fd1d
2021-02-01 11:29:28 +00:00
Lorenzo Colitti
e73a36ba21 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
6f55e61287 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
8f37b3f55b 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
6ab0a5500d Merge "[FUI16] Expose setSubscriberId in NetworkAgentConfig as system API" am: bc1a11fdb2 am: d53184a4de am: bd6e9518e0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556552

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If6e5747ccc97972a4c21058c600e72c5a3f3b61e
2021-01-29 23:38:56 +00:00
Junyu Lai
680e2d4f64 Merge "[FUI04] Refactor VpnInfo" am: 149add890e am: ba245e077f am: 55c1a77fea
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1537211

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icfa9918e41fc3f952a23956108df4db449741364
2021-01-29 23:38:06 +00:00
Junyu Lai
3c48d0cf6f Merge "[VCN06] Support request background network" am: 2141aec60a am: 336c5d93a7 am: 4d9ef0fc1e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553866

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I50867bc7cb21eb134f20af9ef55c44c2bd8962e9
2021-01-29 23:36:41 +00:00
Junyu Lai
bc1a11fdb2 Merge "[FUI16] Expose setSubscriberId in NetworkAgentConfig as system API" 2021-01-29 17:15:28 +00:00
junyulai
6e74469a64 [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
149add890e Merge "[FUI04] Refactor VpnInfo" 2021-01-29 13:54:53 +00:00
Junyu Lai
2141aec60a Merge "[VCN06] Support request background network" 2021-01-29 11:02:02 +00:00
junyulai
62d35f7e59 [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
23568a4f04 [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
8d06e8aba8 Merge "[VCN01] Add NOT_VCN_MANAGED capability" am: 00caf89795 am: 227fc5d23d am: f76c711734
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1549897

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ide501fcf659637c0ec175d3f6f5926c2482734e0
2021-01-28 14:58:38 +00:00
Junyu Lai
00caf89795 Merge "[VCN01] Add NOT_VCN_MANAGED capability" 2021-01-28 13:04:59 +00:00
Chiachang Wang
fb61f467cf Merge "Replace hidden getFileDescriptor$()" am: f13926d8dc am: 6d0e73ed67 am: 72f68cc2f7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553966

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iebc2b32fa7ed14b5326ec7649831fbc8e08b1e9d
2021-01-28 08:06:05 +00:00
Chiachang Wang
f13926d8dc Merge "Replace hidden getFileDescriptor$()" 2021-01-28 06:36:11 +00:00
Lucas Lin
6225d58df6 Merge "Use createStringArray instead of readStringArray" am: d1a04ba095 am: a9090b57cf am: da20373654
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1559093

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I743f07815b4d2d112d0f8bbeb9d313f6f3d3a8e0
2021-01-28 05:33:07 +00:00
Lucas Lin
19a324e9bd Merge "Check if NetworkSpecifier is an instance of MatchAllNetworkSpecifier" am: d15fcc3048 am: b96b07febe am: 0c2e799c80
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556546

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1f7bafc63926c7c68c7c3cdd13069234487888fa
2021-01-28 05:32:36 +00:00
lucaslin
cee4354c1d 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
d15fcc3048 Merge "Check if NetworkSpecifier is an instance of MatchAllNetworkSpecifier" 2021-01-28 04:01:49 +00:00
Chiachang Wang
0bb339732d 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
524489652e Merge "[FUI03] No-op refactoring of VpnInfo" am: c1140f2a33 am: 2b6868d243 am: 85c56d4826
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1547637

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I05e6b14fca44919610317831c147413b0a431224
2021-01-27 14:16:00 +00:00
Junyu Lai
120e49e971 [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
Chiachang Wang
e5648441c4 Merge "Update jni to get int descriptor in native layer" am: 332aae3a6e am: c1e552c667 am: 669715a9c5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553967

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibc0ac9def6a0a05658235b61f36ef8829906c341
2021-01-27 08:04:37 +00:00
lucaslin
61ad5f342e 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
bd7f3cd75b [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
30199ca9f8 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
Daniel Bright
946f6661c2 Merge "Add method to match address \ port with QosFilter" am: 591fe5327c am: c6e47cad53 am: 22b01d88ca
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1510591

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id9951a0be8821192e3fb403787d096c538d691cf
2021-01-26 00:22:58 +00:00
Chalard Jean
04ba35dc06 Merge "Add Qos Callback support" am: 29f0f6d47f am: b97f23ae96 am: f14671c09a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1386623

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If0a123f16951c88cc5881fba8865fae822ba92f0
2021-01-22 14:52:58 +00:00
Daniel Bright
07dd129bbe 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
Chalard Jean
29f0f6d47f Merge "Add Qos Callback support" 2021-01-22 13:09:24 +00:00
Remi NGUYEN VAN
066b792d54 Merge "Mark connectivity test utilities as module API" am: 5ef8031d57 am: a9630d29d0 am: 9dce262648
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1547643

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3537f92a718d8494234e698df20b535383dc8e90
2021-01-22 11:35:33 +00:00
Remi NGUYEN VAN
7d4530b98d Mark connectivity test utilities as module API
The API surface is planned to move to the Connectivity module, meaning
that it will be maintained across multiple Android releases.
This is incompatible with TestApi semantics, which are designed to be
removable across releases. Effectively the APIs become SystemApi, so
mark them as such considering that TestApi is not supported by modules.

Remove the NetworkCapabilities.getCapabilities test API that is not
essential for tests, and mark other APIs as module API.

Test: m
Bug: 174436414
Change-Id: Ic04551a9874b3d756cf5e6c77ceabfc7c85d52a6
2021-01-22 16:16:57 +09:00
Daniel Bright
60f02ed76b Add Qos Callback support
* Provide App Developers Qos related info associated to
  a bound socket through ConnectivityManager
* Qos sessions are generated and filtered by Network Agents
  and sent back through the Connectivity Service to the
  API consumer.
* The structure of the code within com.android.server
  is designed to support different types of filters in the
  the future.
* The first type of Qos Attributes are related to EPS
  Bearers in order support RCS.

Bug: 155176305
Test: Added to cts/NetworkAgentTest
Test: Added to ConnectivityServiceTest
Change-Id: I145dd065d9deeee449eb9695ab3f6c8556ee7c09
2021-01-21 20:14:52 -08:00
Remi NGUYEN VAN
2de4515158 Merge "Use network list in UNDERLYING_NETWORKS_CHANGED" am: a6f4de3432 am: ef75b38a4d am: 599b2b1d17
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536308

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I28e3fc36dd42316f3cc618c29d610a02ffad8722
2021-01-22 02:31:40 +00:00
Remi NGUYEN VAN
d793eb34ca Use network list in UNDERLYING_NETWORKS_CHANGED
The bundle is no longer necessary, as this message is not sent across
processes: the network list can be sent directly in the message obj
pair.

Bug: 173574274
Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk
Change-Id: Iae049a24212ff9df19b29aead20bf4a594f05f99
2021-01-21 22:36:54 +09:00
Chiachang Wang
6443ace807 Merge "Use ParcelFileDescriptor instead of FileDescriptor in the aidl" am: 0ad97bf744 am: 8178ec8ea2 am: 9d49128dc9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1554098

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8c873db971acd19cba9dd45a874e036587f88940
2021-01-21 09:25:51 +00:00
Paul Hu
010f5749d8 Merge "Replace Context @hide API in MultinetworkPolicyTracker" am: 161e0b9b78 am: 0b1c92d785 am: 39400248ea
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1554096

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibf4d66456d3b3675d16a80b1538949c3807ddcbc
2021-01-21 09:18:45 +00:00
Chiachang Wang
979f46a693 Use ParcelFileDescriptor instead of FileDescriptor in the aidl
Using FileDescriptor in the aidl will refer to
Parcel.readRawFileDescriptor() and Parcel.writeRawFileDescriptor()
whilie trying to do parcel operations. Those two APIs are hidden
and not accessible for the incoming ConnectivityService mainline
module. For such use cases in a module, it should be replaced by
using ParcelFileDescriptor that is designed for such usages.

Bug: 170598012
Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk
Change-Id: Ia7e3a71ccb4b136cc55c9e90a384870c32cfd37b
2021-01-21 08:40:12 +00:00
Paul Hu
161e0b9b78 Merge "Replace Context @hide API in MultinetworkPolicyTracker" 2021-01-21 07:53:19 +00:00
Remi NGUYEN VAN
75ac6c42a1 Merge "Mark TestNetworkManager as module API" am: cc041a72e7 am: 4bfba0d2e1 am: 45d22e4ccc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1547638

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2a8aa17d6acdaed8ee7419990493b631c0eb6d1c
2021-01-21 07:28:46 +00:00
Remi NGUYEN VAN
cc041a72e7 Merge "Mark TestNetworkManager as module API" 2021-01-21 06:02:25 +00:00
Remi NGUYEN VAN
5eee3ec919 Mark TestNetworkManager as module API
The API surface is planned to move to the Connectivity module, meaning
that it will be maintained across multiple Android releases.
This is incompatible with TestApi semantics, which are designed to be
removable across releases. Effectively the APIs become System/module
API, so mark them as such considering that TestApi is not supported by
modules.

Test: m
Bug: 174436414
Change-Id: Icd32fcbb65e9a4bb2b67cb9da7c971281be0781a
2021-01-21 10:45:04 +09:00
paulhu
fd8dac4fe5 Replace Context @hide API in MultinetworkPolicyTracker
MultinetworkPolicyTracker is part of Connectivity mainline module
which cannot call @hide API Context#registerReceiverAsUser. Thus,
replace it to Context#registerReceiverForAllUsers.

Bug: 170634463
Test: atest FrameworksNetTests
Test: Manully check that receiving intent and unregistering
      receiver can work normally.
Change-Id: Ie22a3aa40bc9243082672a64dba7c7940f9ff21a
2021-01-21 01:19:09 +08:00
Junyu Lai
12703ee175 Merge "Revert "[VCN06] Support request background network"" am: 2fa034c812 am: b7b3064394 am: dd7029fd30
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553864

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I896c2008e29163527b03f031623e1c70d16e1da4
2021-01-19 12:39:27 +00:00
Junyu Lai
2fa034c812 Merge "Revert "[VCN06] Support request background network"" 2021-01-19 10:24:47 +00:00
Junyu Lai
34263da2c9 Revert "[VCN06] Support request background network"
Revert submission 1545847-vcn06

Reason for revert: b/177876289 presubmit failure
Reverted Changes:
I8042ce197:[VCN06.1] Add CTS for request background network
If9aaa87b7:[VCN06] Support request background network

Change-Id: I9270b02a2d6d1ffcdd83b4f41becaf09a2b91e0a
2021-01-19 09:06:00 +00:00
Junyu Lai
635c79aeff Merge "[VCN06] Support request background network" am: 95f0791724 am: bf098917d8 am: d57038a8b0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1545847

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I12d2cbe4a5fc10a7ec7abf8038c088fe13b02d59
2021-01-19 01:50:31 +00:00