Commit Graph

8195 Commits

Author SHA1 Message Date
Chiachang Wang
7752ddf0b7 Merge changes I3525edc3,I6e18915e
* changes:
  Filter debug entries for each vpn
  Add test prefix into test cases
2020-04-29 08:43:02 +00:00
Chiachang Wang
1d5c290e38 Filter debug entries for each vpn
NetworkStats calculation needs to filter out debug entries to
prevent over counting. While NetworkStatsFactory migrates data
usage over a VPN to the TUN network, NetworkStatsFactory does
not filter out debug entries per vpn which will cause debug
entries left and cause exception.

Bug: 152678151
Test: atest com.android.server.net.NetworkStatsFactoryTest
      and verify no exception
Change-Id: I3525edc385b07858b48c7add2d331c4b5a2e84ad
2020-04-29 15:07:45 +08:00
Chiachang Wang
88fa813bd7 Add test prefix into test cases
Bug: 152678151
Test: atest com.android.server.net.NetworkStatsFactoryTest
Change-Id: I6e18915e383ac20072cb238d0136d7a8e4ceb811
2020-04-29 13:44:50 +08:00
Benedict Wong
eb8393aa09 Merge "Add filtering for IPsec algorithms in IKEv2 VPNs" 2020-04-28 17:33:46 +00:00
Remi NGUYEN VAN
34e9cb2fdc Merge "Add comment / logging in NetworkMonitor callbacks" 2020-04-27 07:26:25 +00:00
Benedict Wong
27a2f1dff8 Merge "Add tests for Tunnel, Transport mode application with released SPIs" 2020-04-24 22:32:41 +00:00
Benedict Wong
88c8a19311 Merge "Use TransformRecord to get SPI instead of SpiRecord" 2020-04-24 22:32:41 +00:00
Remi NGUYEN VAN
455b93d137 Add comment / logging in NetworkMonitor callbacks
Add a comment explaining the ordering of messages sent to the tracker
and connectivity diagnostics handlers.

Add a Slog.wtf call in case the deprecated notifyNetworkTested callback
is called.

Bug: 153500847
Test: atest ConnectivityServiceTest
Change-Id: I2dbfc9bf7b2f785ea4594851bd354e9fd0fc0bd1
2020-04-24 20:56:39 +09:00
Remi NGUYEN VAN
0e93810453 Merge "Address comments on NetworkStack AIDL v6" 2020-04-24 11:56:32 +00:00
Remi NGUYEN VAN
9b647ca69a Address comments on NetworkStack AIDL v6
Address issues found during AIDL review:
 - Rename clientAddr to singleClientAddr
 - Do not use a ParcelableBundle for notifyNetworkTested or
   notifyDataStallSuspected; instead use AIDL parcelables for stronger
   backwards compatibility guarantees.

Test: atest NetworkMonitorTest ConnectivityServiceTest
      ConnectivityServiceIntegrationTest, manual
Bug: 153500847
Change-Id: Id9b71784e5f6294d203230e57737979e063ff0f8
2020-04-24 18:52:02 +09:00
Treehugger Robot
93c21fc7b5 Merge "Add test for NetworkSpecifier" 2020-04-23 14:12:37 +00:00
Chiachang Wang
de4a675836 Add test for NetworkSpecifier
Tests for canBeSatisfiedBy() and redact()

Bug: 154686765
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkSpecifierTest
Change-Id: Iade6a5b355b8812a5eb191345dfe393938ee272c
2020-04-23 18:03:16 +08:00
Philip P. Moltmann
7bc33dfb89 Set attributionTag for noteOp(WRITE_SETTINGS) calls
Test: atest FrameworksNetTests TetheringTests:TetheringServiceTest
Bug: 136595429
Merged-In: I33f787644c44d7b0e5ce17a433820cfcd985cdfb
Change-Id: Ic3d937e7bb5141798234ed5b2852c1f768e97495
2020-04-20 18:00:03 -07:00
Lorenzo Colitti
c44ca579ad Merge "Stop prefix discovery if an RA prefix arrives in DISCOVERING" 2020-04-20 11:10:31 +00:00
Lorenzo Colitti
6ce7a2aeee Merge "Make the Nat464Xlat tests more realistic." 2020-04-20 11:06:08 +00:00
Lorenzo Colitti
204b31920f Merge "Support learning the NAT64 prefix from two different sources." 2020-04-20 11:05:52 +00:00
Lorenzo Colitti
38c6519a90 Stop prefix discovery if an RA prefix arrives in DISCOVERING
Currently, if a prefix is learned from an RA while prefix
discovery is running, clatd will be correctly started, but
prefix discovery will be stopped.

