Commit Graph

2477 Commits

Author SHA1 Message Date
Junyu Lai
3ec79f9919 Merge "Fix NetworkCallback expecting wrong network" into sc-dev 2021-04-09 02:06:50 +00:00
junyulai
bed32ff530 Fix NetworkCallback expecting wrong network
By current wifi design, wifi will report disconnected and
re-connected when changing from non-metered to metered.
However, the cts test app listens for all network, which
will get mobile network as active network when wifi is
changing meteredness. This is not expected. And causes
test failures when DUT has both wifi and mobile connections.

Thus, this change pass request to track currently active
network to the test app and register only for transport
types of currently active network to prevent from getting
unexpected network.

Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Bug: 182516128
Ignore-AOSP-First: merge conflict with ag/13615939 which cannot
                   be cherry-picked.
Change-Id: I2dce6035b13472bbdc2609009d690aac96280033
2021-04-08 18:37:26 +08:00
Chiachang Wang
f3066426bf Merge "Add framework-connectivity-test-defaults to hostside test" into sc-dev 2021-04-07 00:30:57 +00:00
Chiachang Wang
8cbbafef5e Merge "Update tests for onNetworkCreated and onNetworkDestroyed" am: 7d0e27bd7c am: d212efd8b0 am: e08cfe35ca
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1652210

Change-Id: I3b80a8a8a68f6a1ef2cab32d59cf4aae71cca645
2021-04-06 13:02:08 +00:00
Chiachang Wang
7d0e27bd7c Merge "Update tests for onNetworkCreated and onNetworkDestroyed" 2021-04-06 11:04:30 +00:00
Chiachang Wang
b3269df005 Merge "Ensure SSID is not exposed to apps without correct permission" am: 674a907cc4 am: c1c5f7f974 am: 0f60bf6013
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1655447

Change-Id: If7ac04aa2a7014d7154879f539b37bb12a3788ae
2021-04-06 10:04:05 +00:00
Chiachang Wang
0f60bf6013 Merge "Ensure SSID is not exposed to apps without correct permission" am: 674a907cc4 am: c1c5f7f974
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1655447

Change-Id: I7ddbfa9eaf0bb6b2e0375f48a17e0d96e49b6c7a
2021-04-06 09:38:26 +00:00
Chiachang Wang
674a907cc4 Merge "Ensure SSID is not exposed to apps without correct permission" 2021-04-06 08:58:50 +00:00
Frank Li
1502d841cf Merge "Add session ID to VpnTransportInfo" am: 320cd17220 am: 45d9b25a36
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1652217

Change-Id: I0011ffa4d24d9680e79241a120ea7c4904d88d67
2021-04-06 07:29:23 +00:00
Frank Li
320cd17220 Merge "Add session ID to VpnTransportInfo" 2021-04-06 06:50:48 +00:00
Remi NGUYEN VAN
9980f77bc2 Merge "Allow connectivity tests to use hidden APIs" into sc-dev 2021-04-02 02:18:51 +00:00
lifr
877fd475f5 Add session ID to VpnTransportInfo
- This will be visible only to apps with the NETWORK_SETTINGS
  permissions (signature), and will be redacted for all other callers.
- This string is expected to be the same as set by
  VpnService#setSession, and in general, VpnConfig.session. But it
  will be a general API that Vpn.java can call when setting the
  VpnTransportInfo.
- This string cannot be updated once the VPN NetworkAgent is connected.

Bug: 171872481
Ignore-AOSP-First: needed to prevent automerger race breaking build
Test: atest ConnectivityServiceTest
      atest VpnTransportInfoTest
      atest NetworkAgentTest
Change-Id: I883035262465238c35c5a931d89707f3e84feef8
Merged-In: I883035262465238c35c5a931d89707f3e84feef8
           (cherry-picked from ag/14008230)
2021-04-01 15:51:44 +08:00
Remi NGUYEN VAN
eeeed136e0 Allow connectivity tests to use hidden APIs
The tests have been building against hidden APIs to provide additional
coverage.

Test: m TetheringCoverageTests CtsNetTestCases
Bug: 182859030
Ignore-AOSP-First: needs manual cherry-picks
Change-Id: I37d748411a34f25834214a2412c49aed1423e526
2021-04-01 06:37:53 +00:00
Chiachang Wang
9a27925368 Update tests for onNetworkCreated and onNetworkDestroyed
Update test to:
1. verify onNetworkCreated callback called when network is
   created.
2. Verify onNetworkDestroyed callback called when agent
   updates its connection state to disconnect and native
   network is destroyed.

