Commit Graph

1122 Commits

Author SHA1 Message Date
Xiao Ma
ace5b3635b Merge "Remove filegroup connectivity-module-utils-srcs in connectivity." am: 7f15ce1d9c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2153736

Change-Id: Idd2df16857eab2f7b7e7a971f876c36531fcb736
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-12 09:24:40 +00:00
Xiao Ma
7f15ce1d9c Merge "Remove filegroup connectivity-module-utils-srcs in connectivity." 2022-08-12 09:06:58 +00:00
Paul Hu
36b1e1eefc Merge changes I1cf472bd,Ibdaf2b23,I6967ad6f,I65f522c2,I0f220d1f, ... am: a3340c1355
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2001790

Change-Id: I1ab803bf751ef4dcb76c07d71ff6acd7873a2b60
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-10 02:17:26 +00:00
Paul Hu
a3340c1355 Merge changes I1cf472bd,Ibdaf2b23,I6967ad6f,I65f522c2,I0f220d1f, ...
* changes:
  Make the temporary NC sanitized instead of inlining
  Remove the legacy int from FullScore.
  Remove accessors for legacy int score from NAI
  Log the creation time of network agents
  Show time taken by the rematch
  Address some IDE warnings in ConnectivityService
  Copy arguments from NetworkAgent registration early
2022-08-10 01:41:43 +00:00
Paul Hu
69213fd19c Merge "Force specifying sanitized/not sanitized in caps from agent" am: 1896d713cc
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2001256

Change-Id: Idb21a047bbf6566dcdbb603828e5460aaaab983c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-09 09:35:31 +00:00
Chiachang Wang
6135c3b4ba Merge "Stop calling setAlwaysOnPackage from VpnManagerService" am: 588e1bde6f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2174906

Change-Id: I82ab007bd5bdadadf4555770cdb40dc048db0bd6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-09 09:35:19 +00:00
Paul Hu
1896d713cc Merge "Force specifying sanitized/not sanitized in caps from agent" 2022-08-09 09:16:21 +00:00
Chiachang Wang
588e1bde6f Merge "Stop calling setAlwaysOnPackage from VpnManagerService" 2022-08-09 09:02:50 +00:00
Chiachang Wang
ef3f9de521 Merge "Verify lock down related flows" am: f575c79c01
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2146966

Change-Id: I3f34d818bdac868ae4e9e259d9f7c272d634a9d0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-08 01:13:33 +00:00
Chiachang Wang
f575c79c01 Merge "Verify lock down related flows" 2022-08-08 00:52:04 +00:00
chiachangwang
3797f878ac Stop calling setAlwaysOnPackage from VpnManagerService
To decouple VpnManagerService from ConnectivityServiceTest, stop
calling setAlwaysOnPackage from VpnManagerService as a
preparation for the follow up changes. Update it to equivalent
calls from Vpn directly.

The VpnManagerService variable is still needed because tests
have indirect calls via sending intent to update the lock
down behavior.

Bug: 230548427
Test: atest ConnectivityServiceTest
Change-Id: Ib78ac8173b2a4d2a8e9845e943eb63d79c36218c
2022-08-08 00:50:54 +00:00
Aaron Huang
4705518156 Merge "Cleanup constructor of NetworkStats#Entry" am: 0ab4d265d6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2167482

Change-Id: Ie9dfc1e735af3842a40b31015bd90f09d2038cdc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-05 08:37:59 +00:00
Aaron Huang
0ab4d265d6 Merge "Cleanup constructor of NetworkStats#Entry" 2022-08-05 07:46:28 +00:00
chiachangwang
7b8b264315 Verify lock down related flows
This commit verifies the lock down related flows:
- When a user present
- When lock down is reset
- Create LockdownVpnTracker
- isVpnLockdownEnabled(int)
- getVpnLockdownAllowlist(int)

Bug: 230548427
Test: atest VpnManagerServiceTest
Change-Id: Ic42d884b64d2c7ec0caf9dff95d94fc5e52456b2
2022-08-05 02:00:16 +00:00
Treehugger Robot
eea540837c 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>
2022-08-04 10:25:20 +00:00
Treehugger Robot
bdedaacd88 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.
2022-08-04 09:50:53 +00:00
Chalard Jean
39b12d4b8f Force specifying sanitized/not sanitized in caps from agent
To make sure anyone using the capabilities originally from
the agent have to know what they're dealing with, make the
member private and make accessors that spell out explicitly
the important parts.

This is the last step towards addressing the leftover
comment from aosp/1958906.

Bug: 238139913
Test: FrameworksNetTests CtsNetTestCases
Change-Id: I9fc1986c59726212acfc2ad921745c8bbc424035
2022-08-04 06:45:39 +00:00
Chalard Jean
0158fe9fd1 Remove the legacy int from FullScore.
This is a nice cleanup and will clear misunderstandings where
people mistakenly look at it in the logs.
Unfortunately it can't be removed from NetworkScore because there
are public APIs, and it's even used to transmit invincibility in
a legacy spur.

