Commit Graph

5772 Commits

Author SHA1 Message Date
Paul Hu
aab0bf5483 Merge "Replace NetworkPolicyManagerInternal#isUidNetworkingBlocked()" am: 158e8ae1f1 am: 42a2d40519 am: 9425733cd6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1535722

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id78638ca2a5384accb7b1b92d70a779fda561b98
2021-01-12 11:25:28 +00:00
Treehugger Robot
02986329e4 Merge "[VCN02] Make LingerTimer takes request Id instead of NetworkRequest" am: 46c82c2739 am: ce706fe852 am: 3854c7ac43
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1529109

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I99aa6ba209a6e051d9c2c9ebf9f2635effaa450b
2021-01-12 11:03:01 +00:00
Paul Hu
158e8ae1f1 Merge "Replace NetworkPolicyManagerInternal#isUidNetworkingBlocked()" 2021-01-12 09:53:05 +00:00
Treehugger Robot
46c82c2739 Merge "[VCN02] Make LingerTimer takes request Id instead of NetworkRequest" 2021-01-12 08:59:04 +00:00
paulhu
cb693f8e2c Replace NetworkPolicyManagerInternal#isUidNetworkingBlocked()
Connectivity service is going to become a mainline module which
will not able to access hidden APIs. NetworkPolicyManagerInternal
is a internal serivce that CS can't be access after be a mainline
module. Thus, replace NPMI#isUidNetworkingBlocked() to similar
method NPMS#isUidNetworkingBlocked() and create new API
NPM#isUidNetworkingBlocked() to support CS usage.

Bug: 170598012
Test: atest FrameworksNetTests
Test: atest FrameworksCoreTests:NetworkPolicyManagerTest
Test: atest FrameworksServicesTests:NetworkPolicyManagerServiceTest
Test: atest CtsNetTestCases
Test: atest CtsHostsideNetworkTests
Change-Id: Ic3427c71c395de787320f303c9513874b4d64f98
2021-01-12 10:53:05 +08:00
Benedict Wong
26732ca479 Merge changes I3b769562,I63203188,Ia9396d66,Ifec34fad am: 20bfe66a02 am: f2d8cfe88c am: 32f80922f0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1515262

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I26acb191d2cbe5a7483a7dca0d1a5705f3819e8b
2021-01-09 00:02:19 +00:00
Benedict Wong
20bfe66a02 Merge changes I3b769562,I63203188,Ia9396d66,Ifec34fad
* changes:
  Pull VcnNetworkProvider out into a separate class
  Verify carrier privileges for VCN-providing packages
  Add TelephonySubscriptionTracker to VcnMgmtSvc
  Add basic VcnMgmtSvc --> Vcn signals (startup, teardown, NetworkReq)
2021-01-08 22:29:40 +00:00
Junyu Lai
846ff538e5 Merge "Revert "wifi: Add systemAPi:setSubscriberId in NetworkAgentConfig"" am: f44c7cc998 am: 7b15416a2c am: 09460f1ccd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1542628

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib7ca2c9482b3d4c6e50975825239ca9bc461991b
2021-01-08 15:15:51 +00:00
Treehugger Robot
d2ae6601fd Merge "Pivot network statistics to use DataInput/Output." am: 5b322f10be am: 5c5eff8d5c am: fe39a927b5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1540224

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I44be7ea64d012f35d312ae3b039b0fd7e37e9d60
2021-01-08 11:49:37 +00:00
Junyu Lai
2960af3978 Revert "wifi: Add systemAPi:setSubscriberId in NetworkAgentConfig"
This reverts commit 7521c2277a.

Reason for revert: After discussion, we prefer to add a field in NetworkCapabilities instead. Sorry for inconvenience.

