Commit graph android_packages_modules_Co.../tests/unit/java/com/android
Message SHA1
Merge "Validate or set the eth specifier on update Iface" am: 85694dc277 am: c9bb8aab8b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2128511

Change-Id: I3977abc3d6235de9f020c0bcac3df1991714c5ee
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-06-23 16:55:58 +00:00
2ec893bbe7
Merge "Validate or set the eth specifier on update Iface"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-06-23 16:16:05 +00:00
85694dc277
Validate or set the eth specifier on update Iface
When a calling the updateInterface API, if no eth specifier was set it
would be removed not allowing follow-up network requests to request by
ethernet specifier.

This CL makes sure that the eth specifier is always set as expected when
updateInterface is called by either validating the input or setting the
specifier if the passed one is null.

Bug: 236294399
Bug: 229207021
Test: atest FrameworksNetTests
:com.android.server.ethernet.EthernetNetworkFactoryTest

Change-Id: Ic05ca7fe4adaa94f79e59758569f7595ab4c4f54

James Mattis   commited 2022-06-23 07:51:20 -07:00
59d98c07a7
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.

(cherry-picked from ag/18910973)
Bug: 233828210
Test: FrameworksNetTests:NetworkStatsRecorderTest

Change-Id: Id7a3d8bebf8a00d814f9e84bf4c10d927e6ff749
Merged-In: Id7a3d8bebf8a00d814f9e84bf4c10d927e6ff749

Aaron Huang   commited 2022-06-22 17:37:51 +08:00
80767e64ef
Disable comparison in user release builds
This CL disable the comparison mechanism introduced
in previous beta releases to stop receiving log.wtf signals
from beta users.

This CL only affects logging on user release builds.

Test: 1. NetworkStatsServiceTest
      2. manual test with script
Bug: 233752318
Change-Id: I7047106b1019c29460d6633b148f501ffa62f139
Merged-In: I7047106b1019c29460d6633b148f501ffa62f139
  (cherry-picked from ag/18869740)

Junyu Lai   commited 2022-06-22 11:00:17 +08:00
11e9887fa8
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.

Test: 1. NetworkStatsServiceTest
      2. Test all datasets with script
Bug: 233752318
Change-Id: I869ff05297149bde6e13a204bd8c5a4fece75de0
Merged-In: I869ff05297149bde6e13a204bd8c5a4fece75de0
  (cherry-picked from ag/18849946)

Junyu Lai   commited 2022-06-22 10:59:10 +08:00
e72c849a61
Address comment at ag/18491259 and ag/18486388
Test: TH
Bug: 230289468
Change-Id: Id91fabb47b542d8526d6aa787b5947238c3934fb
Merged-In: Id91fabb47b542d8526d6aa787b5947238c3934fb
  (cherry-picked from ag/18579048)

Junyu Lai   commited 2022-06-22 10:57:38 +08:00
dbe8ddca71
Persisting status int on the device if fallback happened
This CL also stop from incresing "successes" counter if the
importer finishes with fallback.

Test: manual
Bug: 230289468
Change-Id: I88fce1b2d0dea3772a8b31df8f8fa93bf13bffad
Merged-In: I88fce1b2d0dea3772a8b31df8f8fa93bf13bffad
  (cherry-picked from ag/18486388)

Junyu Lai   commited 2022-06-22 10:35:25 +08:00
079717052c
Merge "Verify VPN can handle network loss" am: b3cfcc5c18 am: c91087744c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2120558

Change-Id: I765fd96938261c807ba85ffd92e3185a1c548049
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Yan Yan   authored and   Automerger Merge Worker   commited 2022-06-21 18:18:14 +00:00
df3a655f32
Merge "Disable comparison in user release builds" into tm-dev am: 5409851f43
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/18869740

Change-Id: I7c1150436b477a7f6d6dcb8e7132fddcabb2d9b1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2022-06-21 09:03:29 +00:00
19bb30b0cf
Merge "Disable comparison in user release builds" into tm-dev
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2022-06-21 08:58:23 +00:00
5409851f43
Disable comparison in user release builds
This CL disable the comparison mechanism introduced
in previous beta releases to stop receiving log.wtf signals
from beta users.

This CL only affects logging on user release builds.

Ignore-AOSP-First: Parent CLs are not in aosp yet
Test: 1. NetworkStatsServiceTest
      2. manual test with script
Bug: 233752318
Change-Id: I7047106b1019c29460d6633b148f501ffa62f139

Junyu Lai   authored and   Remi NGUYEN VAN   commited 2022-06-21 08:57:06 +00:00
a5e1428fbc
Add wipeOnError flag to NetworkStatsRecorder am: 692baa7d71
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/18910973

Change-Id: I0a0e42c0acce71aa5873c6f2d2767e3d0479c962
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Aaron Huang   authored and   Automerger Merge Worker   commited 2022-06-20 02:10:02 +00:00
ef3c12c392
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
(cherry picked from commit 265eba982d)
Merged-In: I91359272c07e090039049370ba9f438546fce3ad

James Mattis   authored and   Cherrypicker Worker   commited 2022-06-17 23:30:52 +00:00
99f342e229
Verify VPN can handle network loss
This commit also
- verifies that during network switch with MOBIKE
  enabled, the cleanup task is scheduled upon network loss and
  cancelled when new network is available.
- improves the retry tests to avoid waiting for actual timeout

Bug: 192077544
Test: atest VpnTest (new tests)
Change-Id: I5b47ba98116ac4523a36bc495e8788f29a9ecf20

