Commit Graph

36727 Commits

Author SHA1 Message Date
Treehugger Robot
abbee98e86 Merge "Move test_mainline_modules to AndroidTest.xml" 2021-06-28 06:27:42 +00:00
Mark Chien
840e2efd7f Merge "Fix and test usb function configuration change" 2021-06-28 04:16:14 +00:00
Paul Hu
683c386403 Merge "Use appId instead of uid" 2021-06-28 03:35:45 +00:00
markchien
34f7857b07 Fix and test usb function configuration change
Allow stop TETHERING_NCM no matter ncm is used for TETHERING_USB or
TETHERING_NCM.

Add a test:
1. NCM is started for TETHERING_NCM
2. The config changes to use NCM for TETHERING_USB.
3. Then the config changes to use RNDIS for TETHERING_USB.

Also let some logs not only print in dumpsys, but also in logcat to
easiler debug unit test.

Bug: 185649441
Test: atest TetheringTests
Change-Id: Ia8d76a29646f36941cbb16cd68ae6887100ec8ec
2021-06-28 02:59:33 +00:00
Remi NGUYEN VAN
8b2a47c867 Move test_mainline_modules to AndroidTest.xml
When an AndroidTest.xml is used, configuration needs to be in the
AndroidTest.xml file, not in the Android.bp.

This currently causes tests not to be run in TEST_MAPPING as they should
be.

Test: TH needs to test
Bug: 187935317
Change-Id: Ie0aca0c64646825175769cd375bcecf65de4b4c8
2021-06-28 10:55:15 +09:00
Remi NGUYEN VAN
883df67f3f Merge "Improve TestConnectivityManager readability" 2021-06-27 23:47:45 +00:00
Nucca Chen
a569410667 Merge "Refresh conntrack entry timeout" 2021-06-25 18:34:22 +00:00
Nucca Chen
7238b31c15 Merge "Clear IPv4 offload rules when tethering stopped" 2021-06-25 17:56:21 +00:00
Junyu Lai
c06260b5b5 Merge changes I81bf8969,I2edba513,Ibb913979
* changes:
  Add CTS for NetworkScore.setTransportPrimary
  Add some CTS tests for NetworkScore.
  Add a first CTS for NetworkScore
2021-06-25 15:28:27 +00:00
Junyu Lai
435c4f7fc5 Merge "Check null NetworkSpecifier before redacting" 2021-06-25 15:27:55 +00:00
vichang
c577c271ba Merge "Remove usage of internal APIs from InetAddress and ServerSocket" 2021-06-25 10:54:52 +00:00
Junyu Lai
144b6c742a Check null NetworkSpecifier before redacting
Do null check before redacting, since NetworkSpecifier will not
always be attached. For example, NetworkSpecifier of wifi
network is only attached when a wifi network is created
in response to a network request with specifier attached.

Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testGetAllNetworkStateSnapshots \
      --rerun-until-failure 100
      (tested on cuttlefish mobile and wifi)
Bug: 191944987
Change-Id: I5df3547995111fe6340facb94a577296d2228694
2021-06-25 08:24:12 +00:00
Remi NGUYEN VAN
ef34fd2e21 Merge "Skip connectivity unit tests before S" 2021-06-25 05:43:30 +00:00
Remi NGUYEN VAN
86b39c8c34 Merge "Update TetheringTests for new connectivity shims" 2021-06-25 05:42:14 +00:00
Remi NGUYEN VAN
05dd1ba540 Skip connectivity unit tests before S
The tests are packaged together with other tests in a common coverage
suite, so need to be individually annotated so that they are skipped
before S.

They do not need to pass on platforms older than S, because such
platforms will not updated with the code that is tested.

Bug: 187935317
Test: atest ConnectivityCoverageTests on R
Change-Id: I10da45ae023e7f1e8cd11ec857b84346892a3fa8
2021-06-25 10:10:12 +09:00
Junyu Lai
a6cb322d00 Merge changes from topic "sp31"
* changes:
  [SP35] Pass data warning to tethering offload
  [SP34] Adapt onSetWarningAndLimit
  [SP33] Adapt ITetheringOffloadCallback V1.1
  Address comments on ag/14486203
2021-06-24 10:21:07 +00:00
Chalard Jean
20a159633a Add CTS for NetworkScore.setTransportPrimary
Bug: 184037351
Test: this
Merged-In: I81bf8969ace3cb6826b30c5bbd0b896c64c73c57
Change-Id: I81bf8969ace3cb6826b30c5bbd0b896c64c73c57
  (cherry-picked from ag/14452540)