Change-Id: I2e8840a797df9d1594f2b8b576bcd45beb184fca
2021-01-08 19:22:28 +08:00
Les Lee
66e322ee70 Merge "wifi: Add systemAPi:setSubscriberId in NetworkAgentConfig" am: 6ae2535ec6 am: 2f8f97c64c am: 026441fcd5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536153

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8a491c13545e1dbe09f46081303dc33eed71a467
2021-01-08 10:41:27 +00:00
Treehugger Robot
5b322f10be Merge "Pivot network statistics to use DataInput/Output." 2021-01-08 10:33:16 +00:00
Benedict Wong
9cb5807845 Verify carrier privileges for VCN-providing packages
This change adds and verifies packages in the VcnManagmentService,
ensuring that carrier privilege gain/loss correctly starts/tears down
VCN instances.

Bug: 163431877
Test: atest FrameworksNetTests
Change-Id: I63203188c57fdde1cfc58aaf1108aa3e70eb4a50
2021-01-07 17:13:37 -08:00
Les Lee
6ae2535ec6 Merge "wifi: Add systemAPi:setSubscriberId in NetworkAgentConfig" 2021-01-08 00:54:51 +00:00
Lorenzo Colitti
85191e98f4 Merge changes Iec22ff63,Iaca8a7cc am: 5a5613209d am: 26e29afb3e am: bdba76fe13
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1528211

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I293366c6aac42f776ff23277a707d8c2ae0fd1b0
2021-01-07 19:22:06 +00:00
Lorenzo Colitti
282ed251ce Inform ConnectivityService about always-on VPN lockdown.
Currently, when an always-on VPN is set in lockdown mode, Vpn
configures prohibit UID rules in netd directly and does not
inform ConnectivityService of the fact.

This means that ConnectivityService cannot send NetworkCallbacks
that tells apps that they are blocked or unblocked. It also means
that ConnectivityService has to take the mVpns lock and call into
Vpn to allow synchronous APIs such as getActiveNetwork to return
BLOCKED if the app is blocked.

Move all this to ConnectivityService:
- Add a setRequireVpnForUids API to ConnectivityManager, and have
  that pass the routing rules to netd.
- Update VpnTest to expect calls to ConnectivityManager instead
  of to netd.
- Whenever setRequireVpnForUids is called, ensure that
  ConnectivityService sends onBlockedStatusChanged to the
  affected callbacks.
- Update existing unit tests to check for callbacks.
- Add a way to find the VPN that applies to a given UID without
  taking the VPN lock, by instead scanning all connected VPNs.
  Use this as a replacement for direct access to mVpns.

For simplicity, and in order to ensure proper ordering between
the NetworkCallbacks sent for VPNs connecting and disconnecting,
process blocked UID ranges on the handler thread. This means that
when setRequireVpnForUids returns, the rule changes might not
have been applied. This shouldn't impact apps using network
connectivity, but it might mean that apps setting an always-on
package, and then immediately checking whether networking is
blocked, will see a behaviour change.

Bug: 173331190
Fix: 175670887
Test: new test coverage in ConnectivityServiceTest
Test: atest MixedDeviceOwnerTest#testAlwaysOnVpn \
            MixedDeviceOwnerTest#testAlwaysOnVpnLockDown \
	    MixedDeviceOwnerTest#testAlwaysOnVpnAcrossReboot \
	    MixedDeviceOwnerTest#testAlwaysOnVpnPackageUninstalled \
	    MixedDeviceOwnerTest#testAlwaysOnVpnUnsupportedPackage \
	    MixedDeviceOwnerTest#testAlwaysOnVpnUnsupportedPackageReplaced \
	    MixedDeviceOwnerTest#testAlwaysOnVpnPackageLogged \
            MixedProfileOwnerTest#testAlwaysOnVpn \
            MixedProfileOwnerTest#testAlwaysOnVpnLockDown \
	    MixedProfileOwnerTest#testAlwaysOnVpnAcrossReboot \
	    MixedProfileOwnerTest#testAlwaysOnVpnPackageUninstalled \
	    MixedProfileOwnerTest#testAlwaysOnVpnUnsupportedPackage \
	    MixedProfileOwnerTest#testAlwaysOnVpnUnsupportedPackageReplaced \
	    MixedProfileOwnerTest#testAlwaysOnVpnPackageLogged \
            MixedManagedProfileOwnerTest#testAlwaysOnVpn \
            MixedManagedProfileOwnerTest#testAlwaysOnVpnLockDown \
	    MixedManagedProfileOwnerTest#testAlwaysOnVpnAcrossReboot \
	    MixedManagedProfileOwnerTest#testAlwaysOnVpnPackageUninstalled \
	    MixedManagedProfileOwnerTest#testAlwaysOnVpnUnsupportedPackage \
	    MixedManagedProfileOwnerTest#testAlwaysOnVpnUnsupportedPackageReplaced \
	    MixedManagedProfileOwnerTest#testAlwaysOnVpnPackageLogged
