Commit graph android_packages_modules_Co.../tests/unit/java/com/android/server
Message SHA1
Merge "Replace requestNetwork with registerSystemDefaultNetworkCallback"
Lucas Lin   authored and   Gerrit Code Review   commited 2022-09-15 09:00:39 +00:00
e490cffb0a
Merge "Add a field and score flag for first evaluation"
Jean Chalard   authored and   Gerrit Code Review   commited 2022-09-15 08:56:26 +00:00
be0e453159
Merge "Remove usage for deprecated ro.radio.noril"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-09-15 06:21:49 +00:00
fc54e71b02
Merge "Test no Internet and partial connectivity notifications."
Jean Chalard   authored and   Gerrit Code Review   commited 2022-09-15 03:56:13 +00:00
76fdaf89c6
Remove usage for deprecated ro.radio.noril
The ro.radio.noril system properties is not used anymore. Tests
that require to check if device supports wifi but not telephony
should verify it via PackageManager.hasSystemFeature(). Also
remove the systemProperties mocking since the only need for the
mocking is removed.

Bug: 242647857
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: Ie34e87394458e64a9363678a863d6d977834958f

chiachangwang   commited 2022-09-14 14:08:24 +08:00
4e8b49bee4
Merge changes from topic "dump_map_status"
* changes:
  Move Interface index name map dump to NetworkStatsService
  Move stats map A/B dump to NetworkStatsService
  Add BpfInterfaceMapUpdater#getIfNameByIndex

Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-09-14 01:27:49 +00:00
9e1675d38c
Add a field and score flag for first evaluation
A wifi network that is still evaluating, i.e. that doesn't know
yet if it's behind a captive portal, should not be preferred
to a network that yields to bad wifi because the stack doesn't
know yet if it's bad.

To rank the networks correctly, the ranker will therefore need
to know whether a network is still being evaluated. This patch
adds the time when this happened first to the NAI (as a
timestamp for debuggability) and the corresponding flag in
FullScore.

This doesn't have new tests because it doesn't yet expose
new behavior. Tests will come with the behavior.

Test: FrameworksNetTests
Change-Id: I737f314760356926fc07e6eef52f3c8abba2248b

Chalard Jean   commited 2022-09-13 19:33:30 +09:00
f9f4a8ddfe
Test no Internet and partial connectivity notifications.
Test: new unit tests pass
Change-Id: I363fa3ef15476a30e7b8708a80867dd456e5e520

Chalard Jean   commited 2022-09-13 19:33:26 +09:00
4c46308265
Move Interface index name 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
....
     mIfaceIndexNameMap:
      ifaceIndex=5 ifaceName=ip6_vti0
      ifaceIndex=19 ifaceName=r_rmnet_data3
      ifaceIndex=17 ifaceName=r_rmnet_data1
      ifaceIndex=18 ifaceName=r_rmnet_data2
      ifaceIndex=23 ifaceName=wifi-aware0
....

$ dumpsys netstats
....
  BPF map content:
    ifaceIndex=5 ifaceName=ip6_vti0
    ifaceIndex=19 ifaceName=r_rmnet_data3
    ifaceIndex=17 ifaceName=r_rmnet_data1
    ifaceIndex=18 ifaceName=r_rmnet_data2
    ifaceIndex=8 ifaceName=rmnet_ipa0
....

Bug: 217624062
Test: dumpsys netstats, atest
com.android.server.net.BpfInterfaceMapUpdaterTest

Change-Id: If182bd97f72713b6347028668cf7bd4676b8aea4

Motomu Utsumi   commited 2022-09-12 16:53:51 +09:00
fdb601603d
Move stats map A/B 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
....
      mStatsMapA:
      ifaceIndex ifaceName tag_hex uid_int cnt_set rxBytes rxPackets txBytes txPackets
      20 wlan0 0x0 1051 0 144 2 312 4
      10 rmnet_data0 0x0 0 0 0 0 48 1
      20 wlan0 0x0 0 0 0 0 136 2
      20 wlan0 0xffffff82 1051 0 144 2 312 4

      mStatsMapB:
      ifaceIndex ifaceName tag_hex uid_int cnt_set rxBytes rxPackets txBytes txPackets
....