Yan Yan   commited 2022-06-17 21:27:03 +00:00
37a1ba2202
Merge "Add unit tests for IKEv2 VPN setup and MOBIKE" am: 554eb0699c am: 6e762ca922
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2124749

Change-Id: I04225f9434997c4c1f452277f3f4162e8ac5ce0a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

Yan Yan   authored and   Automerger Merge Worker   commited 2022-06-17 20:35:08 +00:00
1c3c660904
Merge "Send callback if ip provisioning is interrupted" am: 7d5aae1a55 am: 6775e2eaea
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2123881

Change-Id: Ib8c11b71d599d48c422c0cee470d60e15c101d22
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>

James Mattis   authored and   Automerger Merge Worker   commited 2022-06-17 20:34:53 +00:00
f637582a7a
Merge "Add unit tests for IKEv2 VPN setup and MOBIKE"
Yan Yan   authored and   Gerrit Code Review   commited 2022-06-17 17:53:59 +00:00
554eb0699c
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

Aaron Huang   commited 2022-06-17 15:23:24 +08:00
692baa7d71
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

Yan Yan   commited 2022-06-17 00:14:32 +00:00
4b0e4b1f17
Merge "Revert "Temporarily ignore ethernet tests until prebuilts are updated"" into tm-dev
Patrick Rohr   authored and   Android (Google) Code Review   commited 2022-06-16 19:22:10 +00:00
ab3e14471b
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

James Mattis   commited 2022-06-16 08:10:20 -07:00
265eba982d
Merge "Revert "Temporarily disable testUidStatsForTransport"" into tm-dev
TreeHugger Robot   authored and   Android (Google) Code Review   commited 2022-06-16 07:43:45 +00:00
3481337b6b
Merge "Revert "Temporarily disable NsdService unit tests"" into tm-dev
TreeHugger Robot   authored and   Android (Google) Code Review   commited 2022-06-16 07:43:03 +00:00
705d85bf3f
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>

Motomu Utsumi   authored and   Automerger Merge Worker   commited 2022-06-16 02:18:53 +00:00
e17b63b4f1
Merge changes Ic6ff7a3d,Iff9b9792
* changes:
  Refactor code and improve tests for VPN filtering
  Remove LOCKDOWN from FirewallChain IntDef

Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-06-16 01:32:20 +00:00
5d787feef0
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>

Junyu Lai   authored and   Automerger Merge Worker   commited 2022-06-15 21:48:26 +00:00
480cd3a603
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

Patrick Rohr   commited 2022-06-15 18:55:48 +00:00
3a7645fc75
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

Junyu Lai   commited 2022-06-15 19:49:33 +08:00
f955184698
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

Remi NGUYEN VAN   commited 2022-06-15 02:15:23 +00:00
b3740168ae
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

Remi NGUYEN VAN   commited 2022-06-15 02:13:23 +00:00
d86035f662
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>

Yan Yan   authored and   Automerger Merge Worker   commited 2022-06-13 21:43:07 +00:00
259c00bbaf
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

Yan Yan   commited 2022-06-13 19:51:52 +00:00
fcc7e905b2
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>

Yan Yan   authored and   Automerger Merge Worker   commited 2022-06-13 18:20:52 +00:00
f825c61f24
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

Yan Yan   commited 2022-06-10 18:48:49 +00:00
cbd6205ae9
Refactor code and improve tests for VPN filtering
Bug: 206482423
Test: atest ConnectivityServiceTest PermissionMonitorTest

Change-Id: Ic6ff7a3d7695ad6ce96764a9bab2c0a641ba2ba6

Motomu Utsumi   commited 2022-06-10 03:18:32 +00:00
f8bd82cd67
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

Motomu Utsumi   commited 2022-06-10 02:49:25 +00:00
8b42e6d431
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>

Lucas Lin   authored and   Automerger Merge Worker   commited 2022-06-09 18:27:40 +00:00
e5bc899067
Merge "Test recoverable Ikev2 errors"
Lucas Lin   authored and   Gerrit Code Review   commited 2022-06-09 17:37:45 +00:00
281390e58c
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>

Aaron Huang   authored and   Automerger Merge Worker   commited 2022-06-09 03:44:47 +00:00
438cad705c
Merge "Remove debug log from NetworkStatsService"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-06-09 02:37:42 +00:00
bd96778236
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>

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-06-08 07:58:47 +00:00
f8ad5d6ca1
Merge "ClatCoordinator: improve file descriptor clean up in error handling"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-06-08 07:19:31 +00:00
a58028e31a
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

Aaron Huang   commited 2022-06-08 12:20:55 +08:00
de99c7a9f4
Merge changes from topic "oom-fix"
* changes:
  Fix get summary does not include the latest bucket
  Add unit test for MultipathPolicyTracker

Junyu Lai   authored and   Gerrit Code Review   commited 2022-06-07 09:26:09 +00:00
093cd94972
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

lucaslin   commited 2022-06-07 16:28:47 +08:00
adb56e94a5
Merge "Hold wifi and mobile interfaces since boot in NetworkStatsService"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-06-07 07:36:26 +00:00
5804b5c5df
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>

Motomu Utsumi   authored and   Automerger Merge Worker   commited 2022-06-07 06:14:35 +00:00
aee69a63d8
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

Motomu Utsumi   authored and   Cherrypicker Worker   commited 2022-06-07 05:35:36 +00:00
608015f24e
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)

Junyu Lai   commited 2022-06-07 11:07:46 +08:00
04b2cb2f2d