Commit graph android_packages_modules_Co.../tests/unit/java/com/android
Message SHA1
Merge changes I036b7f23,I53c58e7b am: bdedaacd88
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2173585

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-08-04 10:25:20 +00:00
eea540837c
Merge changes I036b7f23,I53c58e7b
* changes:
  Improve the JavaDoc for FIREWALL_CHAIN_OEM_DENY_x.
  Allow tests to set the NetworkAgent's callbacks when creating it.

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-04 09:50:53 +00:00
bdedaacd88
Merge changes I71988117,Ia70379a3 am: 31b48fa787
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2165825

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

Motomu Utsumi   authored and   Automerger Merge Worker   commited 2022-08-03 12:07:51 +00:00
4f6d11e04f
Merge changes I71988117,Ia70379a3
* changes:
  Move app uid stats map dump to NetworkStatsService
  Move uid counter set map dump to NetworkStatsService

Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-08-03 11:34:39 +00:00
31b48fa787
Allow tests to set the NetworkAgent's callbacks when creating it.
ConnectivityServiceTest#testNetworkAgentCallbacks tests the
behaviour of the NetworkAgent callbacks onNetworkCreated,
onNetworkUnwanted, and onNetworkDestroyed. This uses a
NetworkAgentWrapper method that sets the callbacks after the
test agent is constructed.

This infrastructure not sufficient to test an upcoming change
which will make onNetworkCreated be fired as soon as the
registration onNetworkCreated is fired as soon as the agent is
registered. Fix the code so that the callbacks can be specified
at agent registration time. This is also a bit more realistic
since in real usage, the callbacks are methods on the
NetworkAgent subclass and are already set when the agent is
constructed.

Bug: 143158421
Test: test-only change
Change-Id: I53c58e7b6c6ae4abf08e0df5051694cc4568a510

Lorenzo Colitti   commited 2022-08-03 17:29:01 +09:00
54eae6c348
Merge "Move cookie tag bpf map dump to NetworkStatsService" am: e441f7025c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2167063

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

Motomu Utsumi   authored and   Automerger Merge Worker   commited 2022-08-03 08:10:18 +00:00
624564babc
Merge "Move cookie tag bpf map dump to NetworkStatsService"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-08-03 07:43:13 +00:00
e441f7025c
Merge "Fix flaky testNotifyNoInternetAsDialogWhenHighPriority" am: 28a690dc79
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2171112

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

Aaron Huang   authored and   Automerger Merge Worker   commited 2022-08-03 02:41:35 +00:00
0eb2c79982
Merge "Fix flaky testNotifyNoInternetAsDialogWhenHighPriority"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-08-03 02:22:55 +00:00
28a690dc79
Merge "Update VpnTest to use VpnNetworkAgentWrapper" am: 7dce599f42
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2167050

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-08-02 12:14:36 +00:00
99aaa9a6e0
Merge "Update VpnTest to use VpnNetworkAgentWrapper"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-02 12:08:13 +00:00
7dce599f42
Move app uid stats map dump to NetworkStatsService
Map status dump will do access check if map is null.
This could show different message from the current dump output.

Information in map content dump does not change
$ dumpsys connectivity trafficcontroller
....
      mAppUidStatsMap::
      uid rxBytes rxPackets txBytes txPackets
      0 135 1 3602 47
      1001 2414 8 385 6
      1021 76 1 76 1
      1000 290 2 260 3
....
$ dumpsys netstats
....
  mAppUidStatsMap:
    uid rxBytes rxPackets txBytes txPackets
    0 135 1 3602 47
    1001 2414 8 385 6
    1021 76 1 76 1
    1000 290 2 260 3
....

Bug: 217624062
Test: dumpsys netstats, dumpstate, atest NetworkStatsServiceTest
Change-Id: I71988117c6dc3033f710b26a15d15879b35d50a4

Motomu Utsumi   commited 2022-08-02 09:41:46 +00:00
b8dd98e4d1
Move uid counter set map dump to NetworkStatsService
Map status dump will do access check if map is null.
This could show different message from the current dump output.

Information in map content dump does not change
$ dumpsys connectivity trafficcontroller
....
mUidCounterSetMap:
      10093 1
      10060 1
      1073 1
      1001 1
      10089 1
....
$ dumpsys netstats
....
  mUidCounterSetMap:
    uid=10093 set=1
    uid=10090 set=1
    uid=1073 set=1
    uid=10089 set=1
    uid=1000 set=1
....

