Commit Graph

247 Commits

Author SHA1 Message Date
lucaslin
cf6d450eb8 Expose constants of ConnectivityManager
The callers cannot call the hidden APIs after ConnectivityManager
became a part of mainline module, so expose them for callers.
Also change the value of ACTION_PROMPT_PARTIAL_CONNECTIVITY,
ACTION_PROMPT_LOST_VALIDATION and ACTION_PROMPT_UNVALIDATED because
of API lint errors.

Bug: 172183305
Test: Check private DNS settings is normal, and test NO_INTERNET
      notification can be shown normally.
Change-Id: I715c766ad8e5eb54f4dc67239c1dbca7239506fc
2021-03-19 10:51:36 +08:00
Chiachang Wang
628cb1187e Revert "Revert "Expose uids related APIs in NetworkRequest and N..."
Revert^2 "Add shims for NetworkRequest"

b72b3ca768fc25ef72dc78f1396b08447b8ef5c6

NetworkRequest is moving into the incoming connectivity mainline
module. The hidden setUids becomes inaccessible outside the
module. Shims for support cts in different API levels will need
to use it to verify the behavior of NetworkRequest. Thus, expose
it to the API surface.

Also, VPN uses getUids and setUids to control network
capabilities. Networkcapabilities is a part of incoming
connectivity mainline module but VPN is not. Thus, exposing these
two methods are needed to allow VPN to continue using it.

Test: make update-api
Bug: 172183305

Change-Id: I4b8e1aa558e3459a932535f9901f4ae86b0ecb67
Merged-In: I107c329d4d7130d488772166eae8b5e7aaa2ff04
2021-03-19 02:12:17 +00:00
Chiachang Wang
aacf237c27 Expose uids related APIs in NetworkRequest and NetworkCapabilities
NetworkRequest is moving into the incoming connectivity mainline
module. The hidden setUids becomes inaccessible outside the
module. Shims for support cts in different API levels will need
to use it to verify the behavior of NetworkRequest. Thus, expose
it to the API surface.

Also, VPN uses getUids and setUids to control network
capabilities. Networkcapabilities is a part of incoming
connectivity mainline module but VPN is not. Thus, exposing these
two methods are needed to allow VPN to continue using it.

Test: make update-api
Bug: 172183305
Change-Id: I107c329d4d7130d488772166eae8b5e7aaa2ff04
2021-03-19 08:39:07 +08:00
Anthony Stange
35b926cc47 Merge changes from topic "revert-1626206-replaceUidRange-MSYTKFNGUE"
* changes:
  Revert "Replace the usage of UidRange"
  Revert "Expose uids related APIs in NetworkRequest and NetworkCa..."
2021-03-18 16:40:53 +00:00
Anthony Stange
fa6349a6c7 Revert "Expose uids related APIs in NetworkRequest and NetworkCa..."
Revert "Add shims for NetworkRequest"

Revert submission 1626206-replaceUidRange

Reason for revert: Breaking build - b/183106405
Reverted Changes:
I0b79c73e8:Add shims for NetworkRequest
I4bc0daf5a:Replace the usage of UidRange
I4e5aec6ef:Replace the usage of UidRange
I107c329d4:Expose uids related APIs in NetworkRequest and Net...

Change-Id: I45e08f89533af0d6851add38fecb5c6c114615ae
2021-03-18 16:30:59 +00:00
Remi NGUYEN VAN
8238a7665a Add startCaptivePortalApp to system API
The API is already used by settings and should be usable by setup
wizards. It is the only way for a caller outside of the system_server to
trigger the captive portal application.

The API is already CTS tested in android.net.cts.CaptivePortalTest.

Fixes: 182871577
Test: atest CtsNetTestCases:android.net.cts.CaptivePortalTest
Change-Id: Ie8d9a546b54524ba837715baa94a07d1f993d8d3
2021-03-18 22:41:00 +08:00
Lucas Lin
56564e061c Merge "Expose systemReady for SystemServer" 2021-03-18 13:40:54 +00:00
Chiachang Wang
268a9f56f2 Merge changes from topic "replaceUidRange"
* changes:
  Expose uids related APIs in NetworkRequest and NetworkCapabilities
  Replace the usage of UidRange