$ dumpsys netstats
....
  mStatsMapA:
    ifaceIndex ifaceName tag_hex uid_int cnt_set rxBytes rxPackets txBytes txPackets
    20 wlan0 0x0 1051 0 144 2 312 4
    10 rmnet_data0 0x0 0 0 0 0 48 1
    20 wlan0 0x0 0 0 0 0 136 2
    20 wlan0 0xffffff82 1051 0 144 2 312 4
  mStatsMapB:
    ifaceIndex ifaceName tag_hex uid_int cnt_set rxBytes rxPackets txBytes txPackets
....

Bug: 217624062
Test: dumpsys netstats, dumpstate, atest NetworkStatsServiceTest

Change-Id: Ifbd45f0ad6dd9c519a15a7680cf0ea99fb5f5dcf

Motomu Utsumi   commited 2022-09-12 16:53:48 +09:00
608c32c782
Merge "Check automotive system feature on Constructor"
Paul Hu   authored and   Gerrit Code Review   commited 2022-09-12 07:36:33 +00:00
ab32bf8aa1
Add BpfInterfaceMapUpdater#getIfNameByIndex
Upcoming CL uses this to dump stats bpf map

Bug: 217624062
Test: atest com.android.server.net.InterfaceMapValueTest
com.android.server.net.BpfInterfaceMapUpdaterTest

Change-Id: I5454b6abbd9d84cb7e1dccaaa772d66726cfe3d0

Motomu Utsumi   commited 2022-09-12 15:03:18 +09:00
95e095dd0d
Merge changes from topic "idiag_sock_id"
* changes:
  Switch SkDestroyListener based on the flag.
  Add startSkDestroyListener flag to native_init
  Add SkDestroyListenerTest

Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-09-10 02:02:11 +00:00
08ccd0d2e1
Merge "register callback to pull NetworkBpfMapInfo atom"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-09-09 08:11:37 +00:00
3dc2fb5378
register callback to pull NetworkBpfMapInfo atom
Test: statsd_testdrive 10161, atest BpfNetMaps
Bug: 217624062
Bug: 245228691

Change-Id: I630a86cb5a34aaa1810eb75b374588dba570f0ff

Motomu Utsumi   commited 2022-09-09 11:23:10 +09:00
166f966209
Merge "Split POLICY_EVER_VALIDATED_NOT_AVOIDED_WHEN_BAD into two"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-09-08 15:42:44 +00:00
3b2907e449
Split POLICY_EVER_VALIDATED_NOT_AVOIDED_WHEN_BAD into two
This flag conflates these two things, but it's a lot clearer
if they are separate and evaluated at the end.

Moreover, a new policy will make use only of one of them,
so having them separate is also useful going forward.

Test: FrameworksNetTests

Change-Id: Ia47b3974277cf76153a53d7e8a0e969c90ba78f4

Chalard Jean   commited 2022-09-08 19:41:38 +09:00
710b2893c2
Check automotive system feature on Constructor
The system feature depends on device, it will not change at runtime
basically. So do the system feature check once on NetworkAgentInfo
constructor.

Test: FrameworksNetTests CtsNetTestCases
Change-Id: I03fb8b87f5fda93286bd68ccbb23210066b0611b

Paul Hu   commited 2022-09-08 06:38:20 +00:00
00955f3d46
Merge "Open CookieTagMap in BpfNetMaps"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-09-08 05:38:27 +00:00
96c6aad70d
Open CookieTagMap in BpfNetMaps
Upcoming CL will update BpfNetMaps to pull NetworkBpfMapInfo atom that
contains the cookieTagMap size field.

Test: m, atest BpfNetMaps
Bug: 217624062
Change-Id: I84bb0aa56e3916fc6fc0ca31ba5962f3b9be4b6f

Motomu Utsumi   commited 2022-09-06 22:33:44 +09:00
b9548860a9
Switch SkDestroyListener based on the flag.
Switch existing C SkDestroyListener and new Java SkDestroyListener based
on the experiment flag.

Bug: 217624062
Test: atest SkDestroyListenerTest
Change-Id: I7031ba7c155edb43e0e7b77449587058d6ba38fb