In order to fix this, make it possible to call
stopPrefixDiscovery without transitioning to IDLE state (which
is obviously necessary in this case), by moving the assignment of
the next state from that method to its callers. For consistency,
do the same for startPrefixDiscovery.

Bug: 150648313
Test: new test coverage
Change-Id: I3803fa3d9806848b331c35ee8bac256934bd1f21
2020-04-20 17:54:20 +09:00
Lorenzo Colitti
c6bd5847c9 Make the Nat464Xlat tests more realistic.
464xlat will never be started on a network that is not connected,
or on a network that has no IPv6 address.

This is a no-op test-only change but it is necessary for an
upcoming change that violates some of the invalid assumptions
currently made by this test and causes it to fail.

Bug: 150648313
Test: test-only change
Change-Id: I41766e9adaa7c24454648b371e6e3cc647693be5
2020-04-20 17:54:20 +09:00
Lorenzo Colitti
e2eade021a Support learning the NAT64 prefix from two different sources.
The NAT64 prefix from the RA always takes precedence over the
NAT64 prefix from DNS discovery, because it is detected faster,
and detecting it does not require sending any packets.

Bug: 150648313
Test: new unit test
Change-Id: Ic7452431d2d9aea1ae59b67a9d8383c6cc5b3902
2020-04-20 16:50:53 +09:00
Aaron Huang
147d253956 Merge "Add network agent to enhance NetworkProvider test" 2020-04-20 07:20:25 +00:00
Aaron Huang
82948ddb1c Move DhcpInfoTest to frameworks/base/tests/net/common
Address comment from aosp/1162443.
Move to FrameworksNetCommonTests so that it can be run in
cts test and presubmit test.

Also change package name from android.net.cts to android.net

Bug: 154299158
Test: atest FrameworksNetTest
      atest CtsNetTestCasesLatestSdk:android.net.DhcpInfoTest
Change-Id: I42a965ae5cb748fdd80b4d5c0f8b26f36f74be72
2020-04-17 18:26:20 +08:00
Aaron Huang
8d2f514530 Add network agent to enhance NetworkProvider test
Add network agent to test more situation that could get the
onNetworkRequested callback.

Bug: 153614605
Bug: 153613690
Bug: 153612373
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkProviderTest
Change-Id: Id494a1697cc1b73e8e56ae585a69faec31c59f52
2020-04-17 17:26:07 +08:00
Aaron Huang
ab8282eea7 Merge changes from topic "cts-networkprovider"
* changes:
  Add cts test for NetworkProvider
  Adjust permission of NetworkProvider related API
2020-04-17 03:59:47 +00:00
Bruce Chen
0e97073a4d Merge "Add testTransportTypesEqual to dnsmanager test cases" 2020-04-17 02:59:15 +00:00
Junyu Lai
9151f7c748 Merge "[SP27.3] Rename TestableNetworkStatsProvider" 2020-04-17 02:24:55 +00:00
Lorenzo Colitti
4cba5a3981 Merge "Add a function to process LinkProperties coming from an agent." 2020-04-16 16:25:29 +00:00
Lorenzo Colitti
f09bc1734f Merge "Support changing the NAT64 prefix without removing it." 2020-04-16 16:24:57 +00:00
chenbruce
01950be123 Add testTransportTypesEqual to dnsmanager test cases
A test that ensures that NetworkCapabilities.TRANSPORT_* is eaual
to IDnsResolver.TRANSPORT_* for every possible value of each.

Bug: 153267602
Test: atest FrameworksNetTests
Change-Id: I6b23ccc6ce1659fdfd9573dfcd895f2c20fa9417
2020-04-16 18:04:16 +08:00
Lorenzo Colitti
18a58468c4 Add a function to process LinkProperties coming from an agent.
There are tasks that need to be performed when receiving
LinkProperties directly from a NetworkAgent (either at
registration time or in subsequent updates).

