Commit graph android_packages_modules_Co.../tests/net/java
Message SHA1
Move the test of minimum supported keepalive slots to CTS
This change also enables log when keepalive is started.

Bug: 134352656
Test: 1. atest android.net.cts.ConnectivityManagerTest#testSocketKeepaliveLimitTelephony
      2. atest FrameworksNetTests
Change-Id: I408750fa0bceb0c1c26afb5fead4e44fb824fbc1

junyulai   commited 2019-06-19 16:25:19 +08:00
c7fc2f7745
Add one more test for VPN usage stats.
(cherry picked from commit 54bb4f4608)

Covers the case where the majority of traffic through the VPN is
caused by the VPN app itself, and ensures that that traffic is
correctly attributed to the VPN app as opposed to spread between
the other apps that use the VPN.

Bug: 120145746
Test: atest NetworkStatsServiceTest
Change-Id: Ibd7646dc088fa4180abd696e89c3148ff34ce190
Merged-In: Iffd3f95fc2e11d311691a797b010edb38d2ef3c6

Lorenzo Colitti   authored and   Varun Anand   commited 2019-05-30 15:59:28 +00:00
e13b3791a0
Addressing comments for http://ag/7700679.
(cherry picked from commit 8031acad0e)

Note, that its in a separate CL so we could cherry-pick this CL to aosp.
http://ag/7700679 is already in aosp (http://aosp/865073).

Bug: 113122541
Bug: 120145746
Test: atest FrameworksNetTests

Change-Id: Ic1767bc8bf1460e4223f86465fc72344428e6055
Merged-In: I7cfda226b4ed11b67002b83b38fba0f5caf96718

Varun Anand   commited 2019-05-30 15:59:07 +00:00
ab4f831229
Merge "Always give VPN the INTERNET capability."
Chalard Jean   authored and   Gerrit Code Review   commited 2019-05-30 08:36:19 +00:00
a24f3216be
Always give VPN the INTERNET capability.
Split-tunnel VPN (which are the only ones affected by this change)
always fall through to the default network for routes they don't
handle, and even if the underlying network(s) don't provide access
this may be a pinhole that can actually reach the broader network.

In practice this behaves like the original release of P and is the
safest thing to do for Q. In R we should evaluate giving the VPN
app the ability to simply tell the network stack whether it does
provide Internet access or not.

Bug: 119216095
Test: FrameworksNetTests NetworkStackTests
Change-Id: I262ca41fe0225660551c9a421562405366b6acac

Chalard Jean   commited 2019-05-30 16:11:14 +09:00
16da69ea0e
Merge "NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions"
Chen Xu   authored and   Gerrit Code Review   commited 2019-05-29 17:15:41 +00:00
43b5e55334
Merge "Add a common test library."
Chalard Jean   authored and   Gerrit Code Review   commited 2019-05-29 12:16:08 +00:00
aa6821b805
NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions
Bug: 133236378
Test: Manual
Change-Id: I49fbde1fe73b33aadcf8fd23ad224f363b137bf3

chen xu   commited 2019-05-28 23:28:56 -07:00
38b98ab27c
Minor changes for DnsUtils and its test
fix nits for ag/7671031

Bug: 129530368
Test: atest DnsUtilsTest
Change-Id: I562d33870a933a5fe55c89137a2d9574e3c59b90

Luke Huang   commited 2019-05-29 13:56:27 +08:00
cda76a7ad9
Add a common test library.
This is the most common test library for Connectivity tests. It is
meant to be usable in framework tests, network stack tests, CTS,
GTS. To achieve that, it can only depend on framework classes.

Bug: none
Test: NetworkMonitorTest
Test: NsdManagerTest
Test: ConnectivityServiceTest
Test: OffloadControllerTest
Test: NetworkStatsObserversTest
Test: NetworkStatsServiceTest
(all the touched classes)

Change-Id: Ic47cbe7ba0e407145fa6bc49bb2adb3c5937dbc4

Chalard Jean   commited 2019-05-28 22:20:51 +09:00
d5cae6a6e4
Merge "Let the system server have CONNECTIVITY_USE_RESTRICTED_NETWORKS."
Chalard Jean   authored and   Gerrit Code Review   commited 2019-05-28 12:26:10 +00:00
2ada647c37
Merge "Wipe the data in IpMemoryStore database upon network factory reset."
Xiao Ma   authored and   Gerrit Code Review   commited 2019-05-28 00:52:00 +00:00
7aaf1b6710
Remove broken test testRfc6724Sort
This test is conitnuely fail in cuttlefish.
Lack of ipv6 default route in cuttlefish caused the test failed.
The reason is that the result of rfc6724Sort depends on on the route in system.
It is not good to expect any route should exists, so remove it.

