Commit graph android_packages_modules_Co.../tests/net/java
Message SHA1
Add common tests for FrameworksBaseTests and CTS
The common package covers tests that should be included both in CTS and
unit tests.

Test: atest FrameworksBaseTests
Bug: 129199908
Change-Id: Ic78ff947250871fa773252c924f1dee9395c6074
(cherry picked from commit 054e3e0f5ebfffe5d9fdd0095abac309552ae0cd)

Remi NGUYEN VAN   commited 2019-04-05 05:52:03 +00:00
fb21e4697b
Merge "Move NetworkStatsFactory into service directory"
TreeHugger Robot   authored and   Android (Google) Code Review   commited 2019-04-03 23:44:26 +00:00
76e2c02339
Move NetworkStatsFactory into service directory
In order to notify netd to swap eBPF maps before pulling the
networkStats from eBPF maps, NetworkStatsFactory need to use the
NetdServices to issue binder calls. So it need to be moved from
framework/base/core to framework/base/service since object in
framework/base/core cannot get any system services. This change is also
necessary for setting up a lock inside NetworkStatsFactory to prevent
racing between two netstats caller since the lock need to be hold before
netd trigger the map swap.

Also fix the compile problem caused by moving the NetworkStatsFactory
and the related tests. Rename the packages and the jni functions to a
more proper name.

Bug: 124764595
Bug: 128900919
Test: NetworkStatsFactoryTest
      android.app.usage.cts.NetworkUsageStatsTest
      android.net.cts.TrafficStatsTest

Change-Id: Ifcfe4df81caf8ede2e4e66a76552cb3200378fa8

Chenbo Feng   commited 2019-04-03 14:28:41 -07:00
6566d1b82f
Merge "Straighten AIDL interface for the memory store"
Chalard Jean   authored and   Android (Google) Code Review   commited 2019-04-03 19:58:46 +00:00
8aaebde014
Merge "Clean up permissions when uids are no longer used" am: 9235821478 am: 6825c65462
am: c3a583e52e

Change-Id: I7773132d11d6225eac91ab2fee1043159c295d83

Chenbo Feng   authored and   android-build-merger   commited 2019-04-03 11:03:32 -07:00
9a10bb92b7
Merge "Clean up permissions when uids are no longer used"
Treehugger Robot   authored and   Gerrit Code Review   commited 2019-04-03 17:15:48 +00:00
9235821478
Merge "Add tests for PermissionMonitor" am: 4e39721f18 am: e11632e768
am: 073ca45f14

Change-Id: Ifcb29bfded1b1675231c397ed886506a70267279

Chenbo Feng   authored and   android-build-merger   commited 2019-04-03 02:19:30 -07:00
ade2fe930a
Straighten AIDL interface for the memory store
Some names were still wrong somehow, and the wrappers were
missing.

Test: NetworkStack & FrameworkNetTests
Change-Id: I475bd011ad9bc714a07021a9dfd85c4876f8e9ad

Chalard Jean   commited 2019-04-03 15:18:08 +09:00
8472116bff
Merge "Add tests for PermissionMonitor"
Treehugger Robot   authored and   Gerrit Code Review   commited 2019-04-03 06:12:12 +00:00
4e39721f18
Clean up permissions when uids are no longer used
The kernel eBPF maps have a blacklist to store all the uids that doesn't
have internet permission. When an app is unintalled from the device and
it is the last package on device that uses that uid, make sure we
cleaned the uid from the map and do not add no longer used uids into the
eBPF map. This action helps reduce the number of entries stored in the
map and reduce the chance of overflow the eBPF map.

Bug: 128944261
Test: PermissionMonitorTest
Change-Id: I10dd0113d00d6cf9ca39902d9721f2591d387d4a

Chenbo Feng   commited 2019-04-02 20:31:57 -07:00
fe00494c97
Add tests for PermissionMonitor
Add more tests to PermissionMonitor to verify the functionality related
to INTERNET permission and UPDATE_DEVIE_STATS permission. Modified some
of the class design of PermissionMonitor so that it is easier to test
the new functionalities.

