summaryrefslogtreecommitdiff
path: root/src/com/android/server
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-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-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-19Merge "Move Inet[4]AddressUtils to libs/net" into rvc-devRemi NGUYEN VAN
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-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-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-02Merge "Fallback if redirect url is not valid for captive portal login" into ↵Chiachang Wang
rvc-dev
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-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-21add TCP data stall metricsChiachang Wang
Current metrics contains only DNS signal. Given TCP info is also considered to detection data stall, the related TCP information should be included into metrics. Bug: 150182763 Test: atest NetworkStackTests NetworkStackNextTests Test: Test with ./out/host/linux-x86/bin/statsd_testdrive 121 to ensure log properly Merged-In: I5e306299f3cf4f49c46f161cd0aa4cb40d1ab76e Change-Id: I5e306299f3cf4f49c46f161cd0aa4cb40d1ab76e
2020-05-18Refactor DHCP server with StateMachine.Xiao Ma
To support DHCPDECLINE message and request a new prefix from IpServer, a WaitState is required to wait until IpServer allocates a different prefix and completes configuring this prefix/route. Then server could resume from pausing DHCP packets listening. From this point, StateMachine is easier to add a WaitState for implementation. Refactor DHCP server by replacing ThreadHandler with StateMachine first. Bug: 130741856 Test: atest NetworkStackTests NetworkStackNextTests Test: manual test: connect wifi, turn on hotspot, downstream device attaches to hotspot successfully, then turn off hotspot, repeat multiple times. Merged-In: I6c09d9c371e9c4e71d8ba26adaed640e3b97437b Change-Id: I6c09d9c371e9c4e71d8ba26adaed640e3b97437b
2020-05-18Merge changes I86cb5af0,I706e40db into rvc-devRemi NGUYEN VAN
* changes: Fix dumpVersion for IpMemoryStore on Q Log interface hash in NetworkStack dumpsys version
2020-05-15Do not mock shim in TcpSocketTrackerTestRemi NGUYEN VAN
Instead of mocking the shim, the test needs to run only on platforms that support the feature, and can provide test versions of the underlying objects (here Network). Also move the SDK version check to TcpSocketTracker itself, as users of TcpSocketTracker should not be able to set isTcpInfoParsingSupported to true on Q. Bug: 143586229 Test: atest NetworkStackTests NetworkStackNextTests on Q and R Change-Id: I580ae9ded468d3f08da336b160596484938bf2a5 Merged-In: I580ae9ded468d3f08da336b160596484938bf2a5 (cherry picked from commit 3ad1d5f0fbfff40d3dc66c3c68f103a9b2d3f5ef)
2020-05-15Move common apishim classes to apishim.common pkgRemi NGUYEN VAN
This provides a better separation of the classes based on their role (an actual shim, or an interface or utility common to all shims), and forces the apishim package to import the common classes, which makes it easier at SDK bump time since the imports do not need to be added at that point. Bug: 143586229 Test: atest NetworkStackTests Original-Change: https://android-review.googlesource.com/1310517 Merged-In: Ie77c17a96a67016f35890afa065bea0a07b09504 Change-Id: Ie77c17a96a67016f35890afa065bea0a07b09504
2020-05-15Fix dumpVersion for IpMemoryStore on QTreehugger Robot
IpMemoryStore was considered part of the system server AIDLs in Q, so its version must be part of the system server versions set. This fixes a regression on testDumpVersion_Q. Bug: 137328719 Test: atest NetworkStackTests:NetworkStackServiceTest on a Q device Change-Id: I86cb5af059fe81fe9f10555d57096164665205db Merged-In: I86cb5af059fe81fe9f10555d57096164665205db (cherry picked from commit 8b5cead3df4489a0fd8d9950761a387d2c8d02b4)
2020-05-15Log interface hash in NetworkStack dumpsys versionRemi NGUYEN VAN
The hash is logged similarly to how version code was logged, and will be used to verify that valid interfaces are used to communicate with NetworkStack. Bug: 137328719 Test: atest NetworkStackTests:NetworkStackServiceTest Original-Change: https://android-review.googlesource.com/1293755 Merged-In: I706e40dbe884ffa545f9127e29616a65d5f69c53 Change-Id: I706e40dbe884ffa545f9127e29616a65d5f69c53
2020-05-13Add test for NetworkStackService dumpsys versionRemi NGUYEN VAN
The test verifies that each method on INetworkStackConnector updates the version received from the remote, and that the output of dumpsys version matches the expected template. This logic will be changed in R to include interface hashes, so a test is important to verify that Q behavior remains the same to avoid breaking Q conformance tests. Test: atest NetworkStackTests:NetworkStackServiceTest Bug: 137328719 Original-Change: https://android-review.googlesource.com/1293754 Merged-In: Icaab91d2cb4c62930f969612545e369f09f1b0c7 Change-Id: Icaab91d2cb4c62930f969612545e369f09f1b0c7
2020-05-07Update default value of probe url to be a constantChiachang Wang
Default value for probing url should be a constant in NetworkStack but not an overlayable config due to some technical limitations. OEMs can mistakenly override configs that were not designed to be overridden. Bug: 152730542 Test: atest NetworkStackTests NetworkStackNextTests Change-Id: I1846958e7c4e8b64ae287718c63e705bb232632a Merged-In: I1846958e7c4e8b64ae287718c63e705bb232632a
2020-05-06Add EvaluatingBandwidthState to evaluate network bandwidthLucas Lin
Add a new state between EvaluatingPrivateDnsState and ValidatedState to evaluate the network bandwidth. This state is optional, OEMs can overlay the resource file and set the related config to enable this feature. Bug: 133522566 Test: atest NetworkStackTests Change-Id: I4b43450ad7ed4284bf433b0daab8d0c00d4c284e Merged-In: Ia2d6e4b8e434c15e76bc9e58874c40b1647f97fb (cherry picked from commit 679809049207e48a63fde4f00f1084a3ea287dc1)
2020-04-30Add test configuration values for probe URLsRemi NGUYEN VAN
The test configuration values override RROs that may have been set by OEMs, which is necessary to be able to rely on them in CTS tests. Test: atest NetworkStackTests Bug: 152280218 Merged-In: I8171fd6360a6e504f3abaea3d7de4fa308bbb35b Change-Id: I8171fd6360a6e504f3abaea3d7de4fa308bbb35b
2020-04-28Address comments on NetworkStack AIDL v6Remi NGUYEN VAN
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. As part of moving notifyNetworkTested to using a parcelable the test result int is split into two: the actual evaluation result, and the probesSucceeded int. It used to contain both as a bit mask, which does not make sense if probesAttempted is in a separate int itself. Test: atest NetworkMonitorTest ConnectivityServiceTest ConnectivityServiceIntegrationTest, manual Bug: 153500847 Merged-In: I4aac6ff7432472f8a9345fb5785c6314ec8946e4 Change-Id: I4aac6ff7432472f8a9345fb5785c6314ec8946e4
2020-04-16[MP04] Allow to run multiple HTTP and HTTPS probes in parallelChiachang Wang
In certain area, there is no single server that works well. It may result in the validation result varied. Thus, allow device manufacturers to configure these URLs to get expected network status. Bug: 139034276 Test: atest NetworkStackTests NetworkStackNextTests Test: manually test with resource configuration Change-Id: I5327db39b22bf9393e7a397e8f4de786075c841e Merged-In: I5327db39b22bf9393e7a397e8f4de786075c841e (cherry picked from commit 9ce129a8079cf0b0dc1b744738fc7b41fbd40bad)
2020-04-16Merge "Support decoding the new PREF64 RA option." into rvc-devLorenzo Colitti
2020-04-16Make a customized context when matching a record in MccMncOverrideInfoLucas Lin
MccMncOverrideInfo records the customized carrier id, visited mccmnc, home mccmnc. Once the carrier id and sim's mccmnc are matching a record in MccMncOverrideInfo, make a customized context by changing the mcc/mnc of configuration. Bug: 147075795 Test: atest NetworkStackTests:NetworkMonitorTest Change-Id: I75924f60c637eb93ac99b14b333608b6faeaa24a Merged-In: I20f3c291015a0a79d88e923438d39ff90e1f0752 (cherry picked from commit 6d0b27f8cb8f96eb427609eb03ff6e1a1d490771)
2020-04-16Support decoding the new PREF64 RA option.Lorenzo Colitti
Bug: 153694684 Test: new unit tests Merged-In: I94346939cda910b01ffee75cf8b62a23ec5314cc Change-Id: I94346939cda910b01ffee75cf8b62a23ec5314cc
2020-04-15[MP03] Refactor probing classChiachang Wang
Refactor probing class to allow sending probe via thread class in legacy send parallel probes function and also refactor for follow up commit to send multiple probes. Bug: 139034276 Test: atest NetworkStackTests NetworkStackNextTests Test: manually test with resource configuration Change-Id: Ia25bfe58b10b0a1a641a2be535ee0d602ffd8cd6 Merged-In: Ia25bfe58b10b0a1a641a2be535ee0d602ffd8cd6 (cherry picked from commit c17b3996f428ac80a2f8b2c4f361b0e18b0b50fa)
2020-04-10Refine DNS private IP probesRemi NGUYEN VAN
This addresses comments on the parent change that introduced the optional feature. This change also considers IPv6 ULAs as private addresses, corrects some style and comments. Bug: 136734947 Test: atest NetworkStackTests:NetworkMonitorTest \ NetworkStackTests:NetworkStackUtilsTest Change-Id: I1169320f3a5c09631e754518c60acab337faf49b Merged-In: If4231804b77143b78f26a32c16db53fc4ac44cd8 (cherry picked from commit 0f62e8c6d21afd28280dbae7c3ea216097def466, aosp/1282802)
2020-04-10Matches the URL content by regular expressionlucaslin
This patch provides a way to configure the regular expression which is used for matching the URL content. Once the result is matching, then NetworkMonitor will treat the validation result as fail or success. Bug: 141406258 Test: 1. Build pass 2. atest NetworkStackTests Merged-In: I77747b34fad895565d42ea4c017759c256d61489 Change-Id: I77747b34fad895565d42ea4c017759c256d61489
2020-04-10Do not detect portals when DNS returns private IPsRemi NGUYEN VAN
When access points return private IPs (as defined in the NetworkMonitor constant) in response to DNS probes, do not consider the access point as behind a portal, but instead indicate that it has no connectivity. This solves issues with some access points that return private IP responses to DNS queries when they do not have internet access. This feature is turned off by default while investigating its impact. OEMs can force-enable it through a resource overlay: config_force_dns_probe_private_ip_not_portal. Metrics to evaluate the feature will be added in a later change. Bug: 136734947 Test: atest NetworkStackTests Merged-In: I51975e18f424e3b7265011000f073777f376e597 Change-Id: I51975e18f424e3b7265011000f073777f376e597
2020-04-06Merge changes Ifdf54ace,Ib2c1d16d into rvc-devChiachang Wang
* changes: [MP02] Make multiple probe url configration overlayable [MP01] Add configuration to support multiple probes
2020-04-03Merge "Update NetworkStack version check in NetworkMonitor." into rvc-devCody Kesting
2020-04-01Update NetworkStack version check in NetworkMonitor.Cody Kesting
NetworkMonitor calls INetworkMonitorCallbacks#notifyNetworkTested when network validation is complete. NetworkMonitor will transition to using to NetworkStack Stable AIDL version 6. However, the current version check changes behavior for version 5, which is incorrect. Bug: 152931568 Test: atest NetworkStackTests Change-Id: Ib88b8b0c0b23079287e72e50cbe840fa8c642047 Merged-In: Ib88b8b0c0b23079287e72e50cbe840fa8c642047 (cherry picked from commit 82808cb4eb433d861536199adc7bdaecd614e37d)
2020-04-01[MP01] Add configuration to support multiple probesChiachang Wang
Add configuration to allow configuring multiple probe. Bug: 139034276 Test: atest NetworkStackTests NetworkStackNextTests Merged-In: Ib2c1d16d2088ef043cdc6f9cb323a9df552beefb Change-Id: Ib2c1d16d2088ef043cdc6f9cb323a9df552beefb
2020-04-01Correct tests for verifying data stall metricsChiachang Wang
NetworkMonitor sends data stall metrics data via static method. The DataStallStatsUtils object from its constructor is never used. Tests in NetworkMonitorTest that verify the interaction with the mock object are incorrect. Bug: 152374582 Test: atest NetworkStackTests NetworkStackNextTests Merged-In: I308344a80deef6aaf3ed4fb57723f2f210b30483 Change-Id: I308344a80deef6aaf3ed4fb57723f2f210b30483
2020-03-24Add test to verify make urls configurationChiachang Wang
Follow up from the commit(ChangeId: I66141e4bdc71d19e766aeec6ca33db8e1cb737fe) Bug: 152178565 Test: atest NetworkStackTests NetworkStackNextTests Change-Id: Ib9c25b43a52963e4222de8152c47c9eb26227e65 Merged-In: Ib9c25b43a52963e4222de8152c47c9eb26227e65 (cherry picked from commit 6e30cd8bbaea529bc1661f68a605c9a17476678b) (Clean cherry-pick from internal master)
2020-03-23Use location mcc to load the array config resourceChiachang Wang
Align the mechanism to load resource with others inside NetworkMonitor. Bug: 141406258 Test: atest NetworkStackTests Change-Id: I66141e4bdc71d19e766aeec6ca33db8e1cb737fe Merged-In: I66141e4bdc71d19e766aeec6ca33db8e1cb737fe (cherry picked from commit a2d25ddbd828fa45f6875e722c6ff18ff4049827)
2020-03-18Detect upstream hotspot device type by checking the vendor specific IE.Xiao Ma
Checking a particular IE (vendor specific) in the wifi scan results to identify upstream hotspot device type, meanwhile also checking if the ssid matches with the network which the downstream device is attaching to. Bug: 137835398 Test: atest FrameworksNetTests NetworkStackTests NetworkStackIntegrationTests Test: 1.attach to upstream hotspot device by selecting the sanned ssid from wifi settings, then check the OUI, vendor specific type fileds of IEs from the logcat. 2. build network stack module and install on Q device, verify wifi works normally. Merged-In: I8a3212fa066bdc8bf889768f92569891a3cb2408 Merged-In: I57c709c5da984accbbb389ab8d1295eae01328c6 Change-Id: I8b0ea9542775aecc13ed8ceede80abd693002825
2020-03-10Use redirect URL to start webviewAutomerger Merge Worker
NetworkMonitor will detect captive portal and may get a redirect URL from WiFi AP. Redirect URL should able to send to captive portal app to open the webview instead of detecting again by captive portal app. Bug: 134892996 Test: Manually test with captive portal AP Test: atest NetworkStackTests NetworkStackNextTests Change-Id: Idf363c79b7243a899121be8a68b32d0541dff14f Merged-In: Idf363c79b7243a899121be8a68b32d0541dff14f
2020-02-20Merge "Show notifications after capport login"Chalard Jean
2020-02-19Show notifications after capport loginRemi NGUYEN VAN
Add NetworkStackNotifier to manage notifications created by NetworkStack. NetworkStackNotifier handles the "connected" notifications shown after connecting to a captive portal, which may contain information sourced from the captive portal API. Test: atest NetworkStackTests Bug: 139269711 Change-Id: Iaf96f7e5f02be04b098230316595ad4c0777a9d8
2020-02-18Merge "Update version check for notifyNetworkTested() call."Cody Kesting
2020-02-15Add CaptivePortalData fetching to NetworkMonitorRemi NGUYEN VAN
When a capport API URL is sent through notifyNetworkConnected or notifyLinkPropertiesChanged, NetworkMonitor will (re)evaluate to fetch the data, and report it back via notifyCaptivePortalDataChanged. Test: atest NetworkStackTests NetworkStackNextTests Bug: 139269711 Change-Id: I101e2b2799d399fa7b560bf5ea3d86dac7ba1be9
2020-02-14Add NetworkStack utilities for reading textRemi NGUYEN VAN
The utilities will be useful for: - Implementing the captive portal API - Implementing generic probes based on regular expressions Test: atest NetworkStackTests Bug: 139269711 Change-Id: I17a9564033f985af9061534f5cffcc8a0e70f9ed