Commit Graph

1475 Commits

Author SHA1 Message Date
Junyu Lai
635c79aeff Merge "[VCN06] Support request background network" am: 95f0791724 am: bf098917d8 am: d57038a8b0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1545847

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I12d2cbe4a5fc10a7ec7abf8038c088fe13b02d59
2021-01-19 01:50:31 +00:00
Junyu Lai
95f0791724 Merge "[VCN06] Support request background network" 2021-01-19 01:04:20 +00:00
Lorenzo Colitti
e9b4195087 Merge changes Ic5750d4f,I9fa888c9,I4211475f am: c127a58770 am: 5a27eb5043 am: 171f45afc8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1547495

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia036fad7b5070679f382410107a14b0dbfd951e6
2021-01-18 15:02:46 +00:00
Lorenzo Colitti
c127a58770 Merge changes Ic5750d4f,I9fa888c9,I4211475f
* changes:
  Deflake testNetworkBlockedStatusAlwaysOnVpn
  Simplify testVpnRestrictedUsers.
  Add test coverage for LockdownVpnTracker.
2021-01-18 14:03:54 +00:00
Treehugger Robot
36bc369260 Merge "Enforce that NetworkAgentInfo fields are never null." am: 3a6e50bdb9 am: c000462ea0 am: f8a9b5c78e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553734

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If07ff3b1b8dd2d6245cc38c8d25423da5392b6ae
2021-01-18 11:49:08 +00:00
junyulai
6ecf04d6f7 [VCN06] Support request background network
This will be mainly used by VCN management service which will
need to hold the networks but preserve the backgrounded-ness
of the networks.

Test: android.net.ConnectivityManagerTest#testRequestType
Test: android.net.cts.ConnectivityManagerTest#testRequestBackgroundNetwork /
      --rerun-until-failure 100
Test: ConnectivityServiceTest#testBackgroundNetworks
Test: m -j doc-comment-check-docs
Bug: 175662146
Change-Id: If9aaa87b7e71c2b695ac7b08858850e975b28bb6
2021-01-18 16:32:08 +08:00
Lorenzo Colitti
5c27674ad1 Deflake testNetworkBlockedStatusAlwaysOnVpn
This test flakes about 1% of the time on my device. This is due
to the test calling expectNetworkRejectNonSecureVpn() before the
handler thread has processed the call to setAlwaysOnVpnPackage.

Fix this by waiting for callbacks where it is possible to do so,
and by calling waitForIdle where it is not.

Test: test-only change
Change-Id: Ic5750d4fdf9e7e3654a2b6ade74da6bc5de18fb6
2021-01-18 17:28:52 +09:00
Lorenzo Colitti
79ff36588d Simplify testVpnRestrictedUsers.
Code review comments have suggested that this test is too long
and difficult to understand. Split it into two tests and put some
of the common setup into setup methods and statics.

Bug: 173331190
Test: test-only change
Change-Id: I9fa888c940d7048f1ba6836a5706fbdb84b5f5c9
2021-01-18 17:28:52 +09:00
Lorenzo Colitti
756a7345e8 Add test coverage for LockdownVpnTracker.
Also add a comment to an existing test.

Bug: 173331190
Test: test-only change
Change-Id: I4211475f053f0cdf2b804132c52ce5205a772193
2021-01-18 17:28:50 +09:00
Lorenzo Colitti
83d065696f Enforce that NetworkAgentInfo fields are never null.
These fields have been recently audited, confirmed never to be
null, and annotated @NonNull. Ensure that they can never become
null by throwing exceptions in the codepaths that set them.
Also remove some null checks.

Test: atest FrameworksNetTests
Change-Id: I6ce5bb4d69a990f1c857c599b7e50e372352eb87
2021-01-18 07:49:26 +00:00
Paul Hu
bfd5f4ea02 Merge "Remove unused IpConnectivityMetrics in CS" am: 671085fbde am: 22a26d0918 am: c2115c380e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552660

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4bac9e17a3584df017a83472a58c6353bdef845b
2021-01-18 06:33:17 +00:00
Paul Hu
671085fbde Merge "Remove unused IpConnectivityMetrics in CS" 2021-01-18 05:26:35 +00:00
paulhu
a1b4fbe5a0 Remove unused IpConnectivityMetrics in CS
ConnectivityService doesn't call any IpConnectivityMetrics
methods, so remove all usages from CS.