2021-06-24 08:33:28 +00:00
junyulai
991433d8c8 [SP35] Pass data warning to tethering offload
This is supported by:
  1. Utilize the new API from both NetworkStatsProvider
     and IOffloadControl to send data warning quota to hardware.
     And pass the warning reached notification back to NPMS.
  2. Disable software solution introduced in R release for
     V1.1+ hardware, since now we can fully offload data warning
     and limit notification to hardware.

Test: atest TetheringTests
Fix: 149467454
Merged-In: Ie49461694d77ab7f25a549433b01b5b0167bd489
Change-Id: Ie49461694d77ab7f25a549433b01b5b0167bd489
  (cherry-picked from ag/13981692)
2021-06-24 08:33:28 +00:00
Chalard Jean
b8c396b3b5 Add some CTS tests for NetworkScore.
Bug: 184037351
Test: this
Merged-In: I2edba51351cd4c71727663aa85b1d5141bff2a15
Change-Id: I2edba51351cd4c71727663aa85b1d5141bff2a15
  (cherry-picked from ag/14452538)
2021-06-24 08:33:28 +00:00
junyulai
da52dab266 [SP34] Adapt onSetWarningAndLimit
This is a no-op change that just adapt new API from
NetworkStatsProvider to get warning and limit bytes at the same
time. This change also stores them locally for subsequent
patches to set warning bytes to hardware.

Test: Will be included in the subsequent patch.
Bug: 149467454
Merged-In: Iec01cb01fd1ce481ce0bd736762baddde1e38084
Change-Id: Iec01cb01fd1ce481ce0bd736762baddde1e38084
  (cherry-picked from ag/13981691)
2021-06-24 08:33:28 +00:00
Chalard Jean
e349356eb9 Add a first CTS for NetworkScore
In an effort to make reviewing easier, this implements most of
the infra but only a mostly trivial test.

Bug: 184037351
Test: this
Merged-In: Ibb9139798ce44d748e87bae79a1e23311ec8d9b6
Change-Id: Ibb9139798ce44d748e87bae79a1e23311ec8d9b6
  (cherry-picked from ag/14452537)
2021-06-24 08:33:28 +00:00
junyulai
37a7e620b4 [SP33] Adapt ITetheringOffloadCallback V1.1
This is a no-op change that redirect both V1.0 and V1.1 callback
events to the same handling function. Since the V1.1 callback
is extended from V1.0 callback, we can safely use V1.1
callback for both V1.0 and V1.1 control.

The change also provides interface for subsequent
OffloadController changes to set warning and limit at the
same time.

Test: atest TetheringTests
Bug: 149467454
Merged-In: I6505a04de8c57357dd1fa9ce898c13395e497816
Change-Id: I6505a04de8c57357dd1fa9ce898c13395e497816
  (cherry-picked from ag/13973147)
2021-06-24 08:33:28 +00:00
Chalard Jean
20c7cad598 Address comments on ag/14486203
Bug: 186458024
Test: comment-only change
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I7b086abbb57354086e8fb1a41c63140f2227173f
Change-Id: I7b086abbb57354086e8fb1a41c63140f2227173f
  (cherry-picked from ag/14540395)
2021-06-24 08:33:27 +00:00
Remi NGUYEN VAN
2e0f0da0b7 Improve TestConnectivityManager readability
Remove NetworkCallbackInfo to use Handler directly, and separate
registerSystemDefaultNetworkCallback from requestNetwork.

Also verify that requestNetwork is only used with a default-like network
request on R, as S should be using registerSystemDefaultNetworkCallback.

Test: atest TetheringTests
Bug: 189581241
Change-Id: If6b9124b2d795b9db1e85256c694d0120c852542
2021-06-24 17:17:54 +09:00
Remi NGUYEN VAN
11e5cf0b0b Update TetheringTests for new connectivity shims
The stable connectivity shims are updated to now contain S API, so
tethering tests that assumed that compatibility R behavior was used need
to be updated.

To avoid such failures Tethering tests should have a test target using
updated shims (TetheringNextTests), but this was not done in S
timeframe.

