Commit Graph

113 Commits

Author SHA1 Message Date
Jayachandran C
735e1ce55b QOS filter matching support based on remote address and port number for connected sockets
This CL adds APIs for telephony to perform filter matching based on
remote address if the socket is connected. Additional checks will be
performed on the state of socket to avoid the future callbacks in a
separate CL.

Bug: 181916576
Test: Manually verified in live T-Mobile network
      atest ConnectivityServiceTest
      atest com.android.internal.telephony.dataconnection.QosCallbackTrackerTest

Change-Id: I6fbd4e84c76bc4acbf4e59f06f8e86e0237bae29
2021-05-13 09:50:13 -07:00
paulhu
344c11661f Update mobile data preference getter/setter
To satisfy OEM's requests, setting mobile data preference
should be by uid. Thus, update the getter/setter to
return/accept set of uids that need to apply mobile data
preference.

Bug: 171872461
Test: atest FrameworksNetTests
Change-Id: Id44efd2a6d820867f4405426c91e65b9ef155898
2021-05-13 10:35:29 +00:00
paulhu
69afcd51db Add RESTRICTED_ALLOWED_APPS setting
This setting is OEM upstream requirement for third party apps
using restricted networks.

Bug: 185149952
Test: atests FrameworksNetTests
Change-Id: I5e16b46cf2935f38ee1e516bb8b85fa487cf9f61
2021-05-13 10:09:31 +08:00
Lucas Lin
a23e55da49 Merge "Update PrivateDnsMode from StringDef to IntDef" 2021-05-12 17:09:50 +00:00
Lorenzo Colitti
395fafb54f Rename unwanted capabilities to forbidden capabilities.
Addresses API council feedback.

Bug: 184890428
Test: atest FrameworksNetTests CtsNetTestCases
Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest on R device
Change-Id: Id7c68fbf56ee08fcad8e8e3aacf037fa1885936b
2021-05-11 17:46:13 +09:00
lucaslin
57f9ba8b40 Update PrivateDnsMode from StringDef to IntDef
Update PrivateDnsMode from StringDef to IntDef because IntDef is
the normal way of representing multiple choices in public API.
Also update other related files.

Bug: 185311744
Test: 1. make update-api
      2. atest FrameworksNetTests CtsNetTestCases CtsNetTestCasesLatestSdk
      3. atest FrameworksServicesTests:DevicePolicyManagerTest
Change-Id: I23e7ec140066979726d769cabc5f7057bb2167e6
Merged-In: I23e7ec140066979726d769cabc5f7057bb2167e6
    (Cherry-picked from ag/14227609)
2021-05-05 03:19:51 +00:00
Treehugger Robot
984e51670e Merge "Rename getAllNetworkStateSnapshot which should be pluralized" 2021-04-29 04:40:51 +00:00
Chiachang Wang
5e2a729668 Merge "Address API review feedback" 2021-04-26 00:22:27 +00:00
Chiachang Wang
9075ae36be Address API review feedback
Address API review feedback to:
 - Rename NetworkAgent#setTeardownDelayMs to
   NetworkAgent#setTeardownDelayMillis
 - Use getters instead of fields in VpnTransportInfo
 - Rename registerDefaultNetworkCallbackAsUid to
   registerDefaultNetworkCallbackForUid in ConnectiivityManager

Bug: 183972850
Bug: 185246410
Fix: 184735863
Test: make update-api
Test: atest FrameworksNetTests
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I5e8c4bed8bda40d507afa894c359b5e24ee5d868
Merged-In: I5e8c4bed8bda40d507afa894c359b5e24ee5d868
2021-04-23 02:46:05 +00:00
Aaron Huang
da103b3365 Rename getAllNetworkStateSnapshot which should be pluralized
Address API review feedback, ConnectivityManager#getAllNetworkStateSnapshot
should be pluralized so rename the method to getAllNetworkStateSnapshots

(cherry picked from ag/14221105)
Bug: 183972554
Test: make, FrameworksNetTests
      FrameworksServicesTests
Merged-In: Ic18d17d05984fa2466c962c7843c0ef7183ce77c
Change-Id: Ic18d17d05984fa2466c962c7843c0ef7183ce77c
2021-04-22 17:45:22 +08:00
junyulai
651928c310 [VCN19] Rename get/setSubIds to get/setSubscriptionIds
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215036
Merged-In: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7
Change-Id: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7
  (cherry-picked from ag/14198665)
2021-04-19 17:41:01 +08:00
junyulai
8c8ac36d9a [VCN20] Change requestBackgroundNetwork argument order
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215095
Merged-In: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
Change-Id: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
  (cherry-picked from ag/14198667)