Bug: 177656797
Test: atest FrameworksNetTests
Test: atest FrameworksNetIntegrationTests
Change-Id: I2fb3b6b08cd8013eb8f75882f77ca699a2df927e
2021-01-18 04:03:32 +00:00
Roshan Pius
8b48fa3ff4 Merge "LocationPermissionChecker: Exempt privileged components from location check" am: fdc3167044 am: 56b8d48921 am: 5573b0c726
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1550515

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I66afba490765f4eae803d0ea4e2cc3eb54528aa4
2021-01-18 03:24:51 +00:00
Roshan Pius
fdc3167044 Merge "LocationPermissionChecker: Exempt privileged components from location check" 2021-01-18 01:33:31 +00:00
Junyu Lai
d55721db90 Merge "[VCN05.1] Add unit test for invalid request types" am: 3157c3642a am: 70e6084cfd am: b4e3dc2428
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552495

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id0ac3fcc869664fa3465a02b2aaa1a03f65e363d
2021-01-16 04:13:10 +00:00
Junyu Lai
3157c3642a Merge "[VCN05.1] Add unit test for invalid request types" 2021-01-16 02:27:28 +00:00
Roshan Pius
854f6a6269 LocationPermissionChecker: Exempt privileged components from location check
This is a port of the exemption that exists in WifiPermissionsUtil.
Settings, sysui, network stack needs to be able to access all network
state regardless of location toggle. If we want to move sysui, etc to
retrieve WifiInfo via NetworkCapabilities (which is the current plan),
this exemption is essential since UI should reflect wifi state
regardless of location toggle state.

Bug: 162602799
Test: atest LocationPermissionCheckerTest
Change-Id: I49ce465eccce27bb7a860d882360436fd9ec19c6
2021-01-15 06:51:39 -08:00
James Mattis
331a21f3ae Merge "Waiting for idle in test" am: 17ac644470 am: fadb5494f1 am: 85a9a2f7ef
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1550420

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib7ef4eedc0982640b4923885b2deeaefc8081db9
2021-01-15 14:04:42 +00:00
junyulai
12cf8caa46 [VCN05.1] Add unit test for invalid request types
Test: atest ConnectivityServiceTest#testInvalidRequestTypes
Bug: 175662146
Change-Id: I595b0bd1cfb88724581f67942cd3891f95c157ab
2021-01-15 21:19:49 +08:00
Lorenzo Colitti
865c72aabb Improve testing of CONNECTIVITY_ACTION broadcasts.
We currently test CONNECTIVITY_ACTION broadcasts by directly
registering BroadcastReceivers with BroadcastInterceptingContext,
and making the receivers unregister themselves when all the
broadcasts they expect have been received.

This works for current test cases, but does not work if anything
registers another receiver for CONNECTIVITY_ACTION. In that case,
when we unregister the receiver in the receiver's onReceive
method, BroadcastInterceptingContext will throw a
ConcurrentModificationException because the list of receivers is
being modified during iteration.

Fix this by adding an ExpectedBroadcast class that stores the
receiver and unregisters the receiver only when the test checks
that the broadcast was received, which happens after the receiver
runs. This is easier to use and also guarantees that the receiver
is unregistered even if the test is expecting that the broadcast
is never fired. Accordingly, remove mRegisteredReceivers and the
code that uses it; it's no longer necessary now that
ExpectedBroadcast always unregisters its receivers.

Also add a convenience expectConnectivityAction method to expect
a CONNECTIVITY_ACTION broadcast with specific contents. This
makes the test easier to read and more detailed. Convert some
existing tests to this method.

While I'm at it, fix a test that was using "mCellNetworkAgent" to
represent a wifi network.

Bug: 173331190
Test: test-only change
Change-Id: Ibada8b4215625e1016d9fd170526206920af76f5
2021-01-15 20:04:57 +09:00
James Mattis
17ac644470 Merge "Waiting for idle in test" 2021-01-15 00:28:54 +00:00
Roshan Pius
7cdb30ec22 Merge "NetworkCapabilities: Embed location senstive TransportInfo" 2021-01-14 15:38:15 +00:00
Lorenzo Colitti
a34c401619 Merge changes I28e39400,Ibada8b42
* changes:
  UserManager restricted profile SystemApis
  Improve testing of CONNECTIVITY_ACTION broadcasts.
2021-01-14 10:39:48 +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
Adam Bookatz
283e061fba UserManager restricted profile SystemApis
Makes two new SystemApis:
getRestrictedProfileParent()
canHaveRestrictedProfile()

Temporarily disables VPN Tests that rely on the old APIs until those
tests are updated (b/175883995).

