Commit Graph

2475 Commits

Author SHA1 Message Date
Chiachang Wang
a26c02f27a Merge "Replace hidden ParcelFileDescriptor constructor usage" am: b60805b832 am: bddce89449 am: 263b7e551f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552154

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I38369186c581fcde3e21c91af6b35ccd88320509
2021-01-18 03:27:17 +00:00
Chiachang Wang
b60805b832 Merge "Replace hidden ParcelFileDescriptor constructor usage" 2021-01-18 01:59:10 +00:00
Chiachang Wang
c5f86f48b0 Replace hidden ParcelFileDescriptor constructor usage
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
2021-01-18 01:58:49 +00:00
Roshan Pius
7cdb30ec22 Merge "NetworkCapabilities: Embed location senstive TransportInfo" 2021-01-14 15:38:15 +00:00
Aaron Huang
afb977d841 Merge "Migrate Slog usage in MultinetworkPolicyTracker to Log" am: 3637b6d0bf am: 8754a60bb9 am: 644892e3cb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1549720

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iad48fae63c7ef8c72e565cee8426fcbdd20c6295
2021-01-14 10:20:03 +00:00
Aaron Huang
3637b6d0bf Merge "Migrate Slog usage in MultinetworkPolicyTracker to Log" 2021-01-14 09:10:17 +00:00
Junyu Lai
d151942b6a Merge "[VCN05] Pass request type when requesting network" am: 8188af4521 am: b728deeb7f am: 53f3094fb0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1545846

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4280a78822db2943f0a62a3d729aac3b5f64326d
2021-01-14 09:05:35 +00:00
Junyu Lai
8188af4521 Merge "[VCN05] Pass request type when requesting network" 2021-01-14 06:52:46 +00:00
Aaron Huang
728980f276 Merge "Rename PacManager to PacProxyInstaller" am: 8505c870cd am: 51203ec517 am: 2a89cb3753
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1513130

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I10ff3bab210dbfeb10a19ea99459038499ce5ed9
2021-01-14 04:44:01 +00:00
Aaron Huang
fc52b82254 Migrate Slog usage in MultinetworkPolicyTracker to Log
Connectivity mainline module cannot use hidden API so
replace Slog with Log which is a public API.

Test: FrameworksNetTests
Change-Id: I8758079cf635ff4ab218df53c0f7bf6fc23ce476
2021-01-14 09:53:38 +08:00
Aaron Huang
8505c870cd Merge "Rename PacManager to PacProxyInstaller" 2021-01-14 01:52:24 +00:00
Roshan Pius
0a0c036906 Merge changes from topic "revert-13329427-revert-13274595-XTPTORCRLV-WLDUPFEJWD"
* changes:
  NetworkControllerWifiTest: Fix unit tests
  Revert "Revert "NetworkCapabilities: Embed location senstive Tra..."
2021-01-14 01:19:34 +00:00
Roshan Pius
dd76fab606 Revert "Revert "NetworkCapabilities: Embed location senstive Tra..."
Revert^2 "WifiLocationTest: Add test for Wifi TransportInfo"

b548aac6081a6899e966d7a8d961f2a47147e244

Exempt-From-Owner-Approval: Reland of approved CL

Bug: 162602799
Bug: 177390648
Test: atest com.android.systemui.statusbar.policy.NetworkControllerWifiTest
Change-Id: Iec8d1441e8d02ff43037fdcb0c90065adff8e716
2021-01-13 22:28:01 +00:00
satayev
5d2639e7e2 Merge "Revert "[VCN01] Add NOT_VCN_MANAGED capability"" am: ca95071a98 am: f9253eefae am: b8cf9e427b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1549962

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I051a51e5ee5898784d3a126140536ddeec6a0ba6
2021-01-13 18:53:37 +00:00
satayev
ca95071a98 Merge "Revert "[VCN01] Add NOT_VCN_MANAGED capability"" 2021-01-13 17:40:03 +00:00
satayev
5e2b869dfc Revert "[VCN01] Add NOT_VCN_MANAGED capability"
This reverts commit 869e7020a0.

Reason for revert: b/177411288 broken test

Bug: 177411288
Bug: 175662146
Change-Id: I02a25b83e62ab9a2ed22a98530d62b08de73f56e
2021-01-13 15:04:23 +00:00
Rick Yiu
56e47c492e Merge "Revert "NetworkCapabilities: Embed location senstive TransportInfo"" 2021-01-13 14:30:52 +00:00
Junyu Lai
aeb5c17911 Merge "Align coding style of line-wrapping in NetworkCapabilities" am: 74d132736b am: deb6c74bd8 am: c7714d1c32
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1529105

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I15dc61c1c845de22cd973156e00549395800edeb
2021-01-13 12:09:32 +00:00
Junyu Lai
5591c1c73e Merge "[VCN01] Add NOT_VCN_MANAGED capability" am: 82ffaf2ac2 am: 0afa8fa899 am: 101173a281
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1529959

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2ef798c4f1d66196322796c5e7ca9254300b5f78
2021-01-13 09:00:08 +00:00
Rick Yiu
a427afd7e3 Revert "NetworkCapabilities: Embed location senstive TransportInfo"
Revert "WifiLocationTest: Add test for Wifi TransportInfo"

