Commit graph android_packages_modules_Co.../tests/unit/java/com/android/server
Message SHA1
Merge changes from topics "RefactorIR", "appExclusionPrefix", "reStartVpnProfile" am: ff41ecc64d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2145586

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

Chiachang Wang   authored and   Automerger Merge Worker   commited 2022-07-11 01:47:33 +00:00
0116bc51f4
Refactor to mock package add and remove event
Use mock intent receiver to handle intent related events instead
of exposing the private methods even for testing only.

The visibility for onPackageAdded, onPackageRemoved and
onUserStarted were exposed for testing only in former commit.
The test coverage for intent receiver part may be missed.
The other intent related methods will be verified in the
follow up commits. This refactor will also help to not to
expose further private methods.

Bug: 230548427
Test: atest VpnManagerServiceTest
Change-Id: If2aa88d8d5c1643e8bd4937673aa792186047fd8

chiachangwang   commited 2022-07-07 08:54:27 +00:00
26de58ea79
Test reconnect VpnManager VPN with always on enabled
Verify reconnect using startVpnProfile with the same package with
always-on package should work without exception.

Bug: 235322391
Test: atest FrameworksNetTests
Change-Id: I9a780d970208032e2468e9c5b3334373627c6a20

chiachangwang   commited 2022-07-07 06:46:15 +00:00
a412026c6b
Update the prefix of VPN_APP_EXCLUDED in the test
Update the string according to the change in Vpn.java

Bug: 237345836
Test: atest FrameworksNetTests
Change-Id: I9bfe0a1fad29ba1435eeb8b8b2cffa9d385b1cb5

chiachangwang   commited 2022-07-07 06:46:08 +00:00
9460f45c04
Add tests to verify getProvisionedVpnProfileState
Add tests to verify that calling getProvisionedVpnProfileState works
normally from the same package but gets a security exception from a
differnet package.

Bug: 230548427
Test: atest FrameworksNetTests
Change-Id: I0132c42dce1b8269859fca8d0143304142162838

chiachangwang   commited 2022-07-07 06:45:55 +00:00
72fe97ea1c
Merge "ClatCoordinator: Dump ClatdTracker information" am: 78cf7c5e29
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2145582

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-07-05 15:20:52 +00:00
011b8dca41
Merge "ClatCoordinator: Dump ClatdTracker information"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-07-05 15:01:11 +00:00
78cf7c5e29
ClatCoordinator: Dump ClatdTracker information
Test: atest ClatCoordinatorTest
Change-Id: I6bb47c84321e1323496b728f2db939ee8d74504a

Hungming Chen   commited 2022-07-05 15:30:50 +08:00
a760a10474
Merge "Remove unnecessary null check" am: daced9e4b8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2138293

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-07-04 18:57:15 +00:00
be5920c6cd
Remove unnecessary null check
Address review comments from aosp/2131752 and aosp/2117045
sConfigurationMap must have a entry for UID_RULES_CONFIGURATION_KEY
because this bpf map is an array

Bug: 217624062
Test: atest BpfNetMapsTest
Change-Id: Ic52623e11c1f53e363416d57c0d8705d5510ef04

Motomu Utsumi   commited 2022-07-04 09:20:23 +00:00
1f73fedfef
Merge "Refactor BpfNetMaps and getChainEnabled" am: 51a03d629e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2135061

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

Motomu Utsumi   authored and   Automerger Merge Worker   commited 2022-06-30 07:09:35 +00:00
1608aed5c7
Merge "Refactor BpfNetMaps and getChainEnabled"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-06-30 06:48:10 +00:00
51a03d629e
Merge "Decouple security exception check test from ConnectivityServiceTest" am: bb2e871cce
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2133162

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

Chiachang Wang   authored and   Automerger Merge Worker   commited 2022-06-30 02:00:38 +00:00
c568a0e522
Merge changes from topic "appExclusionPackage" am: 5b4ad7c47a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2106025

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

Chiachang Wang   authored and   Automerger Merge Worker   commited 2022-06-30 02:00:10 +00:00
8003ddb079
Add VpnTestBase for VPN test common code am: 9f672bdae6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2138296

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

chiachangwang   authored and   Automerger Merge Worker   commited 2022-06-30 02:00:07 +00:00
4a1860836d
Merge "Decouple security exception check test from ConnectivityServiceTest"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-06-30 01:36:46 +00:00
bb2e871cce
Merge changes from topic "appExclusionPackage"
* changes:
  Test VPN app exclusion
  Add VpnTestBase for VPN test common code

Chiachang Wang   authored and   Gerrit Code Review   commited 2022-06-30 01:34:54 +00:00
5b4ad7c47a
Merge "Merge tm-dev-plus-aosp-without-vendor@8763363" into stage-aosp-master
Xin Li   authored and   Android (Google) Code Review   commited 2022-06-29 21:22:03 +00:00
514698c728
Decouple security exception check test from ConnectivityServiceTest
Decouple security exception check test from ConnectivityServiceTest
to VpnManagerServiceTest.