Bug: 217624062
Test: dumpsys netstats, dumpstate, atest NetworkStatsServiceTest
Change-Id: Ia70379a3cee820f3f05d1f036947b357d9da4bd7

Motomu Utsumi   commited 2022-08-02 09:41:23 +00:00
7013b92a22
Move cookie tag bpf map dump to NetworkStatsService
Map status dump will do access check if map is null.
This could show different message from the current dump output.

Information in map content dump does not change
$ dumpsys connectivity trafficcontroller
....
      mCookieTagMap:
      cookie=1398 tag=0x0 uid=1029
      cookie=1433 tag=0xffffff82 uid=1051
      cookie=1166 tag=0xfffffe01 uid=1073

$ dumpsys netstats
....
  mCookieTagMap:
    cookie=1144 tag=0xfffffe01 uid=1073
    cookie=1376 tag=0x0 uid=1029
    cookie=1408 tag=0xffffff82 uid=1051

Bug: 217624062
Test: dumpsys netstats, dumpstate, atest NetworkStatsServiceTest
Change-Id: I14dd6f969a0b5eb24ace62361ce2484cf18b7470

Motomu Utsumi   commited 2022-08-02 09:41:03 +00:00
cedfab91c6
Merge changes I6fff65eb,Ie49d2319,Ief974217 am: 2719dc8682
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2171842

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-08-02 07:08:19 +00:00
35a1feb7d1
Merge changes I6fff65eb,Ie49d2319,Ief974217
* changes:
  Make all ConnectivityService#doTestXyz methods private.
  Expect creating the DNS event listener in setUp, not in tests.
  Rename testPreferenceForUserNetworkUpDownForGivenPreference.

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-02 06:49:46 +00:00
2719dc8682
Merge changes Id2a6bfdf,I5cab2b78 am: 2dba76105c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2116300

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

Junyu Lai   authored and   Automerger Merge Worker   commited 2022-08-02 05:50:14 +00:00
907e49867c
Merge changes Id2a6bfdf,I5cab2b78
* changes:
  Remove qtaguid support in NetworkStatsFactory
  Refactor NetworkStatsFactoryTest

Junyu Lai   authored and   Gerrit Code Review   commited 2022-08-02 05:32:45 +00:00
2dba76105c
Make all ConnectivityService#doTestXyz methods private.
They are not tests so there is no need for them to be public.

Test: TH
Bug: 143158421
Change-Id: I6fff65eb62b1689432dc1c9c7347261433317fac

Lorenzo Colitti   commited 2022-08-02 09:52:51 +09:00
db04c60658
Expect creating the DNS event listener in setUp, not in tests.
This simplifies the code a bit.

Also remove an unnecessary reset(mMockNetd) call.

Bug: 143158421
Test: test-only change
Change-Id: Ie49d23193ef8d9dcb3f724a7dff249755c67a971

Lorenzo Colitti   commited 2022-08-02 09:52:51 +09:00
410d4e18b0
Rename testPreferenceForUserNetworkUpDownForGivenPreference.
This method name is confusing because it is not a test, and
convention in this file is that only test methods are called
testXyz. Rename it to doTestXyz.

Bug: 143158421
Test: test-only change
Change-Id: Ief9742174a7fc9966ade29d9a32a13277ce747ac

Lorenzo Colitti   commited 2022-08-01 18:42:24 +09:00
b82e25c51b
Fix flaky testNotifyNoInternetAsDialogWhenHighPriority
If the notification shade was swiped down, the activity that
this test wants to verify will be behind the notification
shade, and this causes the test failed. Thus, this change
makes the screen back to home before starting the test to
avoid the activity being hidden by the notification shade.

Bug: 240891836
Test: NetworkNotificationManagerTest#testNotifyNoInternetAsDialogWhenHighPriority
Change-Id: I4d903d2623c462fca4ec07eb0a0231ef527a200b

Aaron Huang   commited 2022-08-01 08:20:35 +00:00
7fcbc2ecbd
Merge "Add back compat config for NSD" am: a39d54bf43
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2157803

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

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2022-07-29 08:41:54 +00:00
a5803006e9
Merge "Add back compat config for NSD"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-07-29 08:09:54 +00:00
a39d54bf43
Remove qtaguid support in NetworkStatsFactory
All devices shipped with S+ release would have 4.9+ kernel
with bpf enabled. And for older devices qtag uid is
already broken for a long time. Hence, it is safe to
remove the related code.

