Commit Graph

6148 Commits

Author SHA1 Message Date
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
Remi NGUYEN VAN
9ed32081bf Fix comment on StaticIpConfiguration#getDomains
Add consistency with setDomains().

Test: m
Change-Id: I9ff2de98cec2caf903310d7e8eb7b32362c0e151
2019-04-03 15:55:15 +09:00
Remi NGUYEN VAN
cf0f380f4e Merge "Fix API in CaptivePortal, StaticIpConfiguration" 2019-04-03 06:51:35 +00:00
Treehugger Robot
4e39721f18 Merge "Add tests for PermissionMonitor" 2019-04-03 06:12:12 +00:00
markchien
42e22097c3 Some cleanups for Tethering
Bug: 126481523
Test: -build, flash, boot
      -FrameworksNetTests

Change-Id: I904646efa87eb5434124c7828aca4ab09c5dc38e
2019-04-03 13:56:00 +08:00
Chenbo Feng
fe00494c97 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
2019-04-02 20:31:57 -07:00
Chenbo Feng
1401715e6f 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
2019-04-02 20:31:49 -07:00
Junyu Lai
8680cda689 Merge "Ignore the asynchronous result while stopping keepalive"
am: ea6508f9b7

Change-Id: Idc6d76ca412f7bbae3b32e81756c419d84dc2c80
2019-04-02 04:05:49 -07:00
Junyu Lai
ea6508f9b7 Merge "Ignore the asynchronous result while stopping keepalive" 2019-04-02 10:48:23 +00:00
Paul Hu
bc8ca075ef Merge "Address leftover comments on 923337 and 930217."
am: a9b8e31cf8

Change-Id: I733160ae51b8f0e80f78ab375cdb0a547b74f68d
2019-04-02 00:58:18 -07:00
Paul Hu
a9b8e31cf8 Merge "Address leftover comments on 923337 and 930217." 2019-04-02 07:39:04 +00:00
Paul Hu
b9cffc513e Merge "Fix IpPrefixTest#testContainsInetAddress fail."
am: 9c58ddc48e

Change-Id: I0926ee39c306fefdd158e1c4c7e4c1ba4b7c5f7d
2019-04-01 18:47:42 -07:00
Remi NGUYEN VAN
04c58fe907 Fix API in CaptivePortal, StaticIpConfiguration
- Add documentation to CaptivePortal#logEvent
 - Add paragraph breaks to StaticIpConfiguration class javadoc
 - Format javadoc for API documentation
 - Move setters to a builder and hide fields for apps targeting P or
   older
 - Document StaticIpConfiguration getters and builder setters
 - Add documentation for StaticIpConfiguration#getRoutes

Bug: 129362244
Bug: 129433304
Test: built, flashed, booted, WiFi working
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: Ia66c1097f01ca87d02eba3456547aedb1e480186
2019-04-02 10:43:04 +09:00
Paul Hu
9c58ddc48e Merge "Fix IpPrefixTest#testContainsInetAddress fail." 2019-04-02 01:33:02 +00:00
Chalard Jean
c1e58995da Merge "Cleanup SystemReady in the network stack"
am: ff23b6dce0

Change-Id: I1a55078b74d5f94afde94da0dc5f6e1d2af10de3
2019-04-01 17:12:06 -07:00
Chalard Jean
ff23b6dce0 Merge "Cleanup SystemReady in the network stack" 2019-04-01 23:28:47 +00:00
paulhu
207037a243 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
2019-04-02 00:49:00 +08:00
Xiao Ma
bdb1f90f32 Merge "Add DHCP address lease expiry in IpMemoryStore."
am: 98aa76e2e8

Change-Id: Idb73423aaf875bb77d19f9661e243f152f734fa3
2019-04-01 06:16:08 -07:00
Xiao Ma
98aa76e2e8 Merge "Add DHCP address lease expiry in IpMemoryStore." 2019-04-01 12:59:20 +00:00
paulhu
1a40765101 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
2019-04-01 16:24:10 +08:00