Test: atest FrameworksNetTests HostsideVpnTests \
            CtsNetTestCases:VpnServiceTest \
	    CtsNetTestCases:Ikev2VpnTest
Change-Id: Iaca8a7cc343aef52706cff62a7735f338cb1b772
2021-01-07 17:44:29 +09:00
Chiachang Wang
f1188efefe Merge "Remove mobile provision design out from connectivity service" am: 518d9d8f27 am: 194b3d1058 am: 6e82c52947
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1531804

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5984ea716e87cfb1c4ec79d5c7edbf994dd4911f
2021-01-07 08:19:22 +00:00
Chiachang Wang
518d9d8f27 Merge "Remove mobile provision design out from connectivity service" 2021-01-07 06:47:26 +00:00
Chiachang Wang
454497b7df Remove mobile provision design out from connectivity service
In order to support ConnectivityService mainline, module should
not use hidden APIs. The logic to get mobile provision is moved
to telephony surface since it's only used by telephony.
Hence, remove the design out from Connectivity.

Bug: 175177794
Test: atest FrameworksNetTests
Change-Id: Ic3082fc1c4d7ac998f4e4cff1351e6829d500924
2021-01-07 06:46:40 +00:00
Lucas Lin
31f217fa63 Merge "Replace withCleanCallingIdentity with [clear|restore]CallingIdentity" am: c7906266c5 am: 3b6bae1fee am: aa3bd77f93
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1537266

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I52549a279f89639ac0132cd1bd1d2a830966eeac
2021-01-07 05:42:02 +00:00
Lucas Lin
c7906266c5 Merge "Replace withCleanCallingIdentity with [clear|restore]CallingIdentity" 2021-01-07 04:32:54 +00:00
Jeff Sharkey
6b773549e3 Pivot network statistics to use DataInput/Output.
Using these generalized interfaces is more flexible, since it enables
us to pivot the implementation being used internally.  In particular,
an upcoming CL will pivot them to use a more efficient alternative.

This is a no-op refactoring.

Bug: 176777285
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: Ibd4717174cf1f136e9d5d80172ecb6e493265306
2021-01-06 18:48:12 -07:00
Lorenzo Colitti
91348d9f22 Merge "Migrate away from AsyncChannel in NetworkAgent" 2021-01-06 14:10:21 +00:00
junyulai
532d8a164f [VCN02] Make LingerTimer takes request Id instead of NetworkRequest
Currently, LingerTimer takes a NetworkRequest for internal use.
However, this is unnecessary since only request Id is used.

Thus, this patch allows subsequent patches to remove the need
of a NetworkRequest when creating a LingerTimer. And the output
of lingered requests is reduced to id instead of printing
content of requests.

Test: atest FrameworksNetTests
Bug: 175180558
Change-Id: I9106d0804f1083942e1fcaca842f547c0aee1840
2021-01-06 17:26:12 +08:00
lucaslin
0d01b3b1eb Replace withCleanCallingIdentity with [clear|restore]CallingIdentity
To prevent using @hide method - withCleanCallingIdentity() from
mainline module, use clearCallingIdentity() &
restoreCallingIdentity() instead.