Bug: 238139913
Test: ConnectivityServiceTest
Change-Id: Ibdaf2b235b994383d5f8f42f1780b04bda80c93a
2022-08-04 06:45:39 +00:00
Chalard Jean
aa5bc624f6 Remove accessors for legacy int score from NAI
These are no longer useful. Also, NAI no longer needs to
be comparable, and it should no longer be – comparing 2
NAIs only make sense in the context of a specific request.

Bug: 238139913
Test: ConnectivityServiceTest IpConnectivityMetricsTest
Change-Id: I6967ad6f08380213c29f3d47d6422f8bbea1946c
2022-08-04 06:45:39 +00:00
Motomu Utsumi
4f6d11e04f 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>
2022-08-03 12:07:51 +00:00
Motomu Utsumi
31b48fa787 Merge changes I71988117,Ia70379a3
* changes:
  Move app uid stats map dump to NetworkStatsService
  Move uid counter set map dump to NetworkStatsService
2022-08-03 11:34:39 +00:00
Xiao Ma
6014237340 Remove filegroup connectivity-module-utils-srcs in connectivity.
Once moving NetworkMonitorUtils to frameworks/libs/net is done, we can
remove the connectivity-module-utils-srcs filegroup from connectivity
module, instead import it from net-utils-device-common lib.

Bug: 238960524
Test: atest ConnectivityCoverageTests
Change-Id: Ic1464a4c32d7c22ca7916e8f298ff1a09b71ce46
2022-08-03 18:16:48 +09:00
Lorenzo Colitti
54eae6c348 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
2022-08-03 17:29:01 +09:00
Motomu Utsumi
624564babc 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>
2022-08-03 08:10:18 +00:00
Motomu Utsumi
e441f7025c Merge "Move cookie tag bpf map dump to NetworkStatsService" 2022-08-03 07:43:13 +00:00
Aaron Huang
0eb2c79982 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>
2022-08-03 02:41:35 +00:00
Aaron Huang
28a690dc79 Merge "Fix flaky testNotifyNoInternetAsDialogWhenHighPriority" 2022-08-03 02:22:55 +00:00
Aaron Huang
8b9ecdad6d Cleanup constructor of NetworkStats#Entry
Have all callers to use the same constructor and remove the
unused constructors.

Bug: 238843364
Test: FrameworksNetTests
Change-Id: Ieb1d0bc4ff8d2238c7a802189f8d91f4a9978eb8
2022-08-02 22:49:16 +08:00
Treehugger Robot
99aaa9a6e0 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>
2022-08-02 12:14:36 +00:00
Treehugger Robot
7dce599f42 Merge "Update VpnTest to use VpnNetworkAgentWrapper" 2022-08-02 12:08:13 +00:00
Motomu Utsumi
b8dd98e4d1 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
2022-08-02 09:41:46 +00:00
Motomu Utsumi
7013b92a22 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
2022-08-02 09:41:23 +00:00
Motomu Utsumi
cedfab91c6 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
2022-08-02 09:41:03 +00:00
Treehugger Robot
35a1feb7d1 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>
2022-08-02 07:08:19 +00:00
Treehugger Robot
2719dc8682 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.
2022-08-02 06:49:46 +00:00
Junyu Lai
907e49867c 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>
2022-08-02 05:50:14 +00:00
Junyu Lai
2dba76105c Merge changes Id2a6bfdf,I5cab2b78
* changes:
  Remove qtaguid support in NetworkStatsFactory
  Refactor NetworkStatsFactoryTest
2022-08-02 05:32:45 +00:00
Lorenzo Colitti
db04c60658 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
2022-08-02 09:52:51 +09:00
Lorenzo Colitti
410d4e18b0 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
2022-08-02 09:52:51 +09:00
Lorenzo Colitti
b82e25c51b 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
2022-08-01 18:42:24 +09:00
Aaron Huang
7fcbc2ecbd 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
2022-08-01 08:20:35 +00:00
Remi NGUYEN VAN
a5803006e9 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>
2022-07-29 08:41:54 +00:00
Remi NGUYEN VAN
a39d54bf43 Merge "Add back compat config for NSD" 2022-07-29 08:09:54 +00:00
Junyu Lai
e9f8d8516c 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
2022-07-29 16:00:29 +08:00
junyulai
8c77e385bd 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
2022-07-29 15:46:18 +08:00
Motomu Utsumi
76e3be3f4f 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>
2022-07-28 12:58:10 +00:00
Motomu Utsumi
f688eeb10a 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
2022-07-28 02:32:41 +00:00
Yan Yan
bbb586d7f1 Update VpnTest to use VpnNetworkAgentWrapper
Bug: 192077544
Test: atest VpnTest
Change-Id: Id0be4c4f2c9eba6cb7445d5c5ea4889165971317
2022-07-28 00:40:02 +00:00
Motomu Utsumi
edbe05a67f 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>
2022-07-27 13:32:36 +00:00
Motomu Utsumi
6bcb3c290c Merge "Use java BpfMap in BpfNetMaps#replaceUidChain" 2022-07-27 13:21:50 +00:00