userId integers are not public API and code should use UserHandle
instead.
Bug: 170598012
Test: passes existing tests
Change-Id: Ic27b93ccfe6bbc97e7419293ce165fee6cd51e6d
This information originates in non-mainline system server code
and needs to be passed to the connectivity mainline code.
Bug: 173331190
Test: already covered by CTS tests
Change-Id: Ic612b6a51f7ec13e2213c8754312cf716130c876
Main implementation of ConnectivityService.setOemNetworkPreference. This
covers the main requirements of this method including listener
functionality.
Bug: 176495594
Bug: 177101287
Bug: 176494815
Test: atest FrameworksNetTests
atest NetworkStackTests
atest FrameworksNetIntegrationTests
atest NetworkStackIntegrationTests
atest CtsNetTestCasesLatestSdk
Change-Id: I8d318ab07785e52dd84d6261fdea8f318dce9bc5
This currently stores the VPN type and a session name, but can be
extended in the future.
Bug: 173331190
Test: added coverage in VpnTest
Test: added coverage in ConnectivityServiceTest
Test: added coverage in NetworkAgentTest
Change-Id: I450858a9fa332c8d896dbdb4c14337d5ec23677f
* changes:
[FUI07] Stop making NetworkState with NetworkInfo from external callers
[FUI06] Stop using NetworkInfo in NetworkState from external callers
Follow-up from aosp/1542748. networkId is unused and it is
safe to remove them now.
Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: Ifc9cdad79a3d772035c73116de3f64dd6237b747
Follow-up from previous patch. This change stop accessing the
constructor that needs NetworkInfo to create NetworkState, which
is no longer accessible after ConnectivityService become
mainline module. Instead, pass a legacy network type which is
dedicated for the need of the type.
Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I24157bc33e5a5819eccd6a3111d2049f531c1d43
This is achieved by:
1. Use legacy network type inside NetworkState to replace the
needs of referencing NetworkInfo.getType().
2. Let getAllNetworkState only return networks with isConnected()
equals true. This allows callers such as NPMS or NSS does not
have to reference to NetworkInfo.isConnected().
Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I1c4eb08d18ca973eb8f41d06258872eabc0006b8
This is a partial cherry-pick of change:
I5eedb571c9d78862115dfdc5dae1cf2a35343580
for connectivity classes.
Bug: 170883422
Test: m
Merged-In: I5eedb571c9d78862115dfdc5dae1cf2a35343580
Change-Id: I7dc661863b73f4198ddb4f3a1566583d0f07db3c
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
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
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
The wifi (mainline module) need to set the subscriberId for specific
wifi network.
Bug: 176396812
Test: TreeHugger
Change-Id: Ib568ce0c2d1b629e1c20e7ac8d8b78579cf4825c
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
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
To prevent ProxyInfo calling hidden API, use public one -
Parcel#createStringArray() instead.
Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I1a5376872d743e1863982bb95d579aeba7159d33
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
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
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
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
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
* 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
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
* 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
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
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
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
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
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: If9aaa87b7e71c2b695ac7b08858850e975b28bb6
If IOException happens while trying to start keepalives sockets,
an invalid fd will be constructed. It will fail with
ERROR_INVALID_SOCKET if the user later calls start(). Current
design to construct the invalid fd use the hidden
ParcelFileDescriptor constructor which will not work for the
incoming ConnectivityService mainline. Thus, replace it with
the other formal API.
Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I57fd7ec2281c5e8c75481200bbde723ecf96982a