Bug: 172183305
Test: FrameworksNetTests, CtsNetTestCasesLatestSdk
Change-Id: Iccd492741a0a5b1c2531fc5fc1378933b65ae038
2020-12-30 11:54:55 +08:00
Paul Hu
7b848d34b7 Merge "Add DnsResolverServiceManager" am: 6bc7032b85 am: b3ea5a5a71 am: 206c66213e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1465502

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia89725249d9d6fca7a56b426a4bcb024ac8b1bb8
2020-12-29 03:45:34 +00:00
Paul Hu
6bc7032b85 Merge "Add DnsResolverServiceManager" 2020-12-29 02:14:59 +00:00
Patrick Rohr
5197d1bd33 Add Restricted Mode handling to NetworkPolicyManager
Adds Restricted Mode functionality to NetworkPolicyManager. When this
mode is turned on (via setting), only apps with
android.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS will be able to
use the network. For all other apps, the network will be blocked by the
firewall. This is controlled by a new allowlist firewall chain
fw_restricted_mode.

As a first step, this implementation still requires a reboot after the
enabling / disabling the mode to take effect. I will provide the dynamic
configuration in the next CL.

Test: atest CtsHostsideNetworkTests && atest
NetworkPolicyManagerServiceTest
Bug: 170322816
Bug: 157505406
Bug: 170322455
Bug: 175281879

Change-Id: I0731fa842c69683953baaf9ec3a9a03454f4c607
2020-12-28 18:01:34 +01:00
lesl
7521c2277a wifi: Add systemAPi:setSubscriberId in NetworkAgentConfig
The wifi (mainline module) need to set the subscriberId for specific
wifi network.

Bug: 176396812
Test: TreeHugger
Change-Id: Ie97d3dad81c87d41a360558e91c83278595ff475
2020-12-28 18:15:52 +08:00
Remi NGUYEN VAN
7cad86140e Merge "Register ethernet listeners on specific Executors" am: a9b2fddb51 am: 3e8c949c01 am: 7d3545917b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1513665

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia74a0b6f967f75841e076bc6b825d7809460adc3
2020-12-28 09:12:36 +00:00
Remi NGUYEN VAN
a9b2fddb51 Merge "Register ethernet listeners on specific Executors" 2020-12-28 07:12:45 +00:00
Chiachang Wang
9545203f3f Merge "[IT4.2] Update argument type of interfaceClassDataActivityChanged" am: dcb4051101 am: 8495b1b1dc am: 67cba56eff
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1531806

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I992dd2f78c0f7334bbe97a03faba161d09a03a71
2020-12-28 02:32:19 +00:00
Chiachang Wang
dcb4051101 Merge "[IT4.2] Update argument type of interfaceClassDataActivityChanged" 2020-12-28 01:05:28 +00:00
Serik Beketayev
db38c539cf Merge "[Mainline] Migrate ProxyInfo" am: 3c3711dffd am: 5565118666 am: 40e7949c5f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1506616

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia6f5bf74bf461f762472ea1d88553db3b9719c80
2020-12-25 09:58:40 +00:00
Remi NGUYEN VAN
92f546d4bd Migrate away from AsyncChannel in NetworkAgent
Use two oneway binder interfaces instead.
The interfaces post messages to handlers as was implemented before, but
provide a more strictly defined interface, with less hops between
NetworkAgent, AsyncChannel, and ConnectivityService.

The actual public interface is the NetworkAgent @SystemApi: the binder
interface is an internal implementation detail.

Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk
Bug: 173574274
Merged-In: Ie364ab50f416e7821e70f4539a881eea828e1256

Change-Id: Ie364ab50f416e7821e70f4539a881eea828e1256
2020-12-25 03:54:19 +00:00
Remi NGUYEN VAN
ec29ea445c Merge "Migrate away from AsyncChannel in NetworkAgent" 2020-12-25 01:57:44 +00:00
Aaron Huang
1346575ebc Merge "Have NetworkPolicyManagerService create MultipathPolicyTracker" am: a34d9a7af1 am: 8f96256d85 am: 27ace52564
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1519960

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I023815a53f01a0459b94033b7e2fa2ed91cca86a
2020-12-24 07:02:53 +00:00
Serik Beketayev
4abaecefc2 [Mainline] Migrate ProxyInfo
Bug: 173455434
Test: atest FrameworksNetTests
Change-Id: I924aed710b62a0c91b888a9e04ac2c90cdfd88d0
2020-12-23 22:15:51 -08:00
Aaron Huang
120dfbbec5 Have NetworkPolicyManagerService create MultipathPolicyTracker
To make connectivity service mainline, this patch makes
MultipathPolicyTracker as a submodule of NetworkPolicyManagerService
to remove the dependencies of ConnectivityService.