Bug: 111560570
Test: PermissionMonitorTest

Change-Id: Ic5585f337db5de48e2f87bf4f01ed7d85c349827

Chenbo Feng   commited 2019-04-02 20:31:49 -07:00
1401715e6f
Merge "Address leftover comments on 923337 and 930217." am: a9b8e31cf8 am: bc8ca075ef
am: 6106d1e017

Change-Id: I75eadb66c81d72c768e77feddd383d60f8accd65

Paul Hu   authored and   android-build-merger   commited 2019-04-02 01:29:08 -07:00
6aeeca832f
Merge "Address leftover comments on 923337 and 930217."
Paul Hu   authored and   Gerrit Code Review   commited 2019-04-02 07:39:04 +00:00
a9b8e31cf8
Merge "Fix IpPrefixTest#testContainsInetAddress fail." am: 9c58ddc48e am: b9cffc513e
am: 736189fc88

Change-Id: I9e74dc9bf30a53ce78395e502a52891ba488f4b1

Paul Hu   authored and   android-build-merger   commited 2019-04-01 19:24:38 -07:00
777b96dcad
Fix IpPrefixTest#testContainsInetAddress fail.
The argument of IpPreFix#contains() has been marked as @NonNull.
So the IpPrefixTest#testContainsInetAddress should not test
contains() method wiht null object.

Bug: None
Test: atest FrameworksNetTests
      atest IpPrefixTest#testContainsInetAddress

Change-Id: I2f6bee19514dc47702f64d2a2bbf02d8b7b1b407

paulhu   commited 2019-04-02 00:49:00 +08:00
207037a243
Merge "Add DHCP address lease expiry in IpMemoryStore." am: 98aa76e2e8 am: bdb1f90f32
am: 77bd196428

Change-Id: Ib09ee6a702fb25a682d4782a8822237ebb9a0dfb

Xiao Ma   authored and   android-build-merger   commited 2019-04-01 06:35:34 -07:00
2476c3f532
Merge "Add DHCP address lease expiry in IpMemoryStore."
Xiao Ma   authored and   Gerrit Code Review   commited 2019-04-01 12:59:20 +00:00
98aa76e2e8
Address leftover comments on 923337 and 930217.
- Restrict unprivileged apps to use
  NetworkRequest.Builder#setSignalStrength.

- Remove the "throws NullPointerException" in
  CaptivePortalProbeSpec constructor.

- Remove the null check in LinkProperties.

- Add annotataion into all ConnectivityManager.NetworkCallback
  methods.

Change-Id: Id275cac1d6a30d7515cd7b113394f5e8a0179314
Fix: 129097486
Test: atest FrameworksNetTests

paulhu   commited 2019-04-01 16:24:10 +08:00
1a40765101
Merge "Fix race when starting NetworkMonitor" am: ef8485cc65 am: ea71c49a0e
am: 3a8102ab8e

Change-Id: I595ecdbf0b8e91fec4287c3476239a1e6c9c80a7

Remi NGUYEN VAN   authored and   android-build-merger   commited 2019-03-31 21:35:25 -07:00
c8f93bca44
Merge "Fix race when starting NetworkMonitor"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2019-04-01 03:54:03 +00:00
ef8485cc65
Fix race when starting NetworkMonitor
NetworkMonitor obtained LinkProperties and NetworkCapabilities via
synchronous calls to ConnectivityManager after receiving an asynchronous
notification, which is prone to races: the network could be gone before
the LinkProperties/NetworkCapabilities can be fetched.

Fix the race by passing LinkProperties/NetworkCapabilities directly to
NetworkMonitor in the asynchronous notifications.

Test: atest FrameworksNetTests NetworkStackTests
Test: booted, WiFi works
Bug: 129375892
Change-Id: I200ac7ca6ff79590b11c9be705f650c92fd3cb63

