Commit Graph

12591 Commits

Author SHA1 Message Date
Treehugger Robot
7faee617b9 Merge "Downgrade the log level of exception log" 2021-04-06 04:01:59 +00:00
lucaslin
3967e5f614 Downgrade the log level of exception log
This exception log is usually printed when the device connects to
a wifi. The cause is that when the device connects to a wifi,
wifi will send CONNECTING state first, then CONNECTED state.
And in CONNECTING state, wifi will send the LinkProperties to
ConnectivityService and ConnectivityService will try to update
that LinkProperties(including interface) to netd. But the netid
hasn't set to netd yet before wifi CONNECTED, so this exception
log will be printed.
There is no really issue in this case, so downgrade the log level
might be a better thing for all Android developer.

Bug: 181269159
Test: m
Change-Id: I61c09352225a610fcd6d3dd33b782ee114c35fc5
2021-04-06 02:02:50 +00:00
Steven Moreland
3f6415a2f5 Merge "Remove unstable IpPrefix" 2021-04-05 21:59:47 +00:00
Treehugger Robot
5110c6dad6 Merge "Fix broken testCaptivePortalApp" 2021-04-05 13:05:41 +00:00
Chalard Jean
167cc4a044 Merge "Fix a bug where the wrong profile is queried" 2021-04-05 05:48:17 +00:00
Benedict Wong
87e0ab8905 Merge "Downgrade list of subIds in NetworkCapabilities to @SystemApi" 2021-04-02 22:33:20 +00:00
Sarah Chin
129857619f Merge "API to get network visible network capability name" 2021-04-02 16:50:10 +00:00
Chalard Jean
70b2d9ac2f Fix broken testCaptivePortalApp
This was broken by aosp/1657763, only on eng builds because
of a wtf. The root cause of the issue is that the test is
acquiring MAINLINE_NETWORK_STACK after it registers a callback
but before in unregisters it. After aosp/1657763, the objects
keeping track of callbacks are separate for processes with and
without MAINLINE_NETWORK_STACK, which means the removal is
looked up in a different counter.

Solve this by having the NRI remember the relevant counter
keeping track of it.

Bug: none
Test: testCaptivePortalApp
Change-Id: I566a28522fa68be9cc2bdb4624b588b4f01d3b7e
2021-04-02 20:18:18 +09:00
Chalard Jean
0a04bdb730 Fix a bug where the wrong profile is queried
UserManager#isManagedProfile() is not aware of the user
handle of the context the UM instance is created on.
Instead, call isManagedProfile(int).

Bug: 183625645
Test: ConnectivityServiceTest
Change-Id: I1fef22d67d75df25a8c2d0694f857c3e1c1a1306
2021-04-02 19:24:44 +09:00
Benedict Wong
4310e45eff 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
Steven Moreland
0fb772f6df Remove unstable IpPrefix
Seems nothing is using this.

Bug: 183654927
Test: N/A
Change-Id: I94233d79fb5d93970b38a79a09fc4d50822c3620
2021-04-01 22:59:02 +00:00
Aaron Huang
5c520a3650 Merge "Move some constants from TrafficStatsConstants to NetworkStackConstants" 2021-04-01 15:59:39 +00:00
Aaron Huang
55a22edbab Merge "Expose BIP and VSIM relavent definitions" 2021-04-01 11:38:17 +00:00
Aaron Huang
e36b232c4a Merge "Move deduceRestrictedCapability to libs/net and rename it" 2021-04-01 11:37:51 +00:00
Chalard Jean
58b8d1eb22 Merge "Fix testLegacyLockdownVpn flaky" 2021-04-01 08:19:53 +00:00
Chalard Jean
face022980 Fix testLegacyLockdownVpn flaky
When WiFi disconnects, the VPN disconnects immediately. The
broadcast can therefore be sent before the broadcast receiver is
registered, which causes the receiver to not see the broadcast.

The puzzling part is that CONNECTIVITY_ACTION is a sticky
broadcast, so one would expect the broadcast to still be
received, even if the registration is done after the broadcast
is sent. The reason this doesn't happen is that the context used
by the test is a BroadcastInterceptingContext, which does not
treat sticky broadcasts as sticky.