Bug: 178725261
Test: atest android.net.cts.NetworkAgentTest
Change-Id: Icd30440e0f553d0f97b860d0e69b4f3d4f0a2a1d
2021-04-01 11:13:42 +08:00
Chiachang Wang
3fec2f13e1 Add framework-connectivity-test-defaults to hostside test
The defaults follow the same pattern as framework-wifi-test-defaults
to allow unit tests to build against hidden API in Connectivity.

Bug: 171540887
Test: m
Change-Id: I1a77278aa458e309d2772dd6ad84f4412b6e9387
Ignore-AOSP-First: Necessary code in internal only now
2021-03-31 10:04:35 +00:00
Sudheer Shanka
83b66e64c7 Check and skip certain operations if they are unsupported. am: b0f50c579b am: 7695f293a7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1658759

Change-Id: I4ececd442b6fab3ad4e6aefd0937226831a7b87b
2021-03-30 23:48:22 +00:00
Sudheer Shanka
fd8bfb3f97 Merge "Revert NPMS threshold to BFGS." into sc-dev 2021-03-30 17:51:52 +00:00
Sudheer Shanka
b0f50c579b Check and skip certain operations if they are unsupported.
Fixes: 178334463
Test: com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testMeteredNetworkAccess_expeditedJob
Change-Id: Ie68e17063454e7feeffc93b20b1b8fbb276e837f
Merged-In: Ie68e17063454e7feeffc93b20b1b8fbb276e837f
2021-03-30 16:22:43 +00:00
lifr
ac6614fa05 Add session ID to VpnTransportInfo
- This will be visible only to apps with the NETWORK_SETTINGS
  permissions (signature), and will be redacted for all other callers.
- This string is expected to be the same as set by
  VpnService#setSession, and in general, VpnConfig.session. But it
  will be a general API that Vpn.java can call when setting the
  VpnTransportInfo.
- This string cannot be updated once the VPN NetworkAgent is connected.

Bug: 171872481
Ignore-AOSP-First: needed to prevent automerger race breaking build
Test: atest ConnectivityServiceTest
      atest VpnTransportInfoTest
      atest NetworkAgentTest
Change-Id: I883035262465238c35c5a931d89707f3e84feef8
2021-03-29 14:51:25 +00:00
Chiachang Wang
d841868f39 Ensure SSID is not exposed to apps without correct permission
The class NetworkCapabilities has an extra field for SSID that
can be used by apps to obtain the router SSID (a surrogate for
location) without holding permission. This is a circumvention
of the permission system. Thus, add a test to ensure that
visibility of SSID for apps are controlled by NETWORK_SETTING
permission.

Bug: 183911251
Test: atest CtsNetTestCasesLatestSdk:ConnectivityManagerTest
Change-Id: I18d17093e2da37cde88b730c091c6a1deda08a8a
2021-03-29 17:19:47 +08:00
Sudheer Shanka
384fb5cb42 Revert NPMS threshold to BFGS.
Earlier, we changed the threshold to IMP_FG to allow
HPJs to bypass power saving network restrictions but
later we made a change to instead use network capability
for HPJs, so reverting the threshold to BGFS.

Bug: 177641226
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: This depends on an earlier cl which is not in AOSP
Change-Id: I6364ca04254bdbcc3d2081a70babfbd927e0084e
2021-03-26 13:25:58 -07:00
Chiachang Wang
b439ce8bda Replace the usage of UidRange
The parameter of NetworkCapabilities.setUids() and
NetworkRequest.Builder.setUids() are updated to take a set of
integer Range instead of a set of UidRange because of refactor
work for the incoming connectivity mainline module.

The parameter change stops NetworkRequestTest to work in the
different API levels. Replace the usage with shims to work in
both current and stable APIs.

Ignore-AOSP-First: Prevent race in automerger
Bug: 172183305
Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk

(cherry picked from commit 41918d6cd1)

Change-Id: I3ff97b9bbda8839d271151165b8d99a04ae9e1f1
Merged-In: I4bc0daf5ad9e4b4043f4a897ddab16aec8f8a536
2021-03-24 03:53:29 +00:00
Treehugger Robot
d802f4898f Merge "Shorten the name for the dump file." am: a7542972b1 am: 3935ac08fd
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1648668

Change-Id: Ia73a8459e6bba6f24fc1f40cdb8cfb3177d9f9bb
2021-03-22 22:20:28 +00:00
Treehugger Robot
3935ac08fd Merge "Shorten the name for the dump file." am: a7542972b1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1648668

Change-Id: I11f5ca67a111e7d923310b68d90f66ef383d015a
2021-03-22 21:55:45 +00:00
Treehugger Robot
a7542972b1 Merge "Shorten the name for the dump file." 2021-03-22 21:34:02 +00:00
Sudheer Shanka
81330c83ce Try reconnecting to wifi if it doesn't automatically connect. am: 8bb9eb1912 am: bc0ca639a2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1648670

