Commit Graph

6064 Commits

Author SHA1 Message Date
Treehugger Robot
98ad72632c Merge "Add smoke test for jni library" 2019-04-10 06:30:26 +00:00
Lorenzo Colitti
93fac2892e Add support for TAP interfaces in TestNetworkManager.
Test: builds, boots
Change-Id: I88bfd7f37c0ba0228f8288fe92212618ce134e4f
2019-04-10 13:29:41 +09:00
Benedict Wong
ff9d0bab2c Enable checks for MANAGE_TEST_NETWORKS in TestNetworkService
This commit re-enables enforcement of the MANAGE_TEST_NETWORK
permission, which is only granted to the shell. CTS tests using this
permission should use UiAutomation.adoptShellPermissionIdentity() to
gain access.

Bug: 72950854
Test: IPsec CTS tests using this passing
Change-Id: I98573a5c68e45abbbaddef01f6ac74a6a18e26f9
2019-04-09 21:23:50 -07:00
Benedict Wong
8856354a8a Cleanup of Test Network service
This follow-up change performs some cleanup changes without affecting
functionality

Bug: 72950854
Test: Compiles, CTS tests using this pass
Change-Id: Ic7394f24f11d713c9374b438182e29d2a02ea236
2019-04-09 16:34:35 -07:00
Chenbo Feng
ba01e6c570 Add smoke test for jni library
Since the Framework net test require jni library
libnetworkstatsfactorytestjni, but the test fails to load that library
unless *all* the dependencies of that library are explicitly listed in
jni_libs, whenever any of the dependencies changes the framework net
test will start failing and it might not be catched since the change
might not related to frameworks/base. And this smoke test is aimed to
spot those native library changes and it should be stable enough to put
in global presubmit.

Bug: 124764595
Test: FrameworksNetSmokeTests
Change-Id: Id24e7f0558b5643e4ad7393e85f1f0a2bd875615
2019-04-09 14:45:35 -07:00
Benedict Wong
15b70fe885 Merge "Fix remove-before-add for IpSecService RefcountedResource"
am: 342d6de289

Change-Id: Ief286a54a93efd731deeff9fc32815663ab7695d
2019-04-09 10:39:16 -07:00
Benedict Wong
342d6de289 Merge "Fix remove-before-add for IpSecService RefcountedResource" 2019-04-09 17:22:56 +00:00
Junyu Lai
db161dda22 Merge "Fix onBlockedStatusChanged does not work on multiple networks"
am: eb70ae41c6

Change-Id: Ia8edf1e9d0f49da5be2bac1889cd0001010a869b
2019-04-09 05:43:18 -07:00
Junyu Lai
eb70ae41c6 Merge "Fix onBlockedStatusChanged does not work on multiple networks" 2019-04-09 12:13:26 +00:00
Chalard Jean
a3b77516bc Restrict access to dangerous methods to <= P
Test: make
Fixes: 130143562
Change-Id: I1a6a472f83cf00a1ab174a9c5e67d3e9357a0c45
2019-04-09 15:47:25 +09:00
Chalard Jean
c4b0483288 Merge "Address leftover comments on aosp/894233"
am: 3753f67bcd

Change-Id: I87f120778b2dc6743edc7fdd4e5390b68de05590
2019-04-08 23:38:53 -07:00
Remi NGUYEN VAN
c1704ceaba Merge "Expose captive portal urls for configuration"
am: 55319378ee

