Commit Graph

1485 Commits

Author SHA1 Message Date
Chalard Jean
04ba35dc06 Merge "Add Qos Callback support" am: 29f0f6d47f am: b97f23ae96 am: f14671c09a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1386623

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If0a123f16951c88cc5881fba8865fae822ba92f0
2021-01-22 14:52:58 +00:00
Daniel Bright
60f02ed76b Add Qos Callback support
* Provide App Developers Qos related info associated to
  a bound socket through ConnectivityManager
* Qos sessions are generated and filtered by Network Agents
  and sent back through the Connectivity Service to the
  API consumer.
* The structure of the code within com.android.server
  is designed to support different types of filters in the
  the future.
* The first type of Qos Attributes are related to EPS
  Bearers in order support RCS.

Bug: 155176305
Test: Added to cts/NetworkAgentTest
Test: Added to ConnectivityServiceTest
Change-Id: I145dd065d9deeee449eb9695ab3f6c8556ee7c09
2021-01-21 20:14:52 -08:00
Junyu Lai
12703ee175 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
2021-01-19 12:39:27 +00:00
Junyu Lai
2fa034c812 Merge "Revert "[VCN06] Support request background network"" 2021-01-19 10:24:47 +00:00
Junyu Lai
34263da2c9 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
2021-01-19 09:06:00 +00:00
Treehugger Robot
b19d0ca85d 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
2021-01-19 05:46:03 +00:00
Treehugger Robot
4fcb0e54a1 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.
2021-01-19 04:19:56 +00:00
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
Lorenzo Colitti
34007bd8de Address comments on aosp/1539753, aosp/1542487 and aosp/1547496.
Bug: 173331190
Test: test-only change
Change-Id: I475502fde55d24e7ae3f7fe9f43c54740c57a9cf
2021-01-19 10:35:43 +09:00
Junyu Lai
95f0791724 Merge "[VCN06] Support request background network" 2021-01-19 01:04:20 +00:00
Lorenzo Colitti
c284b4b8dd 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
2021-01-19 09:40:53 +09:00
Lorenzo Colitti
dbf549c1c7 Test for bugs with suspended VPN underlying networks.
Test: atest --rerun-until-failure 100 ConnectivityServiceTest#testVpnSwitchFromSuspendedToNonSuspended
Change-Id: Ia52f9cafef3f49ae70ad135d017e207eb57fddfe
2021-01-19 00:42:46 +09: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