Bug: 171529940
Test: atest FrameworksNetTests:com.android.server.connectivity.VpnTest
Test: Tests for UserManager SystemApis are TODO awaiting completion of new user test infrastructure (b/163890431)
(cherry picked from commit dde2e9e897)
Change-Id: I28e39400039631e7d391dc7b0d003e8a38d1f06a
2021-01-14 17:39:13 +09:00
Lorenzo Colitti
a39f357fb0 Improve testing of CONNECTIVITY_ACTION broadcasts.
We currently test CONNECTIVITY_ACTION broadcasts by directly
registering BroadcastReceivers with BroadcastInterceptingContext,
and making the receivers unregister themselves when all the
broadcasts they expect have been received.

This works for current test cases, but does not work if anything
registers another receiver for CONNECTIVITY_ACTION. In that case,
when we unregister the receiver in the receiver's onReceive
method, BroadcastInterceptingContext will throw a
ConcurrentModificationException because the list of receivers is
being modified during iteration.

Fix this by adding an ExpectedBroadcast class that stores the
receiver and unregisters the receiver only when the test checks
that the broadcast was received, which happens after the receiver
runs. This is easier to use and also guarantees that the receiver
is unregistered even if the test is expecting that the broadcast
is never fired. Accordingly, remove mRegisteredReceivers and the
code that uses it; it's no longer necessary now that
ExpectedBroadcast always unregisters its receivers.

Also add a convenience expectConnectivityAction method to expect
a CONNECTIVITY_ACTION broadcast with specific contents. This
makes the test easier to read and more detailed. Convert some
existing tests to this method.

While I'm at it, fix a test that was using "mCellNetworkAgent" to
represent a wifi network.

Bug: 173331190
Test: test-only change
Change-Id: Ibada8b4215625e1016d9fd170526206920af76f5
2021-01-14 17:11:28 +09:00
Junyu Lai
8188af4521 Merge "[VCN05] Pass request type when requesting network" 2021-01-14 06:52:46 +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
Adam Bookatz
829e46bf2a Merge "UserManager restricted profile SystemApis" 2021-01-13 22:47:26 +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
James Mattis
3e1eddeab7 Waiting for idle in test
Waiting for idle in testRequestsSortedByIdSortsCorrectly to give it time
to handle async operations as part of registering network callbacks.

Bug: 177376544
Test: atest FrameworksNetTests:ConnectivityServiceTest#
testRequestsSortedByIdSortsCorrectly --rerun-until-failure 200

Change-Id: I268c4607d1a4c79e79f1385f014563cea0c2f979
2021-01-13 13:56:50 -08:00
Adam Bookatz
dde2e9e897 UserManager restricted profile SystemApis
Makes two new SystemApis:
getRestrictedProfileParent()
canHaveRestrictedProfile()

Temporarily disables VPN Tests that rely on the old APIs until those
tests are updated (b/175883995).

Bug: 171529940
Test: atest FrameworksNetTests:com.android.server.connectivity.VpnTest
Test: Tests for UserManager SystemApis are TODO awaiting completion of new user test infrastructure (b/163890431)
Change-Id: I28e39400039631e7d391dc7b0d003e8a38d1f06a
2021-01-13 11:53:33 -08: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
Chiachang Wang
5cb5a73fcf Merge "[IT4.21] Update the label type of idle timer" am: 810f56be46 am: da0694f94a am: b9789b1bd4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1535721

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9445412f619fa8d4d0e7888a333bbdffdca013bf
2021-01-13 10:33:55 +00:00
Chiachang Wang
810f56be46 Merge "[IT4.21] Update the label type of idle timer" 2021-01-13 09:10:43 +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
Chiachang Wang
5031026448 [IT4.21] Update the label type of idle timer
The first parameter of adding idle timer is an unique identity
to communicate between ConnectivityService and netd. Netd will
notify the activity change using the identity, so it's fine to
replace the legacy type with transport type since we should
deprecate the usage of legacy type.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: Ia00606539b86872cca9a92285bd940c8a720a033
2021-01-13 14:10:15 +08: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
Lorenzo Colitti
9d76a44551 Merge changes I3eb82680,I9d6147d9 am: 013be9d6c8 am: a619c0c2d7 am: 6158fa695f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1547644

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3f0d6bfead295ed6a98a15ef9bb3542b88d5652a
2021-01-13 00:50:46 +00:00
Lorenzo Colitti
013be9d6c8 Merge changes I3eb82680,I9d6147d9
* changes:
  NetworkWatchlistServiceTests: update IIpConnectivityMetrics.
  Stop using IIpConnectivityMetrics in ConnectivityService.
2021-01-13 00:31:56 +00:00
Ken Chen
1ba322e461 Merge "Let ConnectivityService control the socket closure" am: 191e2d3c39 am: 968c4ed867 am: 9d2c783e91
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1534909

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I159a4a4115f200e78bc368d9db2997c58d0858b8
2021-01-12 23:46:44 +00:00