2021-04-16 00:16:21 +08:00
Chiachang Wang
f212a922e9 Merge "Rename APIs in NetworkAgentConfig.Builder" 2021-04-12 14:10:46 +00:00
Chiachang Wang
f5324d7d03 Rename APIs in NetworkAgentConfig.Builder
As API review feedback, rename disableProvisioningNotification()
to setEnabledProvisioningNotification and disableNat64Detection()
to setEnabledNat64Detection. Also, update code in caller side
accordingly.

Bug: 184735772
Test: make update-api ; atest FrameworksNetTests
Change-Id: If7305634863d1503c967e5593ebd0c8af2174bea
2021-04-12 17:27:47 +08:00
paulhu
c3663377e7 Remove TcpRepairWindow from module-lib API
Both TcpRepairWindow and TcpKeepaliveController(user) are in the
connectivity module, so TcpRepairWindow doesn't need to be
the module-lib API. Thus, remove TcpRepairWindow from
module-lib API.

Bug: 172183305
Test: m update-api
Change-Id: I8fde726f8ad73637e6deab69ea83b3699bb2cf45
2021-04-12 14:26:55 +08:00
Remi NGUYEN VAN
a2a324f843 Merge "Set ParseException constructors as public" 2021-04-09 00:20:33 +00:00
Remi NGUYEN VAN
445fd7e9d9 Merge "Replace fields with getters in keepalive API" 2021-04-09 00:20:13 +00:00
Remi NGUYEN VAN
58a22b1d8f Merge "Add RequiresPermission to TestNetworkManager" 2021-04-09 00:19:51 +00:00
Remi NGUYEN VAN
c5174c3c10 Add RequiresPermission to TestNetworkManager
All API methods in TestNetworkManager require the MANAGE_TEST_NETWORKS
permission.

Fixes: 183972672
Test: m
Change-Id: Ic5929c24ea88d7259d367a81fec8f223a2e3ecb0
2021-04-08 16:12:23 +09:00
Remi NGUYEN VAN
84a217a6ef Set ParseException constructors as public
As there is no strong reason to keep the constructors module-lib, set
them as public API.
This is in response to API feedback.

Fixes: 183446251
Test: m
Change-Id: I01daa6f6f8095f7a4db94d1ca05f913166939df3
2021-04-08 15:57:31 +09:00
Remi NGUYEN VAN
019b0eef3c Replace fields with getters in keepalive API
General guidance is to have getters in the API instead of fields.

Fixes: 181014882
Test: m
Change-Id: Id4bfc447701e8d0380163047779fbba043f17b6f
2021-04-08 14:06:53 +09:00
paulhu
b49c8425b2 Move ACTION_CLEAR_DNS_CACHE to ConnectivityManager
- As API review feedback, move ACTION_CLEAR_DNS_CACHE form Intent
  to ConnectivityManager.

- Rename to "android.net.action.CLEAR_DNS_CACHE" because of lint
  suggestion.
frameworks/base/packages/Connectivity/framework/src/android/net/
ConnectivityManager.java:449: error: Inconsistent action value;
expected `android.net.action.CLEAR_DNS_CACHE`, was
`android.intent.action.CLEAR_DNS_CACHE` [ActionValue]

Bug: 183937999
Test: atest FrameworksNetTests
Test: atest ActivityTaskManagerServiceTests
Test: atest android.permission2.cts.PermissionPolicyTest
Test: atest CtsNetTestCases
Change-Id: Iae8aa0ba10dfc7581f0cfaab82643edbee789e2f
2021-04-07 19:40:47 +08:00
Treehugger Robot
cb20318619 Merge "Expose constants of ConnectivityManager" 2021-04-07 10:11:06 +00:00
lucaslin
d89b2980df 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
Merged-In: I715c766ad8e5eb54f4dc67239c1dbca7239506fc
2021-04-07 09:13:46 +00:00
Roshan Pius
fb309ae283 Merge "NetworkCapabilities: Hide copy constructor" 2021-04-06 15:57:47 +00:00
Frank Li
4ae4410678 Merge "Add session ID to VpnTransportInfo" 2021-04-06 06:50:48 +00:00
Roshan Pius
fc3adb5ae1 NetworkCapabilities: Hide copy constructor
Only used by connectivity service, no need to mark it public.

Bug: 184537591
Test: Compiles
Change-Id: Ie0d515d73e30a4e15141a3d92aa739192badeb13
2021-04-05 09:29:30 -07:00
Benedict Wong
42d706acfc Merge "Downgrade list of subIds in NetworkCapabilities to @SystemApi" 2021-04-02 22:33:20 +00:00
Sarah Chin
aac4d3242a Merge "API to get network visible network capability name" 2021-04-02 16:50:10 +00:00
Benedict Wong
5cec03468c Downgrade list of subIds in NetworkCapabilities to @SystemApi
This change downgrades API visibility for the list-of-subIds in the
NetworkCapabilities to SystemApi