Bug: 133649648
Test: atest DnsUtilsTest
Change-Id: I91f89782b9b989fa1a49e666bb5ce2df3a0dbbf7

Luke Huang   commited 2019-05-27 17:49:32 +08:00
686f558f38
Let the system server have CONNECTIVITY_USE_RESTRICTED_NETWORKS.
Also :
- Fix testUidFilteringDuringVpnConnectDisconnectAndUidUpdates that
  was failing on devices with a first released SDK >= Q
- Add a test actually tests that the system has the permission, as
  the test was only testing what's in the mock

Bug: 119770201
Test: New test making sure this stays true
Change-Id: I74cf5f0fa17fcf818f1fed78c7e3e4375c20152e

Chalard Jean   commited 2019-05-27 16:35:22 +09:00
030a3c7c37
Wipe the data in IpMemoryStore database upon network factory reset.
Bug:128499160
Test: manual
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: Ib563463a861a5d27b1e9b5fbb92342249b573802

Xiao Ma   commited 2019-05-27 15:05:09 +09:00
5141006a28
Clean up for multiple validation result update
This is a follow-up commit for aosp/955431 to update commets
and minor updates in unit test.

Test: atest com.android.server.ConnectivityServiceTest#testCaptivePortalOnPartialConnectivity
Bug: 130683832
Change-Id: I581eae8daeddd2c4c186e7b40e27fef2aaa7ab43

Chiachang Wang   commited 2019-05-24 03:29:56 +00:00
59d7d2957f
Merge "Update multiple validation result to ConnectivityService"
Chiachang Wang   authored and   Gerrit Code Review   commited 2019-05-24 02:50:54 +00:00
7eff27b409
[CM] Fix NPE due to unvalidated callback value
Fix flaky test resulting from the above fix.

Bug: 132950880
Test: atest ConnectivityServiceTest
Change-Id: I1ddf3bb016239bf88cdd8843a71dcb5e582e83ac

Etan Cohen   commited 2019-05-23 08:16:20 -07:00
bcf0006ff7
Update multiple validation result to ConnectivityService
Once a network is determined to have partial connectivity, it
cannot go back to full connectivity without a disconnect. This
is because NetworkMonitor can only communicate either
PARTIAL_CONNECTIVITY or VALID, but not both. Thus, multiple
validation results allow ConnectivityService to know the real
network status.

Bug: 129662877
Bug: 130683832
Test: atest FrameworksNetTests
Test: atest NetworkStackTests
Test: atest --generate-new-metrics 50
NetworkStackTests:com.android.server.connectivity.NetworkMonitorTest
Test: Simulate partial connectvitiy
Change-Id: I406c9368617c03a2dd3ab15fb1f6dbf539d7c714

Chiachang Wang   commited 2019-05-23 16:29:30 +08:00
9cfa6fe703
Add Rfc6724 style sort for DnsResolver and fix potential bug
1. pass default network explicitly to fix potential
   mis-sync network problem in DnsResolver#query
2. Add rfc6724 sort and related test
3. DnsResolver do rfc6724 sort before response InetAddress answers
4. move haveIpv* function from DnsResolver to DnsUtils

Bug: 129530368
Test: atest DnsResolverTest DnsUtilsTest
Change-Id: I4efa599c0605f6a9e4ef2dd1a36572c69b3c433f

Luke Huang   commited 2019-05-23 11:23:41 +08:00
f9a84cd530
[CM] Fix NPE due to unvalidated callback value
When unregistering callback due to ON_UNAVAILABLE did not check for
a non-null callback.

Bug: 132950880
Test: atest ConnectivityServiceTest
Change-Id: I8f3322963f322e6690f1403681bf66e8b38b35f8

Etan Cohen   commited 2019-05-22 04:56:09 +00:00
bc3a4eb54c
Merge "Clean up the permission control code in framework"
Treehugger Robot   authored and   Gerrit Code Review   commited 2019-05-13 18:04:50 +00:00
2ecbe8b8b1
Merge "Clean up the arguments annotation and verify items on IpMemoryStoreTest."
Xiao Ma   authored and   Gerrit Code Review   commited 2019-05-10 15:16:33 +00:00
51aef6fe7b
Merge "Support strict mode private DNS on VPNs that provide Internet."
Chalard Jean   authored and   Gerrit Code Review   commited 2019-05-10 09:39:17 +00:00
faf2bd1a23
Clean up the arguments annotation and verify items on IpMemoryStoreTest.
Bug: 131133347
Test: atest FrameworksNetTests
Change-Id: I371e7b637ab1c2671f0378508b06adff174f024d

Xiao Ma   commited 2019-05-10 15:42:33 +09:00
b05101d4a5
Merge changes Ibcb91105,I0218f367
* changes:
  Limit unprivileged keepalives per uid
  Support customization of supported keepalive count per transport