Change-Id: If5970fdafa7c624855ef9d29921542e2fb6fdfa0
2019-04-08 23:29:46 -07:00
Chalard Jean
3753f67bcd Merge "Address leftover comments on aosp/894233" 2019-04-09 05:51:18 +00:00
Remi NGUYEN VAN
55319378ee Merge "Expose captive portal urls for configuration" 2019-04-09 04:37:48 +00:00
Chalard Jean
ce140af98c Address leftover comments on aosp/894233
Bug: 129510344
Test: m, boots, wifi connects, resolves DNS
Change-Id: Idf24f42a86bbfcc89e3ea8cf50d1b705d72ac613
2019-04-09 12:03:28 +09:00
Benedict Wong
2d9864ab3c Fix remove-before-add for IpSecService RefcountedResource
This patch fixes a bug where if a binder dies before the linkToDeath
call, the cleanup will be performed before the entry is added to the
array. While it is safe in that quotas and tracking performs as per
normal, the RefcountedRecord may not be cleaned up.

Rethrowing this exception is safe, since the only paths that would hit
this are all on binder threads coming from applications. Further, it
seems there is only one real way of this getting hit - if the app that
called the creation died during the binder call.

Bug: 126802451
Test: Compiled, CTS tests passing
Change-Id: I6db75853da9f29e1573512e26351623f22770c5d
2019-04-08 18:51:50 -07:00
Niklas Lindgren
fd6f92eaa2 Expose captive portal urls for configuration
Carriers in Mainland China need to customize certain captive portal
urls. The main issue is that google servers are not accessible in
Mainland China.

Added the following captive portal resources to be targeted for overlay.
- config_captive_portal_http_url
- config_captive_portal_https_url
- config_captive_portal_fallback_urls (string-array)
- config_captive_portal_fallback_probe_specs (string-array)

These values can be customized for e g diffent countries

Bug: 111819230
Test: atest FrameworksNetTests NetworkStackTests
Test: Add a product RRO that targets a specific country code,
insert a SIM card that matches that country code and check the log
what URL is used.
Change-Id: I38a294a5e14417f65e96e76235ea153c53c4d7cc
2019-04-09 10:23:53 +09:00
Remi NGUYEN VAN
e214f3c72c [automerger skipped] Merge "Add FrameworksNetTests dependency on libcgrouprc"
am: eade5d227d -s ours
am skip reason: change_id Ifcfe4df81caf8ede2e4e66a76552cb3200378fa8 with SHA1 550ed56426 is in history

Change-Id: Ic374e952cc1ccdd422baf9cbb709f1e37268e220
2019-04-08 03:32:49 -07:00
Treehugger Robot
eade5d227d Merge "Add FrameworksNetTests dependency on libcgrouprc" 2019-04-08 10:19:26 +00:00
junyulai
7509e6e053 Fix onBlockedStatusChanged does not work on multiple networks
There is a logic error in maybeNotifyNetworkBlockedForNewUidRules
that caused function to return if there is no status change in
the first network. This would cause CTS failed in devices which
has volte-enabled SIM inserted.

Bug: 129409153
Fix: 117969394
Test: 1. atest com.android.cts.net.HostsideNetworkCallbackTests \
         --generate-new-metrics 20
      2. atest FrameworksNetTests

Change-Id: Ifd18d1c6ad708c1dbc793f03d8241f572af50317
2019-04-08 17:15:52 +08:00
Remi NGUYEN VAN
ecbcb7fbfc Add FrameworksNetTests dependency on libcgrouprc
The tests are currently broken without this dependency.

Bug: 129902619
Test: atest FrameworksNetTests
Merged-In: Ifcfe4df81caf8ede2e4e66a76552cb3200378fa8
Change-Id: I85891485157ed86e069039dfe3092028ff703dd5
2019-04-08 17:34:47 +09:00
Anil Admal
13bd6a8585 Merge "Extend support for requestRouteToHostAddress for backward compatibility"
am: 1470d8a3b8

Change-Id: I1ecdf945f60d09216e6e8b54754d4feba0437ac1
2019-04-07 17:09:20 -07:00
Treehugger Robot
1470d8a3b8 Merge "Extend support for requestRouteToHostAddress for backward compatibility" 2019-04-07 23:48:32 +00:00
Chenbo Feng
e1ab564e95 Merge "Move NetworkStatsFactory into service directory"
am: c832132056

