Commit Graph

11662 Commits

Author SHA1 Message Date
Lorenzo Colitti
ed09b7be75 Merge changes Ic5750d4f,I9fa888c9,I4211475f am: c6244c74ad
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1547495

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7e727e9e9377690a6badf1a56176138654459493
2021-01-18 14:25:48 +00:00
Lorenzo Colitti
c6244c74ad 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
dae7331f7e Merge "Enforce that NetworkAgentInfo fields are never null." am: b54fb4d4fd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553734

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I12eba91f29b55b7162889e1d44de15580f839195
2021-01-18 10:24:27 +00:00
Treehugger Robot
b54fb4d4fd Merge "Enforce that NetworkAgentInfo fields are never null." 2021-01-18 09:32:39 +00:00
Lorenzo Colitti
081a3a49e1 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
3d37d92c09 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
b7c3097f3f 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
bb4d45fb70 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
Lorenzo Colitti
e79e7fbc05 Merge "Mark several NetworkAgentInfo members @NonNull and address TODO." am: ac155fc61e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552502

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I904873d1998948ef58e6179a78c5d87834fa7c86
2021-01-18 06:33:36 +00:00
Lorenzo Colitti
ac155fc61e Merge "Mark several NetworkAgentInfo members @NonNull and address TODO." 2021-01-18 05:51:38 +00:00
Paul Hu
2fd81f5d38 Merge "Remove unused IpConnectivityMetrics in CS" am: bab9a4577c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552660

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If123fae795475433f61f9264f0a2e3b51676056c
2021-01-18 05:45:22 +00:00
Paul Hu
bab9a4577c Merge "Remove unused IpConnectivityMetrics in CS" 2021-01-18 05:26:35 +00:00
paulhu
caa2c0dabe 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
Chiachang Wang
32e0f65694 Merge "Replace hidden ParcelFileDescriptor constructor usage" am: b1a007e35c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552154

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic3dcae7bce2b8168bff86cfccc7ce83d17d61006
2021-01-18 02:28:04 +00:00
Roshan Pius
0af9aefcc2 Merge "LocationPermissionChecker: Exempt privileged components from location check" am: 67c62a89d9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1550515

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4af673a7be59c0382f68fc53f1b2704746f53cc3
2021-01-18 02:25:39 +00:00
Chiachang Wang
b1a007e35c Merge "Replace hidden ParcelFileDescriptor constructor usage" 2021-01-18 01:59:10 +00:00
Chiachang Wang
619319a3f5 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
67c62a89d9 Merge "LocationPermissionChecker: Exempt privileged components from location check" 2021-01-18 01:33:31 +00:00
Junyu Lai
17b4808623 Merge "[VCN05.1] Add unit test for invalid request types" am: 9ca2f62117
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552495

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If8af28178d6aca1d90b7c93808a41dee0f80b018
2021-01-16 02:34:13 +00:00
Junyu Lai
9ca2f62117 Merge "[VCN05.1] Add unit test for invalid request types" 2021-01-16 02:27:28 +00:00
Lorenzo Colitti
59fa1276a7 Mark several NetworkAgentInfo members @NonNull and address TODO.
1. network cannot be null because it's final and the only caller
   of the constructor passes in a fresh copy.
2. linkProperties cannot be null because:
   - The only caller of the constructor passes in a fresh copy.
   - The only assignment to nai.linkProperties is in
     updateLinkProperties, and that dereferences newLp a few
     lines before assigning it.
3. networkCapabilities cannot be null because:
   - The only caller of the constructor passes in a fresh copy.
   - There are no direct assignments to nai.networkCapabilities.
   - All 4 assignments happen via getAndSetNetworkCapabilities:
     - registerNetworkAgentInternal, updateCapabilities and
       applyBackgroundChangeForRematch all pass in the return
       value of mixInCapabilities, which is always non-null.
     - updateNetworkInfo re-assigns the capabilities that were
       already set in the object.
4. networkAgentConfig cannot be null because it's final and
   the only caller of the NetworkAgentInfo constructor passes
   in a fresh copy.

Address a TODO in ConnectivityService to remove a check for the
nai's capabilities being null.

Also fix a style nit pointed out by the linter.