Bug: 234315786
Test: atest FrameworksNetTests CtsNetTestCases \
      ConnectivityCoverageTests
Change-Id: Id2a6bfdf32793e5f48eb74da3b662906e5ed380e

Junyu Lai   commited 2022-07-29 16:00:29 +08:00
e9f8d8516c
Refactor NetworkStatsFactoryTest
This patch changes the way of mocking samples in the tests, and
enabling use bpf stats flag, testing through the code path
that is not running in the production code does not make any
sense.

This change also copied methods from NetworkStatsFactory
as we want to continue parsing the golden files to test the
464xlat adjustment which historically has been prone to errors.
And deleting tests that does not execrise NetworkStatsFactory
code or rely on monotonic accumulative readings from native
layer, which is not happening today.

Bug: 234315786
Test: atest FrameworksNetTests CtsNetTestCases \
      ConnectivityCoverageTests
Change-Id: I5cab2b78651f1da628705c191e42857c8b59d826

junyulai   authored and   Junyu Lai   commited 2022-07-29 15:46:18 +08:00
8c77e385bd
Merge "Add flag to test BpfNetMaps refactoring" am: 64f706fe2c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2162998

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

Motomu Utsumi   authored and   Automerger Merge Worker   commited 2022-07-28 12:58:10 +00:00
76e3be3f4f
Add flag to test BpfNetMaps refactoring
Following CLs will switch previous codepath (JNI) and new codepath
(Java) for bpf map operations based on this flag.

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

Motomu Utsumi   commited 2022-07-28 02:32:41 +00:00
f688eeb10a
Update VpnTest to use VpnNetworkAgentWrapper
Bug: 192077544
Test: atest VpnTest
Change-Id: Id0be4c4f2c9eba6cb7445d5c5ea4889165971317

Yan Yan   commited 2022-07-28 00:40:02 +00:00
bbb586d7f1
Merge "Use java BpfMap in BpfNetMaps#replaceUidChain" am: 6bcb3c290c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2145584

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

Motomu Utsumi   authored and   Automerger Merge Worker   commited 2022-07-27 13:32:36 +00:00
edbe05a67f
Merge "Use java BpfMap in BpfNetMaps#replaceUidChain"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-07-27 13:21:50 +00:00
6bcb3c290c
Add back compat config for NSD
Add back compat config for RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS, which was
lost when moving NsdManager to framework-connectivity-t.

This causes NsdManager to start mdnsresponder again when used by apps
with target SDK < 31.

The change also changes the compat ID used, to make sure it does not
conflict with the ID already in use in S and below, when the module is
installed on such a platform. This is the only ChangeId used by
framework-t.

Also add a CtsNetTestCasesMaxTargetSdk30 test to verify that behavior.

Bug: 235355681
Test: atest CtsNetTestCasesMaxTargetSdk30
Change-Id: I7ca6051d0a4ba5aff3e44bece2cbac22eb1be32d

Remi NGUYEN VAN   commited 2022-07-27 19:53:25 +09:00
348bbb0231
Use java BpfMap in BpfNetMaps#replaceUidChain
Bug: 217624062
Test: atest BpfNetMapsTest
Change-Id: Ib2a2c2646834110a3eeeb786a4ea7a3f85718be8

Motomu Utsumi   commited 2022-07-27 06:01:47 +00:00
9be2ea0080
Merge changes Ic18521b6,Ibede8137 am: a1b3378285
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2164423

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

Maciej Å»enczykowski   authored and   Automerger Merge Worker   commited 2022-07-26 09:08:06 +00:00
fee07b3477
Merge changes Ic18521b6,Ibede8137
* changes:
  Move tag/untag socket BPF map access from JNI to Java
  Move struct CookieTagMap{Key, Value} to Connectivity/common

Maciej Å»enczykowski   authored and   Gerrit Code Review   commited 2022-07-26 08:35:58 +00:00
a1b3378285
Merge "Migrate buildTemplate* to use NetworkTemplate.Builder" am: c37d806dfd
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2152658

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

Aaron Huang   authored and   Automerger Merge Worker   commited 2022-07-26 07:58:23 +00:00
059a7f9526
Merge "Migrate buildTemplate* to use NetworkTemplate.Builder"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-07-26 07:40:49 +00:00
c37d806dfd
Merge "Changing EthernetNetworkFactoryTest assert order" am: c34c21c624
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2163529

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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-07-25 22:49:48 +00:00
07ec1ed8fb
Changing EthernetNetworkFactoryTest assert order
Changing multiple instances where the assert order for an assert.equals
was (actual, expected) to the more widely (and suggested) ordering of
(expected, actual).