2021-03-18 13:36:39 +00:00
Chiachang Wang
e584943ca1 Merge "Expose APIs for Settings" 2021-03-18 13:27:47 +00:00
lucaslin
8e0c1f0850 Expose getCapabilities
Expose getCapabilities() for EthernetNetworkFactory.

Bug: 182963415
Test: m ethernet-service
Change-Id: I430416af8fae3d4ee99f2f2abe529e3051e9e5cb
2021-03-18 20:30:22 +08:00
Chalard Jean
8c288603d1 Merge "Move constants to MODULE_LIB" 2021-03-18 12:29:38 +00:00
Chiachang Wang
f9294e7cd1 Expose APIs for Settings
ConnectivityManager will be a part of incoming connectivity
mainline. Settings will no longer to access the hidden methods.
For those methods that accept the interaction from users, they
should be exposed as formal interface to allow the
functionality. Expose them to API surface.

Bug: 172183305
Test: make update-api
Change-Id: Id4533b94291766bb060af0091b5ccb81a00630fd
2021-03-18 11:18:56 +08:00
Chiachang Wang
0c32e09028 Expose uids related APIs in NetworkRequest and NetworkCapabilities
NetworkRequest is moving into the incoming connectivity mainline
module. The hidden setUids becomes inaccessible outside the
module. Shims for support cts in different API levels will need
to use it to verify the behavior of NetworkRequest. Thus, expose
it to the API surface.

Also, VPN uses getUids and setUids to control network
capabilities. Networkcapabilities is a part of incoming
connectivity mainline module but VPN is not. Thus, exposing these
two methods are needed to allow VPN to continue using it.

Test: make update-api
Bug: 172183305
Change-Id: I107c329d4d7130d488772166eae8b5e7aaa2ff04
2021-03-17 23:13:39 +08:00
Lucas Lin
253a041a13 Merge "Change the parameter type from ContentResolver to Context" 2021-03-17 06:35:21 +00:00
lucaslin
10774b7ebc Expose systemReady for SystemServer
SystemServer cannot call the hidden API of ConnectivityManager
after it becomes a part of mainline module. So expose the hidden
API for SystemServer.

Bug: 182963354
Test: m services
Change-Id: I9c1dc8eb1401dbdc069d5c9fc3992f4c7939b70e
2021-03-17 14:16:55 +08:00
Chalard Jean
bef6b09cd9 Move constants to MODULE_LIB
These constants are used by a MODULE_LIBRARIES API, they should
have the same visibility.

Test: ConnectivityServiceTest
Change-Id: I14cb189d949fe552f463cae3002801fd8cf8230c
2021-03-17 14:59:24 +09:00
Chalard Jean
24a9b5cad6 Merge changes I335e82e2,I84ba363d,I8f18083b,I854a952d,I00e23441
* changes:
  Remove per-user preference when the user is removed
  Expose the enterprise per-profile networking API.
  Implement setNetworkPreferenceForUser.
  Public API for per-profile network preference.
  Add tests for setNetworkPreferenceForUser
2021-03-17 05:48:18 +00:00
Hai Shalom
611b02178d CaptivePortalData: use CharSequence in VenueFriendlyName API
Following up on feedback from API council, change the String type
to CharSequence in the get and set Venue friendly name API.

Bug: 179163405
Test: atest ConnectivityServiceTest CtsNetTestCasesLatestSdk:CaptivePortalDataTest
Test: atest NetworkNotificationManagerTest NetworkMonitorTest
Change-Id: Ia63974cd2ff5975bde410eb93731d4b1def36d19
2021-03-16 20:59:42 -07:00
junyulai
bd1230675e [VCN14] Expose registerBestMatchingNetworkCallback
Test: m -j doc-comment-check-docs
Bug: 175662146
Change-Id: Ie67dd2f4f8d973de37bc64a03908d7cbb7c2b7ad
2021-03-16 21:30:56 +08:00
Chalard Jean
0a4aefcec2 Expose the enterprise per-profile networking API.
Also unify the listener for Oem settings, which have
never been released as public API (it is slated to be
released in S).

