Commit graph android_packages_modules_Co.../tests/net/java/com/android/server
Message SHA1
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
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

Hai Shalom   authored and   Automerger Merge Worker   commited 2021-01-13 03:48:44 +00:00
41473668e1
[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

junyulai   commited 2021-01-13 11:05:40 +08:00
869e7020a0
Merge "NetworkCapabilities: Embed location senstive TransportInfo"
Roshan Pius   authored and   Android (Google) Code Review   commited 2021-01-13 02:26:34 +00:00
d04061ee77
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

Roshan Pius   commited 2021-01-13 02:25:49 +00:00
423fff6300
Merge "Support for Venue URL and friendly name from Network agent"
Hai Shalom   authored and   Gerrit Code Review   commited 2021-01-13 01:54:05 +00:00
6fce4189cd
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

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-01-13 00:50:46 +00:00
9d76a44551
Merge changes I3eb82680,I9d6147d9
* changes:
  NetworkWatchlistServiceTests: update IIpConnectivityMetrics.
  Stop using IIpConnectivityMetrics in ConnectivityService.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-01-13 00:31:56 +00:00
013be9d6c8
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

Ken Chen   authored and   Automerger Merge Worker   commited 2021-01-12 23:46:44 +00:00
1ba322e461
Let ConnectivityService control the socket closure
Netd currently calls maybeCloseSockets before adding/removing users for
network. The task should be moved from netd to CS. In this way, we can
handle WiFi lingering more easily in the future.

Test: atest HostsideVpnTests
Test: atest FrameworksNetTests
Change-Id: Icf8125e8552c89da367a67f48611ed193a1a343d

Ken Chen   commited 2021-01-12 23:50:28 +08:00
b8e4bc9c3f
Stop using IIpConnectivityMetrics in ConnectivityService.
Currently, ConnectivityService calls the IpConnectivityMetrics
service class directly to log default network events. This is
incompatible with ConnectivityService being in a mainline module.
Replace direct access to IIpConnectivityMetrics with public
methods in IpConnectivityLog, which is @SystemApi class.

The new methods are not yet @SystemApi, but they can be made so
if desired. Alternatively, these metrics could be deleted.

Also remove the IpConectivityMetrics service from the
service-connectivity JAR, and go back to starting it from
SystemServer.java, which is what was happening a few hours ago
before aosp/1542626 was merged.

Test: builds, boots
Test: atest FrameworksNetTests
Test: "dumpsys connmetrics" shows events, including default network events
Change-Id: I9d6147d93590363a2f8f83f39f05c03d001b4851

Lorenzo Colitti   commited 2021-01-12 23:19:49 +09:00
d9932a7da8
[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

junyulai   commited 2021-01-12 19:55:00 +08:00
d1a7816fa2
Merge "Remove Vpn#isBlockingUid." am: 57f4dfc101 am: aeeac8d0c7 am: 19281cbdb4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1528212

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I141c6e1d0585f81e2ab14ad96499beb112eebdb5

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-01-12 11:26:08 +00:00
183bdef769
Merge "Remove Vpn#isBlockingUid."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-01-12 10:20:33 +00:00
57f4dfc101
Merge "Improve error message when testing network factory" am: 5c19af924e am: 00545d7629 am: d89648a6cc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1531798

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4b421f7b2895a24912d37d73dc011fa440440cf2

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-01-12 05:31:18 +00:00
f2b8791703
Merge "Improve error message when testing network factory"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-01-12 03:50:30 +00:00
5c19af924e
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

Hai Shalom   commited 2021-01-11 18:45:34 -08:00
492febbfa2
Merge "Show LargeIcon as wide for apps targeting S."
Jeff DeCew   authored and   Android (Google) Code Review   commited 2021-01-08 20:57:53 +00:00
2c92a7415a
Merge "Pivot network statistics to use DataInput/Output." am: 14b8536eb3 am: 67ae1d500b am: 2ac863a446
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1540224

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I44be7ea64d012f35d312ae3b039b0fd7e37e9d60

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-01-08 11:49:37 +00:00
19efed5fab