Revert "WifiInfo: Embed location sensitive TransportInfo"

Revert submission 13274595

Reason for revert: DroidMonitor: Potential culprit for Bug 177390648 - verifying through Forrest before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.
Reverted Changes:
Ibcf0c6711:WifiInfo: Embed location sensitive TransportInfo
Ic68546e2a:WifiService: Use WifiInfo for masking
Ie522d8c75:NetworkCapabilities: Embed location senstive Trans...
Iaf0fef999:WifiLocationTest: Add test for Wifi TransportInfo
I017de6d4c:ClientModeImpl: Fill info elements for connected b...
I384c9321e:WifiInfo: Add info elements for connected bssid

Change-Id: I4e96850b96dc5ea71d9bb6af2ff17343b8d09d68
2021-01-13 08:36:22 +00:00
Aaron Huang
11e7cb2433 Rename PacManager to PacProxyInstaller
Generally, a manager class in Android is used to access
system services and it should be obtained from Context.
This class is a bit different from the definition of a
manager class.

API linter will detect an error if trying to expose a
class name end with Manager. ProxyTracker will create a
new instance of this class so this class needs to be
renamed to avoid API lint error.

Bug: 177035719
Test: FrameworksNetTests
Change-Id: I9185d4fb4342bd285a575f0bdd3518b758f37eb6
2021-01-13 15:47:45 +08:00
junyulai
70988816f9 Align coding style of line-wrapping in NetworkCapabilities
Test: TH
Change-Id: Ic864524a60954f8dbcce265643c2cb3ac3aefca8
2021-01-13 07:45:18 +00:00
Hai Shalom
41473668e1 Merge "Support for Venue URL and friendly name from Network agent" am: 6fce4189cd am: 5485906661 am: 16750033ff
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1515261

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I52b5fdc3445d35a19c0281469b4780bc5fe12199
2021-01-13 03:48:44 +00:00
junyulai
869e7020a0 [VCN01] Add NOT_VCN_MANAGED capability
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

Test: 1. atest FrameworksNetTests CtsNetTestCases
      2. adb shell dumpsys connectivity
      3. atest ConnectivityServiceTest#testLoseMutableAndRequestableCaps
Bug: 175662146

Change-Id: Ia5eeb3912a687164fa95d7ba5516fd73abca79ba
2021-01-13 11:05:40 +08:00
Roshan Pius
d04061ee77 Merge "NetworkCapabilities: Embed location senstive TransportInfo" 2021-01-13 02:26:34 +00:00
Roshan Pius
423fff6300 NetworkCapabilities: Embed location senstive TransportInfo
Changes:
i) Add a new constructor for NetworkCapabilities which accepts whether
location sensitive fields need to be parceled or not. Defalts to false
on the other constructor. This boolean should only be set on the copy of
NetworkCapabilities when sent to apps that hold location permission.
(Similar to how sensitive fields are handled in LinkProperties)
ii) Add a new makeCopy() method in the TransportInfo interface which
accepts whether location sensitive fields need to be parceled or not.
iii) Migrate the existing NetworkCapabilities owner UID masking to use
this new mechanism (instead of existing masking in ConnectivityService).
iv) Always set parcelLocationSensitiveFields to true in the NetworkAgent
surface (since that is a privileged surface from the transports to the
connectivity service)
v) Add a hasSensitiveFields() in TransportInfo interface to avoid
perfoming location permission checks for location insensitive
TrasnsportInfo.

Also, migrate to the new SdkLevel util for isAtLeastR() & isAtLeastS()
checks.

Bug: 162602799
Test: atest android.net
Test: atest com.android.server
Change-Id: Ie522d8c75a82ae521ccfd5165823d0c72642e651
Merged-In: Ie522d8c75a82ae521ccfd5165823d0c72642e651
2021-01-13 02:25:49 +00:00
Hai Shalom
6fce4189cd Merge "Support for Venue URL and friendly name from Network agent" 2021-01-13 01:54:05 +00:00
Tomasz Wasilczyk
ddbc7feb4d Merge "Keep Vehicle internal network always up" am: 2602edad73 am: fad6801459 am: 0c90d69a61
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1535861

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic3fad64a3a049e760f60a63b826c6f0d962309bb
2021-01-12 23:47:18 +00:00
Tomasz Wasilczyk
2602edad73 Merge "Keep Vehicle internal network always up" 2021-01-12 22:40:50 +00:00
Tomasz Wasilczyk
2793ab9e5b Keep Vehicle internal network always up
Bug: 171801262
Test: Boot with and without overlay set and check ifconfig
Change-Id: I1fd332caf3e09924abcfec9c2c137363be7873e4
2021-01-12 10:33:38 -08:00
junyulai
d1a7816fa2 [VCN05] Pass request type when requesting network
Currently, ConnectivityService decides the request type by
whether NetworkCapabilities is null when handling request
network. However, to fulfill the need of firing background
request via ConnectivityManager in the follow-up patches,
the request type is needed to pass into ConnectivityService.

