Commit graph android_packages_modules_Co.../tests/net/java/com/android
Message SHA1
Merge "Revert "[VCN06] Support request background network"" am: 2fa034c812 am: b7b3064394 am: dd7029fd30
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553864

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I896c2008e29163527b03f031623e1c70d16e1da4

Junyu Lai   authored and   Automerger Merge Worker   commited 2021-01-19 12:39:27 +00:00
12703ee175
Merge "Revert "[VCN06] Support request background network""
Junyu Lai   authored and   Gerrit Code Review   commited 2021-01-19 10:24:47 +00:00
2fa034c812
Revert "[VCN06] Support request background network"
Revert submission 1545847-vcn06

Reason for revert: b/177876289 presubmit failure
Reverted Changes:
I8042ce197:[VCN06.1] Add CTS for request background network
If9aaa87b7:[VCN06] Support request background network

Change-Id: I9270b02a2d6d1ffcdd83b4f41becaf09a2b91e0a

Junyu Lai   commited 2021-01-19 09:06:00 +00:00
34263da2c9
Merge changes I475502fd,Ibf376a6f,Ia52f9caf am: 4fcb0e54a1 am: ed9f5d54a5 am: 0cc2e20cc9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553958

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic7c2c6289bcc469f43f0293ca4bfd7d6b15ce80a

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-01-19 05:46:03 +00:00
b19d0ca85d
Merge changes I475502fd,Ibf376a6f,Ia52f9caf
* changes:
  Address comments on aosp/1539753, aosp/1542487 and aosp/1547496.
  Fix propagating underlying caps when a network disconnects.
  Test for bugs with suspended VPN underlying networks.

Treehugger Robot   authored and   Gerrit Code Review   commited 2021-01-19 04:19:56 +00:00
4fcb0e54a1
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

Junyu Lai   authored and   Automerger Merge Worker   commited 2021-01-19 01:50:31 +00:00
635c79aeff
Address comments on aosp/1539753, aosp/1542487 and aosp/1547496.
Bug: 173331190
Test: test-only change
Change-Id: I475502fde55d24e7ae3f7fe9f43c54740c57a9cf

Lorenzo Colitti   commited 2021-01-19 10:35:43 +09:00
34007bd8de
Merge "[VCN06] Support request background network"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-01-19 01:04:20 +00:00
95f0791724
Fix propagating underlying caps when a network disconnects.
aosp/1513052, which generalized support for underlying networks,
broke default network switching when the network underlying a VPN
disconnects.

This is because it calls propagateUnderlyingNetworkCapabilities
in the middle of the bookkeeping operations needed when a
network is disconnected (specifically, after all satisified
requests are removed from the disconnecting network, but before
mDefaultNetworkNai is updated). This is completely incorrect
because propagateUnderlyingNetworkCapabilities can trigger a
network rematch, and running a rematch when the request data
structures are inconsistent is obviously wrong. See the test
changes in this CL for an example of the damage.

Fix this by moving propagateUnderlyingNetworkCapabilities to
before the bookeeping operations begin. It must be before
mDefaultNetworkNai is updated, because otherwise it will not know
that the default network is disconnecting, and it will not be
able to propagate capabilities to VPNs that set underlying
networks to null (i.e., to the default network). It must be
after the nai is removed from mNetworkForNetId because
otherwise it will think that the underlying network is still
connected.

Bug: 173331190
Test: accompanying unit test shows lots of bugs removed
Change-Id: Ibf376a6fa4b34d1c96f8506fa8abbb7595a8c272

Lorenzo Colitti   commited 2021-01-19 09:40:53 +09:00
c284b4b8dd
Test for bugs with suspended VPN underlying networks.
Test: atest --rerun-until-failure 100 ConnectivityServiceTest#testVpnSwitchFromSuspendedToNonSuspended
Change-Id: Ia52f9cafef3f49ae70ad135d017e207eb57fddfe

Lorenzo Colitti   commited 2021-01-19 00:42:46 +09:00
dbf549c1c7
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

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-01-18 15:02:46 +00:00
e9b4195087
Merge changes Ic5750d4f,I9fa888c9,I4211475f
* changes:
  Deflake testNetworkBlockedStatusAlwaysOnVpn
  Simplify testVpnRestrictedUsers.
  Add test coverage for LockdownVpnTracker.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-01-18 14:03:54 +00:00