Remi NGUYEN VAN   commited 2019-04-01 11:33:10 +09:00
ca33d197d9
Merge "Use IDnsResolver instead of INetd for resolver related binder commands" am: efa4301a7f am: 8ef15888a5
am: 068f305fc7

Change-Id: I2d642b71df25934fddd8a1476b5d27457628b8e2

Luke Huang   authored and   android-build-merger   commited 2019-03-29 02:24:24 -07:00
bd2a4be755
Merge "Use IDnsResolver instead of INetd for resolver related binder commands"
Luke Huang   authored and   Gerrit Code Review   commited 2019-03-29 08:45:19 +00:00
efa4301a7f
Add DHCP address lease expiry in IpMemoryStore.
Bug:122710829
Test: atest FrameworksNetTests
Change-Id: I643fe1231edcd18923514ab66c64a6cf83e69443

Xiao Ma   commited 2019-03-29 16:51:47 +09:00
3c33ee5d81
Merge changes from topic "vpn_data_accounting"
* changes:
  Move BatteryStats and StatsCompanionService to use NetworkStatsService.
  NetworkStatsService: Fix getDetailedUidStats to take VPNs into account.
  Take all VPN underlying networks into account when migrating traffic for VPN uid.

Varun Anand   authored and   Gerrit Code Review   commited 2019-03-29 00:40:53 +00:00
06b4b6f92e
NetworkStatsService: Fix getDetailedUidStats to take VPNs into account.
This API is similar to one provided by NetworkStatsFactory with the
difference that NSS also migrates traffic from VPN UID to other apps.

Since traffic can only be migrated over NetworkStats delta, NSS
therefore maintains NetworkStats snapshot across all UIDs/ifaces/tags.

This snapshot gets updated whenever NSS records a new snapshot
(based on various hooks such as VPN updating its underlying networks,
network getting lost, etc.), or getDetailedUidStats API is invoked by
one of its callers.

Bug: 113122541
Bug: 120145746
Test: atest FrameworksNetTests
Test: manually verified that battery stats are migrating traffic off of
TUN (after patching above CL where we point BatteryStats to use this
API).
Change-Id: Ib0f0c2d4d41ee1d7a027ea9da457baaf198d649e

Varun Anand   commited 2019-03-28 10:31:51 -07:00
2af0b66aba
Take all VPN underlying networks into account when migrating traffic for
VPN uid.

Bug: 113122541
Bug: 120145746
Test: atest FrameworksNetTests
Test: Manually verified on device that stats from VPN UID are moved
      appropriately based on its declared underlying network set.
Test: vogar --mode app_process --benchmark NetworkStatsBenchmark.java

Change-Id: I9d8d0cc58d18002c1c96f8ddff780ef8dc452d21

Varun Anand   commited 2019-03-28 10:31:49 -07:00
612520f544
Merge changes I0baf582f,I4bba01ba am: 6d7c97dc5c am: a0540419f9
am: 7fd6b91b04

Change-Id: I2cc021899270b41e4b9047ef32869af53ea6fb65

Junyu Lai   authored and   android-build-merger   commited 2019-03-27 18:43:18 -07:00
bf7917290e
Merge changes I0baf582f,I4bba01ba
* changes:
  Block unpriviledged apps which create keepalives with null fd
  Fix keepalive don't get removed when lower layer error

Junyu Lai   authored and   Gerrit Code Review   commited 2019-03-28 00:53:20 +00:00
6d7c97dc5c
Block unpriviledged apps which create keepalives with null fd
Currently, socketKeepalive implementation is accepting null fd
due to backward compatibility with legacy packet keepalive API.
However, due to lack of the fd, the service cannot guarantee the
port is not reused by another app if the caller release the port
for any reason.

Thus, grant the null fd access only for priviledged apps.

This commit also address some comments from aosp/918533.

