Commit Graph

1320 Commits

Author SHA1 Message Date
Yan Yan
554eb0699c Merge "Add unit tests for IKEv2 VPN setup and MOBIKE" 2022-06-17 17:53:59 +00:00
Aaron Huang
befadfe3d1 Disable NetworkStatsRecorder Test
Disable test since it won't pass until prebuilt module updated.

Ignore-AOSP-First: urgent fix and will cherry-pick immediately after.
Bug: 233828210
Bug: 234099453
Test: FrameworksNetTests
(merged-in tag is pointed to an unrelated CL that only exists on
aosp and its downstreams, to make this CL doesn't get merged in aosp downstreams)

Change-Id: I81b43e6a1410e7cf241487ef213acf0cbcfd019d
Merged-In: I47fb59334d00ae7fee91c5694548b3cf89b09b2d
2022-06-17 15:34:48 +08:00
Aaron Huang
692baa7d71 Add wipeOnError flag to NetworkStatsRecorder
If reading data happens exception while doing data migration,
the file will be deleted by legacy recorders. This would cause
legacy persistent data being lost and cannot be retrieved by
any method. To avoid the files being deleted, add a wipeOnError
flag to recorder which indicates this recorder will wipe on
error or not . If the flag is set to true then deletes all files
when it throws, otherwise keeps all files.

Ignore-AOSP-First: urgent fix and will cherry-pick immediately after.
Bug: 233828210
Test: FrameworksNetTests:NetworkStatsRecorderTest
Change-Id: Id7a3d8bebf8a00d814f9e84bf4c10d927e6ff749
2022-06-17 15:23:24 +08:00
Yan Yan
4b0e4b1f17 Add unit tests for IKEv2 VPN setup and MOBIKE
Add unit tests for IKEv2 VPN setup and handling network change.

Bug: 192077544
Test: atest VpnTest (new tests)
Change-Id: Idd13a3ae57a521901c576bdd33ca0170e94be048
2022-06-17 00:14:32 +00:00
Patrick Rohr
ab3e14471b Merge "Revert "Temporarily ignore ethernet tests until prebuilts are updated"" into tm-dev 2022-06-16 19:22:10 +00:00
James Mattis
265eba982d Send callback if ip provisioning is interrupted
A callback is expected to be sent on either success or failure when the
EthernetManager#updateConfiguration API is called.

Currently, if this API is called for an active interface and marked
restricted, after the IP provisioning process is started in
EthernetNetworkFactory, the interface will then processe all the
onNetworkUneeded requests for the newly restricted network. Assuming no
apps have requests for this particular network or restricted networks,
the network will be stopped once the outstanding network request count
reaches zero.

If provisioning hasn't completed yet for the original
updateConfiguration call, the original callback will be cleared out on
stop and will never notify the original caller of
EthernetManager#updateConfiguration whose call was aborted.

Bug: 235907515
Test: eth unit and cts tests
Change-Id: I91359272c07e090039049370ba9f438546fce3ad
2022-06-16 08:10:20 -07:00
TreeHugger Robot
3481337b6b Merge "Revert "Temporarily disable testUidStatsForTransport"" into tm-dev 2022-06-16 07:43:45 +00:00
TreeHugger Robot
705d85bf3f Merge "Revert "Temporarily disable NsdService unit tests"" into tm-dev 2022-06-16 07:43:03 +00:00
Motomu Utsumi
e17b63b4f1 Merge changes Ic6ff7a3d,Iff9b9792 am: 5d787feef0 am: 78df805366
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2110087

Change-Id: Ib10eb3de45b85e9c02f9103d22a50cc7b2aabf89
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-16 02:18:53 +00:00
Motomu Utsumi
5d787feef0 Merge changes Ic6ff7a3d,Iff9b9792
* changes:
  Refactor code and improve tests for VPN filtering
  Remove LOCKDOWN from FirewallChain IntDef
2022-06-16 01:32:20 +00:00
Junyu Lai
480cd3a603 Merge "Disable fallback when comparison result is different" into tm-dev am: ebec0f76ce
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/18849946

Change-Id: I568129dda63d52fb71e56f191063fa15913eb573
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-15 21:48:26 +00:00
Patrick Rohr
3a7645fc75 Revert "Temporarily ignore ethernet tests until prebuilts are updated"
This reverts commit 14f45a3e98.

Reason for revert: Reenabling tests after prebuilts are updated.

Bug: 233824546
Change-Id: I6883ea55dd390e7fe102b735e0b757e838d9eff6
Merged-In: I8e806b3b884f2e0b6c1a1d2fffdb9a99c5dd60e8
2022-06-15 18:55:48 +00:00
Junyu Lai
f955184698 Disable fallback when comparison result is different
Follow-up from ag/18452103, where we add fallback code that runs
with the importer to make sure they are identical.
When the result is different, we'll take the result from fallback
code to minimize the rollout risk. However, since the OEMs might
change the importer implementation. The fallback code would no
longer valid and that makes OEM modified code not working. Hence
the fallback code must be disabled before release.

This change keeps comparison enabled for all cases to keep getting
signals from beta users. And will switch it to read overlay value
for OEM to debug their solution.

Ignore-AOSP-First: Parent CLs are not in aosp yet
Test: 1. NetworkStatsServiceTest
      2. Test all datasets with script
Bug: 233752318
Change-Id: I869ff05297149bde6e13a204bd8c5a4fece75de0
2022-06-15 19:49:33 +08:00
Remi NGUYEN VAN
b3740168ae Revert "Temporarily disable testUidStatsForTransport"
This reverts commit 87a9bc7edb.

Reason for revert: Prebuilts are updated and tests should pass now

Change-Id: I6dd793e124a2781b9d74d28b7da7ac9f15f41d89
Merged-In: Ib1d180cc799dde94ada642ce752623b4b65f1e31
Merged-In: I44dda14cae265e600010c6f8efe1471ac481c6ea
Merged-In: I702a75e91be0bb582f9cbd7b4a23e1286f8252cf
2022-06-15 02:15:23 +00:00
Remi NGUYEN VAN
d86035f662 Revert "Temporarily disable NsdService unit tests"
This reverts commit a3ce8f8438.

Reason for revert: Prebuilts should be newer now

Change-Id: I717288c9a2e25fb9bc358a61beb8877144ed078c
Merged-In: Ib1d180cc799dde94ada642ce752623b4b65f1e31
Merged-In: I44dda14cae265e600010c6f8efe1471ac481c6ea
Merged-In: I702a75e91be0bb582f9cbd7b4a23e1286f8252cf
2022-06-15 02:13:23 +00:00
Yan Yan
259c00bbaf Merge "Revert "Add unit tests for IKEv2 VPN setup and MOBIKE"" am: c8144ff164 am: 0b022e8d5c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2124453

Change-Id: Ie794ae544b59461075e49eeec0b593cbe2b72c43
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-13 21:43:07 +00:00
Yan Yan
fcc7e905b2 Revert "Add unit tests for IKEv2 VPN setup and MOBIKE"
Revert "Make VPN more testable and update NC during network change"

Revert submission 2113906-mobike-ut

Reason for revert: b/235853154 Test files build failed on tm-mainline-prod
Reverted Changes:
I739016db1:Add unit tests for IKEv2 VPN setup and MOBIKE
Ic0f0c5496:Make VPN more testable and update NC during networ...

Change-Id: I9e8695078633822d3051aed27dcd617e0b8da6e5
2022-06-13 19:51:52 +00:00
Yan Yan
f825c61f24 Merge "Add unit tests for IKEv2 VPN setup and MOBIKE" am: e934e484c7 am: c4ddee9707
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2113906

Change-Id: I9fe164bbde085367a7254b4a1428605a340d0499
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-13 18:20:52 +00:00
Yan Yan
cbd6205ae9 Add unit tests for IKEv2 VPN setup and MOBIKE
Add unit tests for IKEv2 VPN setup and handling network change.

Bug: 192077544
Test: atest VpnTest (new tests)
Change-Id: I739016db1b139b722b54c828fcc3babc5b1f14c4
2022-06-10 18:48:49 +00:00
Motomu Utsumi
f8bd82cd67 Refactor code and improve tests for VPN filtering
Bug: 206482423
Test: atest ConnectivityServiceTest PermissionMonitorTest

Change-Id: Ic6ff7a3d7695ad6ce96764a9bab2c0a641ba2ba6
2022-06-10 03:18:32 +00:00
Motomu Utsumi
8b42e6d431 Remove LOCKDOWN from FirewallChain IntDef
LOCKDOWN_VPN was in the FirewallChain IntDef but this was not a right
place because LOCKDOWN_VPN was not a valid value for Connectivity APIs
that take an argument annotated with @FirewallChain(setUidFirewallRule,
setFirewallChainEnabled, replaceFirewallChain).

LOCKDOWN_VPN was in the FirewallChain IntDef because
BpfNetMaps#setUidRule was used to add/remove LOCKDOWN_VPN entries.
This commit adds BpfNetMaps#updateUidLockdownRule and uses this to
add/remove LOCKDOWN_VPN entries instead of BpfNetMaps#setUidRule and
removes LOCKDOWN from FirewallChain.

Bug: 206482423
Test: atest TrafficControllerTest ConnectivityServiceTest
PermissionMonitorTest HostsideVpnTests#testBlockIncomingPacket

Change-Id: Iff9b9792fc0f208f153e10e396c6d5034b412d7c
2022-06-10 02:49:25 +00:00
Lucas Lin
e5bc899067 Merge "Test recoverable Ikev2 errors" am: 281390e58c am: af4edb7ad7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2098818

Change-Id: Ibd191930f95d69cbb2a2c21b383e0386d934ffeb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-09 18:27:40 +00:00
Lucas Lin
281390e58c Merge "Test recoverable Ikev2 errors" 2022-06-09 17:37:45 +00:00
Aaron Huang
438cad705c Merge "Remove debug log from NetworkStatsService" am: bd96778236 am: 2a9dae00ba
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2117037

Change-Id: I3221a0799dc86537fdff803a98e10103c253463e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-09 03:44:47 +00:00
Aaron Huang
bd96778236 Merge "Remove debug log from NetworkStatsService" 2022-06-09 02:37:42 +00:00
Treehugger Robot
f8ad5d6ca1 Merge "ClatCoordinator: improve file descriptor clean up in error handling" am: a58028e31a am: b15536a161
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2114854

Change-Id: I87af9b09aa79bc6224a4b8a75c2e5d3c70c55807
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-08 07:58:47 +00:00
Treehugger Robot
a58028e31a Merge "ClatCoordinator: improve file descriptor clean up in error handling" 2022-06-08 07:19:31 +00:00
Aaron Huang
de99c7a9f4 Remove debug log from NetworkStatsService
This change reverts aosp/1777887. The exception was used to get
the stack while the mMobileIfaces contains null interface, and
currently mMobileIfaces is protected by making it volatile so
it is fine to be removed.

Also, fix style error in NetworkStatsServiceTest

Test: build, FrameworksNetTests
Change-Id: I8435354f8cfd05589c0231f3bb8cbaa66c0525cf
2022-06-08 12:20:55 +08:00
Junyu Lai
093cd94972 Merge changes from topic "oom-fix"
* changes:
  Fix get summary does not include the latest bucket
  Add unit test for MultipathPolicyTracker
2022-06-07 09:26:09 +00:00
lucaslin
adb56e94a5 Test recoverable Ikev2 errors
Test if retry mechanism is working or not when there is a
recoverable Ikev2 error.

Bug: 229350078
Test: atest FrameworksNetTests:VpnTest
Change-Id: I5e881c6b42aeb98adce598587e2a7e49be7d9643
2022-06-07 16:28:47 +08:00
Aaron Huang
5804b5c5df Merge "Hold wifi and mobile interfaces since boot in NetworkStatsService" 2022-06-07 07:36:26 +00:00
Motomu Utsumi
aee69a63d8 Merge "Add 3rd deny firewall chain for OEM" am: 1259ebcb59 am: b80b5e5476
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2117038

Change-Id: I9bc36d8d1b3870d821a9440d7babfc7f9d20a727
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-07 06:14:35 +00:00
Motomu Utsumi
608015f24e Add 3rd deny firewall chain for OEM
Bug: 208371987
Test: atest
CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testFirewallBlocking
ConnectivityServiceTest

Change-Id: Ib521fa02f6a19270cb88a3d85321bda822516c78
(cherry picked from commit 1d9054ba5f)
Merged-In: Ib521fa02f6a19270cb88a3d85321bda822516c78
2022-06-07 05:35:36 +00:00
Junyu Lai
04b2cb2f2d Fix get summary does not include the latest bucket
In internalGetSummaryForNetwork, the history object will not
include the latest bucket because of the logic in
NetworkStatsHistory#recordHistory would only include buckets
that atomically occur in the inclusive time range.

This makes querySummaryForDevice callers who are also sensitive
to the latest bucket fails.

This CL revert the behavior back to S, in T this is temporarily
changed after aosp/1937268.

Also, for test purpose, this CL change System.currentTimeMillis to
use mClock when querying.

Test: NetworkStatsServiceTest#testGetLatestSummary
Bug: 233733267
Change-Id: I55e2a5d953622b68da36a9b8d3e57c88d57543b0
Merged-In: I55e2a5d953622b68da36a9b8d3e57c88d57543b0
  (pure cherry-picked from ag/18670248)
2022-06-07 11:07:46 +08:00
Junyu Lai
207b125a20 Add unit test for MultipathPolicyTracker
This CL adds unit test to test onThresholdReached event
would unregister and re-register usage callback.

Test: MultipathPolicyTrackerTest#testOnThresholdReached
Bug: 233733267
Change-Id: I6e43ae93055009d91b0795a4466f2c02f4403c0a
Merged-In: I6e43ae93055009d91b0795a4466f2c02f4403c0a
  (pure cherry-picked from ag/18579049)
2022-06-07 11:06:46 +08:00
Motomu Utsumi
1d9054ba5f Add 3rd deny firewall chain for OEM
Bug: 208371987
Test: atest
CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testFirewallBlocking
ConnectivityServiceTest

Change-Id: Ib521fa02f6a19270cb88a3d85321bda822516c78
2022-06-06 07:47:35 +00:00
Aaron Huang
f4f5de3993 Hold wifi and mobile interfaces since boot in NetworkStatsService
In current design, the interface will be removed from the list if
the network disconnected which will cause getUidStatsForTransport()
returns unexpected snapshot to caller since the list is empty.

This change also remove interface name from all entries before
the method returns the result.

Bug: 231514741
Test: FrameworksNetTests
      manual test
Change-Id: Ie60829a65d0d9b5b63ad353695a820c0586e3665
Merged-In: Ie60829a65d0d9b5b63ad353695a820c0586e3665
2022-06-06 13:19:11 +08:00
TreeHugger Robot
52f0fe0c47 Merge changes from topic "cherrypicker-L34800000954905788:N57900001270872696" into tm-dev
* changes:
  Ignore new test until prebuilts are updated.
  Add deny firewall chain for OEM
2022-06-03 16:45:05 +00:00
Treehugger Robot
5f5b94cfdf Merge "ClatCoordinatorTest: add test for startClat error handling" am: 6d0b34ecb3 am: d8031cf082
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2109965

Change-Id: I4de6014183413c6f44e239b2ba0dcca198d309f4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-03 15:51:39 +00:00
Treehugger Robot
0a4c675372 Merge "ClatCoordinatorTest: add testDump" am: 1076248194 am: 70e1fd1cc2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2110085

Change-Id: I4690dfb0dda3decc4b7e335679c1fbda4b206b91
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-03 15:51:29 +00:00
Treehugger Robot
6d0b34ecb3 Merge "ClatCoordinatorTest: add test for startClat error handling" 2022-06-03 15:17:10 +00:00
Treehugger Robot
1076248194 Merge "ClatCoordinatorTest: add testDump" 2022-06-03 15:17:06 +00:00
Patrick Rohr
1f8bd41e87 ethernet: broadcast state change for server interfaces
Also update the test to ensure mFactory.hasInterface is mocked to match
mFactory.getInterfaceState: previously it would be called by the factory
in the mocked getInterfaceState, but the new code calls it directly.

Bug: 171872016
Test: atest EthernetManagerTest
Change-Id: I9ac959f181c88a7992991923b98a836f2833fa88
(cherry picked from commit f33f276b29)
Merged-In: I9ac959f181c88a7992991923b98a836f2833fa88
2022-06-03 21:32:31 +09:00
Lorenzo Colitti
266e3cc123 Merge changes from topic "remove-ethernet-shims" am: 337d512081 am: 293129ca50
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2114378

Change-Id: I557bc2835c6aa75af895466585424fd0587bfcb0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-03 12:23:56 +00:00
Lorenzo Colitti
337d512081 Merge changes from topic "remove-ethernet-shims"
* changes:
  ethernet: add test for tethered interface callbacks
  ethernet: stop using EthernetManager shims
  ethernet: broadcast state change for server interfaces
  ethernet: increase timeout to deflake tests
2022-06-03 11:51:58 +00:00
Lorenzo Colitti
09130e00ae Merge "Verify if the VPN app has been added into power save whilte list" into tm-dev 2022-06-03 11:49:35 +00:00
Motomu Utsumi
78319c9f6d Merge "Add deny firewall chain for OEM" am: 181f7c85fc am: 7731ca47f9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2114533

Change-Id: I9bfb2edc9bded9e895f291385ebdb16218fe05a2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-03 11:46:43 +00:00
Motomu Utsumi
9cd4726890 Add deny firewall chain for OEM
Bug: 207773349
Bug: 208371987
Test: atest
CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testFirewallBlocking
--iterations 50 && atest ConnectivityServiceTest --iterations 10

Change-Id: I60d5540821abcced03356f366775f16ee369d7f9
(cherry picked from commit d980149817)
Merged-In: I60d5540821abcced03356f366775f16ee369d7f9
2022-06-03 11:06:46 +00:00
Motomu Utsumi
181f7c85fc Merge "Add deny firewall chain for OEM" 2022-06-03 11:06:02 +00:00
Aaron Huang
ab097b28d5 Hold wifi and mobile interfaces since boot in NetworkStatsService am: a2f1cf3576
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/18710006

Change-Id: Ie53afd7a2c6cfdd46a1ed3954a1aceac9bd120eb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-03 09:25:50 +00:00