Test: FrameworksNetTests
Change-Id: I84ba363dd0ec03871c37b1c3a31e5557d9aa12e7
2021-03-16 12:14:00 +00:00
lucaslin
e2cd02d9ab Change the parameter type from ContentResolver to Context
Context is more useful than ContentResolver, it can provide more
information if we want to change the behavior in the future.

Bug: 172183305
Test: atest FrameworksNetTests
Change-Id: I5702c7d74b862a76558b94f1abe2c6df9eb7f097
Merged-In: I5702c7d74b862a76558b94f1abe2c6df9eb7f097
2021-03-16 09:26:57 +00:00
Lucas Lin
b79ae17835 Merge "Have a new API to get private DNS mode" 2021-03-16 07:39:35 +00:00
Remi NGUYEN VAN
25dcabf72d Add ParseException constructors to API
ParseException constructors are used by both platform and mainline
module code, so they can't be package-private.
Removing dependencies on either side is not possible as the class
itself is part of the public API, and supports APIs on both sides.

Having the constructors part of the API makes the class usable by both
sides.

Fixes: 182705505
Test: CtsNetTestCases for APIs using the exception
Change-Id: Ia396ab2fa3afaed3cf474c8e60f72fc7f3f4fded
2021-03-15 10:26:02 +09:00
lucaslin
889dcda9c4 Have a new API to get private DNS mode
- Expose PRIVATE_DNS_MODE_OFF, PRIVATE_DNS_MODE_OPPORTUNISTIC and
PRIVATE_DNS_MODE_PROVIDER_HOSTNAME for external users.
- Since PRIVATE_DNS_DEFAULT_MODE_FALLBACK might be changed from
release to release, so it cannot be exposed as a system API.
Remove PRIVATE_DNS_DEFAULT_MODE_FALLBACK and have a new API -
getPrivateDnsMode() for users to get the private DNS mode instead.

Bug: 172183305
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I02a1e91b4eafb5f5df3eada1c07b99849a050c3c
Merged-In: I02a1e91b4eafb5f5df3eada1c07b99849a050c3c
2021-03-12 17:56:09 +08:00
Junyu Lai
992f747392 Merge changes from topics "vcn04", "vcn12"
* changes:
  [VCN12] Expose setSubIds/getSubIds APIs
  [VCN04] Add Subscription Id set into NetworkCapabilities
2021-03-12 07:12:59 +00:00
Roshan Pius
a03f3bbf0e Merge "ConnectivityManager: Provide API's to include location sensitive info" 2021-03-12 05:56:29 +00:00
Remi NGUYEN VAN
24162a26ff Merge "Move ParseException to Connectivity" 2021-03-12 04:27:55 +00:00
Lucas Lin
3ef74f3cab Merge changes Ib80f814f,Ic605e489
* changes:
  Use new API - getIpSecNetIdRange() in IpSecService
  Add a new API to get the network ID range of IPSec tunnel interface
2021-03-12 03:30:32 +00:00
Roshan Pius
e08bc1803c ConnectivityManager: Provide API's to include location sensitive info
Existing NetworkCallback users will get NetworkCapabilities with
location sensitive data removed (except for ownerUid which will be
added for existing apps for backwards compatibility). Apps
have to opt-in to receive location sensitive data.

Note: This was chosen because WifiInfo is the only TransportInfo tha
has location sensitive info & that was added only in Android 12. If we
choose to default to true, all existings apps retrieving
NetworkCapabilities for wifi networks will be blamed for location access
unnecessarily.

Changes:
i) Add a flag in NetworkCallback creation to retrieve
NetworkCapabilities with location sensitive info in their callback.
(More flags are being planned for NetworkCallback for throttling
callback frequency, etc)
ii) For NetworkCapabilities.getOwnerUid(), we will continue to send the
data for apps targeting older SDK (since this is an existing field and
the new flag defaults location sensitive data to off).