Bug: 126699232
Test: atest FrameworksNetTests
Change-Id: I0baf582ff4ca8af6082c3754e8dfbcd867f39792

junyulai   commited 2019-03-27 19:51:08 +08:00
828dad188c
Use IDnsResolver instead of INetd for resolver related binder commands
migrate resolver related commands from INetd to IDnsResolver

Bug: 126141549
Test: atest FrameworksNetTests ConnectivityServiceTest Nat464XlatTest
      atest DnsManagerTest
Change-Id: I559c0c1304d53dde408c062e1a52e742595e7cbe

Luke Huang   commited 2019-03-27 17:39:07 +08:00
8141319b4d
Merge "Fix flaky test for ConnectivityServiceTest#testPartialConnectivity" am: 52feef4450 am: b7977acec0
am: 5ae1bff2bf

Change-Id: I80399f9980119342ba5cd3d4f1922badb1fee3e9

Lucas Lin   authored and   android-build-merger   commited 2019-03-26 19:00:50 -07:00
63c0ac9f45
Merge "Fix flaky test for ConnectivityServiceTest#testPartialConnectivity"
Lucas Lin   authored and   Gerrit Code Review   commited 2019-03-27 01:29:51 +00:00
52feef4450
Fix flaky test for ConnectivityServiceTest#testPartialConnectivity
There are 2 problems will make testPartialConnectivity flaky:
1. If we call setNetworkValid() before expectCapabilitiesWith(),
there may be a timing issue that network will become VALID before
NetworkMonitor send PARTIAL_CONNECTIVITY to ConnectivityService.
Solution:
We should set network to valid after ConnectivityService received
NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY to ensure NetworkMonitor
will send PARTIAL_CONNECTIVITY to ConnectivityService first then
send VALID.

2. When test case call explicitlySelected(true) first then call
connect(true), NetworkMonitor will report the network validation
test result twice because ConnectivityServiceTest() will trigger
notifyNetworkTested() when setAcceptPartialConnectivity() is
called, it may cause a timing that before the second test result
send to ConnectivityService, connect() already called
setNetworkInvalid. So, NET_CAPABILITY_VALIDATED will be removed
and ConnectivityService will trigger onCapabilitiesChanged()
unexpectedly.
Solution:
Don't trigger notifyNetworkTested() when
setAcceptPartialConnectivity() is called. If there is needed,
use mCm.reportNetworkConnectivity() to report the test result
instead.

Bug: 128426024
Test: 1. atest FrameworksNetTests: \
      ConnectivityServiceTest#testPartialConnectivity \
      --generate-new-metrics 1000

Change-Id: I7200528378201a3c7c09a78ff827b41f2741dfa1

lucaslin   commited 2019-03-26 17:49:49 +08:00
9df5336349
Merge "Reveal the call trace of failed test cases which run in executors" am: 67cfb00800 am: ff5f8defa6
am: e674483e9f

Change-Id: I023c8140c94966479db7f12647838699324462af

Junyu Lai   authored and   android-build-merger   commited 2019-03-26 00:13:47 -07:00
b8368cc806
Merge "Reveal the call trace of failed test cases which run in executors"
Junyu Lai   authored and   Gerrit Code Review   commited 2019-03-26 06:38:39 +00:00
67cfb00800
Merge "[TCPKeepalive] Fill correct TOS and TTL value" am: 13cc9e442e am: 52ffa51e7f
am: 73062f4600

Change-Id: I80c56a14a0be2e6b7996f2bcb9a1a320f0c2c058

Mark Chien   authored and   android-build-merger   commited 2019-03-25 06:44:17 -07:00
f2a195cad0
Merge "[TCPKeepalive] Fill correct TOS and TTL value"
Mark Chien   authored and   Gerrit Code Review   commited 2019-03-25 13:10:17 +00:00
13cc9e442e
Reveal the call trace of failed test cases which run in executors
Currently, the fails in testTcpSocketKeepalives are triggered by
fail() inside the executor, which is hiding the actual call trace
but only message remains. And it made the fail case hard to
debug.