Change-Id: If92f556cbf3badcb057a3b6e43bb3ef74d0c9ac0
2019-04-05 13:26:28 -07:00
Treehugger Robot
c832132056 Merge "Move NetworkStatsFactory into service directory" 2019-04-05 19:27:22 +00:00
Anil Admal
e1a2886f73 Extend support for requestRouteToHostAddress for backward compatibility
The gnss@2.0 HAL and the framework GNSS Location Provider code is
updated in Q to not call the deprecated requestRouteToHost() method.
However, devices upgrading to Q which are still using gnss@1.1 or
earlier HAL must continued to be supported.

Fixes: 121222025
Test: Tested with gnss@1.1 HAL and first API level P.  The
      ConnectivityService log message "This method exists only for
      app backwards compatibility and must not be called by system
      services" is not present for devices with first API level P.

Change-Id: I10199776ea413dc256dbf0771e6cb3eedb334495
2019-04-05 10:06:37 -07:00
Remi NGUYEN VAN
6dad7305af Merge "Move attach*Filter() and addArpEntry() methods to NetworkStack"
am: 82b74785d7

Change-Id: I1d6a490a42f68d01e3d0649035cd0015cb522da3
2019-04-04 23:50:27 -07:00
Remi NGUYEN VAN
82b74785d7 Merge "Move attach*Filter() and addArpEntry() methods to NetworkStack" 2019-04-05 06:38:08 +00:00
Remi NGUYEN VAN
ffc15401f3 Merge "Call clearCallingIdentity before notifyDnsResponse"
am: c7b33f7572

Change-Id: I21d52314f332a12bdd96d8f20e68a3eb38f70d6b
2019-04-04 19:02:18 -07:00
Remi NGUYEN VAN
c7b33f7572 Merge "Call clearCallingIdentity before notifyDnsResponse" 2019-04-05 01:54:08 +00:00
Remi NGUYEN VAN
25a8bf080c Merge "Add common tests for FrameworksBaseTests and CTS"
am: e2908b64dd

Change-Id: I1616831ad8f143298b80ebce9af205f8e50de1f8
2019-04-04 05:42:21 -07:00
Treehugger Robot
e2908b64dd Merge "Add common tests for FrameworksBaseTests and CTS" 2019-04-04 12:29:44 +00:00
Lorenzo Colitti
3b7fefe97e Merge "Fix flaky UdpEncapsulationSocket test"
am: 95e8a2b5c3

Change-Id: I4d6cc85fcd539a38674fc3daff1af57fa1bdd2f7
2019-04-04 01:38:02 -07:00
Lorenzo Colitti
95e8a2b5c3 Merge "Fix flaky UdpEncapsulationSocket test" 2019-04-04 08:09:06 +00:00
Benedict Wong
b5bc70dc6a Fix flaky UdpEncapsulationSocket test
This commit reduces the flakiness of the
testOpenAndCloseUdpEncapsulationSocket by retrying up to three times.
Unfortunately, testing port-selected socket creation is racy against
other applications. This helps to handle the same race condition as done
in IpSecService#bindToRandomPort

Bug: 128024100
Test: 200x runs of testOpenAndCloseUdpEncapsulationSocket
Change-Id: I7e036ce821019dbac6c50899bd0894e89d2fe82a
2019-04-03 17:52:03 -07:00
paulhu
f55f77908d Merge "Fix ConnectivityServiceTest fail."
am: 362d9fb687

Change-Id: If3f7a3cbf2ed1a180a3b09872512a5f91bddd89c
2019-04-03 17:24:39 -07:00
Treehugger Robot
362d9fb687 Merge "Fix ConnectivityServiceTest fail." 2019-04-03 23:54:38 +00:00
Chenbo Feng
550ed56426 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