Bug: 189581241
Test: atest TetheringTests
Merged-In: Ibc04e64a1e9d82b67aff10d1a6d77f9e6b1bbdfb
Change-Id: Ibc04e64a1e9d82b67aff10d1a6d77f9e6b1bbdfb
2021-06-24 17:17:54 +09:00
Junyu Lai
d4c644cf4d Merge changes Ib8637100,I33612650
* changes:
  Make yield-to-bad-wifi behavior backward compatible with R
  Add more unit tests for ConnectivityManager S APIs
2021-06-24 08:13:46 +00:00
Remi NGUYEN VAN
09d3a75357 Merge "Add ConnectivityCoverageTests to postsubmit" 2021-06-24 06:32:36 +00:00
Chalard Jean
6b2f09272c Make yield-to-bad-wifi behavior backward compatible with R
Yielding cell wins to exiting wifi (whether good or bad).
It loses to bad wifi that's not exiting.

In R, yielding to bad wifi only affects wifis that are
unvalidated, but a wifi that is exiting should still be
dropped in favor of a cell that yields to bad wifi.

I had misunderstood the policy and implemented it wrong.
Now it's implemented right, and has careful tests.

Test: new tests for this
Bug: 186458024
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: Ib8637100d491e72a2edb837584ce55b7dda58524
Change-Id: Ib8637100d491e72a2edb837584ce55b7dda58524
  (cherry-picked from ag/14486203)
2021-06-24 03:33:05 +00:00
Junyu Lai
92c29c56d7 Add more unit tests for ConnectivityManager S APIs
Test: atest android.net.ConnectivityManagerTest
Bug: 188657173
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I33612650eb89486a14fcfc440ba0c357f4bb513c
Change-Id: I33612650eb89486a14fcfc440ba0c357f4bb513c
  (cherry-picked from ag/14640282)
2021-06-24 03:20:39 +00:00
Lorenzo Colitti
7325c86c26 Merge "Add CTS for BatteryStatsManager new API" 2021-06-24 02:26:53 +00:00
Treehugger Robot
8691f3c286 Merge "Remove TEST_MAPPING duplicate imports" 2021-06-24 01:18:42 +00:00
Aaron Huang
f52a30b605 Add CTS for BatteryStatsManager new API
Bug: 189308158
Test: This test and
      run testReportNetworkInterfaceForTransports
      with --rerun-until-failure 500
Change-Id: I654b8920d6ea1dada782a618776b13870f7f98df
2021-06-24 07:19:33 +08:00
Paul Hu
33b4929cfe Merge "Add test for CSM#[get|set]UidsAllowedOnRestrictedNetworks" 2021-06-23 16:30:57 +00:00
Chiachang Wang
13549792e2 Merge "Add test for CM#setAvoidUnvalidated" 2021-06-23 09:19:51 +00:00
Remi NGUYEN VAN
8b23feb10e Add ConnectivityCoverageTests to postsubmit
Add the tests to both postsubmit and mainline-postsubmit.

This should allow moving the tests to presubmit in the near future,
after they have been verified to pass in postsubmit.

Bug: 187935317
Test: treehugger needs to test
Change-Id: I9a05d6a300c5f777497e867d0456bc59b06eee80
2021-06-23 18:02:22 +09:00
paulhu
d266285172 Add test for CSM#[get|set]UidsAllowedOnRestrictedNetworks
Bug: 185149952
Test: atest ConnectivityManagerTest
Change-Id: Ie9391d9332ded58cf1e63c8c5c6f5ba85c950bc6
2021-06-23 08:01:00 +00:00
Hungming Chen
c27ec7c4a2 Refresh conntrack entry timeout
Needed because the BPF maps offloads IPv4 traffic. The kernel can't
trace the offloaded traffic to keep the conntrack entry.

Bug: 190783768
Test: atest TetheringCoverageTests
Change-Id: Idbcf686c9b2124b192944156ac5111be741744fb
2021-06-23 15:41:30 +08:00
Hungming Chen
a6e7869646 Clear IPv4 offload rules when tethering stopped
The condition for deleting IPv4 forwarding rules.
1. When the tethering client has gone, deletes the client and its
   rules.
2. When the upstream has gone, deletes all rules.
3. When the upstream has changed, deletes all rules.

Test: atest TetheringCoverageTests and check IPv4 offload rules
via dumpsys tethering in the following test cases.

Bug: 190783768

Test cases:
a. Loss upstream interface while tethering
  1. Enable WIFI tethering
  2. Disable upstream interface
  3. Check the rules are removed.