Bug: 175662146
Test: atest NetworkCapabilitiesTest#testSubIds
Test: atest FrameworksNetTests
Change-Id: I372fa9eaa7585aefd1710948ca007456feedd578
2021-04-02 01:18:11 -07:00
Aaron Huang
5e6693605c Merge "Expose BIP and VSIM relavent definitions" 2021-04-01 11:38:17 +00:00
lifr
65b9f96159 Add session ID to VpnTransportInfo
- This will be visible only to apps with the NETWORK_SETTINGS
  permissions (signature), and will be redacted for all other callers.
- This string is expected to be the same as set by
  VpnService#setSession, and in general, VpnConfig.session. But it
  will be a general API that Vpn.java can call when setting the
  VpnTransportInfo.
- This string cannot be updated once the VPN NetworkAgent is connected.

Bug: 171872481
Test: atest ConnectivityServiceTest
      atest VpnTransportInfoTest
      atest android.net.cts.NetworkAgentTest
Change-Id: I8d09e25b83f7ee8be21ec9c9bd3c72a251f1370d
Merged-In: I8d09e25b83f7ee8be21ec9c9bd3c72a251f1370d
           (cherry-picked from ag/14011912)
2021-04-01 15:46:31 +08:00
Frank Li
487698b2b7 Merge "[JS01]Remove hidden API usage of Connectivity Sevice" 2021-03-30 07:22:40 +00:00
lifr
b4dab37e28 [JS01]Remove hidden API usage of Connectivity Sevice
The Connectivity service will become the mainline module.
Therefore, remove the caller of using Connectivity's
hidden API outside the module and expose the required
connectivity API used in Jobscheduler.

Bug: 183456204
CTS-Coverage-Bug: 170598012
Test: atest JobStoreTest
Change-Id: Ie6bc81ff382fb242b98f35d28a96defc207c7987
Merged-In: Ie6bc81ff382fb242b98f35d28a96defc207c7987
           (cherry-picked from ag/13946348)
2021-03-30 11:41:50 +08:00
Lorenzo Colitti
9364b3a406 Add a setTeardownDelayMs API to NetworkAgent.
This allows transports to request that when the network is
disconnected, the system should delay destroying the native
network until the specified time has passed after the network
disconnected.

Bug: 181941583
Test: next CL in the stack
Change-Id: I9765f1c9d1e55c23c6d583d6709dbe06505975b1
2021-03-29 21:33:08 +09:00
lifr
d90927f218 [TL02]Remove hidden API usage of NetworkAgent
The connection service will become the mainline module.
Remove the hidden API usage of NetworkAgent.

Bug: 170598012
CTS-Coverage-Bug: 170598012
Test: atest FrameworksNetTests FrameworksTelephonyTests
      atest FrameworksWifiTests
Change-Id: I4e4040ae7f94bdf479c7df9ec2ffabafbe06331c
Merged-In: I4e4040ae7f94bdf479c7df9ec2ffabafbe06331c
2021-03-29 15:33:44 +08:00
Chiachang Wang
eab4a9c984 Expose BIP and VSIM relavent definitions
In order to support special APNs below, OEM may need extra
NetworkCapabilities and apn type definition to support the
carriers request. Add corresponding definition into API
surface.

VSIM: for Virtual SIM service
BIP: for Bearer Independent Protocol

Bug: 130869457
Test: make update-api
Change-Id: I41e881c6fe39e92d5cdac2d0a02fa8a8e814c9c5
Merged-In: I41e881c6fe39e92d5cdac2d0a02fa8a8e814c9c5
2021-03-26 06:17:25 +00:00
Treehugger Robot
c1657fb7f8 Merge "Add network disconnected callback" 2021-03-26 05:47:33 +00:00
Chiachang Wang
1c5f57f921 Add network disconnected callback
Create a network callback to notify network agent after the
native network being destroyed by netd which means the network
is fully disconnected. The NetworkAgent may handle this event
after sending disconnect state to ConnectivityService to proceed
its pending works that have to be done after it.

Bug: 178725261
Test: make update-api
Change-Id: I602ff2c688909473b03b72c9407d4286608cff4c
Merged-In: I602ff2c688909473b03b72c9407d4286608cff4c
2021-03-26 02:53:29 +00:00
Sarah Chin
8fc279e0cc API to get network visible network capability name
Test: atest DataConnectionTest, DcTrackerTest
Bug: 181916712
CTS-Coverage-Bug: 183553812
Change-Id: Iae63ac4d62641cee2bd0f0c5f50dd729750d514c
Merged-In: Iae63ac4d62641cee2bd0f0c5f50dd729750d514c
2021-03-25 15:10:39 -07:00
Lorenzo Colitti
8ad5812ebc Add onBlockedStatusChanged(Network, int) to NetworkCallback.
This is similar to onBlockedStatusChanged(Network, boolean) but
it allows the callback holder to know the exact reason why
networking was blocked. It is useful to privileged system
components such as JobScheduler that are able to ignore some
blocked reasons but not others.