Bug: 184115648
Test: atest --iterations 1000 'ConnectivityServiceTest#testLegacyLockdownVpn'
Change-Id: Ib44c92839d25951cc7d2db0f923e1b104690e1e0
2021-04-01 06:27:46 +00:00
Aaron Huang
e3ea1200ad Move some constants from TrafficStatsConstants to NetworkStackConstants
Keep the constants are only used by framework in TrafficStatsConstants
and move the others to NetworkStackConstants which is in libs/net.

Bug: 182349970
Test: FrameworksNetTests
      NetworkStackTests
      TetheringTests
Change-Id: Ib667c115e5f1e01237d88b77bba753363da309cc
Merged-In: Ib667c115e5f1e01237d88b77bba753363da309cc
2021-04-01 05:10:03 +00:00
Chiachang Wang
5e3d0c85b7 Merge "Add required permission to FrameworksNetIntegrationTests" 2021-04-01 03:15:07 +00:00
Suprabh Shukla
2adfd3ccb5 Add required permission to FrameworksNetIntegrationTests
Test: atest FrameworksNetIntegrationTests

Fixes: 184166194
Change-Id: I7ad920ba5962f9c71c3c3db86809e7cb6b934425
2021-03-31 18:52:04 -07:00
James Mattis
fdd2d3be95 Calling linkToDeath on binder in NRI constructor
Any NRI constructor that can possibly have a binder should call
linkToDeath on that binder if present. Not doing so can result in a
no such element exception when that NRI is removed.

Bug: 184155022
Test: atest FrameworksNetTests
atest FrameworksNetIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: I90d594e43474483c554d0d315ff7abb6f678e093
2021-03-31 14:45:27 -07:00
James Mattis
9bdfa2c582 Change the const for the unreachable network
Changing the const used for the unreachable network for per-app
functionality for those apps whose traffic for the default network we
wish to lose connectivity as dictated by per app network preferences.
This is being done as per changes in https://r.android.com/1643182.

Bug: 181579204
Test: atest FrameworksNetTests
Change-Id: I1bffadfa03a6221096100c9e0457ea00f94027a3
2021-03-30 17:16:44 -07:00
Lorenzo Colitti
cbc6a315c5 Merge changes I24580ea4,Id48b8eab
* changes:
  Allow the system to register 250 NetworkCallbacks.
  Add more test coverage for limiting the number of callbacks.
2021-03-30 16:01:58 +00:00
Lorenzo Colitti
b4f8d8e130 Allow the system to register 250 NetworkCallbacks.
Give anyone with PERMISSION_MAINLINE_NETWORK_STACK (i.e.,
either the system or the networkstack process) a separate limit
of 250 callbacks per UID.

Bug: 183921387
Test: new unit tests
Change-Id: I24580ea48e3ad502ef584efc5fde0b5d22e392b4
2021-03-30 22:54:01 +09:00
Lorenzo Colitti
64ef4d3785 Add more test coverage for limiting the number of callbacks.
Bug: 183921387
Test: test-only change
Change-Id: Id48b8eab507fb616cb0adfeba52e00858d44b8a6
2021-03-30 20:28:36 +09:00
Treehugger Robot
364ad64fa7 Merge changes I3826b9ef,I91d68ca3
* changes:
  Add static for constant
  Get NetworkCapabilities from NetworkCallback