Junyu Lai   authored and   Gerrit Code Review   commited 2019-05-10 05:47:23 +00:00
c797cf56ca
Support strict mode private DNS on VPNs that provide Internet.
Currently, strict mode private DNS does not work on VPNs because
NetworkMonitor does not validate VPNs. When a VPN connects, it
immediately transitions to ValidatedState, skipping private DNS
hostname resolution.

This change makes NetworkMonitor perform private DNS hostname
resolution and evaluation even on VPNs.

In order to ensure that the system always immediately switches to
the VPN as soon as it connects, remove the unvalidated penalty
for VPN networks. This ensures that the VPN score is always 101
and the VPN always outscores other networks as soon as it
connects. Previously, it would only outscore other networks
when no-op validation completed.

Bug: 122652057
Test: atest FrameworksNetTests NetworkStackTests
Test: manually ran a VPN with private DNS in strict mode
atest android.net.cts.ConnectivityManagerTest com.android.cts.net.HostsideVpnTests
Change-Id: Iaa78a7edcf23755c89d7b354edbc28d37d74d891

Lorenzo Colitti   commited 2019-05-10 14:30:54 +09:00
ac456b2f36
Merge changes Ibff278a6,If6d537a3
* changes:
  Revert "Add NATT keepalive resources and methods into IpSecService"
  Revert "[KA11] Verify fd ownership and allocate resource for NattKeepalive"

Treehugger Robot   authored and   Gerrit Code Review   commited 2019-05-10 01:42:26 +00:00
6eaf680338
Revert "Add NATT keepalive resources and methods into IpSecService"
This reverts commit cece56e3ce.

Reason for revert: Adds dependency between IpSecService and
                   ConnectivityService may lead to future deadlock
		   problems. Uses a simpler approach instead,
		   hence the solution is not needed.
		   See aosp/954040.

Change-Id: Ibff278a6eee666cd85dba81c2bed94d568679b02

Junyu Lai   authored and   junyulai   commited 2019-05-10 00:58:18 +08:00
23409e34b4
Support customization of supported keepalive count per transport
This change specifies the required minimum supported keepalives
in SDK, and allows OEMs to customize supported keepalive count
per network through resource overlay.

Bug: 129371366
Test: 1. m -j doc-comment-check-docs
      2. atest FrameworksNetTests

Change-Id: I0218f3674628c13ead63fc9a873895ba7f113033

junyulai   commited 2019-05-10 00:36:58 +08:00
15e26fb485
Merge "adopt non-blocking method to obtain the IpMemoryStore service."
Xiao Ma   authored and   Gerrit Code Review   commited 2019-05-09 11:30:56 +00:00
6c6c6272dd
[CS] Unregister callback as part of onUnavailable dispatch
The onUnavailable semantics promise that it is equivalent to calling
the unregister callback method. But - it doesn't unregister the callback
allowing it to be reused. Fixed.

Additionally, modified the unregisterNetworkCallback method to not fail
on duplicate unregistration (since a callback could now self
unregister). Instead simply print a log.

Bug: 130651445
Test: atest ConnectivityServiceTest
Change-Id: I4c54b003a733eb0b1e4fd8674ed13081b1bef8e3

Etan Cohen   commited 2019-05-09 02:41:40 +00:00
e0e2ca979c
adopt non-blocking method to obtain the IpMemoryStore service.
Test: atest FrameworksNetTests
Change-Id: I7de4f23370bdf9c9df5e74ed074c794080d93d95

Xiao Ma   commited 2019-05-09 10:39:50 +09:00
24f9431d23
Revert "[KA11] Verify fd ownership and allocate resource for NattKeepalive"
This reverts commit 8368fe9fe0.

Reason for revert: Adds dependency between IpSecService and
                   ConnectivityService may lead to future deadlock
                   problems. Uses a simpler approach instead,
                   hence the solution is not needed.
                   See aosp/954040.

Change-Id: If6d537a39595cf132d3ed81d4eaac6700f5f0ab3

Junyu Lai   authored and   junyulai   commited 2019-05-08 11:44:20 +08:00
5218015ed8
Clean up the permission control code in framework
Delete the unused NetworkManagementService API for set/remove
permissions. Use PERMISSION_NONE to replace NO_PERMISSIONS so the
framework now use the same set of permission constant when communicate
with netd.

Bug: 128944261
Test: PermissionMonitorTest.java

Change-Id: I25224c9576f52d2a0a0bd2182325c7aac7b28eb5