Bug: 235605892
Test: atest FrameworksNetTests
:com.android.server.ethernet.EthernetNetworkFactoryTest

Change-Id: I6e9459d34d6cc7f43a2bfe346d2c2ca9551d46da

James Mattis   commited 2022-07-25 12:36:49 -07:00
fce2777a9b
Migrate buildTemplate* to use NetworkTemplate.Builder
Use new Builder API which was introduced in Android T.

Bug: 238843364
Test: FrameworksNetTests
      dumpsys netstats --checkin and check the output
Change-Id: Ieb0a2ee04056a1cedb71274ea710ff5153e2d68c

Aaron Huang   commited 2022-07-25 11:30:13 +08:00
1c14fa9b08
Move tag/untag socket BPF map access from JNI to Java
Tag socket as uid AID_CLAT to avoid duplicated data usage counting by
bpf program.

Bug: 237369591
Test: ClatCoordinatorTest
Change-Id: Ic18521b63b3feadd53d77d7f4f0b44ab983e5fbf

Hungming Chen   commited 2022-07-23 03:19:13 +08:00
913507f150
Move struct CookieTagMap{Key, Value} to Connectivity/common
Need to share struct CookieTagMap{Key, Value} with:
service/src/com/android/server/connectivity/ClatCoordinator.java
service-t/src/com/android/server/net/NetworkStatsService.java
tests/unit/java/com/android/server/connectivity/ClatCoordinatorTest.java
tests/unit/java/com/android/server/net/NetworkStatsServiceTest.java

These files only have different package name as expected.

$ diff common/src/com/android/net/module/util/bpf/CookieTagMapKey.java service-t/src/com/android/server/net/CookieTagMapKey.java
  17c17
  <- package com.android.net.module.util.bpf;
  ---
  -> package com.android.server.net;

$ diff common/src/com/android/net/module/util/bpf/CookieTagMapValue.java service-t/src/com/android/server/net/CookieTagMapValue.java
  17c17
  <- package com.android.net.module.util.bpf;
  ---
  -> package com.android.server.net;

Bug: 237369591
Test: atest ConnectivityCoverageTests
Change-Id: Ibede81376382f0dd7a032c8c988dd84c7422eece

Hungming Chen   commited 2022-07-23 03:18:55 +08:00
ef0280288e
Merge changes If13254d4,I2424bd4f am: df9fbd37c6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2159680

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

Patrick Rohr   authored and   Automerger Merge Worker   commited 2022-07-22 15:03:11 +00:00
0978a2194d
Merge changes If13254d4,I2424bd4f
* changes:
  Sendcallback when setting eth interface up
  ethernet: add test for enable/disable interface

Patrick Rohr   authored and   Gerrit Code Review   commited 2022-07-22 14:44:34 +00:00
df9fbd37c6
Sendcallback when setting eth interface up
Fix so callbacks are sent when changing the interface link state for an
ethernet interface from down -> up.

Bug: 235605892
Test: atest FrameworksNetTests
:com.android.server.ethernet.EthernetNetworkFactoryTest

Change-Id: If13254d4882aa2f0021f6443f31ef173b3867727

James Mattis   commited 2022-07-21 21:39:52 -07:00
a199735a88
Merge "Add more NsdService tests" am: 9c8cda2335
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2129000

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

Paul Hu   authored and   Automerger Merge Worker   commited 2022-07-22 01:53:17 +00:00
7c87930abe
Merge "Add more NsdService tests"
Paul Hu   authored and   Gerrit Code Review   commited 2022-07-22 01:40:30 +00:00
9c8cda2335
Merge "Test if VpnManager event will be sent to Settings VPN or not" am: 95f801a104
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2160462

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

Lucas Lin   authored and   Automerger Merge Worker   commited 2022-07-21 22:20:16 +00:00
3b1f319294
Merge "Test if VpnManager event will be sent to Settings VPN or not"
Lucas Lin   authored and   Gerrit Code Review   commited 2022-07-21 11:05:42 +00:00
95f801a104
Test if VpnManager event will be sent to Settings VPN or not
Bug: 236315805
Test: atest FrameworksNetTests:VpnTest
Change-Id: I0ee4a70ded4937a1573d34cddab552f762e4fc18

lucaslin   authored and   Lucas Lin   commited 2022-07-21 00:58:38 +00:00
6baebebbe1