This change also make ConnectivityService utilizes the passed
request type.

Test: atest ConnectivityManagerTest#testRequestType
Bug: 175662146
Change-Id: I3bc172bca1217c8020db45057a621d0745d43b3c
2021-01-12 19:55:00 +08:00
Treehugger Robot
9240e320b9 Merge "[VCN02] Make LingerTimer takes request Id instead of NetworkRequest" am: 5e27a2f6e3 am: d6033084b2 am: 5303115994
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
Treehugger Robot
5e27a2f6e3 Merge "[VCN02] Make LingerTimer takes request Id instead of NetworkRequest" 2021-01-12 08:59:04 +00:00
Hai Shalom
492febbfa2 Support for Venue URL and friendly name from Network agent
Extend CaptivePortalData with a member to hold the venue friendly
name. If CaptivePortalData is initialized by both the network
agent and Capport, merge the two objects to include the venue
friendly name and prioritize the venue URL from the network
agent.

Bug: 162783305
Test: atest ConnectivityServiceTest
Test: atest CtsNetTestCasesLatestSdk:CaptivePortalDataTest
Test: End-to-end test
Change-Id: I4fdf356be42237c5b6c0ae5bacfd3cec4726861b
2021-01-11 18:45:34 -08:00
Junyu Lai
611f6e7819 Merge "Revert "wifi: Add systemAPi:setSubscriberId in NetworkAgentConfig"" am: f44c7cc998 am: 7acae7b049 am: c575215274
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
Junyu Lai
3bd1e4ffb1 Revert "wifi: Add systemAPi:setSubscriberId in NetworkAgentConfig"
This reverts commit b36c519c4c.

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
fe65e2d5c9 Merge "wifi: Add systemAPi:setSubscriberId in NetworkAgentConfig" am: 51115a8705 am: 78df78fef9 am: 7604c6c0ac
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
Les Lee
51115a8705 Merge "wifi: Add systemAPi:setSubscriberId in NetworkAgentConfig" 2021-01-08 00:54:51 +00:00
Roshan Pius
e9c34f86cb NetworkCapabilities: Embed location senstive TransportInfo
Changes:
i) Add a new constructor for NetworkCapabilities which accepts whether
location sensitive fields need to be parceled or not. Defalts to false
on the other constructor. This boolean should only be set on the copy of
NetworkCapabilities when sent to apps that hold location permission.
(Similar to how sensitive fields are handled in LinkProperties)
ii) Add a new makeCopy() method in the TransportInfo interface which
accepts whether location sensitive fields need to be parceled or not.
iii) Migrate the existing NetworkCapabilities owner UID masking to use
this new mechanism (instead of existing masking in ConnectivityService).
iv) Always set parcelLocationSensitiveFields to true in the NetworkAgent
surface (since that is a privileged surface from the transports to the
connectivity service)
v) Add a hasSensitiveFields() in TransportInfo interface to avoid
perfoming location permission checks for location insensitive
TrasnsportInfo.

Also, migrate to the new SdkLevel util for isAtLeastR() & isAtLeastS()
checks.

Bug: 162602799
Test: atest android.net
Test: atest com.android.server
Change-Id: Ie522d8c75a82ae521ccfd5165823d0c72642e651
2021-01-07 13:24:33 -08:00
Lorenzo Colitti
927845625a Merge changes Iec22ff63,Iaca8a7cc am: 0cec61c277 am: de3c1f6764 am: 6aacbaac9c
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
e8ce205f6d 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
1060f1cf15 Merge "Remove mobile provision design out from connectivity service" am: 243a8acbca am: 2b221892a1 am: 75fb6d4016
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
243a8acbca Merge "Remove mobile provision design out from connectivity service" 2021-01-07 06:47:26 +00:00
Chiachang Wang
ce6dcc943e 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
516b3a7ccb Merge "Replace withCleanCallingIdentity with [clear|restore]CallingIdentity" am: 7a8259c987 am: 5069a406b0 am: 4b89bc0052
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
7a8259c987 Merge "Replace withCleanCallingIdentity with [clear|restore]CallingIdentity" 2021-01-07 04:32:54 +00:00
Lorenzo Colitti
abf3317103 Merge "Migrate away from AsyncChannel in NetworkAgent" 2021-01-06 14:10:21 +00:00
junyulai
5ef392cc89 [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
ad369e30b7 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
lesl
b36c519c4c 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