b. Loss downstream interfaces while tethering
  1. Enable WIFI tethering
  2. Enable BT tethering
  3. Disable BT tethering
  4. Check the BT tether rules are removed.
  5. Disable WIFI tethering
  6. Check the WIFI tether rules are removed.
c. Switch upstream interface while tethering
  1. Enable WIFI tethering
  2. Enable BT tethering
  3. Switch upstream interface from cellular to wifi.
  4. Check all rules are removed.
d. Enable NAT failure (manual)

Log:
The rule deletion in each case.
- IpServer#stopIPv4: case b and case d.
- BpfCoordinator#updateUpstreamNetworkState: case a and case c.

Test case a
06-23 09:58:59.245  [...] Tethering: [BpfCoordinator]
    updateUpstreamNetworkState tetherOffloadRule4Clear wlan2

Test case b
06-07 22:17:51.886  [..] Tethering: [bt-pan] cleanupUpstream bt-pan
06-07 22:17:51.888  [..] Tethering: [bt-pan] stopIPv4 bt-pan
06-07 22:18:23.769  [..] Tethering: [wlan2] cleanupUpstream wlan2
06-07 22:18:23.772  [..] Tethering: [wlan2] stopIPv4 wlan2

Test case c
06-08 11:11:48.277  [..] Tethering: [BpfCoordinator]
    updateUpstreamNetworkState tetherOffloadRule4Clear bt-pan
06-08 11:11:48.396  [..] Tethering: [BpfCoordinator]
    updateUpstreamNetworkState tetherOffloadRule4Clear wlan2
06-08 11:11:48.579  [..] Tethering: [wlan2] cleanupUpstreamInterface
    wlan2
06-08 11:11:48.808  [..] Tethering: [bt-pan] cleanupUpstreamInterface
    bt-pan

Enabling NAT failure
06-08 13:04:18.117  [..] Tethering: [wlan2] Exception enabling NAT [..]
06-08 13:04:18.234  [..] Tethering: [wlan2] cleanupUpstream wlan2
06-08 13:04:18.246  [..] Tethering: [wlan2] stopIPv4 wlan2

Change-Id: Id505a3deb277bbe0f44403234d8ca8bbf01eec80
2021-06-23 15:41:27 +08:00
Chiachang Wang
481040b43a Add test for CM#setAvoidUnvalidated
Bug: 186061922
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I77dc5556458c2e824f7abd5a7b79e8aeed8dabf3
2021-06-23 13:54:04 +08:00
Remi NGUYEN VAN
8ce48fe117 Merge "Added tests for QosCallback" 2021-06-23 05:34:46 +00:00
Remi NGUYEN VAN
eb0a4b41f8 Merge "Add basic tests for InvalidPacketException" 2021-06-23 05:32:52 +00:00
Luke Huang
0c20c4901f Merge "Fix the comments from aosp/1719018" 2021-06-23 03:36:02 +00:00
Remi NGUYEN VAN
bf44f6200e Add basic tests for InvalidPacketException
The test simply verify the constructor. They only apply on S+ as
InvalidPacketException is not updatable before S.

Bug: 187935317
Test: atest InvalidPacketExceptionTest
Change-Id: I33f1ee1702672204a46063e6e75c3880d5e7600b
2021-06-23 11:33:10 +09:00
Remi NGUYEN VAN
ef21082033 Merge "Move ConnectivityDiagnosticsManagerTest to common" 2021-06-23 02:31:03 +00:00
Frank Li
a8a7cfd668 Merge "Ignore some ConnectivityManagerTest CTS tests that can't be run in the instant app mode" 2021-06-23 01:58:59 +00:00
Paul Hu
6160d60b2e Merge "Add ConnectivitySettingsManagerTest" 2021-06-23 01:36:16 +00:00
Remi NGUYEN VAN
6214f82c04 Added tests for QosCallback
Tests for the newly added QosCallback functionality

Bug: 155176305
Test: Added to cts/NetworkAgentTest
Change-Id: I29769fc8be074a5105bfe4ac34e30980c5f8744a
2021-06-23 09:51:14 +09:00
Chiachang Wang
38e8c2c94b Merge "Provide a way to override the avoid bad wifi configuration" 2021-06-23 00:48:17 +00:00
Remi NGUYEN VAN
307cb41ade Merge "Add tests for duplicate PendingIntent requests" 2021-06-22 23:35:42 +00:00
Junyu Lai
69bc4fede1 Merge "[SP32] Try to get 1.1 OffloadControl hardware if available" 2021-06-22 20:31:18 +00:00