Bug: 156867433
Test: atest android.net
Test: atest com.android.server
Change-Id: If70b5ea6f5c8885f0c353c8df08a826d55fe7f7a
2021-03-11 18:27:18 -08:00
Remi NGUYEN VAN
de3d545cf1 Merge changes from topic "ethernet_specifier"
* changes:
  Fix common tests on Q and R
  Add Ethernet, TestNetworkSpecifier API
2021-03-11 23:51:49 +00:00
Daniel Bright
686d5d2c3d Swap parameters in QosCallback#registerQosCallback
Bug: 181551395
Test: unit tests
Change-Id: I9f3f7e7a1bbb19629a2607b82ce316768c4143df
2021-03-11 12:07:33 -08:00
lucaslin
5cdbcfb7fa Add a new API to get the network ID range of IPSec tunnel interface
- Add a new API to get the network ID range of IPSec tunnel
interface.
- Use the new API in IpSecServiceTest to make sure the result is
the same. Follow-up commit will change the logic in
IpSecService#reserveNetId(), the modified test can ensure the
correctness of the new change.

Bug: 172183305
Test: atest FrameworksNetTests:IpSecServiceTest
Change-Id: Ic605e48941fc9d6482cdcd01a8adcdc9b6d586a6
2021-03-12 00:46:33 +08:00
junyulai
e1b65bdbfe [VCN12] Expose setSubIds/getSubIds APIs
Test: atest NetworkCapabilitiesTest
Bug: 175662146
Change-Id: Ia4b98bc6c5fcefee44233f3b7fbb6517a0e8870e
2021-03-11 23:03:19 +08:00
Remi NGUYEN VAN
ea33ac97f6 Add Ethernet, TestNetworkSpecifier API
Rename StringNetworkSpecifier to EthernetNetworkSpecifier (its only
production user), and make it module-lib API.
The original StringNetworkSpecifier file is actually kept to satisfy
some invalid dependencies; it will be removed separately.

This allows specifying an Ethernet interface with a non-deprecated API:
until this change the only way to do so would be to use
NetworkRequest#setSpecifier(String), which is deprecated.

Similarly, add the TestNetworkSpecifier API for TestNetworkManager, to
replace previous usage of StringNetworkSpecifier. TestNetworkManager is
module API, so TestNetworkSpecifier should be module API too. This
allows tests to request the test interface specifically, without using
the deprecated NetworkRequest#setSpecifier(String).

Bug: 179329291
Test: m
Merged-In: Iee569f5c8bbdc4bc979610e1191308281f3d4620

Change-Id: Iee569f5c8bbdc4bc979610e1191308281f3d4620
2021-03-11 23:02:02 +08:00
junyulai
dbb7046923 [VCN11] Make requestBackgroundNetwork requires handler
Test: atest FrameworksNetTests android.net.cts.ConnectivityManagerTest
Bug: 175662146
Change-Id: Iac9487e8de8bfdd87fc7a0153b228ae2a7ba4e19
2021-03-11 21:05:27 +08:00
Remi NGUYEN VAN
5a4c7353b2 Move ParseException to Connectivity
ParseException is a public API class used to support Connectivity APIs,
so it should be in the same API surface as connectivity.

Bug: 181512874
Test: m
Change-Id: Ie1213de0d0facc8f409f7b4c2553abb382e4afbf
2021-03-11 17:19:18 +09:00
Remi NGUYEN VAN
c5e54d4c37 Move OemNetworkPreferences to Connectivity
The data class supports a ConnectivityManager API, so it should be
together with the ConnectivityManager API surface.

Bug: 181512874
Test: m
Change-Id: I5642486ea0febcb08cadcbd4cd3f0c6056deae0e
2021-03-08 09:26:41 +09:00
junyulai
b12113700c [FUI22] Support getAllNetworkStateSnapshot
Currently, ConnectivityService has getAllNetworkState but it is
not ideal to expose as system API since the plan is to get rid
of NetworkState. Thus, create a new one that returns
NetworkStateSnapshot to fulfill the needs.