Currently, the only example of such a task is calling
ensureDirectlyConnectedRoutes. This is currently done in
handleUpdateLinkProperties, which is often unnecessary,
because that method iscalled in many other cases than when
receiving properties directly from an agent. Ensuring directly
connected routes only needs to be done when receiving
LinkProperties from the agent, because ConnectivityService does
not directly manipulate routes.

This CL does not do much except remove these superfluous calls
and add the method. A future CL will add more code to the method.

Bug: 150648313
Test: atest ConnectivityServiceTest
Change-Id: Ibeeb5f79e8afd3350c935934713d7882f2e0281f
2020-04-16 16:23:07 +09:00
Aaron Huang
2bb072d54c Add cts test for NetworkProvider
It will skip whole tests on Q device since NetworkProvider class
is introduced in R.

Result on Q device would be:
[1/1] android.net.NetworkProviderTest#skippedClassForDevSdkMismatch: IGNORED (3ms)

Bug: 153614605
Bug: 153613690
Bug: 153612373
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkProviderTest
Change-Id: If7bfc7fae503e3497c37754697d0b148ff4cab3b
2020-04-16 06:40:20 +00:00
Aaron Huang
ebbfd3ccb9 Adjust permission of NetworkProvider related API
- Allow an app holds NETWORK_SETTINGS to acess registerNetworkProvier()
  and unregisterNetworkProvider().
- To access declareNetworkRequestUnfulfillable(), allow an app holds
  MANAGE_TEST_NETWORKS to declare a unfulfillable request that contains
  TRANSPORT_TEST transport.

This makes easier to write cts to test.

Bug: 153612373
Bug: 153614605
Test: atest FrameworksNetTests
      atest CtsNetTestCases:android.net.NetworkProviderTest
Change-Id: Ic9809e731aa811a51c2f82d189372169d99a5ed9
2020-04-16 14:03:55 +08:00
Lorenzo Colitti
7f3d684631 Support changing the NAT64 prefix without removing it.
This cannot (currently) happen with DNS64 detection, but it can
happen with the PREF64 option.

Bug: 150648313
Test: atest ConnectivityServiceTest Nat464XlatTest --rerun-until-failure 100
Change-Id: I789fe9d46d3ac5d074ae697d23013f24a9e0246d
2020-04-16 00:07:30 +09:00
junyulai
d8d7916d95 [SP27.3] Rename TestableNetworkStatsProvider
Currently, TestableNetworkStatsProvider is a subclass of
INetworkStatsProvider. This is not very accurate naming after
API council review feedback since now we have
NetworkStatsProvider as a system api interface.

This is the counter-part change of actual renaming CL in
NetworkStack.

Test: atest FrameworksNetTests TetheringTests
Bug: 150643374
Change-Id: Ifa8175dc4e2fe2b907ec13b3bd2eca12974f5ea7
Merged-In: Ifa8175dc4e2fe2b907ec13b3bd2eca12974f5ea7
(cherry-picked from ag/10976522)
2020-04-15 19:01:13 +08:00
Benedict Wong
8e3914c162 Add filtering for IPsec algorithms in IKEv2 VPNs
This commit adds support for validating and filtering IPsec algorithms.
Without a public API exposing IKEv2 algorithms (and their respective
public APIs), the allowedAlgorithms can only filter the proposals for
IPsec (Child) SA algorithms.

Additionally, this removes the HMAC_SHA1 from the IKE SA's integrity
algorithm proposals due to insecurity

Bug: 153701879
Test: FrameworksNetTests passing, new tests added
Change-Id: I7e61a1612692db275b751330af5bacbf86836a8c
2020-04-14 18:07:36 -07:00
Chalard Jean
836df36aee Merge "Allow testing of signal strength" 2020-04-13 17:27:06 +00:00
Chalard Jean
eb1d6593c5 Merge "Add instrumentation to test NetworkAgent." 2020-04-13 14:47:58 +00:00
Chalard Jean
6b59b8fbcc Allow testing of signal strength
- Let any process with NETWORK_SETTINGS register for signal strength
  wakeup.
- Allow agents registering test networks to assign them a signal
  strength.