Test: atest FrameworksNetTests
Change-Id: I2e265f1c60a73d6da0222dd6711bc53c32db06ec
2021-01-16 00:56:44 +09:00
Roshan Pius
c68c03ced4 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
junyulai
7c51b4b463 [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
Aaron Huang
d36cb179e6 Merge "Refactor setCurrentProxyScriptUrl to a void method" am: 1000c8138f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1513131

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I24bb3882c467aa590e37e858df875825221c88a0
2021-01-15 10:19:58 +00:00
Aaron Huang
1000c8138f Merge "Refactor setCurrentProxyScriptUrl to a void method" 2021-01-15 10:01:10 +00:00
Treehugger Robot
916052a6b7 Merge "Fix CaptivePortalDataTest on R-" am: 6516373759
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1550715

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie16759138fd84a46bf7d3d30c3a254b2ee72264a
2021-01-15 06:20:18 +00:00
Treehugger Robot
6516373759 Merge "Fix CaptivePortalDataTest on R-" 2021-01-15 05:26:34 +00:00
James Mattis
db0e54b63e Merge "Waiting for idle in test" am: ef4488fb0d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1550420

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia335a4fedabed9eed6465d08e5ea882c259539e1
2021-01-15 01:52:16 +00:00
Remi NGUYEN VAN
a82274021d Fix CaptivePortalDataTest on R-
The new venue friendly name field is not present on R-

Bug: 162783305
Change-Id: I63bd9c61d27c7d3b07826053373c9c5e38666948
Test: atest FrameworksNetTests
2021-01-15 01:13:27 +00:00
James Mattis
ef4488fb0d Merge "Waiting for idle in test" 2021-01-15 00:28:54 +00:00
Roshan Pius
c865ce7edd Merge "NetworkCapabilities: Embed location senstive TransportInfo" am: d0cb8f3ec3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1508602

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie88978197172519e6bd26182e1d24178769b3741
2021-01-14 16:08:04 +00:00
Roshan Pius
d0cb8f3ec3 Merge "NetworkCapabilities: Embed location senstive TransportInfo" 2021-01-14 15:38:15 +00:00
Lorenzo Colitti
e806f0ee83 Merge changes I28e39400,Ibada8b42 am: 5da00cfb62
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1548870

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I59bcae23f71d57715845b1f613c0733a04725763
2021-01-14 11:00:43 +00:00
Lorenzo Colitti
5da00cfb62 Merge changes I28e39400,Ibada8b42
* changes:
  UserManager restricted profile SystemApis
  Improve testing of CONNECTIVITY_ACTION broadcasts.
2021-01-14 10:39:48 +00:00
Aaron Huang
5c9279c17a Merge "Migrate Slog usage in MultinetworkPolicyTracker to Log" am: 38f1711f80
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1549720

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id726928bd9363d01de8aaafd19e07db8498897c7
2021-01-14 09:23:25 +00:00
Aaron Huang
38f1711f80 Merge "Migrate Slog usage in MultinetworkPolicyTracker to Log" 2021-01-14 09:10:17 +00:00
Adam Bookatz
01a979f91a 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 20ba13f5bc482de37a569c8c791ee5be9e7874b4)
Change-Id: I28e39400039631e7d391dc7b0d003e8a38d1f06a
2021-01-14 17:39:13 +09:00
Lorenzo Colitti
90f0c4584f 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
8d109211b4 Merge "[VCN05] Pass request type when requesting network" am: 2909e18901
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1545846

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2f617b172ca17748b6e6be0afbf3474b5629dec7
2021-01-14 07:43:35 +00:00
Junyu Lai
2909e18901 Merge "[VCN05] Pass request type when requesting network" 2021-01-14 06:52:46 +00:00
Aaron Huang
a42805cd7e Refactor setCurrentProxyScriptUrl to a void method
setCurrentProxyScriptUrl is used by ProxyTracker which is
included in connectivity service mainline module. To make
this method @SystemApi in follow-up patch, change this
from a boolean method to a void method. Moving the send or
not send broadcast logic to caller because it can know
whether it needs to send a broadcast or not.

Bug: 177035719
Test: FrameworksNetTests
Change-Id: I7c0fd20bb449463a65952cfa9fb8a42310da079c
2021-01-14 12:19:26 +08:00
Aaron Huang
fa89f7987b Merge "Rename PacManager to PacProxyInstaller" am: 65e963c224
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1513130

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Idf8192ca563275048acccbf6163f7effc4b04781
2021-01-14 01:54:51 +00:00
Aaron Huang
528c13e72f 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
65e963c224 Merge "Rename PacManager to PacProxyInstaller" 2021-01-14 01:52:24 +00:00
James Mattis
5b67282966 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
satayev
2915e67074 Merge "Revert "[VCN01] Add NOT_VCN_MANAGED capability"" am: 66bf5f05e1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1549962

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I03dade86df57e4728eea88ab9b148251a1097c85
2021-01-13 18:32:31 +00:00
satayev
66bf5f05e1 Merge "Revert "[VCN01] Add NOT_VCN_MANAGED capability"" 2021-01-13 17:40:03 +00:00
satayev
31a436c6d8 Revert "[VCN01] Add NOT_VCN_MANAGED capability"
This reverts commit d0617de32c.

Reason for revert: b/177411288 broken test

Bug: 177411288
Bug: 175662146
Change-Id: I02a25b83e62ab9a2ed22a98530d62b08de73f56e
2021-01-13 15:04:23 +00:00
Lorenzo Colitti
3351e52b34 Merge "Stop using VPNs in getActiveNetworkForUidInternal." am: d26df144fd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1529106

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0e0de3f3cd9762feecf5dda5a40bb50791f17654
2021-01-13 14:54:40 +00:00
Lorenzo Colitti
d26df144fd Merge "Stop using VPNs in getActiveNetworkForUidInternal." 2021-01-13 13:52:56 +00:00