Merged-In: Ifcfe4df81caf8ede2e4e66a76552cb3200378fa8
Change-Id: Ifcfe4df81caf8ede2e4e66a76552cb3200378fa8
2019-04-03 11:33:40 -07:00
Chenbo Feng
6825c65462 Merge "Clean up permissions when uids are no longer used"
am: 9235821478

Change-Id: I3c06a36368abb9a1e7885d281ea1155fce857eea
2019-04-03 10:38:57 -07:00
Treehugger Robot
9235821478 Merge "Clean up permissions when uids are no longer used" 2019-04-03 17:15:48 +00:00
paulhu
451b1c8609 Fix ConnectivityServiceTest fail.
NetdService#getInstance() will get null object in
WrappedConnectivityService constructor. Then pass this null
INetd object to PermissionMonitor will case NPE in
PermissionMonitor#sendPackagePermissionsToNetd()

Bug: None
Test: atest FrameworksNetTests
Change-Id: Ia1c80f9600a19c4aaf3f3c1b497b355d96c49c8e
2019-04-04 00:07:40 +08:00
lucaslin
39810500f0 Merge "Fix NetworkMonitor won't do private dns resolution"
am: e121a329b8

Change-Id: I7c7a573bef77ba952219e6f6f56ab11f0211e0a7
2019-04-03 04:13:48 -07:00
Treehugger Robot
e121a329b8 Merge "Fix NetworkMonitor won't do private dns resolution" 2019-04-03 10:50:09 +00:00
Mark Chien
997009af45 Merge "Some cleanups for Tethering"
am: 7cf4907b89

Change-Id: Ifb60c76855a2bea5a1cccf26034e6c582ad16021
2019-04-03 03:35:42 -07:00
Mark Chien
7cf4907b89 Merge "Some cleanups for Tethering" 2019-04-03 10:16:25 +00:00
Remi NGUYEN VAN
49b15870a9 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: I9c138d49ce010edde095e4bd3c47e36ca301634a
2019-04-03 18:53:04 +09:00
paulhu
fd7c030082 Move attach*Filter() and addArpEntry() methods to NetworkStack
The SocketUtils.attach*Filter and SocketUtils.addArpEntry methods
were added there because they could not be added as JNI inside
the NetworkStack. This was not possible because on Go devices,
the NetworkStack was a jar library. But now, Go also uses an APK.
Hence, move these methods to the NetworkStack.

Change-Id: I1d88a0f0be23f2b15d5103fa092b9bf982329d7c
Fix: 129433183
Test: atest NetworkStackTests FrameworksNetTests
2019-04-03 17:49:36 +08:00
lucaslin
45e639b041 Fix NetworkMonitor won't do private dns resolution
NetworkMonitor cannot do the private dns resolution due to lack
"mNetworkCapabilities". ConnectivityService will call
NetworkStackService#notifyPrivateDnsChanged() before doing
network validation. After NetworkMonitor received
CMD_PRIVATE_DNS_SETTINGS_CHANGED, it will call
isValidationRequired to check if the validation is required.
But mNetworkCapabilities didn't be set, so the
mPrivateDnsProviderHostname will be set to empty and make
EvaluatingPrivateDnsState doesn't do private dns resolution.

Bug: 129375892
Test: 1. Build pass
      2. atest FrameworksNetTests
      3. atest NetworkStackTests

Change-Id: I637212fb4746bb2e9a2f4a4457fd36c4c2701149
2019-04-03 17:09:28 +08:00
Remi NGUYEN VAN
fb943d00ca Merge "Fix API in CaptivePortal, StaticIpConfiguration"
am: cf0f380f4e

Change-Id: Ia36ba5946e8dc956c5c71cbebe7dc02658fdb7a0
2019-04-03 01:21:38 -07:00
Chenbo Feng
e11632e768 Merge "Add tests for PermissionMonitor"
am: 4e39721f18

Change-Id: I2079c4ce13aae962c1d907009edc107e861bb3b5
2019-04-03 01:10:07 -07:00