Motomu Utsumi   commited 2022-09-06 11:23:13 +09:00
d95a0dafa8
Merge "Migrate NetworkStatsServiceTest from when().thenReturn() to doReturn().when()"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-09-05 12:20:55 +00:00
26ebf8c97a
Migrate NetworkStatsServiceTest from when().thenReturn() to doReturn().when()
This will address flakiness issues arising from the use of
when() in multithread context.

Fix: 243658074
Test: atest com.android.server.net.NetworkStatsServiceTest#testDataMigration_differentFromFallback \
      --rerun-until-failure 1000
Change-Id: I047050ef14cb60658098ff7803c6773907a92919

Junyu Lai   commited 2022-09-05 16:17:57 +08:00
bae070bf80
Merge "Fix settings show data usage with the uid of a removed package"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-09-02 07:43:55 +00:00
279733e3f5
Merge "Convert EthTrackTest from when() to doReturn()"
Jean Chalard   authored and   Gerrit Code Review   commited 2022-09-02 02:52:39 +00:00
3db58490ff
Merge "Convert booleans in NAI to timestamps"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-09-01 23:06:09 +00:00
24ca302311
Convert booleans in NAI to timestamps
These timestamps will be useful for debugging issues where
debuggers need to know what happened to long-lived networks,
where logcat doesn't span long enough.

These timestamps are also likely to be useful in the future,
in particular for metrics.

Test: FrameworksNetTests
Change-Id: I8f46ce92e2ab301fa32e18e714a43a4130719199

Chalard Jean   commited 2022-09-01 18:37:01 +09:00
254bd168a3
Convert EthTrackTest from when() to doReturn()
Bug: 242671512
Test: FrameworksNetTests
Change-Id: I5f13ebe1c1e8e1ecd3d561cae8380ec12b31dc95

Chalard Jean   commited 2022-09-01 18:02:12 +09:00
61525a57a0
Merge "Use IBpfMap type instead of BpfMap type"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-08-31 03:54:28 +00:00
171c817072
Merge "[ST01] Attributes data usage of test network by specifier"
Junyu Lai   authored and   Gerrit Code Review   commited 2022-08-30 05:50:40 +00:00
1c685c1e97
Fix settings show data usage with the uid of a removed package
When an app is removed, the stats still be included in
the persist snapshot in NetworkStatsFactory which
causes settings show the data usage with the uid of the
removed app. Thus, remove the stats of the removed
package from the persist snapshot when NetworkStatsService
receives ACTION_UID_REMOVED intent.

Bug: 239899930
Bug: 209360825
Test: FrameworksNetTests:NetworkStatsServiceTest
      FrameworksNetTests:NetworkStatsFactoryTest
Change-Id: I73cca367ac6bf0d2d29ef0a7d94500f1e6917dcb

Aaron Huang   commited 2022-08-29 22:31:26 +08:00
095438420c
Merge "unit test of offernetwork and unoffernetwork"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-29 13:59:18 +00:00
c6c4dc719f
[ST01] Attributes data usage of test network by specifier
Currently, data usage of all test networks are all attributed to
the same NetworkIdentity, which does not allow services to
distinguish upload & download traffic of different test networks.

Thus, this CL put specifier that comes along with
TestNetworkAgent into wifiNetworkKey field to build different
NetworkIdentity to attribute data usage to different for
individual networks. And allow querying test network usage with
wifiNetworkKeys.

Bug: 139774492
Test: atest FrameworksNetTests
      atest android.net.cts.ConnectivityManagerTest
Change-Id: I1bb38fd20781eaf3105735440a04b27bef36fcae

Junyu Lai   commited 2022-08-29 13:55:08 +08:00
c9f1ca62d9
Merge "Rename expect* methods that are used in NetworkStatsServiceTest"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-08-26 14:18:43 +00:00
827dbd9277
Merge "Revert "Test if VPN app can grant ACTIVATE_PLATFORM_VPN with CON...""
Lucas Lin   authored and   Gerrit Code Review   commited 2022-08-25 05:41:01 +00:00
e87c1e0187
Merge changes Id6ae7929,I70474ef5,I4958df65,Ifc0e1ba2
* changes:
  ethernet: remove callback from factory updateInterfaceLinkState
  ethernet: updateConfiguration result should not rely on ip provisioning
  ethernet: remove callback boilerplate from EthernetNetworkFactory
  ethernet: add EthernetCallback class to wrap OutcomeReceiver