Chenbo Feng   commited 2019-05-07 13:50:25 -07:00
cdd3087296
Merge "Add CTS API coverage for APIs which are used by NetworkStack"
Paul Hu   authored and   Gerrit Code Review   commited 2019-05-02 01:37:26 +00:00
4e78fd70d0
Add CTS API coverage for APIs which are used by NetworkStack
Change-Id: I4f6c34f3bcfa65e60cf73fc1b7cab2d83c32836a
Bug: 129200003
Bug: 129200292
Bug: 129199996
Bug: 129200261
Bug: 129200513
Bug: 129200316
Bug: 129200589
Bug: 129200181
Bug: 129200669
Bug: 129200504
Bug: 129200478
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases: added tests pass

paulhu   commited 2019-04-30 17:26:24 +08:00
19ed8076b4
Support adding NATT keepalive packet filter
Support adding NATT keepalive packet filter to APF
filter.
Generating APF program will be addressed in another CL.

Bug: 33530442
Test: - atest NetworkStackTests
      - atest FrameworksNetTests

Change-Id: I4961d5da343d8700600269632787c28112f0f9f1

Aaron Huang   authored and   markchien   commited 2019-04-29 19:33:45 +08:00
87cd8a7e34
Merge "Make DNS cache lifecycle management explicit"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2019-04-26 00:23:22 +00:00
8970adbc8c
Reinstate new VPN uid filtering unit tests
Mock out PackageManager and returns correct information corresponding
to the test app package itself.

Test: atest --generate-new-metrics 10 com.android.server.ConnectivityServiceTest
Bug: 114231106
Bug: 130397860
Change-Id: Ib921700eda417f411d7a2c77c1140fba9ab50bbb

Rubin Xu   commited 2019-04-23 18:04:14 +01:00
ad26ff3fa1
Merge "Add tests for DhcpErrorEvent"
Paul Hu   authored and   Gerrit Code Review   commited 2019-04-23 11:31:03 +00:00
7e025f750a
[KA11] Verify fd ownership and allocate resource for NattKeepalive
Since socket keepalive APIs for UDP encapsulation sockets are
public to generic app. In order to ensure the given fd is valid,
this change verifies the resource id inside the UDP
encapsulation socket by using methods provided by IpSecService.

Bug: 125517194
Fix: 123968920
Test: 1. atest FrameworksNetTests --generate-new-metrics 10
      2. atestcom.android.server.ConnectivityServiceTest \
         #testNattSocketKeepalives --generate-new-metrics 100
Change-Id: I408aacc19b364683854d15a095c34e72389a6e5b

junyulai   commited 2019-04-23 10:47:19 +08:00
8368fe9fe0
Merge "Fix an argument to the legacy broadcast"
Chalard Jean   authored and   Gerrit Code Review   commited 2019-04-23 00:38:10 +00:00
5036127856
Merge "Add NATT keepalive resources and methods into IpSecService"
Benedict Wong   authored and   Gerrit Code Review   commited 2019-04-22 20:03:54 +00:00
4d31a792fa
Add tests for DhcpErrorEvent
The tests are run both in unit and CTS tests.
Test: atest FrameworksNetTests NetworkStackTestCases
Bug: 129200175

Change-Id: I52976bbbaca26fb317836e8461e372c25df02a22

Remi NGUYEN VAN   authored and   paulhu   commited 2019-04-23 00:19:06 +08:00
fb574ef02d
Merge "Move more network unit tests to common tests"
Paul Hu   authored and   Gerrit Code Review   commited 2019-04-22 13:59:25 +00:00
77492e48c4
Fix an argument to the legacy broadcast
Test: new test for this
Fixes: 62650382
Change-Id: I918b8271d3c3c058553ca888cb54cd36a6efba66

Chalard Jean   commited 2019-04-22 22:26:16 +09:00
24a433a538
Make DNS cache lifecycle management explicit
1. ConnectivityService calls netd binder to create/destroy network directly.
2. Call dnsresolver binder to create/destroy cache after create/destroy network.
3. Remove unused network create/destroy methods in NetworkManagementService.

Bug: 129453995
Test: atest FrameworksNetTests
Change-Id: I15660d27f735e33d621d4af8972cdf115bf76dfa

Luke Huang   commited 2019-04-22 17:43:37 +08:00
135c5261ec
Merge changes Id598ae1d,I475bd011
* changes:
  Fix a possible crash when the listener is null
  Straighten AIDL interface for the memory store

Chalard Jean   authored and   Gerrit Code Review   commited 2019-04-22 02:15:04 +00:00
eefe399495
Straighten AIDL interface for the memory store
Some names were still wrong somehow, and the wrappers were
missing.

Test: NetworkStack & FrameworkNetTests
Change-Id: I475bd011ad9bc714a07021a9dfd85c4876f8e9ad
Merged-In: I475bd011ad9bc714a07021a9dfd85c4876f8e9ad

Chalard Jean   commited 2019-04-22 00:40:28 +00:00
2b73c58736