So this commit is to bubble up the Exception by using a custom
functional interface.

Bug: 123987272
Test: 1. atest FrameworksNetTests
      2. manually fail the test case and see the call trace

Change-Id: I125e673938a5e9d1de86f83c1a732227a4bd3207

junyulai   authored and   Junyu Lai   commited 2019-03-25 12:56:47 +00:00
c3106feee7
Merge "Fix SocketKeepalive APIs which do not meet API review requirement" am: 66bc22760a am: 7246f1a563
am: 0f69af35db

Change-Id: I873a82de90efce6f3baa17761c0576dc9c8210be

Junyu Lai   authored and   android-build-merger   commited 2019-03-25 04:16:18 -07:00
40ad433f92
Fix SocketKeepalive APIs which do not meet API review requirement
Per API review, change the use of FileDescriptor to
ParcelFileDescriptor.
This change also fix nullability according to API review
feedbacks.

Fix: 126698610
Fix: 126699425
Fix: 126699232
Fix: 126700278

Test: 1. m -j
      2. atest FrameworksNetTests --generate-new-metrics 50
      3. m -j doc-comment-check-docs
Change-Id: I19476c50dd1ca290bf3f41973829da2bd229796a

junyulai   commited 2019-03-25 15:56:35 +08:00
7e06ad4ce9
[TCPKeepalive] Fill correct TOS and TTL value
Fill correct TOS/TTL value by fetching them from kernel with
getsockopt.

bug: 123967966
Test: -build, flash, boot
      -atest FrameworksNetTests

Change-Id: I75b1be51040b4a381163958b4cddd27dbb22bac1

markchien   commited 2019-03-25 11:14:57 +08:00
b5a2b8076a
Merge "Fix Automated API Review issues." am: acb5eca325 am: f1f3b08982
am: affa3f497d

Change-Id: Iba1630161579571d4975aba9bbd5c767f82c8a98

Paul Hu   authored and   android-build-merger   commited 2019-03-21 11:54:51 -07:00
2e2bc9c173
Merge "Fix Automated API Review issues."
Paul Hu   authored and   Gerrit Code Review   commited 2019-03-21 17:19:26 +00:00
acb5eca325
Merge "Temporarily disable flaky test." am: a7f5cf3adb am: d7a9e6da54
am: 70cb4b5281

Change-Id: I583ed9aa0e42e864ef0c1e74fbcd9357e093cc25

lucaslin   authored and   android-build-merger   commited 2019-03-21 08:39:31 -07:00
ea54b7ef6b
Merge "Temporarily disable flaky test."
Treehugger Robot   authored and   Gerrit Code Review   commited 2019-03-21 15:04:15 +00:00
a7f5cf3adb
Merge "Replace TcpSocketInfo with similar structure" am: a460377cf9 am: bee0fa077b
am: 846e87b170

Change-Id: I9b51e6905245ada2707ef7498cc1b8e4cb4c69a0

Mark Chien   authored and   android-build-merger   commited 2019-03-21 05:35:15 -07:00
3fd041d2ec
Merge "Replace TcpSocketInfo with similar structure"
Mark Chien   authored and   Gerrit Code Review   commited 2019-03-21 12:02:54 +00:00
a460377cf9
Temporarily disable flaky test.
Test: None
Bug: 128426024
Change-Id: I6fa12e50decbafe9d934030865c5a8f20d42b86f

lucaslin   commited 2019-03-21 19:14:32 +08:00
3bc80ae915
Merge "Cleanup NetworkManagementService for Netd commnads binder migrartion" am: df7d47d182 am: 17745f6602
am: 063cfac0f0

Change-Id: Ib6730d87eeebcd82964feeb96d12c09ae652d0d5

Luke Huang   authored and   android-build-merger   commited 2019-03-20 23:40:30 -07:00
1f5862ef2a