Note the original getAllNetworkState cannot be deleted now since
it has @UnsupportedAppUsage annotation.

Test: atest FrameworksNetTests
Bug: 174123988
Change-Id: Icddd434552b0e9ecbc8299e7242ec88cf3145aca
2021-03-04 18:41:09 +08:00
Frank Li
4297526f8b Merge "[CS05]Remove the hidden API usage of MetricsLogger" 2021-03-04 01:34:53 +00:00
lifr
1c7789742b [CS05]Remove the hidden API usage of MetricsLogger
Legacy metrics are unused and deprecated, so they are being removed.
Therefore, delete the usage of the hidden MetricsLogger API.

Bug: 157966864
Test: atest CtsNetTestCases
      atest CaptivePortalTest
      atest ConnectivityServiceTest
Change-Id: I51241f5d50ec580015882c84dd917b015c700c7c
2021-03-03 10:17:52 +00:00
Sarah Chin
ae9a64d7da APIs for 5G slicing
Create TrafficDescriptor class
Create new APN ENTERPRISE
Update setupDataCall and DataCallResponse to take TrafficDescriptor and
matchAllRuleAllowed
Move ApnTypes from Annotation to ApnSetting

Bug: 179312227
Test: atest FrameworksTelephonyTests
Change-Id: I7433976bfe25bcb2af85ffb9338959cbcc9f42f3
Merged-In: I7433976bfe25bcb2af85ffb9338959cbcc9f42f3
2021-03-03 14:16:21 +09:00
Remi NGUYEN VAN
a103c450bc Merge "Move Proxy, PacProxySelector out of Connectivity" 2021-03-02 07:49:00 +00:00
Remi NGUYEN VAN
e467f13ace Merge "Move SocketUtils out of the connectivity module" 2021-03-02 06:44:01 +00:00
Remi NGUYEN VAN
a1433566fe Move Proxy, PacProxySelector out of Connectivity
PacProxySelector is tied to IProxyService, which does not have a formal
API.
Proxy is the interface with ConnectivityService, and all its methods are
public or module API.

Bug: 171540887
Test: m
Change-Id: I8ceba961a81661c3e11d8179955b594d3cab6ff7
2021-03-01 18:35:26 +09:00
Remi NGUYEN VAN
070ff8bb9c Move QoS API classes to Connectivity
The classes were added in S and are used to back ConnectivityManager
APIs. Add them to the connectivity boundary as they belong together with
ConnectivityManager.

Bug: 181512874
Test: m
Change-Id: I03b5978949b200a72813d1ebc4812d851fe3df37
2021-03-01 18:09:30 +09:00
Remi NGUYEN VAN
1e29080037 Move SocketUtils out of the connectivity module
SocketUtils contains system APIs for modules to interact for sockets,
wrapping internal APIs. It should be part of the platform to keep access
to the internal APIs.

This involves splitting NetworkUtils.protectVpn to NetworkUtilsInternal,
since SocketUtils and VpnService are the only users of that method.

The @UnsupportedAppUsage NetworkUtils.protectVpn has low usage
count, and is already available through VpnService.protect.

Bug: 181512874
Test: boots, VPN working
Change-Id: I7028d334975f7536c06afac7a22200c33db707ac
2021-03-01 16:50:08 +09:00
Remi NGUYEN VAN
f15fc7f9a8 Split out the connectivity API surface
Split out connectivity APIs to connectivity module directories. This
prepares future move of the connectivity code into a mainline module,
but still keeps it implemented by framework-minus-apex for now: the API
stubs are moved to framework-connectivity.stubs, but the implementation
on device remains in the same place.

This allows moving the connectivity code in/out of APEX with minimal
changes.

BYPASS_INCLUSIVE_LANGUAGE_REASON=Moving files, can't modify released API

Bug: 171540887
Test: device boots, connectivity working

Merged-In: I21c42f032efa6c10e36c749df3183ce9679303a7
(cherry-pick from internal branch with API files conflicts)

Change-Id: I21c42f032efa6c10e36c749df3183ce9679303a7
2021-02-26 19:23:25 +09:00