Patrick Rohr   authored and   Gerrit Code Review   commited 2022-08-24 17:45:04 +00:00
f37e7c645b
Use IBpfMap type instead of BpfMap type
Currently, production code uses BpfMap type and TestBpfMap extends
BpfMap but this makes it diffcult to test because TestBpfMap loads the
JNI.

This CL updates to use IBpfMap type in the production code.
Upcoming CL updates TestBpfMap to implement IBpfMap instead of extending
BpfMap so that test can still use TestBpfMap but tests do not need to
load JNI.

Bug: 217624062
Test: atest BpfCoordinatorTest BpfNetMapsTest
Change-Id: Ie67e14bf5519fb4427474ecc0fda441877a9555f

Motomu Utsumi   commited 2022-08-24 23:31:19 +09:00
73599a5f5d
Merge "Add tests for callback visibility"
Jean Chalard   authored and   Gerrit Code Review   commited 2022-08-24 09:51:36 +00:00
38a01e080d
Merge "Add null check for clientInfo"
Paul Hu   authored and   Gerrit Code Review   commited 2022-08-24 03:54:49 +00:00
f37dfa3a11
Merge changes from topic "cookie_tag_map_raw_dump"
* changes:
  Add option to dump cookieTagMap in base64 format
  Use BpfDump#fromBase64EncodedString

Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-08-24 03:16:53 +00:00
9988869442
Merge "Decouple VpnManagerService from ConnectivityServiceTest"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-08-24 03:05:24 +00:00
cbe38b46a2
ethernet: remove callback from factory updateInterfaceLinkState
updateInterfaceLinkState already returns true / false depending on the
success, so the EthernetCallback can be removed and sent from
EthernetTracker instead.

Test: atest EthernetManagerTest
Bug: 225317892
Change-Id: Id6ae7929097840ac5c9a4d244fdf669a06b94ed5

Patrick Rohr   commited 2022-08-23 13:07:57 -07:00
750036b286
Merge "Use PerUidCounter in the connectivity static library"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-23 18:25:03 +00:00
6a8166cf5e
ethernet: updateConfiguration result should not rely on ip provisioning
In addition, the result should always be success if the new
configuration is stored. This allows updating interfaces that are not
currently registered with ethernet service.

Bug: 236312641
Test: atest EthernetManagerTest
Change-Id: I70474ef5f046c65a6f74161137e25debd8dfe612

Patrick Rohr   commited 2022-08-23 11:01:47 -07:00
ea5c6dd136
Merge "Support java BpfMap in BpfNetMaps#swapActiveStatsMap"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-08-23 04:01:30 +00:00
405d676a08
Merge "Address comments on aosp/1781202"
Jean Chalard   authored and   Gerrit Code Review   commited 2022-08-23 03:13:12 +00:00
595a98b352
ethernet: add EthernetCallback class to wrap OutcomeReceiver
The OutcomeReceiver that gets passed into the EthernetServiceImpl is
hard to use (it is nullable and both onError and onResult can throw
RemoteExceptions).

Note: This is an intermediary state.
The next step will be to completely tear EthernetCallback out of
EthernetNetworkFactory, which will remove a lot of boilerplate code.

Bug: 225317892
Test: atest EthernetManagerTest
Change-Id: Ifc0e1ba29ded933c418e4b335cb731c3496d7e44

Patrick Rohr   commited 2022-08-22 12:10:27 -07:00
251f2fcf13
Merge "Support java BpfMap in BpfNetMaps#setNetPermForUids"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-08-21 04:01:19 +00:00
618b9b0fa0
Merge "Check if VpnConfig#allowBypass is set or not"
Lucas Lin   authored and   Gerrit Code Review   commited 2022-08-19 09:13:35 +00:00
d17c5ea7f0
Rename expect* methods that are used in NetworkStatsServiceTest
These expect* methods are used to have NetworkStatsService
returns the given stats instead of expecting anything.
Therefore, give these methods more appropriate naming.

Bug: 236819091
Test: FrameworksNetTests:NetworkStatsServiceTest
Change-Id: Ife877dede5b8ac78001679792d7459764bbc38f0

Aaron Huang   commited 2022-08-18 14:34:33 +08:00
8509ef03a9