Bug: 175015282
Test: FrameworksNetTests
Change-Id: I82a7c62069ffd0683deb2f5ce2f99de120a2a16f
2020-12-23 23:17:15 +08:00
Chiachang Wang
4dd4e08c4e [IT4.2] Update argument type of interfaceClassDataActivityChanged
The argument type of interfaceClassDataActivityChanged takes a
string for the network type. It requires both the receivers and
NMS to do type transformation. The transformation is a redundant
work. Update it to take integer directly and rename to
understandable naming.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: Ibe9fa7a1b71af2dab916b5d615742e77e4174c39
2020-12-23 17:34:08 +08:00
Remi NGUYEN VAN
fb9c6e8d3c Migrate away from AsyncChannel in NetworkAgent
Use two oneway binder interfaces instead.
The interfaces post messages to handlers as was implemented before, but
provide a more strictly defined interface, with less hops between
NetworkAgent, AsyncChannel, and ConnectivityService.

The actual public interface is the NetworkAgent @SystemApi: the binder
interface is an internal implementation detail.

Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk
Change-Id: Ie364ab50f416e7821e70f4539a881eea828e1256
2020-12-23 17:30:54 +09:00
Chiachang Wang
0930c03c9e Merge "[IT04] Add uid as parameter of interfaceClassDataActivityChanged" am: baef452e38 am: 04aa5eac85 am: a817ecd4b5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1523339

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ieafdf569c13b1421c18fa3086827e6e432b498d7
2020-12-23 07:31:25 +00:00
Chiachang Wang
baef452e38 Merge "[IT04] Add uid as parameter of interfaceClassDataActivityChanged" 2020-12-23 05:20:33 +00:00
Remi NGUYEN VAN
23f93322c2 Merge "Split NetworkUtils and NetworkUtilsInternal" am: 3ed4fd3a89 am: 635d60201d am: edc6b0fb67
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1513140

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ief9d6a1fae360dbe1c43d5d6bac4dad5850c004b
2020-12-23 02:22:35 +00:00
Remi NGUYEN VAN
3ed4fd3a89 Merge "Split NetworkUtils and NetworkUtilsInternal" 2020-12-23 01:19:27 +00:00
paulhu
b6fcddfd5d Add DnsResolverServiceManager
Add DnsResolverServiceManager to obtain android.net.IDnsResolver
IBinder for incoming connectivity service mainline.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: Ibd7a678ceaaa550ff3d8eff1d0c4d3a5073b5527
2020-12-22 21:31:39 +08:00
Benedict Wong
bdfa53714d Merge "Add additional javadoc for VcnManager" am: ba3f1179a8 am: e1a23d3245 am: 3e867f4ff7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1458805

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I37106e194123c0bab6cb187f194bc7f3b619b693
2020-12-22 09:34:12 +00:00
Benedict Wong
ba3f1179a8 Merge "Add additional javadoc for VcnManager" 2020-12-22 08:11:02 +00:00
Benedict Wong
457fe96023 Merge changes Ifabf5e2b,I2e632532 am: c0e2e1c9bd am: 0ed3d9cb2f am: ade3cf56b3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1501053

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie864a11f42cea063bf922a1df3253fcdc6abf681
2020-12-22 06:59:01 +00:00
Chiachang Wang
e63d69a6b8 Merge "[IT03] Add replacement methods for network activity" am: 4ba82f5dba am: 26c1e82d43 am: 8ccb2ba934
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1523338

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0da6d452e989f7a89e33230cabfdc89c1a49ce6d
2020-12-22 06:58:05 +00:00