2021-03-30 08:22:41 +00:00
Frank Li
0557b8b4c6 Merge "[JS01]Remove hidden API usage of Connectivity Sevice" 2021-03-30 07:22:40 +00:00
lifr
d023f35cc3 [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
2206e976c1 Merge changes If539cf5d,I9765f1c9,I6d3007a1
* changes:
  Add test coverage for NetworkAgent callbacks.
  Add a setTeardownDelayMs API to NetworkAgent.
  Address comments on onBlockedStatusChanged(Network, int) CL.
2021-03-30 00:38:47 +00:00
Sudheer Shanka
90358f5154 Remove NetworkPolicyManager.isUidBlocked() API.
It isn't used by ConnectivityService any more and even if
it needs such utility method in the future, we could create
one which is part of connectivity module and doesn't need
to be exposed as part of NetworkPolicyManager API surface.

Bug: 183696103
Test: atest ./tests/net/java/com/android/server/ConnectivityServiceTest.java
Change-Id: Ie3c681f88e4b2b9bb92d2224c5ea96b074f155d5
2021-03-29 12:39:12 +00:00
Lorenzo Colitti
1bc9ad0375 Add test coverage for NetworkAgent callbacks.
Tests the onNetworkCreated, onNetworkUnwanted and
onNetworkDisconnected callbacks, and the teardown delay timer.

Bug: 181941583
Test: atest --rerun-until-failure 500 ConnectivityServiceTest#testNetworkAgentCallbacks
Change-Id: If539cf5d01ba23193afab2433ed0ac4e7f0550ec
2021-03-29 21:33:11 +09:00
Lorenzo Colitti
6d88078151 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
Lorenzo Colitti
a37eaff1ea Address comments on onBlockedStatusChanged(Network, int) CL.
Test: m
Bug: 165835257
Change-Id: I6d3007a1eac54ee6650b350aee56ed398a2c950d
2021-03-29 20:12:09 +09:00
Frank Li
8539ed6fd2 Merge changes from topic "NetworkAgent02"
* changes:
  Fix cannot success verify count of the networkAgent Config items on R device
  [TL02]Remove hidden API usage of NetworkAgent
2021-03-29 11:08:24 +00:00
lifr
f459c60984 Fix cannot success verify count of the networkAgent Config items on R
device

Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkAgentConfigTest
Fix: 183474500
Change-Id: Ie0fd5ba816c390bfb7bc6512d896a88482c217ec
Merged-In: Ie0fd5ba816c390bfb7bc6512d896a88482c217ec
2021-03-29 15:36:32 +08:00
lifr
f1594291c4 [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
Junyu Lai
371bd281f5 Merge "Support Dual ViLTE stats" 2021-03-29 06:59:19 +00:00
Remi NGUYEN VAN
a99e50dbf7 Merge "Re-implement NetworkUtils#queryUserAccess." 2021-03-29 04:57:40 +00:00
Lorenzo Colitti
092af05525 Re-implement NetworkUtils#queryUserAccess.
Currently, queryUserAccess talks to netd via FwmarkServer.
Doing this from the module would require exposing queryUserAccess
as an NDK API or reimplementing FwmarkClient.

Because queryUserAccess really only uses information that comes
from ConnectivityService/PermissionMonitor anyway, just use that
information without calling to net.

Test: atest HostsideVpnTests
Bug: 171540887
Merged-In: If855de1ea3e1fd2ed30f2795d9b4acfcf969a2dc

Change-Id: If855de1ea3e1fd2ed30f2795d9b4acfcf969a2dc
2021-03-29 12:11:19 +09:00
Chiachang Wang
ec5b130e4e 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
Aaron Huang
f151f5f8ad Move deduceRestrictedCapability to libs/net and rename it
NetworkCapabilities is included in framework-connectivity, so external
module cannot have dependencies on its hidden API. Move the method to
libs/net so that external modules can use it by including the library.

Bug: 178777253
Test: FrameworksNetTests
(cherry-picked from ag/13921626)
Merged-In: I77970b3a5e5e0e9d263639694b1f06519169bf64
Change-Id: I77970b3a5e5e0e9d263639694b1f06519169bf64
2021-03-26 14:13:51 +08:00
Treehugger Robot
6d1437a596 Merge "Add network disconnected callback" 2021-03-26 05:47:33 +00:00
Chiachang Wang
3ffcb398e2 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
bba22b2120 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
9150b1ec95 Add unit tests for onBlockedStatusChanged(Network, int).
Bug: 165835257
Test: atest FrameworksNetTests
Change-Id: I0597df71aa94817835d7a2fb54bfcf9222a34b64
2021-03-26 02:37:20 +09:00
Lorenzo Colitti
60104f59a0 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
521169738c 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
87ac58016f 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
e6badefc33 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
c542ed20fa Merge "Add network created callback support" 2021-03-25 13:22:17 +00:00
Lucas Lin
3483ccf883 Merge "Add annotation for Vpn#getNetwork()" 2021-03-25 11:29:38 +00:00