These security exception tests landed in ConnectivityServiceTest
because of no VpnManagerServiceTest. Move the tests to the
VpnManagerServiceTest where is better place to put the VPN related
tests to reduce the size of ConnectivityServiceTest.

Bug: 230548427
Test: atest FrameworksNetTests
Change-Id: I94b691c4d1f63bd5226e3296e6d0160dcb03107c

chiachangwang   commited 2022-06-29 06:15:41 +00:00
1aef309197
Test VPN app exclusion
Initialize the VpnManagerServiceTest and verify app exclusion
design.

Bug: 231373589
Test: atest FrameworksNetTests
Change-Id: Icf3994a58de7b2fcc6fafe9712b5ac94e6c2c134

chiachangwang   commited 2022-06-29 06:15:41 +00:00
7f5d04962b
Add VpnTestBase for VPN test common code
This is a no-op change to move some common codes that share
between different VPN unit tests to the new base class.
It's helpful to reduce the code duplication for the follow up
work to add the VpnManagerServiceTest and other test codes
refactor.

Bug: 231373589
Test: atest FrameworksNetTests
Change-Id: Id5111e7ca33ea8f9eb4bcc6c13d0e681f0664d24

chiachangwang   commited 2022-06-29 03:06:09 +00:00
9f672bdae6
Merge tm-dev-plus-aosp-without-vendor@8763363
Bug: 236760014
Merged-In: Ic05ca7fe4adaa94f79e59758569f7595ab4c4f54
Change-Id: Id2ed4b3865be3c959c4cb62a31fba318f5b6fd77

Xin Li   commited 2022-06-28 21:23:32 +00:00
e9ece30105
Use import for testAndCleanup
Follow up work to remove the TODO since it's available in all
branches.

Test: ates VpnTest
Change-Id: I0830148e8577f98616f24d9ee4224496f51bd692

chiachangwang   authored and   Chiachang Wang   commited 2022-06-28 10:57:25 +00:00
337726529b
Merge "Add mdns files and unit tests"
Paul Hu   authored and   Gerrit Code Review   commited 2022-06-28 05:43:58 +00:00
57852487b8
Add mdns files and unit tests
- Put mdns code to service/mdns because we don't want to impact
  coverage for code that's not yet in use.
- Also fix some lint errors
  - Common typo errors
  - Lines longer than 100 characters
- Update IgnoreUpTo from S to SC_V2 because the tests should be
  ignored until T.

Bug: 232766079
Test: atest FrameworksNetTests
Change-Id: I19af3bf7ae004bd37960f2ad9014cf0c6a804c8d

Paul Hu   commited 2022-06-28 09:54:39 +08:00
3e1f4489bf
Refactor BpfNetMaps and getChainEnabled
Address comments from aosp/2117045 and aosp/2131752
Rename USE_NETD to PRE_T
Rename getChainEnabled to isChainEnabled
Remove unnecessary parentheses
Fix comment

Bug: 217624062
Test: atest BpfNetMapsTest
Change-Id: Iaff8c9fc5f74de3fe41a7fb010355b1742fbce90

Motomu Utsumi   commited 2022-06-27 14:33:28 +00:00
25cf86fc95
Merge "Use java BpfMap in BpfNetMaps#setChildChain"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-06-27 05:44:38 +00:00
bccf9df50e
Merge "Add API to get current firewall chain status"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-06-27 05:43:46 +00:00
6421d8456c
Use java BpfMap in BpfNetMaps#setChildChain
Bug: 217624062
Test: atest BpfNetMapsTest android.net.cts.ConnectivityManagerTest#testFirewallBlocking

Change-Id: I13e96911eccd7d1d0545a156ddc2859bcaac09eb

Motomu Utsumi   commited 2022-06-24 09:11:58 +00:00
18b287d285
Add API to get current firewall chain status
This commit adds ConnectivityManager#getFirewallChainEnabled to read the
current firewall chain status

Bug: 208371987
Test: m
Change-Id: I1eadb69f953af5d031cd8dabde3e1f098cf0f4df

Motomu Utsumi   commited 2022-06-24 09:11:53 +00:00
be3ff1e923
Add test for startPptp
The test verifies arguments used to start the daemon

Bug: 201660636
Test: atest VpnTest
Change-Id: I0854fbeaf1a3e3554c157fde227a7bfa187b1013
Merged-In: I0854fbeaf1a3e3554c157fde227a7bfa187b1013

Remi NGUYEN VAN   authored and   chiachangwang   commited 2022-06-24 03:33:30 +00:00
522cea7d4e
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