Change-Id: Ief4defadb6e4f5b45a7ef3d3022953244eca4788
2021-03-22 21:14:50 +00:00
Sudheer Shanka
bc0ca639a2 Try reconnecting to wifi if it doesn't automatically connect. am: 8bb9eb1912
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1648670

Change-Id: I06fc9f6273a947811c97be0da2a642b078a372c2
2021-03-22 20:52:52 +00:00
Lorenzo Colitti
cb938eca7b Mark most VpnServiceTest methods as @AppModeFull. am: 60b26ee453 am: f7ff930e3a am: 29ab4cfc4a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1648190

Change-Id: I2e0c1d036bd8907df22eb98fa3d4a1218c5cfdc0
2021-03-22 19:55:59 +00:00
Lorenzo Colitti
2583e758e4 Mark most VpnServiceTest methods as @AppModeFull. am: 60b26ee453 am: f7ff930e3a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1648190

Change-Id: I3fe91bf6dd3c451aa01fbd5fcc290e8125adc43b
2021-03-22 19:12:34 +00:00
Sudheer Shanka
8bb9eb1912 Try reconnecting to wifi if it doesn't automatically connect.
When meteredness of wifi changes during test, wifi disconnects.
Try reconnecting if it automatically connects after this.
Also, change the way we update metereness so that we can
use callback mechanism to wait for the state change instead of
polling for it regularly.

Bug: 181686645
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Merged-In: I31fb127ef333d39fe4697043876c7cef15d525e3
Change-Id: Icc0b37730201aebeab2713c6527a3195f6dcf97d
2021-03-22 17:26:46 +00:00
Sudheer Shanka
8d92650da9 Shorten the name for the dump file.
The file name is getting truncated by tradefed and
we are missing the information to actually idenity
the test. So, instead shorten the filename to preserve
the test name.

Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Submitting internally first to avoid merge conflicts.
Merged-In: Ic0f87b97bb58e115fe81e2d688ce0e633397da42
Change-Id: I6ce3fc662782de82d8cad95414e24204b5f7f130
2021-03-22 17:24:46 +00:00
Sudheer Shanka
0d8452ab81 Merge "Try reconnecting to wifi if it doesn't automatically connect." into sc-dev 2021-03-22 17:12:30 +00:00
Lorenzo Colitti
f7ff930e3a Mark most VpnServiceTest methods as @AppModeFull. am: 60b26ee453
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1648190

Change-Id: I6fcb53be747a5e95d58f2d84b16214cf9607a3d0
2021-03-22 15:29:05 +00:00
Lorenzo Colitti
60b26ee453 Mark most VpnServiceTest methods as @AppModeFull.
In S, instant apps can no longer access the system service that
backs the VPN APIs, so these tests started to fail in instant
mode.

Regardless of that change in S, though, instant apps cannot
create VPNs because they cannot access the package manager.

Previously, the tests were only passing because they did not
check that the VPN would actually work, they only checked that
the VPN API calls failed.

Fix: 181575083
Test: atest --instant CtsNetTestCases:VpnServiceTest
Change-Id: Idd35051bd1c908a8b85c02e8d0c54d3dea2dde38
2021-03-22 13:16:02 +00:00
Remi NGUYEN VAN
ddd1a6b40a Move connectivity AIDLs to android.net am: cc305b2fa5 am: 1feb0c3076
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1596432

Change-Id: Ifd637a65600cc1185d27b15e486fcaeb83b244db
2021-03-21 17:26:59 +00:00
Treehugger Robot
bf0c19e52f Merge "Revert^2 "Replace the usage of UidRange"" 2021-03-21 16:41:13 +00:00
Sudheer Shanka
2b5735165a Shorten the name for the dump file.
The file name is getting truncated by tradefed and
we are missing the information to actually idenity
the test. So, instead shorten the filename to preserve
the test name.

Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Submitting internally first to avoid merge conflicts.
Change-Id: Ic0f87b97bb58e115fe81e2d688ce0e633397da42
2021-03-21 12:24:09 +00:00
Remi NGUYEN VAN
cc305b2fa5 Move connectivity AIDLs to android.net
java_sdk_libraries and apexes need to contain bootclasspath classes
under predefined packages. Tethering currently uses android.net, so make
sure all the connectivity bootclasspath classes are under android.net.

This avoids maintaining two packages for the tethering APEX, where
com.android.connectivity.aidl is only used by internal AIDL files.