c127a58770
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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-01-18 11:49:08 +00:00
36bc369260
[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

junyulai   commited 2021-01-18 16:32:08 +08:00
6ecf04d6f7
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

Lorenzo Colitti   commited 2021-01-18 17:28:52 +09:00
5c27674ad1
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

Lorenzo Colitti   commited 2021-01-18 17:28:52 +09:00
79ff36588d
Add test coverage for LockdownVpnTracker.
Also add a comment to an existing test.

Bug: 173331190
Test: test-only change
Change-Id: I4211475f053f0cdf2b804132c52ce5205a772193

Lorenzo Colitti   commited 2021-01-18 17:28:50 +09:00
756a7345e8
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

Lorenzo Colitti   commited 2021-01-18 07:49:26 +00:00
83d065696f
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

Paul Hu   authored and   Automerger Merge Worker   commited 2021-01-18 06:33:17 +00:00
bfd5f4ea02
Merge "Remove unused IpConnectivityMetrics in CS"
Paul Hu   authored and   Gerrit Code Review   commited 2021-01-18 05:26:35 +00:00
671085fbde
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

paulhu   authored and   Paul Hu   commited 2021-01-18 04:03:32 +00:00
a1b4fbe5a0
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

Roshan Pius   authored and   Automerger Merge Worker   commited 2021-01-18 03:24:51 +00:00
8b48fa3ff4
Merge "LocationPermissionChecker: Exempt privileged components from location check"
Roshan Pius   authored and   Gerrit Code Review   commited 2021-01-18 01:33:31 +00:00
fdc3167044
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

Junyu Lai   authored and   Automerger Merge Worker   commited 2021-01-16 04:13:10 +00:00
d55721db90
Merge "[VCN05.1] Add unit test for invalid request types"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-01-16 02:27:28 +00:00
3157c3642a
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

Roshan Pius   commited 2021-01-15 06:51:39 -08:00
854f6a6269
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

James Mattis   authored and   Automerger Merge Worker   commited 2021-01-15 14:04:42 +00:00
331a21f3ae
[VCN05.1] Add unit test for invalid request types
Test: atest ConnectivityServiceTest#testInvalidRequestTypes
Bug: 175662146
Change-Id: I595b0bd1cfb88724581f67942cd3891f95c157ab

junyulai   commited 2021-01-15 21:19:49 +08:00
12cf8caa46
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

Lorenzo Colitti   commited 2021-01-15 20:04:57 +09:00
865c72aabb
Merge "Waiting for idle in test"
James Mattis   authored and   Gerrit Code Review   commited 2021-01-15 00:28:54 +00:00
17ac644470
Merge "NetworkCapabilities: Embed location senstive TransportInfo"
Roshan Pius   authored and   Gerrit Code Review   commited 2021-01-14 15:38:15 +00:00
7cdb30ec22
Merge changes I28e39400,Ibada8b42
* changes:
  UserManager restricted profile SystemApis
  Improve testing of CONNECTIVITY_ACTION broadcasts.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-01-14 10:39:48 +00:00
a34c401619
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

Junyu Lai   authored and   Automerger Merge Worker   commited 2021-01-14 09:05:35 +00:00
d151942b6a
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

Adam Bookatz   authored and   Lorenzo Colitti   commited 2021-01-14 17:39:13 +09:00
283e061fba
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

Lorenzo Colitti   commited 2021-01-14 17:11:28 +09:00
a39f357fb0
Merge "[VCN05] Pass request type when requesting network"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-01-14 06:52:46 +00:00
8188af4521
Merge changes from topic "revert-13329427-revert-13274595-XTPTORCRLV-WLDUPFEJWD"
* changes:
  NetworkControllerWifiTest: Fix unit tests
  Revert "Revert "NetworkCapabilities: Embed location senstive Tra..."

Roshan Pius   authored and   Android (Google) Code Review   commited 2021-01-14 01:19:34 +00:00
0a0c036906
Merge "UserManager restricted profile SystemApis"
Adam Bookatz   authored and   Android (Google) Code Review   commited 2021-01-13 22:47:26 +00:00
829e46bf2a
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

Roshan Pius   commited 2021-01-13 22:28:01 +00:00
dd76fab606
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

James Mattis   commited 2021-01-13 13:56:50 -08:00
3e1eddeab7
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

Adam Bookatz   commited 2021-01-13 11:53:33 -08:00
dde2e9e897
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

satayev   authored and   Automerger Merge Worker   commited 2021-01-13 18:53:37 +00:00
5d2639e7e2
Merge "Revert "[VCN01] Add NOT_VCN_MANAGED capability""
satayev   authored and   Gerrit Code Review   commited 2021-01-13 17:40:03 +00:00
ca95071a98
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

satayev   commited 2021-01-13 15:04:23 +00:00
5e2b869dfc
Merge "Revert "NetworkCapabilities: Embed location senstive TransportInfo""
Rick Yiu   authored and   Android (Google) Code Review   commited 2021-01-13 14:30:52 +00:00
56e47c492e
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

Chiachang Wang   authored and   Automerger Merge Worker   commited 2021-01-13 10:33:55 +00:00
5cb5a73fcf
Merge "[IT4.21] Update the label type of idle timer"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-01-13 09:10:43 +00:00
810f56be46
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

Junyu Lai   authored and   Automerger Merge Worker   commited 2021-01-13 09:00:08 +00:00
5591c1c73e
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

Rick Yiu   commited 2021-01-13 08:36:22 +00:00
a427afd7e3
[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

Chiachang Wang   commited 2021-01-13 14:10:15 +08:00
5031026448