Test: NetworkAgentTest
Bug: 139268426
Change-Id: I2b4b89be3e69f4853fd6978d2c8f5c8eb4271f21
2020-04-13 21:55:32 +09:00
Chiachang Wang
422052213c Merge "Add more tests for CaptivePortalData" 2020-04-13 09:46:20 +00:00
Chiachang Wang
d4a9e976e8 Add more tests for CaptivePortalData
Add missing tests to cover all system APIs

Bug: 152280218
Bug: 150640683
Test: atest CtsNetTestCasesLatestSdk:CaptivePortalDataTest on
      both Q and R device
Change-Id: I6d3826922f16816d5b18ed3540266442a0ed3e49
2020-04-13 08:58:48 +00:00
Chiachang Wang
40c78f06d5 Merge "Move CaptivePortalDataTest to common test to support cts" 2020-04-13 08:56:31 +00:00
Chiachang Wang
210a4da6ed Move CaptivePortalDataTest to common test to support cts
Commit has to on top of aosp/1281921 to skip whole test in Q
device since CaptivePortalData class is introduced in R.

Result in Q will be:
[1/1] android.net.CaptivePortalDataTest#skippedClassForDevSdkMismatch: IGNORED

Bug: 152280218
Bug: 150640683
Test: atest CtsNetTestCasesLatestSdk:CaptivePortalDataTest on
      both Q and R device
Change-Id: Iddd00e1c85abe767b1a41a1761d3266ba322dba6
2020-04-13 08:13:04 +00:00
Lorenzo Colitti
d275ec139a Merge "Set transport types to resolver" 2020-04-13 07:03:20 +00:00
Chalard Jean
be9447be58 Add instrumentation to test NetworkAgent.
Test: NetworkAgentTest, new tests using this API
Bug: 139268426
Change-Id: Ia83b1c896df63bb18e2aa4b74d6cc09eba990eb5
2020-04-13 15:44:07 +09:00
chenbruce
7b2f898a9a Set transport types to resolver
For a given network, resolver doesn't know what transport types are.
Therefore, when a new network is created or transport types are changed
in a give network, transport types will be updated and sent by calling
setResolverConfiguration(). In the same time, if link properties or
transport types are null, setResolverConfiguration() won't be called.
The original behaviors of setResolverConfiguration() aren't changed.
Only increasing one new behavior that when a given network has transport
type change, calling setResolverConfiguration() directly and resolver
updates the transport types for that given network.

Bug: 143732914
Test: atest FrameworksNetTests
      atest FrameworksNetIntegrationTests
Merged-In: I03fc5c62dfd9a51a78a720860531df282fdecc20
Change-Id: I6527cde0e177ba08c886576131b35fc769c2bb53
2020-04-11 23:00:13 +08:00
Hall Liu
24e6e442b7 Merge changes from topic "phonestatelistener-limit-rvc-dev"
* changes:
  Add gating, logging for PhoneStateListener's limit
  Institute limit on PhoneStateListener
2020-04-11 00:36:13 +00:00
Treehugger Robot
e21dccde6b Merge "Fix a theoretical NPE" 2020-04-10 16:25:07 +00:00
Chalard Jean
35a06972cc Fix a theoretical NPE
Test: NetworkAgentTests
Bug: 153718627
Change-Id: I08f57cce0cd85d5cd66e9a0ef948224290e9200e
2020-04-10 23:08:00 +09:00
lucaslin
311bd48fe8 Set WifiAwareNetworkInfo into setTransportInfo()
Bug: 139268426
Bug: 135998869
Bug: 138306002
Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest
Change-Id: Ibbe1cd126d6538003fbb1e5e85892bfb15a920e8
Merged-In: Ibbe1cd126d6538003fbb1e5e85892bfb15a920e8
2020-04-08 10:09:16 +00:00
Hall Liu
a85ea98c7a Add gating, logging for PhoneStateListener's limit
Add gating via PlatformCompat and DeviceConfig and logging via
PlatformCompat to the limit instituted on per-process listeners

Fixes: 152074216
Test: atest CtsTelephonyHostCases
Change-Id: I4d6681d90705b68c3349f4124e434a29b50fd3a2
Merged-In: I4d6681d90705b68c3349f4124e434a29b50fd3a2
2020-04-07 17:13:19 -07:00
Junyu Lai
b0104c84f8 Merge "Fix NetworkStatsApiTest failed on Q device" 2020-04-07 10:49:19 +00:00