Bug: 182984842
Test: m
Change-Id: I23feb26c5de2fd7a4177797a3bc1d0dcbef4ade7
Merged-In: I23feb26c5de2fd7a4177797a3bc1d0dcbef4ade7
2021-03-20 22:24:08 +09:00
Sudheer Shanka
aae0d619ae Try reconnecting to wifi if it doesn't automatically connect.
When meteredness of wifi changes during test, wifi disconnects.
Try reconnecting if it automatically connects after this.
Also, change the way we update metereness so that we can
use callback mechanism to wait for the state change instead of
polling for it regularly.

Bug: 181686645
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Submitting internally first to avoid merge conflicts
Change-Id: I31fb127ef333d39fe4697043876c7cef15d525e3
2021-03-20 04:36:47 -07:00
Remi NGUYEN VAN
66a8357ede Merge "Move connectivity AIDLs to android.net" into sc-dev 2021-03-19 10:51:22 +00:00
Remi NGUYEN VAN
9cb8dfc110 Move connectivity AIDLs to android.net
java_sdk_libraries and apexes need to contain bootclasspath classes
under predefined packages. Tethering currently uses android.net, so make
sure all the connectivity bootclasspath classes are under android.net.

This avoids maintaining two packages for the tethering APEX, where
com.android.connectivity.aidl is only used by internal AIDL files.

Bug: 182984842
Test: m
Ignore-AOSP-First: needs manual cherry-pick
Change-Id: I23feb26c5de2fd7a4177797a3bc1d0dcbef4ade7
2021-03-19 08:57:00 +00:00
Chiachang Wang
2fb0846d70 Revert^2 "Replace the usage of UidRange"
274c796731

The parameter of NetworkCapabilities.setUids() and
NetworkRequest.Builder.setUids() are updated to take a set of
integer Range instead of a set of UidRange because of refactor
work for the incoming connectivity mainline module.

The parameter change stops NetworkRequestTest to work in the
different API levels. Replace the usage with shims to work in
both current and stable APIs.

Bug: 172183305
Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk

Change-Id: I7d18402f051051371f3054f6897b05b6da072105
Merged-In: I4bc0daf5ad9e4b4043f4a897ddab16aec8f8a536
2021-03-19 02:10:06 +00:00
Chiachang Wang
41918d6cd1 Replace the usage of UidRange
The parameter of NetworkCapabilities.setUids() and
NetworkRequest.Builder.setUids() are updated to take a set of
integer Range instead of a set of UidRange because of refactor
work for the incoming connectivity mainline module.

The parameter change stops NetworkRequestTest to work in the
different API levels. Replace the usage with shims to work in
both current and stable APIs.

Ignore-AOSP-First: Prevent race in automerger
Bug: 172183305
Test: atest FrameworksNetTests CtsNetTestCasesLatestSdk
Change-Id: I4bc0daf5ad9e4b4043f4a897ddab16aec8f8a536
2021-03-19 00:51:19 +00:00
Anthony Stange
ed43a3d28d Merge "Revert "Replace the usage of UidRange"" am: 83f77d83fd am: 0f97255402 am: abc4b59c47
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1645769

Change-Id: I7182b6f373405d7e12f92f29e7cbaf4ab66b8a13
2021-03-18 18:23:31 +00:00
Anthony Stange
abc4b59c47 Merge "Revert "Replace the usage of UidRange"" am: 83f77d83fd am: 0f97255402
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1645769

Change-Id: I86886953ab47f4d176b11d64a915e637559b3987
2021-03-18 17:41:40 +00:00
Anthony Stange
83f77d83fd Merge "Revert "Replace the usage of UidRange"" 2021-03-18 16:40:53 +00:00
Anthony Stange
274c796731 Revert "Replace the usage of UidRange"
Revert "Replace the usage of UidRange"

Revert "Add shims for NetworkRequest"

Revert submission 1626206-replaceUidRange

Reason for revert: Breaking build - b/183106405
Reverted Changes:
I0b79c73e8:Add shims for NetworkRequest
I4bc0daf5a:Replace the usage of UidRange
I4e5aec6ef:Replace the usage of UidRange
I107c329d4:Expose uids related APIs in NetworkRequest and Net...

Change-Id: I5a4addc562d180487e2891fd2081c593126e6ffc
2021-03-18 16:30:59 +00:00
Chiachang Wang
871e5043d3 Merge "Replace the usage of UidRange" am: 1241156261 am: 73a03e9ca8 am: 54bf54b774
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1597481

Change-Id: I3998c164b05983a4f4528ed5bef8089e89868d3f
2021-03-18 15:12:52 +00:00
Chiachang Wang
54bf54b774 Merge "Replace the usage of UidRange" am: 1241156261 am: 73a03e9ca8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1597481

Change-Id: I82fadd50f3141dab679d361cd17bf7a1f4349e9c
2021-03-18 14:28:24 +00:00
Chiachang Wang
1241156261 Merge "Replace the usage of UidRange" 2021-03-18 13:36:39 +00:00