summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2021-05-20Fix the security issue that preloaded apps can get SSID & BSSIDlucaslin
NetworkMonitor sends "android.net.conn.NETWORK_CONDITIONS_MEASURED" broadcast with Wifi SSID & BSSID. The receiver of this broadcast is only required to have "android.permission.ACCESS_NETWORK_CONDITIONS" permission but not the "android.permission.ACCESS_FINE_LOCATION". It's incorrect because if the apps want to know the Wifi SSID and BSSID, they should get the run-time permission with user consent. Since this broadcast is not used anymore, delete it and the related code. Bug: 175213041 Test: atest NetworkStackNextTests NetworkStackTests Change-Id: I12050737291c7fa0ebff4e7411b91f4c6f57a413 Merged-In: I12050737291c7fa0ebff4e7411b91f4c6f57a413 Ignore-AOSP-First: This is a security patch which cannot submit in AOSP. (cherry picked from commit 0dc33442b74703f7700ba78b05d3c5ec30c07055)
2020-07-06Merge "Refine validation metrics" into rvc-devRemi NGUYEN VAN
2020-07-06Merge "Injecting network validation stats into statsd" into rvc-devRemi NGUYEN VAN
2020-07-03Refine validation metricsRemi NGUYEN VAN
Rename members for a clearer API, and add try/catch blocks to each NetworkMonitor call to guarantee there will not be any crash. Add a flag allowing to disable all the metrics collection code. Bug: 151796056 Test: atest NetworkStackTests (see also test-only change) Change-Id: I06d6dccc57146b955b15cf36a2109c68a5355494
2020-07-03Merge "Update CapportData in CapportApiProbeResult to be nullable" into rvc-devChiachang Wang
2020-07-03Injecting network validation stats into statsdFrank Li
1. Fill in each field of the NetworkValidationReported 2. Write the NetworkValidationReported into statsd This patch also refactors tryCapportApiProbe to return null when the capport data is incorrect, instead of doing the check after calling the method. This makes it easier to compile capport API probe metrics. Test: atest NetworkStackIntegrationTests NetworkStackTests Test: atest FrameworksNetTests Test: Manual test with statsd_testdrive Bug: 151796056 Original-Change: https://android-review.googlesource.com/1295496 Merged-In: Icf34402d6a293cc76c32d00835cbf358c99a87fa Change-Id: Icf34402d6a293cc76c32d00835cbf358c99a87fa
2020-07-03Update CapportData in CapportApiProbeResult to be nullableChiachang Wang
If capport API does not send any valid rely, the capportData could be null in CapportApiProbeResult. Thus, take null capportData for invalid case. Bug: 154196512 Bug: 139034276 Bug: 151796056 Test: atest NetworkStackTests Merged-In: I99cbff2eb1a9ab87a42011038d911fe15e7344a4 Change-Id: I99cbff2eb1a9ab87a42011038d911fe15e7344a4
2020-06-30Use FLAG_IMMUTABLE on NetworkStackNotifier intentsRemi NGUYEN VAN
FLAG_UPDATE_CURRENT was not helpful because: - For the venue info notification, the only extra is the Network, and the intent uses the network handle as identifier; meaning that two matching intents would already have the same extra. - The ACTION_WIFI_SETTINGS intent does not have any extra, so there is nothing to update. Bug: 157475111 Test: atest NetworkStackTests; manual: connected to captive portals and used notifications Change-Id: Ifd9e6ff04f2d574f3e28d612c8ea6215a209069e
2020-06-25Merge "Get link state with same lock as LinkProperties" into rvc-devRemi NGUYEN VAN
2020-06-25Merge "Send normal termination metrics on wifi off" into rvc-devRemi NGUYEN VAN
2020-06-24Fix NullPointerException on addErrorCode when input is Invalid error codeFrank Li
Problem: 1. When the errocode is not defined in DhcpErrorCode enum. Then the DhcpErrorCode.forNumber(errorCode) will return null. 2. Then use null as the parameter cause NullPointerException on addErrorCode. (Because the addErrorCode need nonNullable parameter) Solution: If the errorcode is not defined in the Dhcp ErrorCode enumeration, please use ET_UNKNOWN instead as AddErrorCode parameter, not null. Bug: 151796056 Test: atest Original-Change: https://android-review.googlesource.com/1346103 Merged-In: I43b8415ab98b4cf6520c3240dc544a9f62730a4e Change-Id: I43b8415ab98b4cf6520c3240dc544a9f62730a4e
2020-06-24Get link state with same lock as LinkPropertiesRemi NGUYEN VAN
The previous IpClientLinkObserver code could in theory call mCallback.update with a linkState that came from another update; for example: 1. onInterfaceAddressUpdated - mLinkProperties.addLinkAddress 2. onInterfaceLinkStateChanged - setInterfaceLinkState(false) 1. mCallback.update(false) <- should be true ? 2. mCallback.update(false) In practice this would not happen because the onFoo methods are all called in order (same binder token from netd), but IpClientLinkObserver should not need to make such assumptions. Bug: 151796056 Test: atest NetworkStackIntegrationTests (see also test-only change) Change-Id: I60f5a319519069070eb5a07643686bf5ec937665
2020-06-24Send normal termination metrics on wifi offRemi NGUYEN VAN
When turning wifi off, the interface gets torn down and empty LinkProperties are received before wifi calls stop(). This causes a loss of provisioning to be logged, instead of normal termination. Watch interface link status up/down events, and when provisioning is lost when the interface is down, consider it a normal termination. Bug: 151796056 Test: manual: turn wifi off, observe events Test: atest NetworkStackIntegrationTests (see also test-only change) Original-Change: https://android-review.googlesource.com/1343236 Merged-In: I9d086a199de0017aa425219d20882211423925e0 Change-Id: I9d086a199de0017aa425219d20882211423925e0
2020-06-23Fix the mStopTimeNs not be reset in Stopwatch#RestartFrank Li
Bug: 151796056 Test: atest NetworkStackIntegrationTests NetworkStackTests Test: atest FrameworksNetTests Test: Manual test with statsd_testdrive Original-Change: https://android-review.googlesource.com/1343438 Merged-In: Ib83ceb70af3491dacbb4a45f65ef38661ae75e32 Change-Id: Ib83ceb70af3491dacbb4a45f65ef38661ae75e32
2020-06-23Merge "Injecting network ip provision stats into statsd" into rvc-devRemi NGUYEN VAN
2020-06-23Injecting network ip provision stats into statsdlifr
1. Fill in each field of the NetworkIpProvisioningReported 2. Write the NetworkIpProvisioningReported into statsd Bug: 151796056 Test: atest NetworkStackIntegrationTests NetworkStackTests Test: atest FrameworksNetTests Test: Manual test with statsd_testdrive Original-Change: https://android-review.googlesource.com/1313574 Merged-In: If4bc6af1b794a8620a08858d6cfd85e661865bd7 Change-Id: If4bc6af1b794a8620a08858d6cfd85e661865bd7
2020-06-19Merge "Move Inet[4]AddressUtils to libs/net" into rvc-devRemi NGUYEN VAN
2020-06-18Transition to appropriate state after all left addresses have been cleared.Treehugger Robot
State machine will transit to RunningState directly after clearing all left addresses even if the preconnection flag is enabled, that seems incorrect to skip PreconnectingState. Rely on the preconnection flag to determine which correct state should transit to. Bug: 159109671 Test: atest NetworkStackIntegrationTests NetworkStackTests Merged-In: I3d520a50f26ba7fac804c85c968013b2cb7cab91 Change-Id: I3d520a50f26ba7fac804c85c968013b2cb7cab91
2020-06-17Fix cursor leaks into IPMS databaseChalard Jean
It's depressing we missed so many of these Bug: 158629419 Test: IpMemoryStoreTest IpMemoryStoreServiceTest Original-Change: https://android-review.googlesource.com/1332173 Merged-In: Ic4e0d8b1c8483b4e254bca95d2bf30e5ed203b23 Change-Id: Ic4e0d8b1c8483b4e254bca95d2bf30e5ed203b23
2020-06-12Move Inet[4]AddressUtils to libs/netRemi NGUYEN VAN
The classes should not be picked up from frameworks/base, as they are part of several mainline modules. Bug: 151052811 Test: m; manual: flashed, wifi and telephony working Test: atest NetworkStackCoverageTests Change-Id: I62da3419408b7eb71ea5319e8717fbb22c76a94e
2020-06-12Merge "Remove DhcpResults from NetworkStack shared lib" into rvc-devRemi NGUYEN VAN
2020-06-12Merge "Adding NetworkStack Metrics/protos in the Networkstack" into rvc-devFrank Li
2020-06-11Remove DhcpResults from NetworkStack shared libRemi NGUYEN VAN
Remove the dependency on DhcpResults in moduleutils by moving toStableParcelable to NetworkStack main code, and fromStableParcelable to the test only. Only NetworkStack should be generating DhcpResultsParcelables, and only the NetworkStack should be using DhcpResults at this point (eventually the class would move from frameworks/base/core to NetworkStack). Test: built, flashed, WiFi working Bug: 149403767 Original-Change: https://android-review.googlesource.com/1277444 Merged-In: I093fa48967a48f594b242b1e05e7d481fa9ee529 Change-Id: I093fa48967a48f594b242b1e05e7d481fa9ee529
2020-06-11Merge "Increase tcp polling interval on data stall detection" into rvc-devTreeHugger Robot
2020-06-10Merge "Disable IPv6 stack when IPv6 provisioning is lost but IPv4 is still ↵TreeHugger Robot
alive." into rvc-dev
2020-06-10Adding NetworkStack Metrics/protos in the Networkstacklifr
Here are some new protos we added. 1. NetworkIpProvisioningReported 2. NetworkDhcpRenewReported 3. NetworkValidationReported 4. NetworkStackQuirkReported Test: Run statsd_testdrive Bug: 151796056 Change-Id: I6cb6e8d94ee6ac4bc302646047fb824448c5f543
2020-06-09Disable IPv6 stack when IPv6 provisioning is lost but IPv4 is still alive.Treehugger Robot
When IPv6 provisioning loss happens due to the default route has gone, however, if IPv4 network is still provisioned, we can consider to disable IPv6 stack and still keep the current connection without disconnecting from wifi, applications will be able to reconnect over IPv4 network. Bug: 131781810 Test: atest NetworkStackTests NetworkStackNextTests Test: atest NetworkStackIntegrationTests Merged-In: I8f56a05b38c8387c91306c0dc2bdf4430ec3bd00 Change-Id: I8f56a05b38c8387c91306c0dc2bdf4430ec3bd00
2020-06-09Do not revalidate before network is readyRemi NGUYEN VAN
ConnectivityService sends notifyLinkPropertiesChanged before notifyNetworkConnected. When a captive portal URL is present, this causes NetworkMonitor to revalidate, even though the network is not ready to start validating (DNS servers have not been set yet in particular). ConnectivityService does this because the sending new LinkProperties to NetworkMonitor is part of the standard LinkProperties update flow; NetworkMonitor should be resilient to such behavior. Test: atest NetworkMonitorTest, manual (flashed, wifi working) Bug: 156697983 Original-Change: https://android-review.googlesource.com/1315220 Merged-In: I0619d37a3374726b77e162d174c5b12659db3bbb Change-Id: I0619d37a3374726b77e162d174c5b12659db3bbb
2020-06-09Increase tcp polling interval on data stall detectionChiachang Wang
NetworkMonitor suspects stall if we get high tcp fail rate in 10s. In a cell transition frequently environment, a certain percentage packets lost or retransmission may stay for a longer time interval. The shorter tcp polling interval may not able to get confident enough result. The looser timer may also increase validated result in the metrics which may not a good signal. Thus, increase the polling interval to address it. Bug: 157957111 Test: atest NetworkStackTests Merged-In: I496a32da8f57f88908402722ebe1cd3d0a8483b6 Change-Id: I496a32da8f57f88908402722ebe1cd3d0a8483b6
2020-06-04Merge "Shorten the timeout of DHCP INIT-REBOOT state." into rvc-devTreeHugger Robot
2020-06-04Merge "Adjust the timeout parameters in DHCP client." into rvc-devTreeHugger Robot
2020-06-03Merge "Wifi: Add 6GHz band to getWifiBand method" into rvc-devAhmed ElArabawy
2020-06-03Shorten the timeout of DHCP INIT-REBOOT state.Xiao Ma
Currently the timeout in the INIT-REBOOT state is 18s which allows 4 retransmits. In the scenario where DHCP server fails to response due to certain reason, DhcpClient should go back to INIT state ASAP and do the regular DHCPDISCOVER. Shorten the timeout to 5s to speed up the fallback process. Bug: 157960451 Bug: 157603386 Test: atest NetworkStackIntegrationTests Test: manual test to verify that client goes back to INIT state and broadcasts DHCPDISCOVER after 2 retransmissions. Merged-In: I9d214e193a4f80a9512a3a6f385ca3554f050386 Change-Id: I9d214e193a4f80a9512a3a6f385ca3554f050386
2020-06-03Merge "Fix venue info notification not displaying" into rvc-devRemi NGUYEN VAN
2020-06-02Add a null check to prevent NullPointerExceptionLucas Lin
TelephonyManager#getAllCellInfo() may return null, so before running the foreach loop, the null check is needed. Bug: 156567547 Test: atest NetworkStackTests:NetworkMonitorTest Change-Id: I925eefaffeadd87ef1b18204cbf82a9e63779a10 Merged-In: I5d5e98add0ea2abf92156c11188739c535e7e9a8 (cherry picked from commit 9d5cc53017e82505ec29cd2f17736a0dfdc3bb91)
2020-06-01Wifi: Add 6GHz band to getWifiBand methodAhmed ElArabawy
This commit adds 6GHz band to getWifiBand method Bug: 139354972 Test: None Change-Id: I6336ed59bbf233b02b129c31a824ee02922ff0cb
2020-06-02Merge "Fallback if redirect url is not valid for captive portal login" into ↵Chiachang Wang
rvc-dev
2020-06-02Fix venue info notification not displayingRemi NGUYEN VAN
The venue info notification was never displayed, because querying the notification channel from UserHandle.ALL returns no channel. Channels must be handled from the NetworkStack (owner) user, not the ALL user that is used to send notifications. Bug: 157203874 Test: atest NetworkStackTests; manual: verified showing or disabling the notification as owner or alternate user. Original-Change: https://android-review.googlesource.com/1321357 Merged-In: I9ce908cebdef81bb524353219f7ee9ead2487056 Change-Id: I9ce908cebdef81bb524353219f7ee9ead2487056
2020-06-01Only allow HTTP capport URLs on test networksRemi NGUYEN VAN
HTTP URLs on localhost for the capport API should only be accepted on networks with TRANSPORT_TEST. This change also introduces the first changes to fix thread safety issues in NetworkMonitor, where LinkProperties or NetworkCapabilities are read from the evaluation thread, even though they are updated from the StateMachine thread. The EvaluationThreadDeps class should be augmented in later changes to hold thread-safe copies of what the evaluation thread needs. Bug: 156062304 Bug: 155455470 Test: atest NetworkMonitorTest Original-Change: https://android-review.googlesource.com/1315226 Merged-In: I65bb54c581965159b99d7ac8596304ceb6b5f2cb Change-Id: I65bb54c581965159b99d7ac8596304ceb6b5f2cb
2020-06-01Allow localhost HTTP URLs for the capport APIRemi NGUYEN VAN
Allowing the capport API to be hosted on localhost makes it easy to write fast, stable tests for the feature. This was not possible because: - Pre-validation of the URL used Patterns.WEB_URL, which is over-restrictive and excludes domain names without TLD - NetworkMonitor needs the API to be hosted via HTTPS which is working as intended, however relaxing this requirement only for localhost (for testing) seems reasonable. Bug: 156062304 Test: atest CaptivePortalApiTest in associated change Original-Change: https://android-review.googlesource.com/1309235 Merged-In: I5f2cdd02376785b152e5b9a6e798d797894ea45b Change-Id: I5f2cdd02376785b152e5b9a6e798d797894ea45b
2020-06-01Fallback if redirect url is not valid for captive portal loginChiachang Wang
Wifi AP may send a relative URL or other invalid URL if any network issue or configuration issue happen. In this kind of case, sending a redirect url to captive portal app will fail to open the login page. Thus, fallback to send detection url if the redirect url is a malformed URL. Bug: 157433005 Test: atest NetworkStackTest Merged-In: I6126f5aeb4709a09ec249947b5e59f1310ec7a4b Change-Id: I6126f5aeb4709a09ec249947b5e59f1310ec7a4b
2020-05-29Implement delete methodsChalard Jean
Test: New tests in this patch, IpMemoryStore*Tests Bug: 146460486 Change-Id: Ibda8eeb917c05876e06e78ae600acd626ca94749 Merged-In: I8680164cf34bae2fac1f5431c03a3369dd6318ab (cherry picked from commit 4f81f357bce66c9fca13242d83267ae89cd43f1d, aosp/1311637)
2020-05-29Rename groupHint to cluster.Chalard Jean
Bug: 146460486 Test: atest android.net.IpMemoryStoreTest Test: atest com.android.server.connectivity.ipmemorystore.IpMemoryStoreServiceTest Change-Id: I493472cb65262b04769192b702178351416c9869 Merged-In: I805733e201aa1286477cfac589cdf4ac18bb7e2b (cherry-picked from aosp/1311636)
2020-05-28Merge "Change stopwatch accuracy from milliseconds to microseconds" into rvc-devFrank Li
2020-05-28Merge "Enable DHCP INIT-REBOOT state on R." into rvc-devXiao Ma
2020-05-28Change stopwatch accuracy from milliseconds to microsecondsFrank Li
The microsecond time information needs to be recorded in the NetworkStack Metrics (NetworkIpProvisioningReported). So the unit of stopwatch is converted from millisecond to microsecond. Bug: 151926185 Test: atest com.android.server.connectivity.NetworkMonitorTest Original-Change: https://android-review.googlesource.com/1299376 Merged-In: I5a27a3b1316c67bf076b2e490860385267358ef8 Change-Id: I5a27a3b1316c67bf076b2e490860385267358ef8
2020-05-27Merge "add TCP data stall metrics" into rvc-devChiachang Wang
2020-05-25Enable DHCP INIT-REBOOT state on R.Xiao Ma
Bug: 156575243 Test: atest NetworkStackTests NetworkStackIntegrationTests Test: atest NetworkStackNextIntegrationTests Test: manual test: 1. connect to AP successfully at the first time 2. disconnect wifi 3. reconnect to the same AP 4. checked client broadcasts REQUEST instead of DISCOVER 5. checked client broadcasts DISCOVER if lease has expired Merged-In: I62d1ab6b94be1ee95fbaa2ecce62eaba01e7892d Change-Id: I62d1ab6b94be1ee95fbaa2ecce62eaba01e7892d
2020-05-25Merge "Mock IpConnectivityLog in IpClientTest" into rvc-devMark Chien
2020-05-25Mock IpConnectivityLog in IpClientTestmarkchien
IpConnectivityLog which is used to send metrics need NETWORK_STACK permission. Mock IpConnectivityLog to avoid sending metrics from tests. Also remove platform cert from the network stack unit test because it is not necessary for any signature permission anymore. Bug: 156866746 Test: NetworkStackNextTests, NetworkStackCoverageTests, TetheringTests, TetheringCoverageTests Change-Id: Ibff052b30e000de3c5a08d7265c7642d67d9b0d0