Also add a new BLOCKED_REASON_LOCKDOWN_VPN that is used when
networking is blocked because an always-on VPN is in
lockdown mode.

Also move BLOCKED_METERED_REASON_MASK to ConnectivityManager.
This is necessary because ConnectivityService must ensure that
the blocked status callbacks are correctly sent when meteredness
changes (e.g., a UID that is blocked on metered networks will
become unblocked on a network that becomes unmetered). In order
to do this it needs to know which reasons apply only on metered
networks.

Bug: 165835257
Test: unit tests in subsequent CLs in the stack
Change-Id: I647db4f5a01280be220288e73ffa85c15bec9370
2021-03-26 02:37:19 +09:00
paulhu
7a4eeed62f Add MOBILE_DATA_PREFERRED_APPS setting
This setting is OEM upstream requirement for mobile data
preferred apps feature.

Bug: 171872461
Test: atest FrameworksNetTests
Merged-In: Ic5e0515b2b948de3d333c8d8e073d0b15514562a
Change-Id: Iba17bf68cffbe39d1c08ad94364b41bbf851bf57
2021-03-26 02:37:19 +09:00
paulhu
6865eb6dda Add PRIVATE_DNS_MODE setting setter
Bug: 182538166
Test: atest FrameworksNetTests
Merged-In: If234426f041606c4881de1eca31b6f5bdb3c6bfe
Change-Id: Iaa9e6cc92f1805ab341c308fc60e947ec4c674f0
2021-03-26 02:37:16 +09:00
paulhu
9443095517 Expose ConnectivitySettingsManager as module-lib API
Have getter/setter methods for external modules that can
get/set the setting values.

Bug: 182538166
Test: atest FrameworksNetTests
Merged-In: I82225a43f95e3e1d3e52c4e7a0fc541c0087292e
Change-Id: I61cb00216494e35b6e0dfe444b177cad36ad8afb
2021-03-26 02:35:07 +09:00
Chiachang Wang
1b7563cb1e Merge "Add network created callback support" 2021-03-25 13:22:17 +00:00
Lucas Lin
8e4ae68ddd Merge "Expose some APIs from ConnectivityManager" 2021-03-25 11:29:08 +00:00
Lucas Lin
514e8ad39c Merge changes Ic2357dcf,Iddf8c71a
* changes:
  Expose NetworkAgent constructor taking a NetworkScore parameter
  Expose NetworkScore to external caller
2021-03-25 11:28:28 +00:00
Chiachang Wang
e211de2893 Add network created callback support
Create a network callback to notify network agent after
netd has created the network, so that the NetworkAgent may
wait for this callback and ensure the pre-work to communicate
with netd completed.

Bug: 178725261
Test: make update-api
Change-Id: I8c2ff7bd6980ae838abc5669f9419d62741b8666
Merged-In: I8c2ff7bd6980ae838abc5669f9419d62741b8666
2021-03-25 18:27:24 +08:00
Chiachang Wang
4694a2ab04 Expose NetworkAgent constructor taking a NetworkScore parameter
Vpn constructs NetworkAgent with this exposed NetworkAgent
constructor. Given NetworkAgent is moving into the incoming
connectivity module, Vpn which is outside the module will not
be able to access it if it's not in the API surface. Thus,
expose it to allow Vpn to use it.

Bug: 182963397
Test: make update-api
Change-Id: Ic2357dcfff3233e0dd17b48b0e376a5095ef60fa
Merged-In: Ic2357dcfff3233e0dd17b48b0e376a5095ef60fa
CTS-Coverage-Bug: 172183305
  (cherry-picked from ag/13966707)
2021-03-25 08:40:27 +00:00
lucaslin
39907ba9d6 Expose NetworkScore to external caller
NetworkScore will be a part of mainline module, so the external
callers cannot call its hidden APIs. Expose needed APIs to
the external callers.

CTS-Coverage-Bug: 182963397
Bug: 182963397
Test: m
Change-Id: Iddf8c71a5f51a40bc6ff78626b3e8ee530d1b7eb
Merged-In: Iddf8c71a5f51a40bc6ff78626b3e8ee530d1b7eb
  (cherry-picked from ag/13947595)
2021-03-25 08:15:09 +00:00